JetsonHacks

RACECAR/J – Programming the Electronic Speed Controller

VESC Tool

RACECAR/J is now using VESC 6 electronic speed controllers. Newer versions of the VESC now require the new VESC Tool to program them. Looky here:

Background

For RACECAR/J, we replace the stock TRAXXAS ESC with the VESC 6 Plus from Trampa Boards. This is the official VESC from the creator of the VESC project, Benjamin Vedder.

Note: Earlier versions of RACECAR/J use the FOCBOX, and older versions of the MIT RACECAR use 4.X hardware. Please see our earlier article on the subject for reference material.

Another note: In the RACECAR/J Kit, we program the VESC before shipping. This article is here in case you want to re-program or configure it.

The major reason for the change is to gain full control of the robot at low speeds. Another advantage of the VESC over the stock Traxxas ESC is that the motor speed does not change in relationship to battery charge. Another reason is that the VESC is open source, which allows the curious to explore the motor controller implementation. 

Note: VESC is now a registered trademark. There are several manufacturers who build VESC compatible hardware, but expect different names.

Architecturally, the VESC has a STM32 ARM Cortex processor. The STM32 runs ChibiOS, a real-time operating system. The default firmware flashed on the VESC 6 Plus is ‘Servo-in’, which allows a remote controller to set the motor speed. For the RACECAR/J application, the VESC servo port needs to be programmed as ‘Servo-out’, which allows commands to be sent to the robot steering servo.

Fortunately there is a compiled binary of the version of the VESC firmware that includes the Servo-out setting. We can flash the STM32 directly using a program called ‘VESC Tool’. 

Once the VESC Tools loads the servo-out firmware on to the VESC, we then load a configuration file which matches the VESC configuration to control a TRAXXAS Velineon 3500 motor. 

VESC Tool Installation

Pre-compiled binaries are available for Windows, Macintosh and PC based Linux machines. There is currently no version for the Jetson architecture.

You can download the application from the VESC Project (vesc-project.com). Download the application for your platform (in the video we are on an Ubuntu 16.04 PC laptop), and extract/install the application.

VESC Firmware

Because the VESC Tool is heavily reliant on the GUI, it is easiest to watch the video to understand how to upload the firmware to the VESC.

The first step is to connect the VESC to power, and then plug it in via a USB cable. The VESC must be powered on from the battery before you can program it.

Note: On some host computers (such as the Macintosh) the VESC may not be detected unless it is powered on before plugging it into the host. You can program the VESC when it is installed in the RACECAR, though you may need a longer USB cable.

Start the VESC Tool application.

Next, connect to the VESC by clicking the connect button in the right toolbar:

The VESC Tool will autodetect the VESC. Select Firmware from the left sidebar. You will see the hardware version. Check the ‘Show non-default firmwares‘.

You will see the firmware file VESC_servout.bin. Select the file and press the upload button.

The firmware will upload to the VESC. Once the firmware uploads, the VESC will reboot. You will see the lights flash while programming, and when the VESC reboots you will see red flashing lights. The lights will turn solid after the boot sequence finishes.

Configuring the VESC

Once the VESC is up and running, reconnect via the button as above.

There are several VESC configuration files in the RACECAR/J Github repository. Because we are using a VESC 6 Plus, we use the VESC-6-Plus-30k.xml configuration. Configurations for other VESCs are available in the folder also, such as the FOCBOX and bldc versions for 4.X hardware.

You can download the entire repository, or download one configuration file as shown in the video. Once you have the configuration file on your computer, select:

File->Load Motor Configuration XML

from the File menu. Specify the file which you downloaded. Now you are ready to upload (write) the configuration to the VESC. Press the Write Motor Configuration button on the right toolbar. It looks like this:

The configuration file will upload to the VESC. You are now ready to run your RACECAR/J!

Notes

Here’s an article on how to install your VESC 6 on the RACECAR/J platform.

Here’s an article on how to install the RACECAR/J Software on the Jetson TX2.