John,
What I mean by “data being sent to the robot (sent in robtarget format*)*” is that I am sending the target data from LabVIEW like this:
[X,Y,Z],[Q1,Q2,Q3,Q4],[C1,C4,C6,Cx]. So I unpack the individual elements that make up a robtarget data.
I am using the SocketReceive function. I send all the data at once from LV, and receive it all on one line in RS:
SocketReceive clientSocket\RawData:=messageBytes\Time:=25;. I then can unpack the individual elements.
How could I set all the bytes in rawbytes to zero?
What portion of code do you need to see? My entire program is almost 600 lines of code… The unpacking process can be seen on my previous thread:
(https://forums.robotstudio.com/discussion/comment/25839#Comment_25839)
This is my attempt at unpacking the message into strings, but the numbers are coming out to be completely different than what I was sending RS:
UnpackRawBytes messageBytes\Network,2,targetx\ASCII:=25; ! targetx is a string data type
targetx:=HexToDec(targetx);
UnpackRawBytes messageBytes\Network,6,targety\ASCII:=25; ! targety is a string data type
targety:=HexToDec(targety);
UnpackRawBytes messageBytes\Network,10,targetz\ASCII:=25; ! targetz is a string data type
targetz:=HexToDec(targetz);
I have also just tried it like this:
UnpackRawBytes messageBytes\Network,2,targetx\Hex1; !targetx is a byte data
targetx1:=HexToDec(ByteToStr(targetx)); !targetx1 is a string data type
UnpackRawBytes messageBytes\Network,6,targety\Hex1; !targety is a byte data type
targety1:=HexToDec(ByteToStr(targety)); !targety1 is a string data type
UnpackRawBytes messageBytes\Network,10,targetz\Hex1; !targetz is a byte data type
targetz1:=HexToDec(ByteToStr(targetz)); !targetz1 is a string data type
When I do it like either of these methods, I unpack some numbers, but none of them are the correct numbers that I sent…
I just need to unpack the rawbytes into string(s) instead of unpacking the message into data types like robtarget or num. That’s the ultimate goal right now. That way, I don’t lose any data in the unpacking process. If I unpack a non-numeric value into say a num data type, the message is parsed a “0” due to some RS internal stuff. But if I unpack it into a string, I don’t lose the data, and I can parse out the non-numeric values and then convert that string to robtarget data or num data.
Also, when unpacking messages into strings, how do I do the indexing for that? With Float4, I was just doing every 4. But I am not sure how to do the indexing with strings.
Thanks for the help,
SM