2CAN C# Example

I have posted a Visual Studio 2005 C# example that can be used to control Jaguars using only a 2CAN. The app sockets to the 2CAN and sends voltage throttles over UDP. The 2CAN then in turn updates the Jaguars on the bus. The throttles are read from an attached USB Gamepad or Joystick. This is basically the example that was demoed at the AndyMark booth at Atlanta.

The entire solution (with release built exe) can be downloaded by clicking the “C# Application Example (Updated 5/2/2010)” link at…

For those of you interested in creating your own apps I recommend looking at 2CANComm.cs as it has the c# and C style definition of the data sent to the 2CAN. A formal communication spec is in the works. Hopefully this will suffice in the meantime.

Be sure to use the non-FIRST Jaguar firmware. I have been using Jaguar version 5450 and 2CAN version 1.6. Also be sure to read through the ReadMe.txt file as it contains important information for compiling/debugging the C# app.

I have build a java command line program that does the same thing but without direct-x, joysticks, or a GUI. Source will be released soon!

you can control can with something like an arduino, right?

As long as you can send serial data then I do not see why not. You have to remember though, the Jags are looking for a packet and if none is received within a 100ms time period they trip the watchdog which disables them. There is a pdf that describes the packet structure on the manufacturers website.

OTOH I would recommend using a 2CAN instead because it handles just about all of the conversions for you!

can has link?

Never mind, remember to read the frakken thread in the future


Where can one obtain the non-FIRST Jaguar firmware?

Does the non-FIRST firmware have working support for current-control and speed-control modes? (Apparently there were bugs that were fixed in FIRST version 91.)

Would it be possible to include a compiled proprietary module that could be used with one’s own PC-based software – like the C# software you’ve posted – so that you wouldn’t have to switch firmware when changing from cRIO-based to PC-based control (and back again)? That way trusted mode could be used with PC-based control without spilling the beans on trusted mode.


The built in HTTP server in the 2CAN works really well also. Just hit the 2CAN IP address with a browser and you get all sorts of nice stuff.

The non-FRC firmwares are included in the freely available development software from TI - there are separate ones for the grey Jags and black Jags.

Grey Jag kit: http://www.luminarymicro.com/products/rdk_bdc.html

Black Jag kit: http://www.luminarymicro.com/products/rdk_bdc24.html

Scroll down to the “Software Updates” section of those pages, and you’ll see download links for the Firmware Development Package Software - you need to register to download. After you install the software, you’ll see the firmware sources and binaries under INSTALL_DIR\boards\rdk-bdcXX. The Grey Jag firmware is qs-bdc; the Black Jag firmware is qs-bdc24.

Latest rev of the non-FRC firmwares is apparently 5961; the latest we’ve used is 5821 but have never had problems with any of the control modes in any of the non-FRC firmware.

As a side note our team (#2607) also ported the 2CAN cRIO plugin to run under Windows, and we use that to control the 2CAN from the PC. We’ve requested a firstforge project to post the code but it hasn’t been approved/created yet.

Hope that helps!

  • Ron
    Team #2607 controls mentor

Often the mechanical folks want to test some aspect of the robot without asking the software folks to stop what they’re doing and write a little test program.

If someone is industrious it would be great to have a windows program that you could load on a laptop to control of all the Jaguars on the bus without needing to have the cRIO involved.

Even better would be for the 2CAN web interface itself to allow you to set direction and power settings for various Jaguars.

For Serial bridge users that would be BDC-Comm (a little hard to use). For 2CAN jags that’s not really possible without doing re-flashing of all of them for that one test and then re-flashing them to work with the cRIO (which means even more programmer time) because of the safety system put in by FIRST

I’ve successfully driven FIRST firmware jags with BDC-Comm, at least in voltage/%speed mode (current mode doesn’t seem to work). Oops, re-read your post; you’re right that over 2CAN it doesn’t work with FIRST firmware.