Here is how we did it in nodejs originally, we run new code now but this worked for a long time
_sendall(cmd, payload = '', callback) { let size = 3; //Header is always 3 bytes long, 2 bytes for the size, 1 byte for the command if (payload.length > 0) size += payload.length; let buf = new Buffer(size); buf.writeUInt16BE(size, 0); // write the size at index 0 buf.writeInt8(cmd, 2); // write the command at index 2 buf.write(payload.toString(), 3); // write the payload starting at index 3
this.sock.write(buf, 'binary', err =>{
more code here but nothing pertinent to the discussion
Hi I am trying to use C (not python) for RTDE for a UR10e. Can someone help me figure out how to pack the initial message, which I think should be 'v' for RTDE_GET_URCONTROL_VERSION. It says two bytes for the package size and 1 byte for the package type. I can open and connect thru the port but need help getting started with the basic header info in the first message I need to send.
Can someone break this down for me? Is this
sendmsg[0]=8
sendmsg[1]=0
sendmsg[2]='v'
for the header info or am I way off base?