View Single Post
  #12   Spotlight this post!  
Unread 16-03-2013, 13:01
gbonehead gbonehead is offline
Registered User
FRC #0571
 
Join Date: Jan 2012
Location: Windsor, CT
Posts: 1
gbonehead is an unknown quantity at this point
Re: CAN and Jaguars, any limits?

TL;DR - If you're having trouble with a CAN bus with a lot of Jaguars ("a lot" probably means 5-6+), try rewriting your code to only send commands to the CANJaguar when you actually have a speed change. That will reduce CAN traffic significantly.

--

We had what I believe is an issue with the CAN bus as well. We are using a CAN bus with 7 Jaguars - 2 drive, 2 lift, and 3 to control Frisbee feed/push/shooter wheel.

Our competition 'bot (with a cRIO II) was working fine, but after we bagged it and went to use our practice 'bot (with a cRIO I) we started getting extremely erratic behavior ... the movement was horribly jerky, if it moved at all, and there were huge delays in responding to simple commands.

After some bisection debugging (remove half the code, see if it works ) we finally came to the conclusion that it wasn't related to the code at all, but instead to how many Jaguars we were trying to control.

As it had been written, our loop would simply send the motor speed commands to each Jaguar during each loop. I added some timing code in there and saw the man loop degenerate horribly to 4-8 iterations per second, if that.

We re-wrote the code to only send commands to the Jaguars upon change (though not the drive code; that still uses the standard RobotDrive calls every iteration) and I saw the main loop speed increase to something just under 1000 iterations/sec.

The same code works just fine on our cRIO II, and has *probably* increased performance there as well, but it made the cRIO I usable. It will probably help our image processing code as well, though we haven't done our final merge of the target recognition code yet.

All our code is in C++; if you have any questions feel free to email me at bonehead@acm.org - I'm very rarely on Chief Delphi (in fact, I only knew about this thread because one of the other mentors mentioned it to me).

Or you can poke around on SourceForge; all our code is published there at http://paragon571-2011.svn.sourceforge.net ... this year's code is in the robot-2013 directory, amazingly enough
Reply With Quote