I am using a raspberry pi 4 connecting to a PCA9685 and following the instruction on the donkeycar doc site (the link can be found below). I am at the step "fine tuning calibration." When I run "python manage.py drive" the steering works using my keyboard controls but the throttle is not causing any movement with the keys. I know that the throttle is not broken because the wheels turn when I do the calibration of the throttle. How do I solve this?
2 Answers
There can be a few explanations for this:
- Does your motor controller (ESC) have an on-off switch? If so, try flipping that
- Some ESCs need to "arm". Try going to full throttle and back and see if that makes a difference
- I'm assuming you have your battery plugged in ;-)
- Try reversing the direction in the myconfig.py file
- 11
- 1
There was a known bug in one version of DonkeyCar that could cause this problem. That bug has been fixed, so I would update to the latest tagged version. Open a console in your donkeycar project folder, then
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
git pull
pip3 install -e .[pi]
The fix involved changing how the drivetrain configuration was done, so you may need to update your mycar folder. I tend to create a new one, then edit the myconfig.py file base on my older version. The many of the drivetrain configurations changed from being a set of constants to a python dictionary, so you need to uncomment the appropriate dictionary. So if your drivetrain in myconfig.py is
DRIVE_TRAIN_TYPE = "PWM_STEERING_THROTTLE"
Then you want to uncomment the following lines in myconfig.py and update the values with your pin connections and calibration values.
PWM_STEERING_THROTTLE = {
"PWM_STEERING_PIN": "PCA9685.1:40.1", # PWM output pin for steering servo
"PWM_STEERING_SCALE": 1.0, # used to compensate for PWM frequency differents from 60hz; NOT for adjusting steering range
"PWM_STEERING_INVERTED": False, # True if hardware requires an inverted PWM pulse
"PWM_THROTTLE_PIN": "PCA9685.1:40.0", # PWM output pin for ESC
"PWM_THROTTLE_SCALE": 1.0, # used to compensate for PWM frequence differences from 60hz; NOT for increasing/limiting speed
"PWM_THROTTLE_INVERTED": False, # True if hardware requires an inverted PWM pulse
"STEERING_LEFT_PWM": 460, #pwm value for full left steering
"STEERING_RIGHT_PWM": 290, #pwm value for full right steering
"THROTTLE_FORWARD_PWM": 500, #pwm value for max forward throttle
"THROTTLE_STOPPED_PWM": 370, #pwm value for no movement
"THROTTLE_REVERSE_PWM": 220, #pwm value for max reverse throttle
}
- 356
- 1
- 8
THROTTLE_STOPPED_PWMandTHROTTLE_FORWARD_PWM. When you have the rightTHROTTLE_STOPPED_PWMvalue, runningpython manager.py drivewill produce a beep sound from the ESC – Jonathan Tse May 08 '21 at 00:40