Converts an array of motor positions (in encoder counts) to an equivalent array of axis joint angles (in degrees or millimeters). Automatically takes into account any motor coupling and other factors.
Robot.MotorToJoint ( robot, motor_pos, joint_pos )
Prerequisites
None
Parameters
robot
An optional numeric expression that specifies the robot to be accessed (1-n). If this value is 0 or unspecified, the Selected robot will be accessed.
motor_pos
A required array of double precision values that defines the motor encoder position values that are to be converted into an equivalent array of joint axis positions. This array must have one value for each of the motors of the robot. motor_pos(0) must contain the position for motor 1.
joint_pos
A required array of double precision values into which the computed equivalent joint axis positions are written in either degrees (for rotary axes) or millimeters (for linear axes). This array must have at least one element for each axis of the robot. joint_pos(0) will contain the position for axis 1.
Remarks
This method converts an array of motor positions, specified in encoder counts, into an equivalent array of axis joint angles, specified in degrees for rotary joints and millimeters for linear axes.
For many robots, there is a simple scalar relationship between motor encoder counts and joint angles. However, some robots have a much more complicated relationship due to mechanical coupling of motors, linearity compensation, encoder roll-over compensation, and other factors.
This method can be executed for any robot and all factors that affect the relationship between motor encoder counts and joint angles are automatically taken into consideration.
Examples
Dim mot(4), jts(4), jt2(4) As Double
Dim cur_pos As New Location
Dim ii As Integer
cur_pos.Type = 1 ' Read joint positions
cur_pos.Here
For ii = 1 To 4 ' Copy to jts array
jts(ii-1) = cur_pos.Angle(ii)
Next ii
Robot.JointToMotor(1, jts, mot) ' Convert to enc counts
Robot.MotorToJoint(1, mot, jt2) ' Convert back to jt angles
See Also