Homing and Calibration


In this tutorial, we will go over the homing and calibration process. Homing is the process of setting the robot's joints to a known position. Each joint j0, j1, j2, j3 and j4 is either homed 1, or not homed 0. Note that the homing status of j3 and j4 are coupled to each other. This means, they are both either homed, or not homed, and homing one of them also home the other one.

You can check if your joints are homed with the following:

>>> robot.homed()
'{"j0": 0, "j1": 0, "j2": 0, "j3": 0, "j4": 0}'

Notice that since we haven't homed the robot yet, all of our joints display 0. So let's home all of our joints.

>>> robot.home("j0")
'{"j0": 1, "j1": 0, "j2": 0, "j3": 0, "j4": 0}'

>>> robot.home("j1")
'{"j0": 1, "j1": 1, "j2": 0, "j3": 0, "j4": 0}'

>>> robot.home("j2")
'{"j0": 1, "j1": 1, "j2": 1, "j3": 0, "j4": 0}'

>>> robot.home("j3")
'{"j0": 1, "j1": 1, "j2": 1, "j3": 1, "j4": 1}'

Once this process is finished, the robot should be in the position pictured below.

homed

You can check the [coordinates] of this position with the .position() method.

>>> robot.position()
'[0, 145, -90, 0.0, 0.0]'

Calibration


How do we know that values given by robot.position() are accurate? Do we need to calibrate the robot?

One way to check if we need to calibrate is to send a move command that sets all joint values to zero:

# Move all joints to zero
>>> robot.play({"command": "move", "prm": {"movement": 0, "path": "joint", "j0": 0, "j1": 0, "j2": 0, "j3": 0, "j4": 0}})

# Position should read all zeros
>>> robot.position()
'[0, 0, 0, 0.0, 0.0]'

Observe this position. Is your robot perfectly outstretched, or is there some discrepancy?

homedhomed

In my case, the robot looks like the picture on the left. My j0 and j3 joints are clearly not at zero even though robot.position() indicates they are. So I need to calibrate.

To calibrate the robot, we'll start by moving the robot until it is truly outstretched straight. For me, I needed to move j0 10 degrees and j3 15 degrees:

>>> robot.play({"command": "move", "prm": {"movement": 1, "path": "joint", "j0": 10}})

>>> robot.play({"command": "move", "prm": {"movement": 1, "path": "joint", "j3": 15}})

>>> robot.position()
'[10, 0, 0, 15.0, 0.0]'

If we type robot.position(), it indicates that our joints are at [10, 0, 0, 15.0, 0.0] even though we know this position should be [0, 0, 0, 0.0, 0.0]. To tell the robot that this position is in fact all zeros, we'll use the .calibrate() command.

>>> robot.calibrate([0, 0, 0, 0.0, 0.0])
'[0, 0, 0, 0.0, 0.0]'

>>> robot.position()
'[0, 0, 0, 0.0, 0.0]'

Now the robot knows that this position is truly all zeros. Let's save this configuration, so we don't need to repeat this process again.

>>> robot.save_config('/PATH_TO_YOUR_NEW_CONFIG/my_config.yaml')

Next time you use the robot, when you create the Dorna object, pass in the path to your new configuration file:

>>> robot = Dorna('/PATH_TO_YOUR_NEW_CONFIG/my_config.yaml')

When you home all the joints and check the position, you'll notice that it no longer outputs [0, 145, -90, 0.0, 0.0], but new values that take into account the calibrations needed for our particular robot:

# After homing...

>>> robot.position()
'[-10, 145, -90, 345.0, 0.0]'

That's all for this tutorial. For more information on homing and calibration, you can refer to the Dorna wiki. You can also check out our video tutorial on the subject here.