View Full Version : CAN for dummies
daniel_dsouza
21-07-2011, 01:34
Wow, my first thread on CD!
My team wanted to investigate the CAN interface, and I had a few questions. I already read some of the other “getting started” threads, and the associated files. If I make any technical mistakes, don’t hesitate to correct me, as I am new to some of the terms.
1. Could someone tell me how I should set the PID if I use Position mode?
2. If I wanted to control a robot in autonomous mode, should I use position or speed?
3. If I wanted to control a robot in teleop mode, should I use position, speed, or PercentVbus?
4. Is there any difference between 2CAN and connecting the black jag to the cRIO serial port?
5. We “misplaced the encoder from the KOP”. What was the original part number, or what would be a good replacement?
6. Is there any maximum limit to the quantity of Jaguars as far as FIRST hardware goes?
7. Let’s say I don’t mind spending $25, are the cables from here (http://www.estoprobotics.com/estore/index.php?_a=viewProd&productId=34)worth that much versus making my own cables?
8. Is there anything else I should know?
If it makes any difference, our team programs in Java.
Thanks in advance!
-Daniel
If I wanted to control a robot in autonomous mode, should I use position or speed?
If I wanted to control a robot in teleop mode, should I use position, speed, or PercentVbus?
It depends on the application (drivetrain motor? lift motor? spinning roller motor?) and what you are trying to achieve.
We “misplaced the encoder from the KOP”. What was the original part number,
http://usfirst.org/uploadedFiles/Robotics_Programs/FRC/Game_and_Season__Info/2011_Assets/Kit_of_Parts/2011%20Kit%20of%20Parts%20Checklist%20Rev%20E.pdf
http://usdigital.com/products/encoders/incremental/rotary/kit/e4p
http://usdigital.com/first
http://www.andymark.com/product-p/am-0791.htm
http://www.austriamicrosystems.com/eng/Products/Magnetic-Encoders/Rotary-Encoders/AS5030
or what would be a good replacement?
http://www.chiefdelphi.com/forums/showpost.php?p=1044904&postcount=2
http://www.vishay.com/docs/57103/model981.pdf
http://www.cherrycorp.com/english/sensors/pdf/an8_series.pdf
http://www.usdigital.com/products/encoders/absolute/rotary/shaft/ma3/
Aren Siekmeier
21-07-2011, 10:07
The first list Ether gave are optical encoders, giving a tick count for how many times the shaft has spun around. This is an incremental measure of rotation. However, the second list are all magnetic encoders that sense the absolute orientation of a permanent magnet mounted to the shaft. This is an absolute measure of rotation. Both have their uses.
I'm not entirely sure how these encoders (or any others) hook up to the Jag, or how the Jag uses the data for whatever speed or position control you off board to it, but it all works somehow.
If you're going to run any PID on a two (or more) motor gearbox, however, you probably have to do it on the cRio, because there is yet no way to sync the speed controls off of one feedback sensor. I believe this is on the TI's agenda for a new Jag firmware.
The 2CAN is significantly faster than the serial bus (about 5x, I believe). This may not be an issue, but when we tried CAN this year on a serial bus, our 7 Jags plus some calls to the limit switches on one of them bogged down our CAN bus quite a bit because the serial bus just can't get that many packets through. I'm quite sure the 2CAN would eliminate this problem (for another $200...).
Jaguars on a competition robot are only limited by the number of motors. Every year past (I can't imagine this would change) you can only have one motor per speed controller, one speed controller per motor, and motors have been pretty strictly specified, with up to 13 this year. Very few FRC robots ever have more than 10.
daniel_dsouza
21-07-2011, 10:51
It depends on the application (drivetrain motor? lift motor? spinning roller motor?) and what you are trying to achieve.
Sorry, we have a standard 6wheel tankdrive, 2 motors per side, for a total of 4 drive jaguars.
The first list Ether gave are optical encoders, giving a tick count for how many times the shaft has spun around. This is an incremental measure of rotation.
The Austria Microsystems unit in the first list is not optical, and it is not incremental.
It is an absolute magnetic device.
It depends on the application (drivetrain motor? lift motor? spinning roller motor?) and what you are trying to achieve.
Sorry, we have a standard 6wheel tankdrive, 2 motors per side, for a total of 4 drive jaguars.
... and what are you trying to achieve ?
I'm not entirely sure how these encoders (or any others) hook up to the Jag
That information is in the datasheet (http://www.chiefdelphi.com/forums/attachment.php?attachmentid=10841&stc=1&d=1311261434).
I'm not entirely sure ... how the Jag uses the data
The Jag firmware source is available for download (http://www.chiefdelphi.com/forums/showpost.php?p=1012113&postcount=10).
daniel_dsouza
21-07-2011, 12:10
... and what are you trying to achieve ?
Um...Do you mean this? In Auto. mode, we want to give our robot instructions like move forward 5 feet, then turn 60 degrees, and so on. We want to implement this by telling the jags to keep turning until they have reached that the total.
In teleop, we will have our robot controled by one joystick, and the encoders will be used to make sure that the ratio of the input values (left, right) is the same as the output (left, right).
Also, thanks for the information about encoders. I can figure out where each wire goes, but is there some sort of connector I have to wire the encoder to to connect it to the jaguar?
Um...Do you mean this? In Auto. mode, we want to give our robot instructions like move forward 5 feet, then turn 60 degrees, and so on. We want to implement this by telling the jags to keep turning until they have reached that the total.
In teleop, we will have our robot controled by one joystick, and the encoders will be used to make sure that the ratio of the input values (left, right) is the same as the output (left, right).
Sounds like you want position control for autonomous, and speed control for TeleOp.
In case you decide to do the PID in cRIO instead of Jag, be aware that there's a bug in the cRIO's FPGA code (http://www.chiefdelphi.com/forums/showpost.php?p=1066392&postcount=71) that counts encoder pulses.
daniel_dsouza
21-07-2011, 12:17
Sounds like you want position control for autonomous, and speed control for TeleOp.
Ok, cool. So I gather that I use rpm for speed, but what do I values should I use for position?
Ok, cool. So I gather that I use rpm for speed, but what do I values should I use for position?
A PID controller takes a "setpoint" input and a "processVariable" input.
The setpoint is the value you want for whatever it is you are trying to control (your computed command).
The processVariable is the present measured actual value of what you are trying to control (the feedback from the sensor).
You have to scale the setpoint or the processVariable so that they are in the same units.
So if your command is in "feet", you have to scale your processVariable to be in feet. You do that by either calculating how many encoder pulses correspond to 1 foot of motion, or you can measure it experimentally.
Also, thanks for the information about encoders. I can figure out where each wire goes, but is there some sort of connector I have to wire the encoder to to connect it to the jaguar?
Yes. I don't have the part number of the connector, but if you are using a quadrature encoder it plugs into the Jag as shown here (http://www.chiefdelphi.com/forums/attachment.php?attachmentid=10842&stc=1&d=1311265645).
daniel_dsouza
21-07-2011, 12:30
Fantastic. Thanks everyone for all your help!
Fantastic. Thanks everyone for all your help!
There are some threads that discuss techniques for tuning speed PIDs. I will see if I can find a couple of links.
EricVanWyk
21-07-2011, 17:00
You may want to study this thread before trying to tune your speed-control PID.
That thread might be one of the least friendly ones on this board - Don't let it scare you away.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.