Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   CAN (http://www.chiefdelphi.com/forums/forumdisplay.php?f=185)
-   -   CAN vs PWM (http://www.chiefdelphi.com/forums/showthread.php?t=87299)

ratdude747 27-10-2010 22:30

CAN vs PWM
 
Myself and another member on my team were discussing whether to shoot for CAN or PWM for the jaguars next year.

we do not plan on using any victors, as we were rookies in 2009 and all we have are a few stray ones on a donated prototype chassis. We also plan to program using labview.

as i understand from the table at nationals, next year's KOP has solely black jaguars in it.

a little gracious advice would be helpful as my last 3 years of FRC wiring have been pwm only.

Radical Pi 28-10-2010 00:28

Re: CAN vs PWM
 
We used CAN last year, and though it's a little temperamental, when it works it works well.

Be warned, our problems included difficulty in making the cables, a higher sensitivity to slowdowns in your robot code (We cannot safely enable the bot until the camera feed starts at the driver station), jags randomly resetting their IDs (this has been fixed), and under last year's code the system cannot handle more than 2 jaguars being unpowered (if all goes well that won't be a problem again this year).

On the plus side, the wiring is infinitely simpler with CAN (assuming you can make the cables), as there is only one wire going to the cRIO. I also would have been gutted by the drive team if I pulled the robot apart trying to get at the two jags which power our kicker so I could switch the coast/brake jumper on the day before shipping (true story). Instead, I was able to override it through code. And if there are any problems, you can quickly plug the bus into a computer and check if any jags are not operating properly.

Overall the decision of if to switch should be based on whether you have a use for the extra abilities of the CAN bus and whether you can devote the resources to the problems that will most likely arise from the bus.

disclaimer: I'm a C++ programmer so I may have a different experience with the CAN bus than the LV teams

kamocat 29-10-2010 15:13

Re: CAN vs PWM
 
Try it out before the season. We're happy to support you on any issues you run into, but this is NOT something you want to have to figure out when you should be testing your robot design.
I have data on the performance of CAN using the Black Jaguar plugin at this thread:
http://www.chiefdelphi.com/forums/sh...ad.php?t=86259

2CAN should provide better performance, but I have not tested it.

ratdude747 30-10-2010 01:01

Re: CAN vs PWM
 
i have another question:

if what i remember from the demo at nationals is right, do you use rg45 patch for the lead in and rg11 2 line phone cord (4 wires) for the rest? or do you use all six rg11 pins?

i know the extra pins of the black are what make it a black (and hence why using all blacks next year works)

Radical Pi 30-10-2010 18:26

Re: CAN vs PWM
 
If using a serial interface: RJ-45 is used to communicate between the cRIO and the black jaguar. For the rest of the system only 2 wires are needed

If using a 2CAN: Everything is 2-wire

ratdude747 30-10-2010 22:43

Re: CAN vs PWM
 
Quote:

Originally Posted by Radical Pi (Post 979014)
If using a serial interface: RJ-45 is used to communicate between the cRIO and the black jaguar. For the rest of the system only 2 wires are needed

If using a 2CAN: Everything is 2-wire

ok then. by lead in i meant from cRIO to the first black jag. the rest sounds like stanard phone wire which 2 or 4 wires, fits in an RJ-45 socket just fine... they do that in office buildings a lot.

sounds like making the wires requires modular phone cord, RJ-11 (phone) jacks, the proper crimp tool, and a CAT 5e patch cable. i think i saw the crimp tools for phone wire at Lowe's cheap...

kamocat 31-10-2010 13:45

Re: CAN vs PWM
 
You are correct.

ratdude747 31-10-2010 23:03

Re: CAN vs PWM
 
cool.

so i guess the wiring side is established. now for the programming side, which is not quite my thing... i know labview basics, i imagine the place to find the jags is not pwm with CAN...

kamocat 01-11-2010 20:44

Re: CAN vs PWM
 
You're looking for the CANJaguar project at FIRST Forge.
http://firstforge.wpi.edu/sf/frs/do/....canjaguar/frs

ratdude747 18-12-2010 21:34

Re: CAN vs PWM
 
my team might try it... since we will end up buying a black jag anyway, all it is to us is a db9 plug and a some rj11 parts (we already have the crimper).

i fiund a good pdf by 116 on the subject, but the programming instructions are for C++. we are using labview.

two questions:

1. what all does the programmer need to know to convert the code written for pwm to CAN?

2. is the cRIO FTP thing the same?

the electrical and firmware thing i have down... I was made electrical subteam leader today and i read the pdf and my laptop is set to be a reflash device (you use the homemade serial dongle to do that, right?).

any other advice?

Radical Pi 18-12-2010 23:27

Re: CAN vs PWM
 
Quote:

Originally Posted by ratdude747 (Post 986508)
1. what all does the programmer need to know to convert the code written for pwm to CAN?

I'm a C++ programmer, so this may not be 100% accurate, but from my understanding of the LabVIEW API you just need to replace the references to the regular Jaguar VIs with CANJaguar VIs

Quote:

Originally Posted by ratdude747 (Post 986508)
2. is the cRIO FTP thing the same?

Nothing changes in the stuff to upload from C++ to LabVIEW

Side note: Your PDF may not have said this, but you need to make sure to undo the change to ni-rt.ini before attempting to re-image the cRIO. For some reason it fails if the CAN plugin is loaded.

Quote:

Originally Posted by ratdude747 (Post 986508)
the electrical and firmware thing i have down... I was made electrical subteam leader today and i read the pdf and my laptop is set to be a reflash device (you use the homemade serial dongle to do that, right?).

any other advice?

Yep, the serial dongle is all you need to reflash the jaguars.

Make sure you have plenty of extra cables. One broken cable will most likely take the entire network down. We have 2 or 3 spare jag-jag (2 wire) cables, and an extra jag-cRIO (6-wire) cable. We also found it useful to make a second serial dongle and keep the spare jag-cRIO cable with it so we don't have to dig the connection out of the robot if anything goes wrong (like last year's device number reset bug). A spare termination resistor is also a good idea.

Also, be extra careful about disconnecting power to jaguars. Even though the bus can still travel through an unpowered jaguar, C++ had a (hopefully fixed) bug that would cause glitches if it didn't receive responses from a jaguar. Not sure if LV had that same bug.

ratdude747 18-12-2010 23:35

Re: CAN vs PWM
 
i'm confused. the six wire cord is only for the first bit?

ok... i assume 8 wire patch cord with rj12 pluds (2 wires not used) would work?

one other dumb thing- is only one 100 ohm resistor needed or is one needed at each end?

Ether 18-12-2010 23:44

Re: CAN vs PWM
 
Quote:

Originally Posted by ratdude747 (Post 986539)
one other dumb thing- is only one 100 ohm resistor needed or is one needed at each end?

Search is your friend:

http://www.chiefdelphi.com/forums/sh...88&postcount=4




ratdude747 18-12-2010 23:54

Re: CAN vs PWM
 
gotcha.

ok... luckily I have a bunch of 100 ohm resistors thanks to some junk power supplies i desoldered as soldering practice... already have the end terminator made.

kamocat 19-12-2010 01:10

Re: CAN vs PWM
 
Quote:

Originally Posted by ratdude747 (Post 986508)
what all does the programmer need to know to convert the code written for pwm to CAN?

If you're just converting PWM control to open-loop voltage mode in CAN (also called percent Vbus), it's pretty easy.
There should be an example drive project in the CAN release.

If you're using speed or position mode, you should understand PID and how to use encoders.
If you're using Current mode, you should know that the sensor is only accurate within 1 amp, and is not suitable for small motors.

Radical Pi 19-12-2010 18:35

Re: CAN vs PWM
 
Quote:

Originally Posted by ratdude747 (Post 986539)
i'm confused. the six wire cord is only for the first bit?

ok... i assume 8 wire patch cord with rj12 pluds (2 wires not used) would work?

From the cRIO to the first (black) jaguar, 5 wires are used. 3 for the serial chatter, 2 for the CAN bus with a 100 ohm resistor at the end connected between them.

After that, only 2 wires are used by the bus. It doesn't hurt though to have more wires in the cable.

Ether 19-12-2010 19:11

Re: CAN vs PWM
 
Quote:

Originally Posted by Radical Pi (Post 986651)
From the cRIO to the first (black) jaguar, 5 wires are used. 3 for the serial chatter, 2 for the CAN bus with a 100 ohm resistor at the end connected between them.

After that, only 2 wires are used by the bus. It doesn't hurt though to have more wires in the cable.

Team 1718 just posted the PowerPoint slides from today's LabVIEW & CAN seminar. It has an explanation of the CAN cabling, with pictures.



ratdude747 08-01-2011 21:45

Re: CAN vs PWM
 
we are doing can

i have a terminator and serial cable made.

for some reason the TI program fails to see the jag... and the cable and terminator are good (the terminator on the serial cable is good too)

any advice?

edit- some things that might matter:

i am trying to flash a new black jag.

the cable was made from a chopped serial cord from the 2009 KOP. I used a multimeter to probe the wires to obtain the correct wires. I then crimped 5 wires into the rj-12 and soldered the 3 correct serial wires and the term. resistor to the plug cables. i verified correct pinouts with my multimeter.

the cable is about 6 ft long... maybe it is too long?

edit2- nope, shortening it to 2 ft didn't help (i was sent home with the goods to try and fix the issue)

somewhere it was mentioned that a specific vs. of the bdc-comm was needed... any truth to that?

kamocat 08-01-2011 23:42

Re: CAN vs PWM
 
RatDude747, make sure you don't have the RJ-14 connector backwards.
This is what the male connector should look like:

ratdude747 08-01-2011 23:46

Re: CAN vs PWM
 
Quote:

Originally Posted by kamocat (Post 993959)
RatDude747, make sure you don't have the RJ-14 connector backwards.
This is what the male connector should look like:

my wire colors are non-standard but according to everything i have seen, the connector is not backwards

kamocat 08-01-2011 23:49

Re: CAN vs PWM
 
Quote:

Originally Posted by ratdude747 (Post 993967)
my wire colors are non-standard but according to everything i have seen, the connector is not backwards

What do you get when you enumerate?

ratdude747 08-01-2011 23:53

Re: CAN vs PWM
 
no change

ratdude747 09-01-2011 00:36

Re: CAN vs PWM
 
my guess is a bad jag.

i will try one from the new KOP tomorrow...

ratdude747 09-01-2011 18:13

Re: CAN vs PWM
 
still not working even with a kop jag

it is acting as if it is not getting a signal... i wonder if my rj-12 is bad (i had to reuse one off an old cable as the clips did not get ordered as planned).

any other ideas?

kamocat 09-01-2011 18:20

Re: CAN vs PWM
 
And you're plugging it into the left port of the Jag?

Assuming the BDC-COMM is installed correctly, and your Jaguar has power, the issue is either your RS232 port or your adapter cable.

There's three options I would suggest:
  1. Find a local team that can help you.
  2. Go to the hardware store and get connectors, and a cable with standard wire coloring
  3. Buy an adapter box from digikey

If you want to try to test the cable, use the cRIO to enumerate. If you get a "0" back, then I believe your tx/rx are reversed.

ratdude747 09-01-2011 23:01

Re: CAN vs PWM
 
ok... i have very good news!

IT'S ALIVE!!!

the issue was the used plug... it apparantly had some damage blocking terminal 3. I corrected the damage and it worked flawlessly... had i not been in a rush to clean up I would have snared some pictures.

I now have a black jag and a gray jag with new firmware; the black's ID is 2 and the gray's is 3.

the programmer claims to have done CAN before; and i read somewhere that there is a "black jag" reflash option for the cRIO. any confirmation on that?

kamocat 09-01-2011 23:41

Re: CAN vs PWM
 
Quote:

Originally Posted by ratdude747 (Post 995266)
ok... i have very good news!

IT'S ALIVE!!!

the issue was the used plug... it apparantly had some damage blocking terminal 3. I corrected the damage and it worked flawlessly... had i not been in a rush to clean up I would have snared some pictures.

I now have a black jag and a gray jag with new firmware; the black's ID is 2 and the gray's is 3.

the programmer claims to have done CAN before; and i read somewhere that there is a "black jag" reflash option for the cRIO. any confirmation on that?

You cannot update the Jaguar firmware from the cRIO.
However, the cRIO reimaging tool can install the BlackJagBridge plugin on the cRIO for you. (This allows it to communicate with the Black Jaguar over RS232)

ratdude747 09-01-2011 23:42

Re: CAN vs PWM
 
Quote:

Originally Posted by kamocat (Post 995348)
You cannot update the Jaguar firmware from the cRIO.
However, the cRIO reimaging tool can install the BlackJagBridge plugin on the cRIO for you. (This allows it to communicate with the Black Jaguar over RS232)

i meant reflashing the cRIO. the jags were reflashed using my laptop. sorry about my poor wording

the clips have been ordered and this should work pretty well (knock on wood).

maybe i should explain the whole old connector thing

the cable was actually a REALLY long 4 wire cable with a 6c plug. the cable used pins 3-6, with 1 and 2 empty. it had the other plug damaged and long replaced, so we got a good 20+ feet for 4 wire oval for free.

to make the plug work, i needed to add a wire to pin 1 (pin 2 is NC). to do that, I first cut the plug off with about 1.5" of cable hanging. I then removed the oval part. next, I cut a paper clip at an extreme angle to make the point at the edge instead of center. then I put it in the hole for wire 1 and used it and a pair of needle nose pliers to remove the contact. due to the angle cut, I was able to get to under the connector and twist it to act as a cam of sorts to push up the contact. I then used the pliers to pull the contact.

I then put a bare wire in wire hole 1 and put the contact back in. next i re-crimped the plug (and locking in all 5 wires). i soldered the serial wire and my 100 ohm resistor to my 5 wires coming from the plug. I then used electrical tape to isolate the wires and resistor leads. i tested the cable with a multimeter, neglecting to see the slight damage.

jerry rigging at its best, but if you need a serial cable fast, it works. even I was surprised it worked...

kamocat 10-01-2011 01:28

Re: CAN vs PWM
 
Quote:

Originally Posted by ratdude747 (Post 995351)
i meant reflashing the cRIO. the jags were reflashed using my laptop.

Yes, he is correct. It's very easy.
It's the "CAN Driver Plugin" option. You don't even need to select "Format Controller", and I believe it takes less than a minute.

ratdude747 10-01-2011 22:45

Re: CAN vs PWM
 
random question:

are usb to serial adapters compatible with the serial cable?

reason I ask is the team laptops are newer lenovo thinkpads (celeron cpu) which have no serial... the team's desktop I donated has it but is not portable, so I have been using my personal laptop for now (dell latititude d400).

too bad TI doesn't have bdc-comm in a linux flavor... good thing my laptop is a dualboot.

kamocat 10-01-2011 22:50

Re: CAN vs PWM
 
Yes, USB-RS232 adapters are compatible.

ratdude747 10-01-2011 23:28

Re: CAN vs PWM
 
Quote:

Originally Posted by kamocat (Post 996310)
Yes, USB-RS232 adapters are compatible.

cool.

ratdude747 13-01-2011 18:01

Re: CAN vs PWM
 
1 Attachment(s)
i got it working now with 3 in a row. I attached a picture of it running (sorry about the pic quality)

I also flashed the two new black jags from the KOP... so I now have a total of 5 CAN fw jags, using id's 2, 3, 4, 5, and 6. I reserved #1 for new jags getting a new ID.

look good?

ratdude747 17-01-2011 22:41

Re: CAN vs PWM
 
today we got the kitbot running with CAN!

thanks to all who helped me get there...


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

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