bommadsen / urcap-getrobotdata Goto Github PK
View Code? Open in Web Editor NEWURCap that reads a message from the Universal Robots (UR) Realtime Client on TCP port 30003.
License: Apache License 2.0
URCap that reads a message from the Universal Robots (UR) Realtime Client on TCP port 30003.
License: Apache License 2.0
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.