> For the complete documentation index, see [llms.txt](https://chi-education.gitbook.io/chi-edge-or-education/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chi-education.gitbook.io/chi-edge-or-education/chi-edge-education/module-i-autonomous-vehicles/pathways/regular-pathway/car-calibration.md).

# Car Calibration

**Calibrating the Cars**

1. Connect your personal computer to the car and go into the donkeycar container:
   1. open the terminal application on your computer
   2. connect to the car using ssh

```
ssh root@<ip address of pi>
cd ~/car
```

2. Run the following command to calibrate the steering:

```
donkey calibrate --pwm-pin=PCA9685.1:40.0
```

This will prompt you to input pin values for steering. Test out 360 and then 300 and 400 (etc.) in order to test the optimal number, it can be different for every car, note the optimal number for left and right turns.

3. Make sure that the numbers remembered for left and right turns are not causing the car to “whine.”
   1. Remember which values correspond to the wheels turning all the way to the right and all the way to the left
   2. For reference, our value for maximum left steering was 520 and maximum right steering was 260
4. Run the following command to calibrate the throttle:

```
donkey calibrate --pwm-pin=PCA9685.1:40.1
```

*This will prompt you to input pin values for the throttle. Test out 360 and then 300 and 400 in order to test the optimal number, it can be different for every car, not the optimal number for throttle speed. For reference, our throttle pwm values were 410 for forward, 370 for stopped, and 300 for reverse. Yours might be different depending on what you want the max speed of your car to be.*

5. Change the pwm steering values within the myconfig.py with the optimal ones found in steps 1 and 2:
   1. nano myconfig.py
      1. The variable is named PWM\_STEERING\_THROTTLE and various steering parameters can be modified.
   2. example:

```
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 spe>
     "PWM_THROTTLE_INVERTED": False,         # True if hardware requires an inverted PWM pulse
     "STEERING_LEFT_PWM": 520,               #pwm value for full left steering
     "STEERING_RIGHT_PWM": 260,              #pwm value for full right steering
     "THROTTLE_FORWARD_PWM": 410,            #pwm value for max forward throttle
     "THROTTLE_STOPPED_PWM": 370,            #pwm value for no movement
     "THROTTLE_REVERSE_PWM": 320,            #pwm value for max reverse throttle
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://chi-education.gitbook.io/chi-edge-or-education/chi-edge-education/module-i-autonomous-vehicles/pathways/regular-pathway/car-calibration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
