Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Creating robot targets from gcode for ABB robot using C# API

#1
Hello,

I have been trying to understand how RoboDK creates targets from gcode. For example, how is a sample Gcode line: G1 X123.45 Y67.89 Z0.15 F1200 converted to a robotarget in MOVEL instruction for a ABB robot?

I know robot machining project and 3d printing projects do this automatically, but I want to embed some digital input-output signals and speed information during specific movements and hence need a little more flexibility.

I have looked into some of the functions in the RoboDK.cs file in the C# API example (also the python version). Keeping the discussion specific to ABB IRC5 MoveL command and as per my understanding, the workflow for creating a MoveL robotarget is as follows:

1. Create a pose matrix using position and Euler angles [xyzrpw]: Use function
Code:
static public Mat FromXYZRPW(double x, double y, double z, double w, double p, double r)
in C# API (Same as Transl(x,y,z)*rotz(w)*roty(p)*rotx®)

2. Get orientation information from pose matrix (ABB uses quaternions) [q1 q2 q3 q4]: Use function
Code:
static double[] ToQuaternion(Mat Ti)


3. Compute joint angles required for the pose (using inverse kinematics?)

4. get configuration vector [cf1 cf4 cf6 cfx] from joint angles

Questions:

RoboDK如何计算[xyzwpr](更重要的是吗"wpr" Euler angles) from a gcode line G1 X123.45 Y67.89 Z0.15 F1200? I know this has to do with the relationship between TCP frame and the XYZ coordinates w.r.t userframe (work object frame) but can't wrap my head around it.

Does RoboDK use inverse kinematics to compute joint values for a given pose? Are there any functions available in C# API?

Any help will be appreciated!

Thanks
Rock
#2
我会通过Robolink documentation and found functions which generate pose, joints, etc.

//www.sinclairbody.com/doc/en/PythonAPI/robo...olink.Pose

Could anyone explain how pose is computed? I am confused as to which is generated first: pose matrix or [xyzwpr] array? How can I use the Robolink.Pose() function in C# API?
#3
A pose is a 6 degree of freedom constrain and it can be seen as a 4x4 matrix or as 6-dimensional vector (XYZ coordinates as position and 3 rotations as Euloer angles). More information here:
//www.sinclairbody.com/blog/robot-euler-angles/

Both representations are equivalent and you can calculate one if you have the other.

You may be confusing it with the ijk vector that represents the tool z axis orientation. For that you have an extra degree of freedom that represents the rotation around the tool Z axis. RoboDK's tools for robot machining will help you convert the 5-DOF constrain (typically used by CNC's) to a 6-DOF constrain (required for a robot arm). A sample project here:
https://www.youtube.com/watch?v=tArHbCS2...XBz8QPnq1A
#4
(05-20-2019, 06:54 PM)Albert Wrote:A pose is a 6 degree of freedom constrain and it can be seen as a 4x4 matrix or as 6-dimensional vector (XYZ coordinates as position and 3 rotations as Euloer angles). More information here:
//www.sinclairbody.com/blog/robot-euler-angles/

Both representations are equivalent and you can calculate one if you have the other.

You may be confusing it with the ijk vector that represents the tool z axis orientation. For that you have an extra degree of freedom that represents the rotation around the tool Z axis. RoboDK's tools for robot machining will help you convert the 5-DOF constrain (typically used by CNC's) to a 6-DOF constrain (required for a robot arm). A sample project here:
https://www.youtube.com/watch?v=tArHbCS2...XBz8QPnq1A

Albert, thank you for the links. What was confusing me was that different combinations of euler angles would lead to the same 4x4 pose matrix! Now I understand it after reading the links. I have a follow up question:

Consider a xyzrpw vector = [X Y Z 0 180 0]. From this a homogeneous 4x4 pose matrix (lets say matrix P) can be computed.

Now, there are various combinations of euler angles [Z Y' X"] that lead to same pose matrix: [180 0 180]; [-180 0 180]; [180 0 -180]; [-180 0 -180]; [0 -180 0]

For all these different combinations of euler angles, the pose matrix is:

[ -1.000000, 0.000000, 0.000000, 77.614000 ;
0.000000, 1.000000, 0.000000, 78.452000 ;
-0.000000, 0.000000, -1.000000, 100.000000 ;
0.000000, 0.000000, 0.000000, 1.000000 ];

All the above euler angles result in same rotation matrix and thus should ideally result in same quaternion values. However, in some MoveL commands generated by RoboDK i see quaternion values as follows:

[0 0 -1 0] and [0 0 +1 0]

Both of these seem to result in same orientation. I know each quaternion value has a sign to it. In this case, the sign doesn't seem to make any difference in the orientation of the robot. Is it always the case?

Why does RoboDK generate two different quaternion arrays in MoveL [0 0 -1 0] and [0 0 +1 0] even though the pose matrix (4x4) is the same?
#5
This dual representation of quaternion values happens when you are doing a 180 deg pose rotation (or very close to it).

A similar situation happen with Euler angles. Euler angles usually have 2 different values that represent the same pose. In specific rotations (such as 90 deg or 180 deg rotations) you can have infinite representations.
#6
(05-22-2019, 07:39 PM)Albert Wrote:This dual representation of quaternion values happens when you are doing a 180 deg pose rotation (or very close to it).

A similar situation happen with Euler angles. Euler angles usually have 2 different values that represent the same pose. In specific rotations (such as 90 deg or 180 deg rotations) you can have infinite representations.

Makes sense! thanks.

Are there any functions in C# API to compute joint angles given a pose matrix?
#7
Yes, you can use:
  • SolveIK (Solve robot Inverse Kinematics) to calculate joint angles given the pose
  • SolveFK (Solve robot Forward Kinematics) to calculate a pose given joint angles.




Users browsing this thread:
1 Guest(s)