Giter Site home page Giter Site logo

urcap-getrobotdata's People

Contributors

bommadsen avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

urcap-getrobotdata's Issues

Possible error in calculating lengths?

I've used the version from your initial commit before and it worked fine, ofc I had to also change the length of the realtime message or only loop over the array, not the available data.
But when you changed the readSocket() function, I think there is just a small mistake in the array length calculations after changing from the initial commit, where you set the length of the double array to the length of the input bytes.

// Read the integer available in stream
int length = in.readInt();
System.out.println("Length is "+length);

// Initialize size of RealtimeMessage be using received length
RealtimeMessage = new double[length];
// Add length integer to output array
RealtimeMessage[0] = length;

// Calculate how much data is available from the length
int data_available = (length-4)/8;
System.out.println("There are "+data_available+" doubles available");

// Loop over reading the available data
int i = 1;
while (i <= dataAvailable) {
	...

which gives a double[] of length 1220 for the 153 values from the documentation.
I think should be the data_available and while i < data_available right?

// Read the integer available in stream
int byteLength = in.readInt();
System.out.println("Length is "+length);

// Calculate how much data is available from the length (Add 4 for the int -> double conversion for the length the 0th index)
int dataAvailable = (byteLength + 4) / 8;
System.out.println("There are "+data_available+" doubles available");

// Initialize size of RealtimeMessage be using received length
double[] realtimeMessage = new double[dataAvailable];
// Add byte length integer to double output array
realtimeMessage[0] = byteLength;

// Loop over reading the available data
int i = 1;
while (i < dataAvailable) {
	...

I should note, I haven't tested this on a robot or a simulator, I was writing unit tests first and it this didn't work according to the documentation from ClientInterfaces_Realtime.pdf from this article

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.