Log in

View Full Version : Help with CAN bus closed-loop speed control


RoboGuy
04-04-2010, 20:56
Will the SetMotorSpeed.vi in LabVIEW set the "speed" or the "voltage" of motors if the Jaguars that are controlling the motors with CAN bus off the digital sidecar? Thanks in advance.

kamocat
05-04-2010, 14:07
The "set-speed" should set the speed, with feedback. (it requires an encoder)
I believe it's in RPM, but I don't recall.

The "set-voltage" is proportional; -1 to 1 just like the pwm-based "set-speed" in the WPI libraries.

RoboGuy
05-04-2010, 15:09
Which sub-pallete are the set-speed and set-voltage vi's in?

Joe Ross
05-04-2010, 15:41
All of the CAN VIs are available on FIRSTForge. http://firstforge.wpi.edu/sf/frs/do/viewSummary/projects.canjaguar/frs

The VIs included with LabVIEW do not support CAN. The SetSpeed VI that comes with LabVIEW uses PWM and sets a voltage, it doesn't actually set a closed loop speed.

CAN does not run from the digital sidecar, it either runs from the serial port on the cRIO through a black jaguar or from ethernet through a 2CAN (http://www.andymark.biz/am-0545.html). When you said CAN, did you really mean PWM?

RoboGuy
05-04-2010, 23:03
No I meant CAN. I'm sorry I didn't make that clear. I downloaded and looked at those vi's from Firstforge and it seems to me that they want inputs from encoders through the digital sidecar. But is there a way to program the Jaguars in Labview to perform closed-loop speed control by feeding the encoder wires straight to the Jaugars and hooking the Jaugars to CAN bus? (by the way, my team is using gray Jaugars just to let you know)

kamocat
10-04-2010, 03:31
Well, if you're using CAN, then the encoders SHOULD be hooked up directly to the jaguars.
The documentation may not explicitly say it, but if you're using CAN speed control (as opposed to voltage control), the encoders must be connected to the Jaguar, not the digital sidecar.

RoboGuy
13-04-2010, 15:32
Well, the problem is I don't know how to tell the Jaguars, in LabVIEW, to utilize the closed-loop speed control that the Jaguars already have in them when encoders are wired straight to the Jaguars and the Jaguars are daisy-chained with CAN from the serial port on the CompactRIO.

Joe Ross
13-04-2010, 15:46
Have you looked at the speed control example that is included with the CanJaguar for LabVIEW download from FIRSTForge?

RoboGuy
13-04-2010, 16:17
Yes, but the default form of that example requires inputs from encoders or potentiometers to the cRIO for the code to work right.

Joe Ross
13-04-2010, 18:09
The file I'm looking at "CAN Jaguar - Speed Control Example.vi" does not use encoders or potentiometers on the cRIO. It uses an encoder on the Jaguar.

Chris Hibner
13-04-2010, 19:33
We didn't use CAN this year so I may off base with this so keep that in mind...

As far as I know, CAN gives you feedback on current. Current is proportional to torque in a DC motor. That means you can perform feedback and control torque, so you won't be directly controlling speed.

kamocat
13-04-2010, 19:36
Current is only one of the control modes.
There's Voltage, Speed, Position, and Current.
Current is often advertised because it is not a readily available option without CAN.

Ether
13-04-2010, 21:06
The file I'm looking at "CAN Jaguar - Speed Control Example.vi" does not use encoders or potentiometers on the cRIO. It uses an encoder on the Jaguar.


Joe,

Would you please post a link to that file you're looking at?

I am told by our programmer (and others) that the WPI CAN/Jaguar VIs they have looked at only support closed-loop speed control performed by cRIO using encoder signals passed to the cRIO, not closed-loop speed control performed by the Jags using encoder signals connected to the Jags.

Thanks.

~

Radical Pi
13-04-2010, 21:39
Are you looking at the latest version from firstforge? The C++ version of the code didn't get closed-loop finished until midway through the season. LabVIEW most likely would be a similar situation

Ether
13-04-2010, 23:04
Are you looking at the latest version from firstforge? The C++ version of the code didn't get closed-loop finished until midway through the season. LabVIEW most likely would be a similar situation


Thanks, I'll download the latest rev and ask them to look at it again.


~

RoboGuy
14-04-2010, 11:24
Hey everybody, I'm really sorry I messed everyone up on this :(. I took another look at the CANJaguar vi's and Joe Ross, you were right. The vi's don't read signals from the encoders through the cRIO. So, thank very much everyone for all your help. Hopefully I'll get ths figured out and again I'm sorry.

EricVanWyk
14-04-2010, 12:34
Hey everybody, I'm really sorry I messed everyone up on this.

Don't worry about it! If I had to choose between {you getting this working but confusing us a tiny bit} and {you not getting this working but us being blissfully unaware}, I'd pick the one where everyone comes out ahead every time.

Please do not hesitate to ask more questions in the future.