During the installation, errors may happen to mechanical connection. So you need to calibrate the robot to make sure the accuracy.
Uploading Code for Calibration
Open Crawler.ino under Quadruped Crawling Robot Kit V2.0 for Arduino\code\3.Crawl\Crawler directory
Modify Lines 32-34 as follows (uncomment the Line 33 #define ADJUST), compile the code, upload it to the SunFounder Servo Control Board, and then remove the USB cable.
Switch on SunFounder Servo Control Board. At this point, the crawling robot will keep the calibration poses.
Calibration
Measure the 3D (x, y, z) coordinates of the toe tip of the four legs, put them in the array real_site[4][3] at Line 36 to calibrate the error during the installation.
a. Place the robot on the Calibration Chart as shown in the following picture. Measure the coordinates (x, y, z) of leg 1 with a ruler. Here it is (93, 80, 45).
Please pay attention to the direction of the robot and refer to the orange arrow below.
b. Measure the coordinate (x, y, z) of leg 2. Here it is (100, 82, 48).
c. Rotate the robot as shown in the following figure, and measure the coordinates (x, y, z) of leg 3. Here it is (95, 90,41).
Please pay attention to the direction of the robot and refer to the orange arrow below.
d. Measure the coordinate (x, y, z) of leg 4. Here it is (82, 90, 45).
So, the coordinates filled in the array are (93, 80, 45), (100, 82, 48), (95, 90, 41), and (82, 90, 45), as shown below:
Fill in the values according to your actual measurements to calibrate the robot correctly.
Uploading Code for Verification
Modify Lines 32-34 as follows (uncomment the Line 34 #define VERIFY), compile and upload the sketch to the SunFounder Servo Control Board, and then remove the USB cable.
Switch on SunFounder Servo Control Board. At this point, the crawling robot will keep the verification poses.
Verifying
Place the crawling robot on the calibration chart, and then measure the 3D coordinates (x, y, z) with a ruler. If it is close to the calibration coordinates (100, 80, 42) set in adjust_site[3] and the error of each axis is less than 10mm, it means calibration is successful. Otherwise, recalibrate it until it succeeds.