Motor doesn't change direction Picar-x

Hi, I am having an issue calibrating my Picar-x. When running, all of the servos can be calibrated correctly, but the back wheel motors do not change direction after pressing q. Currently, the left side wheels rotate forward and the right side wheels rotate backward, and I could not fix it using the code. I tried writing some of my own code as well, provided below, and the direction does not change regardless of what I do. Although the code is provided for the right side motor, the same applies to the left side motor, as it also does not change direction.

from robot_hat import Motors
import time

motors = Motors()

motors[2].speed(-80) # even if I change this to positive 80, nothing changes

Suggest you can provide a video of the problem to us, so that we can analyze and solve the problem easily. Run the calibration script: cd ~/picar-x/example/calibrationsudo python3 Since the motor wiring may be reversed during installation, you can press E to test if the cart advances properly. If it does not, use the number keys 4 and 5 to select the left and right motors, then press Q to calibrate the direction of rotation. If your left motor is running forward and your right motor is running backward, you will need to calibrate the right motor. Press “5” to select the right motor and then press “Q” to calibrate the direction of rotation. See if the right motor is running in the forward direction. Or you can swap the left and right motors and see how it works.

Hi, I have tried using the script and it does not work. The video of the problem is available at this link: Calibration Fail Picar-X - Google Drive. I have also tried switching the motor wiring, but the motors continue to turn in their original directions.

Are you unable to calibrate the running direction of both motors? As you can see from your video, the left motor is running in forward direction, and when you run the script to calibrate it, the left motor is always running in forward direction. Is it possible to calibrate the direction of your right motor, normally “1” is forward and “-1” is backward. If you press “5” for the right motor, can you calibrate the direction.

No, the right motor also does not change direction.

  1. Do you have any other Raspberry Pi, you can try to replace it to see if the same situation still occurs, the motor can not calibrate the direction of movement.

  2. Please make sure your code base is up to date. Suggest to update robot-hat, picar-x library code: cd ~/robot-hatgit pullsudo python3 installcd ~/picar-xgit pullsudo python3 install After the code is updated successfully, then run the script to calibrate the motor and see how it works.

I have tried both of these options and there is still no change. Because changing the Raspberry Pi didn’t work, is it possible that the issue is with the Robot Hat?

Please provide a clear picture of the robot hat to confirm the version of the robot hat, it is estimated that you will need to have a new robot hat sent to you as a replacement.

The image is attached above.

A new robot hat will be shipped to you, an after-sales person will contact your mailbox later, please pay attention to check the information.

Thank you for all your help!

1 Like