Skip to content

Calibration guide

Jonathan Oreste Maruca edited this page Apr 11, 2021 · 16 revisions

Calibration of the the robot after assembly

In qd_hw_config.h inside the include folder situated in the Arduino code, there is an array named compensationArrayMec that adds small compensations to every joint and calibrates their initial positions. This is to compensate for the minor assembly errors.

How to calibrate the initial position (mechanical compensations) :

  • Send the main.cpp code to the Arduino as it is with PlatformIO (the line moveMotor(initPositions); should be in setup())
  • The robot should be in its initial position but with slight offsets due to the assembly
    • Initial Position : (Hip and Tibia parallel to the body | Femur perpendicular to the body)
  • Play with the values in compensationArrayMec to get rid of these offsets and get a well aligned initial position

Rotation Directions of the Joints

Right side

droit_sensRot

Left side

gauche_sensRot

Calibrating the joint limits

This step should be done after the calibration of the initial position. In the same file as the previous step (qd_hw_config.h) there is a two dimensional array named jointLimit where the angle values are in degrees. Each joint has an upper and lower angle limit set to protect the robot from colliding with itself.

How to calibrate the joint limits :

  • Add these two arrays as global variables in the main.cpp file of the Arduino code :
float configurableJointDefinition[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
float position[12];
  • Replace the setup with this one (keep the previous setup to restore it after the calibration) :
void setup() {
  servoInit();
  computeLimits();
  for (int i = 0; i < 12; i++)
  {
    position[i] = initPositions[i] + configurableJointDefinition[i];
  }
  moveMotor(initPositions);
  moveMotor(position);
  rosInit();
}
  • For each joint, one at a time, change the values in the configurableJointDefinition array to find the maximal and minimal range (you should be careful not to break the robot by starting with small increments). For some joints, the other leg on the same side must be moved out of the way to reach full range.
  • Once a limit is found, copy it in the two dimensional array jointLimit (qd_hw_config.h) at the right place :
int jointLimit[12][2] = { {J0 min, J0 max}, {J1 min, J1 max}, {J2 min, J2 max},
                          {J3 min, J3 max}, {J4 min, J4 max}, {J5 min, J5 max},
                          {J6 min, J6 max}, {J7 min, J7 max}, {J8 min, J8 max},
                          {J9 min, J9 max}, {J10 min, J10 max}, {J11 min, J11 max} };

The calibration is now done, restore the setup() back to normal.