|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
A few Questions about proggramming with CAN
Hello,
This year my team decided that we would like to program the robot drive, and arm control using CANJaguars. We wanted to do this last year, however the CANJags weren't fully implemented yet. So, before I begin programming i have a few questions. 1) We are using mecanum wheels for our drive train, My assumption after looking through the CANJaguar code is that all I need to do is set the control mode to kSpeed, and then set m_maxoutput to the physical max RPM of our slowest motor. 2) Does the CANJaguar class automatically use feedback from the encoders to correct its speed using PID? I'm assuming again that i would first need to set the speed reference to kSpeedRef_QuadEncoder, and then set the P, I, and D. 3) When the CANJag is set to KSpeed, the source code comments say the constructor will automatically set the speed reference to the quad encoder, but i don't see where in the constructor it does that. 4) I have some qualms about using the jags internal PID loop because of what was said on this thread http://www.chiefdelphi.com/forums/sh...t=90508&page=2 however it looks like they were using java. Can anyone confirm whether this is also happening with c++? Finally, we are also going to be using an arm for our manipulator. I am planning on using potentiometers to determine position. 5) The CANJaguar class has a ConfigPotentiometerTurns(UINT16 turns) function, but the pots i was planning on using only turn 340 degrees(slightly less than 1 turn). Should I just use a 1, and then set soft position limits? For this I'm again assuming that the CANJaguar will automatically use feedback from the potentiometers and use PID to control the arms position. 6) Not really about CAN, but does anyone know if the potentiometers must be 10k, as per the jaguar manual, or is it possible to use other values? If someone could answer these questions, or confirm/disconfirm my assumptions it would be a huge help! I've read through the CanJaguar source, and understand what each function does, however when I actually look at the functions I'm having trouble following how they are doing what they say they are doing. |
|
#2
|
|||
|
|||
|
Re: A few Questions about proggramming with CAN
Quote:
You can use other values, but let's look at the schematic first (page 24 of the RDK-BDC24 User's Manual). Notice there is a 1K resistor in series with the '+' pin on the Potentiometer input header J3. When a 10K pot is wired to this header as per the datasheet, the resistor and pot act as a voltage divider. This puts 3.0V across the pot (3.0V = [10K/(1K + 10K)]*3.3V) making 3V the maximum voltage the wiper can be. This is perfect because the ADC (Analog to Digital Converter) pins on the Jaguar's microcontroller can only read 0 - 3.0V. The ADC on Jaguar is a 10-bit ADC, so it measures 0 - 3.0V in 1024 discrete steps. So if you were to use a lower resistance pot, let's say 5K, your wiper will swing between 0 and 2.75V (2.75V = [5K/(1K+5K)]*3.3V). This is well within the range of the ADC, but you are only measuring the full range of the pot with approximately 940 steps rather than 1024. Let's say you go with a higher resistance pot, 20K, your wiper will swing between 0 and 3.14V. The ADC can still only measure up to 3.0V, so the last 0.14V will just cap the measurement at 3.0V. Let's say that you have a 10-turn pot; the last 0.14V can be equal to 160 degrees of undetected motion! So in conclusion: Yes, you can use different values of potentiometers, but be aware of how the different values can affect your system. TI recommends using a 10K pot for simplicity and maximum resolution over the maximum range of the pot. -David |
|
#3
|
|||
|
|||
|
Re: A few Questions about proggramming with CAN
Quote:
Quote:
So for you, your 0 - 340 degree pot will read as 0 - 1 Turn. -David |
|
#4
|
|||
|
|||
|
Re: A few Questions about proggramming with CAN
Quote:
Quote:
Quote:
-Joe |
|
#5
|
|||
|
|||
|
Re: A few Questions about proggramming with CAN
Quote:
|
|
#6
|
|||
|
|||
|
Re: A few Questions about proggramming with CAN
Quote:
-Joe |
|
#7
|
|||
|
|||
|
Re: A few Questions about proggramming with CAN
Thanks every one for the clarifications, as to the link i posted i was concerned basically because it seemed like people were having trouble getting the set function to work in speed mode. I just wanted to check to see if this was actually the case because i have no experience using CAN.
As to setting the speed reference I know we are using the quad encoders, do i still need to set the number of clicks? |
|
#8
|
|||
|
|||
|
Re: A few Questions about proggramming with CAN
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|