Universal Robots Forum

Feature Request: Add .toArray of class JointPositions

Description of feature:
As a UR+ Developer I would like UR to add the .toArray method to the class JointPositions, so it can straight give the array, as it is possible for the class Pose.

Right now I need to do it like this:
For Poses:

double[] tcp = currentPose.toArray(Length.Unit.M, Angle.Unit.RAD);

For JointPositions:

JointPosition[] temp = currentJointPositions.getAllJointPositions() ; //(Length.Unit.M, Angle.Unit.RAD);
double[] joints = {0,0,0,0,0,0};
joints[0]= temp[0].getAngle(Angle.Unit.RAD);
joints[1]= temp[1].getAngle(Angle.Unit.RAD);
joints[2]= temp[2].getAngle(Angle.Unit.RAD);
joints[3]= temp[3].getAngle(Angle.Unit.RAD);
joints[4]= temp[4].getAngle(Angle.Unit.RAD);
joints[5]= temp[5].getAngle(Angle.Unit.RAD);

I guess I could also use toString and parse that string to an Array of doubles, but I think it would make it a lot easier with a .toArray method.

2 Likes