Swap Axis Direction

From CPR Wiki

If a robot is mechanically set up as intended by the manufacturer all axes should move as shown in the 3D simulation. However in some special cases the motion direction of an axis needs to be swapped.

This article explains how to do this. Follow it's sections in their order.

Mechanical Set Up

If an axis unintentionally moves in the opposite direction first check the mechanical setup. Mounting a motor or referencing sensor at the wrong side of the axis can cause this. Try mounting motor and sensor at the correct places if possible. If all goes well the issue should be solved now.

Motion Direction

The motion direction can be changed by negating the GearScale parameter in the Robot Configuration File:

  1. Find the line for the axis in question: Joint0 refers to axis 1, Joint1 to axis 2 etc.
  2. Find the GearScale entry in that line and note it down for later
  3. Negate it's value (add/remove a minus sign)
  4. Save the configuration file and write it back to the robot control
  5. Restart the robot control

Jogging the axis should now result in a reversed motion. The referencing motion is handled separately from the general motion and therefore does not change (see next section).

Referencing Direction

If the axis moves away from the referencing sensor first check whether it is at the correct position (in most cases the referencing sensor should be at or near the 0 position of the axis) and mount it accordingly.

If the axis still moves away from the sensor change the referencing direction:

  1. Load the firmware parameters off the motor modules as described here: Firmware Parameter Configuration
  2. Find the section for the axis in question: Joint0 refers to axis 1, Joint1 to axis 2 etc
  3. In that section find the parameters RefSpeed and RefSpeedSlow
  4. Negate it's value (add/remove a minus sign)
  5. Save the file and write it back to the robot control
  6. Restart the robot control

The axis should now move towards the referencing sensor and reference correctly.

Referencing Offset

Depending on where the referencing sensor is placed motion may not be possible (e.g. when the sensor is at the far end of the axis, the robot control may only allow motion in positive direction towards the end stop). To fix this the referencing offset needs to be changed.

  1. Reference the axis. Do not move it afterwards.
  2. Measure the distance to the 0 position.
  3. Multiply that distance (in millimeters or degrees) with the GearScale of that axis (see section Motion Direction)
  4. Load the firmware parameters as described in the previous section
  5. Find the Offset parameter of that axis and add or subtract the calculated value
  6. Write it back to the robot and do a restart

After referencing the control software should show the correct position and be able to move to the 0 position. If the position is far off try subtracting instead of adding.