# MC-Basic:TOJOINT

Converts a location point to a joint point the inverse kinematics function implementation.

Input parameters:

<Robot>
name of the group for which the direct kinematics is computed, when a WITH command is executed this argument is not needed (the comma should also be omitted).
<Location>
location coordinates of the point to be translated into joint coordinates.
<configuration>
integer describing the configuration of the returned joint position (for SCARA it is the same as ARMCMD or ARMFBK).

The number and type of configuration flags depend on each robot type. Note that robot properties ARMCMD, ECMD, WCMD have all three values(0, 1, 2), where 0 is reserved for AUTO option. The configuration bits however have only two values (0, 1).

for SCARA robot
Arm (Bit 0)
value = 0 – Lefty (armcd = 1)
value = 1 – Righty (armcmd = 2)
for PUMA robot
Arm (Bit 0)
value = 0 – Lefty (armcd = 1)
value = 1 – Righty (armcmd = 2)
Elbow (Bit 1)
value = 0 – Below (ecmd = 1)
value = 1 – Above (ecmd = 2)
Wrist (Bit 2)
value = 0 - Noflip (wcmd = 1)
value = 1 – Flip (wcmd = 2)
for TRAVERSEARM robot
Arm ( Bit 0)
value = 0 – Lefty (armcd = 1)
value = 1 – Righty (armcmd = 2)

for DELTA, SCISSORS, … and other robots, that have no configuration flags, these fields are not used.

The configuration flag argument of the tojoint is defined as:

${\displaystyle cfg=\sum _{i=0,1,2}(value_{i}-1)\cdot 2^{i}}$
 NOTE Constants lefty, righty, above, below, flip and noflip are defined as built-in constants of the MC-Basic language.

## Syntax

<joint_variable>=ToJoint (<Robot>, <location>, <configuration>)

## Availability

Since Version 3.7.x

## Type

Return Type: Joint point

## Limitations

• Not in Configuration context.
• The joint variable and the location parameter must either have a group type identical to the group parameter, or have the same number of coordinates.
• The values of the configuration argument (the long type parameter) can be only: 0, 1 or 2, with the same meaning as ARMCMD.

## Examples

? ToJoint (G1, #{1,2,3}, 1)
? ToJoint (G1, G1.Here, X)
?ToJoint(#{768.198 , 0 , 233.198 , 0 , 180 , 0},0b010)
J1 = ToJoint (SCARA, L1, 0)