Skip to content

VESC Motor Driver

The VESC (Vedder Electronic Speed Controller) motor driver is an open-source electronic speed controller designed for electric vehicles, including electric skateboards, bikes, and cars. The VESC is used instead of a traditional motor controller due to its ability to stop the motor when no command is received, enhancing safety.

The VESC is mounted on the bottom side of the main car board and is responsible for controlling the car's motor and steering servo.

VESC Motor Driver

The VESC connects to the 3-phase brushless DC motor via three thick wires, which provide the necessary power and control signals to drive the motor.

VESC Motor Connections

In our implementation the VESC is responsible for translating control signals from the vehicle's main computer into precise motor control. It also controls the servo motor that transforms steering commands into physical steering actions. Importantly, the VESC stops the motor when no command is received, ensuring safety.

Configuration

The VESC driver reads its settings from two files in ~/roboracer_ws/packages/ut_automata/config/:

  • vesc.lua holds the defaults, shared by every car and kept in git.
  • car.lua holds this car's own values, and isn't in git. The driver creates it the first time it runs, with the car's name. Anything set in car.lua takes the place of the same setting in vesc.lua.

Car Calibration measures the steering and speed values and writes them to car.lua, and the controller's D-pad trims them (see Joystick). Restart the VESC driver's pane after changing a file by hand.

Setting Default What it depends on
speed_to_erpm_gain 5356 The motor and gearing (Arrma 3800, 17T pinion, P48 T83 spur)
speed_to_erpm_offset 180 The motor, usually 160 to 200
steering_angle_to_servo_gain -0.9015 The steering servo and linkage
steering_angle_to_servo_offset 0.5 The servo's center, usually 0.4 to 0.6
servo_min / servo_max 0.05 / 0.95 How far the servo can travel
max_steering_angle 0.425 rad The steering geometry
wheelbase 0.324 m The chassis
joystick_normal_speed / joystick_turbo_speed 1.0 / 2.0 m/s Top speed when driving with the controller, without and with turbo
serial_port /dev/ttyACM0 Which USB device the VESC appears as. It can change if other USB serial devices are plugged in.
i2c_bus_number 7 The IMU's bus
fuse_imu false Set to true to combine the IMU with the wheel odometry
imu_up_axis "auto" Which of the IMU chip's axes points up; "auto" finds it from gravity at startup. See IMU.
calibrate_imu true Measure the gyro's zero offset at startup, and again whenever the car stands still

If serial_port changes, also change the device in packages/ut_automata/airfield.yaml so the container can reach it; see Device groups.