Robot.JointToMotor Method

Converts an array of axis joint angles (in degrees or millimeters) to an equivalent array of motor positions (in encoder counts).  Automatically takes into account any motor coupling and other factors.

Robot.JointToMotor ( robot, joint_pos, motor_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.

joint_pos

A required array of double precision values that defines the axis position values, in either degrees (for rotary axes) or millimeters (for linear axes), that are to be converted into an equivalent array of motor encoder positions.  This array must have one value for each of the axes of the robot.  joint_pos(0) must contain the position for axis 1.

motor_pos

A required array of double precision values into which the computed equivalent motor encoder positions are written in encoder counts.  This array must have at least one element for each motor of the robot.  motor_pos(0) will contain the position for motor 1.

Remarks

This method converts an array of axis joint angles, specified in degrees for rotary joints and millimeters for linear axes, into an equivalent array of motor positions, specified in encoder counts.

For many robots, there is a simple scalar relationship between joint angles and motor encoder counts.  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 joint angles and motor encoder counts 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

Robot Class | Robot.MotorToJoint