Go to Post You won't find anything in school that says you have to share ideas or strategy with your football rivals. - Al Skierkiewicz [more]
Home
Go Back   Chief Delphi > Technical > Electrical > CAN
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 30-01-2011, 17:08
alexhenning alexhenning is offline
WPILib Developer
FRC #0348
 
Join Date: Apr 2010
Rookie Year: 2003
Location: MA
Posts: 49
alexhenning will become famous soon enough
CAN tutorial

Hi,

Since this was team 348's first year doing CAN, we decided to document it. (in part because I'm a senior and won't be around all the time next year) I Right now, it's currently a draft, but I figured by the time I'm happy with it, it will be too late. Right now, it's just the basics. I plan on adding examples of taking advantage of closed loop control and other features of jaguars.

Hopefully you find it helpful! And please leave any suggestions to clarify or improve it.

Link: http://norwellrobotics.com/papers/canbus.html
Reply With Quote
  #2   Spotlight this post!  
Unread 01-02-2011, 19:30
ratdude747's Avatar
ratdude747 ratdude747 is offline
Official Scorekeeper
AKA: Larry Bolan
no team
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Madison, IN
Posts: 1,063
ratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond repute
Re: CAN tutorial

I also wrote I a document on CAN, but it was from a hardware point of view. It is mostly on the wiring aspect of CAN.

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

care to compare notes?

edit- I read it. your method for making the serial adapter is different. my methods were using a rj-12 to db9 adpter and reusing old db9 serial cables. not that your method is wrong, it is just different.


good luck on the document...
__________________
Dean's List Semi-finalist 2010
1747 Harrison Boiler Robotics 2008-2010, 2783 Engineers of Tomorrow 2011, Event Volunteer 2012-current

DISCLAIMER: Any opinions/comments posted are solely my personal opinion and does not reflect the views/opinions of FIRST, IndianaFIRST, or any other organization.

Last edited by ratdude747 : 01-02-2011 at 19:34.
Reply With Quote
  #3   Spotlight this post!  
Unread 02-02-2011, 19:32
alexhenning alexhenning is offline
WPILib Developer
FRC #0348
 
Join Date: Apr 2010
Rookie Year: 2003
Location: MA
Posts: 49
alexhenning will become famous soon enough
Re: CAN tutorial

Quote:
Originally Posted by ratdude747 View Post
I also wrote I a document on CAN, but it was from a hardware point of view. It is mostly on the wiring aspect of CAN.

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

care to compare notes?

edit- I read it. your method for making the serial adapter is different. my methods were using a rj-12 to db9 adpter and reusing old db9 serial cables. not that your method is wrong, it is just different.


good luck on the document...
Thanks, your's looks really good too! Now, I feel like I should add better pictures.
Reply With Quote
  #4   Spotlight this post!  
Unread 05-02-2011, 16:52
tux tux is offline
Registered User
AKA: Lee Harr
FRC #3842 (Shock-a-Bots)
Team Role: Mentor
 
Join Date: Apr 2005
Rookie Year: 2005
Location: Rochester, NY
Posts: 91
tux is an unknown quantity at this point
Re: CAN tutorial

Thanks for the information on CAN. I had no idea what CAN was and looked all through the documentation without really getting a handle on the very basics.

I might suggest that you start your paper with a sentence or two on what CAN is and what it stands for. Maybe a link here:
http://en.wikipedia.org/wiki/Controller_area_network

I think my team is going to stick with PWM this season. I've already started wiring that way and I have some familiarity with it. Maybe after the season we can reconfigure for CAN to get some experience with the added functionality.

Your work will certainly help with that. Thanks!
Reply With Quote
  #5   Spotlight this post!  
Unread 05-02-2011, 21:51
alexhenning alexhenning is offline
WPILib Developer
FRC #0348
 
Join Date: Apr 2010
Rookie Year: 2003
Location: MA
Posts: 49
alexhenning will become famous soon enough
Re: CAN tutorial

Thanks for the feedback. I added another paragraph in the "overview of CAN" section.

I've also started an example of using the encoders to read speed through the CAN network. I have to verify wiring colors monday, but other than that, it should be good to go.
Reply With Quote
  #6   Spotlight this post!  
Unread 14-02-2011, 10:19
PhilBot's Avatar
PhilBot PhilBot is offline
Get a life? This IS my life!
AKA: Phil Malone
FRC #1629 (GaCo: The Garrett Coalition)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Maryland
Posts: 744
PhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond repute
Using CAN BUS in Labview

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.
__________________
Phil Malone
Garrett Engineering And Robotics Society (GEARS) founder.
http://www.GEARSinc.org

FRC1629 Mentor, FTC2818 Coach, FTC4240 Mentor, FLL NeXTGEN Mentor
Reply With Quote
  #7   Spotlight this post!  
Unread 14-02-2011, 13:14
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Using CAN BUS in Labview

Phil,

Feel free to try using the "position disable" command, and see if it makes a difference. I was under the impression all the "disable" commands function identically. The main purpose of the "enable" and "disable" is to prevent the Jaguar from making wild movements while you are configuring.

In my experience, the BDC-COMM and the LabVIEW implementation treat the position the same; in rotations. I've tested Position Mode with encoders in both LabVIEW and the BDC-COMM, but I've only tested with potentiometers in BDC-COMM.

EDIT:
If you want to control using voltage, you can set your "pot turns" configuration to 3. The Jaguar uses a 3v regulator for the potentiometer.
__________________
-- Marshal Horn

Last edited by kamocat : 14-02-2011 at 13:20.
Reply With Quote
  #8   Spotlight this post!  
Unread 14-02-2011, 13:35
PhilBot's Avatar
PhilBot PhilBot is offline
Get a life? This IS my life!
AKA: Phil Malone
FRC #1629 (GaCo: The Garrett Coalition)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Maryland
Posts: 744
PhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond repute
Re: Using CAN BUS in Labview

Quote:
Originally Posted by kamocat View Post
Phil,

Feel free to try using the "position disable" command, and see if it makes a difference. I was under the impression all the "disable" commands function identically. The main purpose of the "enable" and "disable" is to prevent the Jaguar from making wild movements while you are configuring.

In my experience, the BDC-COMM and the LabVIEW implementation treat the position the same; in rotations. I've tested Position Mode with encoders in both LabVIEW and the BDC-COMM, but I've only tested with potentiometers in BDC-COMM.

EDIT:
If you want to control using voltage, you can set your "pot turns" configuration to 3. The Jaguar uses a 3v regulator for the potentiometer.
Now that I've got things working, I'll try the enable/disable again.
Regardless of the original intent for "enable/disable? it seemed the most logical way for me to "stop" the motor from following the slave controller. Changing the mode back to voltage and then setting voltage to zero seemed long winded.

Now that I think back... it's possible that the BDC-COMM WAS running 0-1, but the on-screen text just made me think it was volts...... perceptions...

Setting pot turns to 3 is a clever trick. I wasn't sure how that value effected the controller. I thought that the gear reduction should also come into play there.... but not really..

That parameter could have a paragraph of explanation somewhere so it's more obvious how it effects things.... The Rotations connection just wasn't obvious to me & I've been around the block a few times (or is it arround the bend?)

Phil.
__________________
Phil Malone
Garrett Engineering And Robotics Society (GEARS) founder.
http://www.GEARSinc.org

FRC1629 Mentor, FTC2818 Coach, FTC4240 Mentor, FLL NeXTGEN Mentor
Reply With Quote
  #9   Spotlight this post!  
Unread 14-06-2011, 13:55
gckid333 gckid333 is offline
Registered User
FRC #2658
 
Join Date: Jan 2011
Location: San Diego
Posts: 12
gckid333 is an unknown quantity at this point
Re: CAN tutorial

Thanks for the great tutorial! Our team has tried for 2 years to get it working, but with the lack of any good documentation, we were unsuccessful. We've been doing only part of what has been said in these tutorials. The extra information must be the missing link. I do have one small question. When we first started using CAN, the person in charge of our electronics said that a 120 ohm resistor worked just as well as the 100 ohm resistor, and bought A LOT of 120 ohm resistors, and NO 100 ohm resistors. So since we're stuck with these, I was wondering if they would still work, or if we should just go buy some 100 ohm resistors. Again, thanks for the great info!
Reply With Quote
  #10   Spotlight this post!  
Unread 14-06-2011, 16:29
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: CAN tutorial

Yes, the 120 ohm resistors work fine.
Truth be told, the CAN bus will actually operate with NO terminating resistor, but it will be less reliable.
__________________
-- Marshal Horn
Reply With Quote
  #11   Spotlight this post!  
Unread 14-06-2011, 20:01
Aren Siekmeier's Avatar
Aren Siekmeier Aren Siekmeier is offline
on walkabout
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: 대한민국
Posts: 735
Aren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond repute
Re: CAN tutorial

We tried out CAN this year via a Serial to CAN cable to a Black Jag. We had a 6 motor drive train and one motor for the elevator (2 black jags, 5 grey). Our CAN code worked beautifully with the drive train; we had not yet wired up the Jag for the elevator. When we did and started running elevator at the same time, we got lots of lag issues, with safety timeouts and CAN bus errors all over the place, resulting in system watchdogs beyond belief. We had it later confirmed (not sure where) that the Serial CAN bus on the cRio can only handle 6 jags efficiently, so we had it switched out for PWM. Unfortunately, due to <R49> and <R58> we couldn't have the limit switches on the elevator jag, which was a big sad face for the programmers.

Have other people had issues with more than 6 jags on the Serial bus? Is the 2CAN able to handle it? (I've heard it's bus speed, anyway, is much much faster, at about 800MHz?)

We also had one Jag (grey) that gave nothing but a Vbus fault in BDC-COMM and didn't accept any image. It worked flawlessly with PWM, so it was probably a firmware issue.
Reply With Quote
  #12   Spotlight this post!  
Unread 20-06-2011, 17:15
ratdude747's Avatar
ratdude747 ratdude747 is offline
Official Scorekeeper
AKA: Larry Bolan
no team
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Madison, IN
Posts: 1,063
ratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond reputeratdude747 has a reputation beyond repute
Re: CAN tutorial

Quote:
Originally Posted by compwiztobe View Post
We tried out CAN this year via a Serial to CAN cable to a Black Jag. We had a 6 motor drive train and one motor for the elevator (2 black jags, 5 grey). Our CAN code worked beautifully with the drive train; we had not yet wired up the Jag for the elevator. When we did and started running elevator at the same time, we got lots of lag issues, with safety timeouts and CAN bus errors all over the place, resulting in system watchdogs beyond belief. We had it later confirmed (not sure where) that the Serial CAN bus on the cRio can only handle 6 jags efficiently, so we had it switched out for PWM. Unfortunately, due to <R49> and <R58> we couldn't have the limit switches on the elevator jag, which was a big sad face for the programmers.

Have other people had issues with more than 6 jags on the Serial bus? Is the 2CAN able to handle it? (I've heard it's bus speed, anyway, is much much faster, at about 800MHz?)

We also had one Jag (grey) that gave nothing but a Vbus fault in BDC-COMM and didn't accept any image. It worked flawlessly with PWM, so it was probably a firmware issue.
very odd... my team made 9 jaguars on Serial Can work fine. we had those erros at one point but it was a code issue; we used labview and the programmer had put everything in teleop.vi and never used periodic tasks, big mistake. moving it all the control loops (non-robot drive) to invidual while loops in periodic tasks solved the timeout issues.

the odd jaguar might have metal shavings inside... open it up and make sure its clean. I was able to fix 5 ones in the junk box that way... remove the shavings and they come back to life.
__________________
Dean's List Semi-finalist 2010
1747 Harrison Boiler Robotics 2008-2010, 2783 Engineers of Tomorrow 2011, Event Volunteer 2012-current

DISCLAIMER: Any opinions/comments posted are solely my personal opinion and does not reflect the views/opinions of FIRST, IndianaFIRST, or any other organization.
Reply With Quote
  #13   Spotlight this post!  
Unread 10-11-2011, 21:53
Eric Sakshaug Eric Sakshaug is offline
Registered User
FRC #0340 (Greater Rochester Robotics)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2009
Location: Brockport, NY
Posts: 8
Eric Sakshaug is an unknown quantity at this point
Question Re: CAN tutorial

If I'm reading this correctly, the firmware must be updated prior to assigning a number? My team is currently experimenting with CAN on one of our off-season robots, and we've gotten as far as getting the LED on the black jaguar to be a solid yellow (don't ask why we've waited this long to even get this far!) while connected through 6P6C-DB9 cable to a laptop, and BDC-COMM is saying that it is connected, however, when we attempt to assign a number to the Jaguar (so far, just the black jaguar, and it does have the proper terminator) it gives us the countdown, we press the user button in time, it flashes yellow once, and goes back to solid yellow (meaning that it's being assigned to ID 1, when we're trying to do ID 2). So, is our issue that we need to update firmware first, or is it something else?
Reply With Quote
  #14   Spotlight this post!  
Unread 11-11-2011, 19:41
FrankJ's Avatar
FrankJ FrankJ is offline
Robot Mentor
FRC #2974 (WALT)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2009
Location: Marietta GA
Posts: 1,901
FrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond repute
Re: CAN tutorial

Go ahead and update the firmware. You will have to do it eventually anyway. I expect the reboot will reset the address to 1 regardless of the current address. I have not actually tried with any ID but 1 this so I could be wrong.

The procedure is to put the new address in the box. Click the assign button. you see the box counting down & the jag light blinking. Press the user button within the 5 seconds. Sorry for being redundant. Should work. Look at the top of the BCD Comm box for the current board ID NOT the assign box.

You can find directions for BCD-COMM here
Reply With Quote
  #15   Spotlight this post!  
Unread 12-11-2011, 17:11
Eric Sakshaug Eric Sakshaug is offline
Registered User
FRC #0340 (Greater Rochester Robotics)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2009
Location: Brockport, NY
Posts: 8
Eric Sakshaug is an unknown quantity at this point
Re: CAN tutorial

Quote:
Originally Posted by FrankJ View Post
The procedure is to put the new address in the box. Click the assign button. you see the box counting down & the jag light blinking.

Look at the top of the BCD Comm box for the current board ID NOT the assign box.
Thanks for the speedy response!

The jag light was remaining solid after we pressed the assign button.

Also, although the jag's LED was solid yellow, there were no board IDs listed in BDC Comm.

Also, we had to force the computer to set the jaguar to Com port 1, otherwise, BDC Comm wouldn't even acknowledge that there was another Com port present.

The black jag was the only one on the network at the time, and attempting to daisy chain through to a tan jag yielded no communications on the tan jag.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:45.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi