CAN-Where to Start

Hello,
Our 2010 robot encountered some serious problem during the season.
When we are driving the robot, at some moment, one of the driving motor will overheat and the robot would get disabled for 2~3 seconds.
We are not sure what the reason is yet, but we were suspecting that the motor might be drawing too much current and it would trip off the internal switch of the Gray Jaguar that we were using.
To fix that problem, my team chose to apply CAN on 2010 robot. We are planning write a program that will use the CAN’s current sensing ability to check whether the current is in the safe range and whenever it gets too high, we would like to reduce the current.
We have all the hardwares ready but we just don’t know where to start in programming wise. Could anyone please help us get started with CAN?
Any help will be greatly appreciated. (LabVIEW codes, picture, link, anything)
It can also be about something else we can do with CAN. (anything relating to CAN is much appreciated!)
Thank you so much!

My team had the same problem this past year. I have looked into it, but it seems the only way to control the current is to use the current control mode, obvious, but it won’t give you the same control over speed as you get with voltage control mode. As far as i could see there was no way to just set a limit on the amount of current the jaguars would let through, other than their own safety shutoff.

I’m a C++ programmer, so I can’t give you too many specifics on how to do this in Labview, but once you have opened the jaguar, there is a vi called CAN Jaguar Get Status.vi which includes the current running through the jag even if you aren’t in current control mode (well, the C++ equivalent works out of current control, so LV probably does too). Once you have that you can change your levels as needed.

Alternatively, you can use current control mode to set the current that should be passing through the jaguar, which could be combined with a PID loop on the cRIO to make up for the loss of speed control.

Sorry if this seems deviant from the purpose of the thread, but have you figured out why the motor is drawing too much current? If it’s a mechanical or electrical problem, it’s worth figuring out that problem instead of trying to patch it with code (especially since you have the time afforded by the offseason).

Just a couple of ideas: You say it’s a drive motor, so did an axle get bent? Did a bearing or some of the chain links (if using chain) collapse? Are any gears aligned and spaced properly? Did the frame get skewed or something causing binding in some other way? Is the gearbox greased? Which type of motor is it? What reduction are you using? Check out the motor curves for your motor and make sure it’s running near the efficient range. If you are using multiple drive motors ganged together, are they balanced? Is the motor in good condition? E.g. If it ever “let out magic smoke”, some of the wire insulation in the motor has been burned away and the power output of the motor could be decreased if the wires are shorting internally.

Current control will help to prevent your motor from burning out, without identifying what’s causing the high current draws, it’s quite possible you’ll end up with a robot that only moves very slowly in order to meet your current requirements.

–Ryan

CAN Jaguar speed control with cRIO current limit:

http://www.chiefdelphi.com/media/papers/2406

~

If you don’t have it already, you need the canJaguar software from firstforge: http://firstforge.wpi.edu/sf/projects/canjaguar. It has the necessary API, as well as examples.

Make sure you take a look at my mods to support the sync mode of the Jaguars. You’ll find it in the open issues section of the CANJaguar section of the site.

Good luck,

Mike

Thank you so much for all the responses!
I think we will try some things with CAN based on the responses.
Once again, thank you so much for the guidance and the tips!

When we found out the problem, we actually switched out the Jaguars with Victors and it worked fine… That’s how we found out that Jaguars were the one that was causing the robot to stop.
Thank you for the response! :slight_smile:

I’m trying to run a black jaguar with a 2CAN. I’m having only limited success. The jag works fine when in voltage mode … not so well in speed mode. When I command the motor to move (in speed mode), I get a tiny bit of movement from the motor then nothing. Adjusting the PID values does not appear to make a difference. The driver station software states that I am enabling the jag. The LED on the jag is on steady (not pulsing). This behavior is consistent across several black jags. None are damaged. Switching back to voltage shows me that the jag works just fine.

Using BDC-COMM (yeah, non-CAN), the jag runs in either voltage or speed mode. I do have an encoder connected. I do have a terminating resistor at the end of the CAN chain. The results are similar whether I use a single jag or several jags. I can point my browser to the 2CAN ip address and view the status of all jags on the CAN bus. I updated the firmware on my jags to version 91 (yes, I used the black jag firmware version).

I’m wondering if I’m missing a hardware connection or (most probably) it’s simply a programming issue. I’m programming in C++.

I have searched through these forums but have not found an answer that works.

The code I’m using now is pretty much a clone of the code at,

http://firstforge.wpi.edu/integration/viewcvs/viewcvs.cgi/CANJaguar%20for%20C%2B%2B/CANJaguarSpeedControlExample/?root=canjaguar&system=exsy1002

If anyone out there has successfully used C++ to operate a black jag in speed mode, could you please itemize the steps necessary to accomplish the task. The more specific the reply, the better.

One last unrelated thing. I’ve obviously figured out how to reply to a forum post. How to you start a new thread?

Thanks

Sam

See attached screenshot.





Are you running the Speed Control Dashboard? It’s required for the demo you linked, since the dashboard is what sets the PID parameters.

That doesn’t sound familiar.

I thought you could set the PID parameters with SetPID command.

double P = 1.0;
double I = 0.0;
double D = 0.0;
jag_name.SetPID ( P, I, D );

You can.
But the example you linked is not as simple as the “Voltage Mode Example”.
If you want the same functionality as in the voltage example (but regulating speed instead of voltage), then your best option is to modify the voltage example to use speed instead.
If you’ve already determined the appropriate PID values though testing with the BDC-COMM, then use those values when you set the PID.