I'm just getting into using CAN and I had some recent revelations which may end up in a white paper somewhere, but I just wanted to post here in case anyone else can benefit/comment.
Using CAN bus in LabVIEW
Our 2011 Robot has a hybrid Swerve drive (6 wheel frame, two center wheels are swerve, 4 outer wheels are omni’s), and a manipulator arm with two motorized joints.
This is my first attempt to use CAN with our robot, and I did it for several reasons.
1) We wanted to have limit switches for the manipulator motions, and CAN provides a software-independent method to protect the motion from end collisions.
2) We wanted to use pots on the rotating joints and have a master/slave controller for the arm, so CAN would let us use the built-in closed loop position control provided by the Jaguar motor controllers.
3) We’ve not had great success with closed loop drive controls to date, so if we try it again it would ne nice for it to be built in to the controllers.
The available tutorials for hooking up the Serial-CAN bus are really good. So we got the actual bus up pretty quickly using a home-made cable and the CAN utility provide by TI. Here we learned about the various control modes and what to expect when reading and writing control data.
However, once we started actually programming (in LabVIEW) things got fuzzier. Larry’s tutorial here:
http://www.chiefdelphi.com/media/papers/2433 was a big help, but Larry was only using it for drive control.
Where I started running into problems was putting the JAG’s into Position Control using a POT.
I had verified this action using the TI Jag tool, but the LabVIEW code wasn’t acting the same.
Issues:
1) The Jag tool did position control based on pot voltage, and provided feedback in terms of voltage, so, I was expecting the same from LabVIEW. But the LabVIEW VI’s seemed to use something else. Through much doc searching and experimentation, I discovered that LV is converting position command and position feedback values to the 0.0 to 1.0 range. This makes sense in hindsight, but since pot vales seemed to work, but not properly, it was cause for several close collisions. The inference is that the “real world” units for “position” are “Rotations”, and that a pot measures 1 complete rotation. We all know that’s not true, but it’s probably close enough.
2) The motor enable and disable VIs don’t seem to work the way I expect them to… We wanted to be able to turn off the control of the arm if no motion was required. The code had an enable/disable switch that would issues Enable/Disable commands. We would repeatedly issue a disable command to an arm motor and it would still continue to run in a weird slow-motion way. Since we are setting the control mode to Position Control (POT) and the Disable.vi is sending a “Volt Disable” message to the Jag, I’m wondering if it is truly disabling the motor, since there is ALSO a more appropriate “Position Disable” command.
Anyway... more info at it comes available.
Phil.