Log in

View Full Version : using CAN with the 2010 control system


Us3rNam3
16-01-2010, 16:21
Does anyone have any tips or know to program using CAN using the Andy Mark adapter? Any info on how to use CAN would be greatly appreciated. Diagrams/pics of code would especially helpful.

Thank you

Alan Anderson
16-01-2010, 23:14
You can find documentation and example code here (http://www.crosstheroadelectronics.com/2CAN.htm).

(The 2CAN is made by Cross The Road Electronics. AndyMark is merely acting as a distributor.)

Us3rNam3
17-01-2010, 13:59
thank you...but unfortunately i forgot to include that i need it for labVIEW not c++

kamocat
17-01-2010, 14:53
Send an email to Omar Zrien (ozrien@gmail.com).

The cRIO driver/interface will allow you to transmit and receive "CAN Frames", whereby a CAN frame will be defined as a structure with arbid, data bytes, len, and also status bits for selecting extended ids, remote frames, and also possibly error information (Transmit Error Count, Receive Error Count).

I suppose it is possible that they don't have a license to LabVIEW, and thus can't do the LabVIEW portion themselves. In looking at it, it's a UDP datagram of a struct[ message, arbitration ID].
If I had experience with UDP, I'd do it myself.

jhersh
17-01-2010, 21:37
The LabVIEW API (as well as C++ and Java) for using CAN is here: http://firstforge.wpi.edu/sf/projects/canjaguar

The C++ API that CTRE has posted will not work with FRC 2010, based on the rules requirement of using the FIRST specific Jaguar firmware.

jhersh
17-01-2010, 21:50
BTW, the plugin for the 2CAN has not been released yet. When it is, you will be able to find it at FIRST Forge.

Another way to connect to CAN is to use the new Black Jaguar as a serial to CAN bridge. You just make the cable according the the getting started guide from TI (http://www.luminarymicro.com/jaguar) and plug it straight into the RS232 serial port on the cRIO. This way you don't need to buy a separate bridge device and can simply use one of your motor controllers. The driver plugin for using the Black Jaguar as a Serial to CAN bridge is posted on FIRST Forge.

If you are going to use a lot of motors in open loop mode, you may need the additional bandwidth of Ethernet.

airnate
21-01-2010, 22:42
If anyone has difficulty navigating the FIRST Forge site looking for the LabVIEW code to use with Jaguar / CAN, here is a deep link to the zip file (at least where it is today):

http://firstforge.wpi.edu/sf/frs/do/listReleases/projects.canjaguar/frs.canjaguar_for_labview

Andy Bradley
30-01-2010, 18:06
If anyone has difficulty navigating the FIRST Forge site looking for the LabVIEW code to use with Jaguar / CAN, here is a deep link to the zip file (at least where it is today):


Thanks very much. Do you know in which directory the extracted files should be placed so that LabView can see them?

airnate
30-01-2010, 23:26
Thanks very much. Do you know in which directory the extracted files should be placed so that LabView can see them?

We put them in

C:\Program Files\National Instruments\LabVIEW 8.6\user.lib\CANJaguar for LabVIEW

They will then show up in your User Libraries palette in LabVIEW.

imcmahon01
01-02-2010, 10:29
I have a similar question to Andy's. Our team is using the netbeans ide; how is the CANJaguar for Java folder added as a library to allow the use of edu.wpi.first.addons.CANJaguar?

MikeE
01-02-2010, 10:57
Our team has looked at the Java CANJaguar release, and at the moment only voltage setting is supported - none of the closed-loop methods are implemented yet.
I'm not sure if the primary developers are planning to release another update before the end of build, but we plan to try to implement some of the functionality we need ourselves. If we have success we will make our efforts available to the community.
In the meantime, the bdc-comm utility does allow some experimentation with closed loop control, but obviously not under actual robot conditions.

jhersh
01-02-2010, 12:59
Our team has looked at the Java CANJaguar release, and at the moment only voltage setting is supported - none of the closed-loop methods are implemented yet.
I'm not sure if the primary developers are planning to release another update before the end of build, but we plan to try to implement some of the functionality we need ourselves.

This is the first I've heard of a team wanting to use CANJaguar with Java. I've not ported the C++ class's closed loop methods to Java yet because I had not heard any demand. I'll either do it or find someone else to do it before the end of build.

-Joe

MikeE
01-02-2010, 13:04
Thanks for the quick reply Joe. The team decided to program in Java this year since it is the language taught at the High School, and we only started seriously investigating CANJaguar support this past weekend.

I also realize this is the wrong sub-forum for Java discussion, so apologies for hijacking a Labview thread.