Go to Post I have died and gone to heaven. :) - dlavery [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 26-01-2011, 21:37
ygd ygd is offline
Registered User
FRC #3341 (Manhattan Project)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: San Diego
Posts: 26
ygd is an unknown quantity at this point
Question CAN from scratch

My primitive Google-fu has failed me, and searching Chief Deplhi has proved futile. So I'll ask the question that so many beginners have asked before.

My team is in its second year. Last year, we controlled our (brown) Jaguars through PWM. This year, having acquired two black Jaguars, we want to try using the CAN bus to control drivetrain.

The only problem is, that we have no idea where to start.

First of all, how do I start the CAN bus? Is that port on the Digital I/O sidecar a CAN port? Or do I need a serial-CAN cable? Can I have brown Jaguars on the bus?

How do I interface to the CAN bus? Do I need to flash the cRIO with a new image? Does WPILib support CAN out of the box?

Any help will be immensely appreciated.
Reply With Quote
  #2   Spotlight this post!  
Unread 26-01-2011, 22:47
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 from scratch

There are two options for creating a CAN network:

You can use a 2CAN as your CAN bus master (connecting to the cRIO via an ethernet cable)

OR

You can use a Black Jaguar as your CAN bus master (connecting to the cRIO via an RS232-CAN adapter).

Here's an overview of the differences:
  • 2CAN provides access to the CAN bus at 5x the rate of the bridging Black Jaguar
  • You can update firmware directly from the 2CAN, whereas with the Black Jaguars, you must upate the firmware using an RS232 port (or converter) on your computer
  • 2CAN is more expensive
  • Using a black Jaguar will require you to make or buy RS232-CAN cable, wheras the 2CAN uses a common ethernet cable to connect to the cRIO

Now, picking one doesn't prevent you from switching. You can always start with a bridging Black Jaguar, and switch to 2CAN if you decide you need a greater communication rate.
However, we can help you better if you decide which one to go with for now.


You can have a tan Jaguar on the bus. Any Jaguar on the bus requires a firmware update to be fully functional with CAN.



In software, it's a very easy change. MotorDevRefs include PWM- and CAN-based controllers in the same typedef. You can convert to CAN just by changing how the motor is opened. (In LabVIEW, this is in Begin.vi. Make sure to replace the "DriveMotorOpen" with the one from the functions palette, so you can just use the polymorphic selector to change it to a CAN open.


If you're using LabVIEW and the Black Jaguar CAN, I've put together a package to help you set up your Jaguars.
http://kamocat.com/robot/electrical/CAN_resources.zip
__________________
-- Marshal Horn
Reply With Quote
  #3   Spotlight this post!  
Unread 26-01-2011, 22:56
ygd ygd is offline
Registered User
FRC #3341 (Manhattan Project)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: San Diego
Posts: 26
ygd is an unknown quantity at this point
Re: CAN from scratch

Thanks for the summary.

We are using C++, not Labview.

The link you gave me seems to be broken, I'm getting a "404" type page.

When you image the cRIO, it has an option for a CAN driver. Do I need to put anything there?
Reply With Quote
  #4   Spotlight this post!  
Unread 26-01-2011, 23:17
big1boom big1boom is offline
Chains=Fun
FRC #2022 (Titan Robotics)
Team Role: Alumni
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Aurora
Posts: 267
big1boom is a glorious beacon of lightbig1boom is a glorious beacon of lightbig1boom is a glorious beacon of lightbig1boom is a glorious beacon of lightbig1boom is a glorious beacon of lightbig1boom is a glorious beacon of light
Re: CAN from scratch

Check out our team's wiki.


The wiki is a work in progress, but this article is complete. It goes over the basics of the CAN network.

EDIT: Nevermind, apparently the website currently has messed up permissions.
__________________

Last edited by big1boom : 27-01-2011 at 08:40.
Reply With Quote
  #5   Spotlight this post!  
Unread 26-01-2011, 23:36
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: CAN from scratch

Quote:
Originally Posted by ygd View Post
Thanks for the summary.

We are using C++, not Labview.

The link you gave me seems to be broken, I'm getting a "404" type page.

When you image the cRIO, it has an option for a CAN driver. Do I need to put anything there?
The link seems fine to me, perhaps you should try again

To switch C++ software to CAN, instead of creating Jaguar objects you should create CANJaguar objects. The only other change needed is updating the port numbers in the constructors with the CAN IDs of the jaguars.

In the cRIO imaging software you should select the method of connecting to the CAN bus you are using. If you are going with a serial-jaguar connection, select BlackJaguarBridge. If you're using a 2CAN, select 2CANBridge (I'm not 100% sure those are the exact names)
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
Reply With Quote
  #6   Spotlight this post!  
Unread 26-01-2011, 23:45
ygd ygd is offline
Registered User
FRC #3341 (Manhattan Project)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: San Diego
Posts: 26
ygd is an unknown quantity at this point
Re: CAN from scratch

@big1boom: When I try to load your page, I get this.

@Radical Pi: Really? When I try to open it, I get this.

Both: thanks for your insight.
Reply With Quote
  #7   Spotlight this post!  
Unread 26-01-2011, 23:56
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 from scratch

You're right, it is broken - I'm re-uploading the file right now.

At any rate, for C++ CAN, Radical Pi is the one to talk to. Unless you have hardware questions, I'll leave you in his capable hands.
__________________
-- Marshal Horn
Reply With Quote
  #8   Spotlight this post!  
Unread 27-01-2011, 08:39
big1boom big1boom is offline
Chains=Fun
FRC #2022 (Titan Robotics)
Team Role: Alumni
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Aurora
Posts: 267
big1boom is a glorious beacon of lightbig1boom is a glorious beacon of lightbig1boom is a glorious beacon of lightbig1boom is a glorious beacon of lightbig1boom is a glorious beacon of lightbig1boom is a glorious beacon of light
Re: CAN from scratch

Quote:
Originally Posted by ygd View Post
@big1boom: When I try to load your page, I get this.
Interesting... The site is currently in Beta and we have been having a lot of trouble with permissions. Thanks for actually showing me what is wrong with it.

EDIT: If you don't mind, could you try this. http://coolhub.imsa.edu/cybercollab/...rk%20%28CAN%29

I may have given you a link for people who are logged in. If this link doesn't work then I am going to have to get in contact with the development team.
__________________

Last edited by big1boom : 27-01-2011 at 09:41.
Reply With Quote
  #9   Spotlight this post!  
Unread 28-01-2011, 04:25
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
Re: CAN from scratch

That link works.

Some other things to be aware about:

CAN cable is pretty much standard phone cable (some small differences) so there is industry support for it. By that I mean we got a crimper that can make a cable in seconds, as opposed to PWM (don't get me started).

The 2CAN has 2 ethernet and 1 CAN port on it; one ethernet goes to the c-RIO, the other goes to either the bridge or the camera (depending on what c-RIO port you plugged it into) and the CAN goes to a jaguar. It has a really nice web interface, which shows you, among other things, input and ?output voltages, temperature, fault condition (internal circuit breakers), current, and lots of other great stuff. It also makes it dead easy to do other fun stuff (setting IDs, reflashing firmware (which didn't actually work for me...)) and is generally cool.

The only problem is it has a really short power cable coming out of it.

The black jaguar converter is also really nice, and much cheaper if you care about that.
Reply With Quote
  #10   Spotlight this post!  
Unread 28-01-2011, 10:58
Mike Copioli's Avatar
Mike Copioli Mike Copioli is offline
You make it pretty We make it dance
no team (Retired(3539, 217))
Team Role: Engineer
 
Join Date: Jan 2006
Rookie Year: 2001
Location: Romeo
Posts: 453
Mike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond repute
Re: CAN from scratch

Quote:
Originally Posted by WizenedEE View Post
The only problem is it has a really short power cable coming out of it.

This is being changed along with several other hardware features in the next revision of hardware.
__________________
Mike Copioli
CTRE Hardware Engineer
http://www.ctr-electronics.com

Team 3539 The Byting Bull Dogs
2013 Michigan State Champions
Team 217 The Thunder Chickens
2006 World Champions
2008 World Champions
2009 Michigan State Champions
Reply With Quote
  #11   Spotlight this post!  
Unread 28-01-2011, 17:37
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 from scratch

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

i wrote that document on how to make the black jaguar method work from scratch.

hopefully that answers your questions.
__________________
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
  #12   Spotlight this post!  
Unread 07-02-2011, 20:34
newkidd-sagar newkidd-sagar is offline
Registered User
FRC #1241
 
Join Date: Jan 2010
Location: Mississauga
Posts: 13
newkidd-sagar is an unknown quantity at this point
Re: CAN from scratch

If we use the Black Jaguar method, can we let that Jaguar have a function like controlling one motor? Or is it required that that Jaguar be left alone only as the CAN Bus Master?

Thank you.
Reply With Quote
  #13   Spotlight this post!  
Unread 07-02-2011, 23:00
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 from scratch

The Black Jaguar can also control a motor.

I've seen no data to indicate that using this Jaguar to control a motor will impact the performance of your CAN bus.
__________________
-- Marshal Horn
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:42.

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