Hello,
I am receiving arbitrary robtarget data from a PC via sockets. I am testing for if the user sent a “bad character” in the target data.
Example: (X, Y, Z) or (100, 200, string) or (100, 200, 300BadCharacter)
I am also receiving Quaternions, Axis Configurations, and Velocity data the same method. So far, whenever the robot encounters a bad character in the data, it just makes the bad character a 0 and any other data numbers after that a 0 as well, even if they are numeric (except in the translation data, where RAPID crashes if a bad character is input into the (X,Y,Z)).
My question is, is there a way to parse the bad character out and/or not make the numbers after that a 0? Or is there a way to notify the user that a bad character has been entered? Here is a snippet of how I am receiving said data:
FUNC robtarget ParseTargetData(VAR rawbytes targetData)
! Parse a string of bytes into a robot target
! Inputs:
! -targetData: byte string
! Returns:
! -position: robtarget
VAR robtarget target;
!Read a position (x,y,z).
UnpackRawBytes targetData\Network,2,target.trans.x\Float4;
UnpackRawBytes targetData\Network,6,target.trans.y\Float4;
UnpackRawBytes targetData\Network,10,target.trans.z\Float4;
!Read tool orientation (quaternion angles).
UnpackRawBytes targetData\Network,14,target.rot.q1\Float4;
UnpackRawBytes targetData\Network,18,target.rot.q2\Float4;
UnpackRawBytes targetData\Network,22,target.rot.q3\Float4;
UnpackRawBytes targetData\Network,26,target.rot.q4\Float4;
!Read axes configuration (axis1,axis4,axis6,axisX)
UnpackRawBytes targetData\Network,30,target.robconf.cf1\Float4;
UnpackRawBytes targetData\Network,34,target.robconf.cf4\Float4;
UnpackRawBytes targetData\Network,38,target.robconf.cf6\Float4;
UnpackRawBytes targetData\Network,42,target.robconf.cfX\Float4;
RETURN target;
ENDFUNC
Thanks in advance for any help!
SM