I am trying to complete the 0_calibration.py script on my PiDog2 and I get intermittant results. First, using the zero button, the servos all align to the desired position described in the assembly instructions - all servos will zero properly if they have been moved from zero position.
Sometimes when I run the 0_calibration,py script all servos except servo 1 will move to new locations for calibration. The IMU board red LED will flash rapidly in this case. I can adjust all the servos except servo 1, It stays in the position that it was after pushing the zero button. In this scenario, running the script shows:
imu_sh3001 init … done
rgb_strip init … fail
Sometimes when I run the 0_calibration.py script none of the servos move.They all stay in the position reached after using the zero button. The red LED on the IMU is on solid. In that case the script shows:
imu_sh3001 init … fail
rgb_strip init … fail
I’ve checked the cable to the IMU board and reseated the connector but it made no difference.
Based on the error you encountered, the issue likely lies with the RGB light strip and the IMU board, possibly due to an improper connection of the RGB light strip.
Please disconnect the RGB light strip from the IMU board. Then, connect each component individually to the I2C interface of the Robot HAT and run the test script again to check if the RGB light strip and the IMU board can each function properly on their own.
The test module scripts are located in the pidog/test directory.
I ran rgb_strip_test and got an I/O failure. On a whim, I changed to the other connector on the strip and the test passed. The imu_test.py passed.
Hooked everything back up and I was able to calibrate though not sure how to calibrate the head with the 60 degree tool. Anyway, looks like an assembly error and it is working now.
Thanks
Regarding how to use the 60° calibration tool, it is only used for the 8 servos in the four limbs. The calibration of the head servo is based on personal preference. For example, with the PiDog facing you, aim to have its head camera parallel to you and its neck perpendicular. You can use this as a general guideline for a macro-level calibration of the head servo.
Ok, perhaps I was premature to say that everything is working. It will properly run most of the scripts in the examples directgory now but fails 6_be_picked_up.py and 10_balance.py scripts:
6_be_picked_up.py: Does nothing when picked up.
10_balance.py: stands then shudders and lists to one side before falling over
Running following tests:
imu_test.py
readings alternate between:
ACC: -16384.0 0.0 0.0 | GYRO: 0.0 0.0 0.0
and:
ACC: -16384.0 0.0 0.0 | GYRO: 6192.0 0.0 0.0
10_imu_read.py
In lie down position:
accData: ~ -12740.0 ~ -2850.0 ~ -5050.0 gyroData: ~300 +/- 300 similar similar
Holding pidog perpendicular to table, head up, tail down:
accData: ~ -11000.0 ~ -4550.0 ~-5050.0
pidog laying on right side:
accData: ~ -10080.0 ~ -2850.0 ~ -3300.0
I disconnected the rgb_strip and hooked the imu module directly to the I2C connector and tests now show:
imu_test.py
Calibrating IMU…
Done!
ACC: ~ -19300.0 ~ 1700.0 ~ 1800.0 | GYRO: ~ 1300.0 ~ -1300.0 1300.0
10_imu_read.py
In lie down position:
accData: ~ -16400.0 ~ 150.0 +/- 100 ~ -50.0 +/-70 gyroData: ~0 ~0 ~0
Holding pidog perpendicular to table, head up, tail down:
accData: ~ -450.0 +/-100 ~-16100.0 +/- 50 ~ -350.0 +/-100 gyroData: ~0 ~0 ~0
With this configuration I modified the 6_be_picked_up.py script to skip the rgb accesses and the script works now. The 10_balance.py also works - there is some shuddering but it stays upright,
Do you mean that running 6_be_picked_up.py returns an error, or that the code runs normally but the function doesn’t work?
You disconnected the rgb_strip, connected the imu module directly to the I2C connector, and then it started working normally. This indicates there might be a problem with the rgb_strip.
Please try reconnecting the rgb_strip by swapping the interface cables and see if it works. If it still doesn’t, we can send you a replacement rgb_strip module.
When running the 10_balance.py example, the limbs show jittering?
This is likely normal. The gyroscope continuously detects balance and adjusts the servo angles to keep the limbs in a horizontal, balanced state, which may cause slight jittering.
6_be_picked_up.py runs without error when the imu module is plugged into the rgb_strip but doesn’t react to being picked up.
Changing interface cables doesn’t seem to fix the problems that I described earlier. As long as the imu module is plugged into the rgb_strip, things don’t work properly.
Please contact service@sunfounder.com to get a rgb_strip