/ ROBOTICS

MIT Racecar VESC and Joystick on Ubuntu 18.04

After building the MIT Racecar in my last post, I started installing all of the peripherals so I could run it in teleop mode. Unfortunately, using a new Jetson image meant that I couldn’t use the pre-compiled drivers online. Here’s how I managed to get the VESC and joystick working.

VESC Firmware

After buying the VESC from Maytech, I updated the firmware according to the instructions on JetsonHacks (I had to use the instalBLDCTool script). The MIT Racecar requires a specific firmware build that allows controlling the servo via the controller, and fortunately JetsonHacks provides a copy of it.

Also, the new VESC-Tool that replaced BLDCTool will not accept the firmware version that JetsonHacks has available. If you want to compile the servo-out change into a newer version of the firmware, then the VESC-Tool should work.

Connecting to the VESC

The VESC uses the USB Abstract Control Module protocol, which requires a special cdc_acm driver. I couldn’t find a compiled version for kernel version 4.9.140, so I had to build the 4.9.140 kernel on the Jetson and include the cdc-acm module.

As usual, JetsonHacks has great instructions on how to build the kernel, but I had to modify their scripts to work for 4.9.140. Here’s a link to my compiled cdc-acm driver in case it helps someone.

4.9.140 cdc-acm driver

To install the cdc-acm driver, I copied it from the compiled kernel output into the /lib/modules/4.9.140/kernel/drivers/usb/class folder.

I had to add the following line to /etc/modules to load cdc-acm automatically.

# /etc/modules
cdc-acm

And the following line to /etc/udev/rules.d/10-racecar.rules (or any rules file) to make the VESC consistently appear as /dev/vesc

# /etc/udev/rules.d/10-racecar.rules
ACTION=="add", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", SYMLINK+="vesc"

Connection to the Joystick

In order to use the Logitech F710 joystick, I had to install xboxdrv and run it on startup in daemon mode.

sudo apt-get install xboxdrv
# /etc/init/xboxdrv.conf
exec xboxdrv -D -d --silent

Conclusion

That’s everything required to run the racecar in teleop mode! Build the catkin workspace then run roslaunch racecar teleop.launch to drive it around!