JetsonHacks

Developing on NVIDIA® Jetson™ for AI on the Edge

RACECAR/J – Programming the Electronic Speed Controller

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.

Facebook
Twitter
LinkedIn
Reddit
Email
Print

6 Responses

  1. Hello. First I want to thank you for your very helpful videos and articles. I bought a Focbox from eBay. I used VESC Tool to update the firmware of the Focbox. Then I uploaded the motor config file for Focbox.
    When the power is connected to Focbox, my servo is making a very weak noise and I can’t move the front tires to right or left. It seems servo is keeping them from being moved. I wanted to know if this is normal.c

    1. Thank you for the kind words. There might a little whine from the steering servo as it tries to maintain its position. How are you trying to make the servo move?

      1. That might be it. I just connected the battery to Focbox and the constant whine is there. When I try to move the front wheel towards the right or left using hand there is a resistance. (while the center of a car is on a tall object and wheels are free). When I disconnect the battery the noise goes away and I can move the wheels with my hand. If that is normal it is fine. I was worry that maybe I did a mistake during the firmware update and config upload. Thanks

        1. The servo is being controlled by the Focbox, which is telling the servo to remain centered. That’s why it resists being turned by hand.

          Not sure why you are trying to move the wheels with your hands, typically people use a computer to send commands to the Focobx to change wheel position.

  2. Great build series and info thank you! Have a project using a VESC type controller in a remote controlled watercraft drone. I’d like to get the servo out working for steering. How do you handle sending the commands to the VESC to move the target servo / steering position?. I have a generic 2.4ghz remote controller which does have two buttons but I’m guessing will need to code some sort of interface. Thoughts most welcome

Leave a Reply

Your email address will not be published. Required fields are marked *

Disclaimer

Some links here are affiliate links. If you purchase through these links I will receive a small commission at no additional cost to you. As an Amazon Associate, I earn from qualifying purchases.

Books, Ideas & Other Curiosities