|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Re: encoder for cam-driven kicker?
Quote:
![]() We do have the exact same setup as yours to release the kicker's dog gear. |
|
#2
|
|||
|
|||
|
Re: encoder for cam-driven kicker?
We are using a continuous rotation potentiometer for a similar purpose. We wired it up like you would wire up any other pot, and it works well. And it is a lot cheaper than an absolute encoder or something like that.
|
|
#3
|
|||||
|
|||||
|
Re: encoder for cam-driven kicker?
Quote:
![]() |
|
#4
|
|||||
|
|||||
|
Re: encoder for cam-driven kicker?
We are also using a limit switch on our cam, and it usually works quite well.
One problem we ran into is that our kicker is adjustable and at high energy the whole robot shakes enough that the limit switch vibrates and can give a false reading that has to be programmed around. |
|
#5
|
||||
|
||||
|
Re: encoder for cam-driven kicker?
Quote:
Thus far, it's been super-solid. |
|
#6
|
||||
|
||||
|
Re: encoder for cam-driven kicker?
You've piqued my curiosity. Would you mind giving a bit more detail how the switch is mounted?
I can't picture how this might happen; certainly no amount of vibration of the switch itself (that could occur on the robot) could cause the switch to give a false reading... unless the vibration is causing the switch lever to bump against something? ~ |
|
#7
|
|||||
|
|||||
|
Re: encoder for cam-driven kicker?
We also use a cam driven kicker. We put a simple 1 turn pot on the shaft for the kicker (not the cam where you need continuous turns). This works well for us because we have multiple positions we want the kicker to be in: one position (middle of travel) for ball collection to stop balls from going under the frame, the other to give us clearance (close to kicking) to go over the bump. It is also easier to detect a pot failure than a limit switch failure.
|
|
#8
|
||||||
|
||||||
|
Re: encoder for cam-driven kicker?
Continuous pots work pretty well, but there are two "gotcha's::
1) The pot can shift over time due to shaft slippage. Usually not that big of a deal, but keep an eye on it. 2) (Potentially BIG) There is a gap in the pot at the wrap-around point where the voltage will float. That will give you false position readings in the gap. The gap may seem insignificant at first, but it grows over time as the pot mechanically wears. There are two ways to cure #2. The first is to wire in a pull-down resistor so the voltage doesn't float. The second method is to put the gap at an angle that you don't need to stop the motor, stop reading the pot near the gap, do a timed motor command to get through the gap, then start reading the pot again. You may consider doing both. We were using a continuous pot at Kettering and we somehow lost the pull-down resistor. We had trouble kicking for a few matches until we figured out what happened. If you want to use a relative encoder, your cam actually makes that quite easy. Start each match by driving the kicker motor backward with a small enough PWM so you don't damage anything. Montior the rate of the encoder. Once the encoder stops moving, you know you hit the edge of your cam. Reset the encoder position and then start using the kicker as you normally would. By doing this, you will get a very accurate zero point of the encoder every match. |
|
#9
|
||||
|
||||
|
Re: encoder for cam-driven kicker?
Quote:
What I envisioned doing instead was to pre-configure the cam in the "armed" ready-to-kick position when the robot is placed on the field. Then at the start of autonomous, zero the encoder counter. What is the data type of the encoder counter in the FPGA? Is it large enough to just let it run free without overflowing during a match ? ~ |
|
#10
|
||||||
|
||||||
|
Re: encoder for cam-driven kicker?
Quote:
You can always convert the encoder output into degrees and do: Code:
if (encoderDeg > 360)
{
encoderDeg -= 360;
}
|
|
#11
|
||||
|
||||
|
Re: encoder for cam-driven kicker?
Yeah, but I doubt that the counter in the FPGA is floating-point.
I want to know if the FPGA counter will not overflow during a match. Quote:
Does the above code actually write a new value to the FPGA counter itself? Or just zero the associated RAM variable in cRIO? ~ |
|
#12
|
||||||
|
||||||
|
Re: encoder for cam-driven kicker?
Quote:
If WPI and NI did things properly, it really doesn't matter if the FPGA counter overflows or not. Let's assume they did things correctly. One possible implementation is that the FPGA services the encoder interrupts and keeps track of the counter in a signed 16-bit register. Then the WPI interface samples that register at a given time interval. The WPI code would be like the following: Code:
// variable declarations s16 encoderCnt = 0; s16 encoderCntPrev; s16 encoderDiff; double encoderOut; // ... // in the loop encoderCntPrev = encoderCnt; encoderCnt = getFPGAencoderCnt(); encoderDiff = encoderCnt - encoderCntPrev; encoderOut = encoderOut + encoderDiff*inchesPerCount; // etc. With the above code, it does not matter if the FPGA encoder counter overflows. If you don't believe me, try the following code: Code:
s16 counter1, counter2, counter3; counter1 = 32765; counter2 = counter1 + 5; cout << "counter1 = " << counter1 << "\n"; cout << "counter2 = " << counter2 << "\n"; counter3 = counter2 - counter1; cout << "counter3 = " << counter3 << "\n"; This is actually a very slick way of handling angles to avoid having to do a lot of wrap-around math and checking. If you always scale your angles such that 360 degrees is equal to the overflow point, the two's compliment math automatically takes care of all of the wrapping for you. Last edited by Chris Hibner : 17-03-2010 at 16:00. |
|
#13
|
||||
|
||||
|
Re: encoder for cam-driven kicker?
Quote:
However, for the benefit of those reading this thread who are just learning about realtime control, and who may go on to program other realtime applications, the following caveat should be pointed out: The 2010 FRC LabVIEW framework is most definitely NOT hard-real-time. Using code running in cRIO to re-set the FPGA counter is not a robust solution if high accuracy is required and you do not want to introduce errors that may accumulate over time. At the very least, the reading and re-setting of the FPGA counter should probably be protected by a critical section to minimize the occurrence of accumulated errors. ~ |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pic: 2252 kicker cam | EIT2 | Extra Discussion | 1 | 16-02-2010 07:51 |
| pic: Winch for Kicker | MrForbes | Extra Discussion | 10 | 10-02-2010 10:42 |
| pic: KICKER FOR 1322 | joeweber | Extra Discussion | 12 | 26-01-2010 16:45 |
| Event Driven Development for FRC-Java | spartango | Java | 5 | 05-01-2010 11:52 |
| Looking for miniDV cam | MattK | Chit-Chat | 3 | 31-01-2006 20:32 |