MPU6050 IMU
The MPU6050 is a popular 6-axis Inertial Measurement Unit (IMU) that combines a 3-axis gyroscope and a 3-axis accelerometer. It is commonly used in robotics and autonomous vehicles for measuring orientation, acceleration, and angular velocity.

The breakout board used on the car is the GY-521 module. It's mounted on the main riser:

The wiring for the MPU6050 connects to the I2C pins on the NVIDIA Jetson Orin Nano:

Software
On the Orin Nano developer kit, the IMU is on I2C bus 7 (/dev/i2c-7). The VESC driver reads it, using these settings in vesc.lua (see VESC configuration):
i2c_bus_number = 7: the bus. If it's different on a car, also change/dev/i2c-7inpackages/ut_automata/airfield.yaml, so the container can reach it.fuse_imu = false: set it totrueto combine the IMU with the wheel odometry. The car's heading then comes from the gyro. Turn it on per car, in that car'scar.lua, since not every car has an IMU.imu_up_axis = "auto": which of the chip's axes points up. The car's turn rate is read from that axis, so it depends on how the chip is mounted."auto"works it out from gravity when the driver starts. If it can't tell, because the car was tilted or moving, the driver leaves the IMU out and prints a message. To set it by hand, use"+x","-x","+y","-y","+z"or"-z". A GY-521 lying flat, components up, is"+z".calibrate_imu = true: measures the gyro's zero offset when the driver starts. Uncorrected, that offset (often a degree or two per second) shows up as the car slowly turning while it stands still. The offset creeps as the chip warms up, so after startup the driver keeps measuring it again whenever the car stands still, and the heading doesn't drift while the car is parked.
Both imu_up_axis = "auto" and calibrate_imu measure the car as the driver starts, so start the plan with the car standing level and still.
The container reaches the bus through the i2c group; see Device groups. To check that the IMU answers, on the car:
sudo i2cdetect -y -r 7 # the MPU6050 shows up as 68
If i2cdetect isn't installed, install it with sudo apt install i2c-tools.
With fuse_imu = true, check it's working once the plan is up:
- The VESC driver's pane prints which axis it found, for example
IMU: the chip's +z axis points up (gravity reads x 0.03 g, y 0.02 g, z 1.04 g). - The IMU light on the car's touchscreen is green.
- Turning the car left by hand makes
/imu'sangular_velocity.zpositive.