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

Problem with example in API documentation

#1
Hello,
There seems to be a problem with an example in the documentation.
The example is under here:
https://robodk.com/doc/en/PythonAPI/robo...em.SolveFK

(1) it needs to import robomath
(2) the variables need some values... like x_move=300 y_move=0 z_move=0
(3) you can't use continue outside of a loop

So there is no hope of this example actually working.  But if you fix those problems there appears to be a larger issue with the choice of comparing configurations.  The scripts are in the attached file for your enjoyment.

The error looks like this:
Code:
Traceback (most recent call last):
  File "C:\Users\henry\AppData\Local\Temp\Example_from_documentation.py", line 30, in <module>
    if robot_config[0] != new_robot_config[0] or robot_config[1] != new_robot_config[1] or robot_config[2] != new_robot_config[2]:
  File "C:\RoboDK\Python\robodk\robomath.py", line 1684, in __ne__
    return not (self == other)
  File "C:\RoboDK\Python\robodk\robomath.py", line 1681, in __eq__
    return pose_is_similar(other, self)
  File "C:\RoboDK\Python\robodk\robomath.py", line 1277, in pose_is_similar
    if distance(a.Pos(), b.Pos()) + pose_angle_between(a, b) * 180 / pi < tolerance:
  File "C:\RoboDK\Python\robodk\robomath.py", line 1886, in Pos
    return [self.rows[0][3], self.rows[1][3], self.rows[2][3]]
IndexError: list index out of range


Attached Files
.rdk   Python Testing.rdk (Size: 1.45 MB / Downloads: 31)
#2
The returned value from JointsConfig is a Mat object (of size 4x1), not a list object. You can convert it to a 4D array by calling list on the Mat object. Example:
Code:
robot_config = robot.JointsConfig(robot_joints).list()
...
new_robot_config = robot.JointsConfig(new_robot_joints).list()
RoboDK may return a list object directly in future versions.
  




Users browsing this thread:
2 Guest(s)