Get actual Euler and Quaternion angles
Hello,
I have a list of targets(Targets 001127), and I have a TRAP routine set up to constantly update and print out the position (X,Y,Z) of the robot, even while it is in the middle of a move. My question is, can I also update and print out the current Euler and Quaternion Angles, even while the robot is moving? I am updating the status 10 times a second, and I am trying to compare the commanded vs. actual for position and the angles. I got the position part, just not sure what to do about the angles?
Thanks for any help,
SM
I have a list of targets(Targets 001127), and I have a TRAP routine set up to constantly update and print out the position (X,Y,Z) of the robot, even while it is in the middle of a move. My question is, can I also update and print out the current Euler and Quaternion Angles, even while the robot is moving? I am updating the status 10 times a second, and I am trying to compare the commanded vs. actual for position and the angles. I got the position part, just not sure what to do about the angles?
Thanks for any help,
SM
Tagged:
0
Best Answer

You can access each component of the the RobTarget record before converting to a string, which will result in shorter stings.
In the header, add:VAR robtarget currentRT;
In the procedure, add:
VAR string posStr;
VAR string orientStr;
VAR string confdataStr;
VAR string extjointStr;currentRT := CRobT(\Tool:=tool0 \WObj:=wobj0); !read current robtarget
posStr:=ValToStr(currentRT.trans); !current robot position
orientStr:=ValToStr(currentRT.rot); !current robot orientation
confdataStr:=ValToStr(currentRT.robconf); !current robot configuration
extjointStr:=ValToStr(currentRT.extax); !current external axis positionOr you could go even further down, if required, e.g.xStr := NumToStr(currentRT.trans.x,3);
The function EulerZYX can into an Euler angle component from an orienttype variable.anglex := EulerZYX(\X, currentRT.rot);
angley := EulerZYX(\Y, currentRT.rot);
anglez := EulerZYX(\Z, currentRT.rot);These nums could then be converted to strings and concatenated if you wish, although I would be temped to do the conversion to Euler angles in LabVIEW or even in Excel after recording the data.
Hope this helps. Note, the code is untested.
Regards,
Joseph5
Answers

Yes, you can use the RAPID function CRobT, which "returns a robtarget value with position (x, y, z), orientation (q1 ... q4), robot axes configuration, and external axes position." It would then be straightforward to convert the orientations into Euler angles, if required.0

jsph,
Thank you for your reply. I am using CRobT just like you said. I am trying to send the data as a string to LabVIEW via sockets. I get an error saying that the string is too long. How can I break the data into multiple strings, 1 string for position, 1 string for quaternions, etc.?
Also, how can I parse the Quaternion angles and then convert to Euler angles?
Thanks for the help!
SM
Post edited by SteveMob on0 
Or is there a way to eliminate some of the values from CRobT, such as the External Axes values or Axis Configurations? That would shorten the string.
Thanks,
SM
0
Categories
 10.4K All Categories
 5.3K RobotStudio
 352 UpFeed
 15 Tutorials
 9 RobotApps
 282 PowerPacs
 404 RobotStudio S4
 1.8K Developer Tools
 239 ScreenMaker
 2.6K Robot Controller
 252 IRC5
 36 OmniCore
 6 RCS (Realistic Controller Simulation)
 3 RobotStudio AR Viewer
 703 RAPID Programming
 14 Wizard Easy Programming
 107 Collaborative Robots
 3 Job listings