Forward stability: Integrating optical encoders and RC input
I'm welding together the chassis for an all-terrain rover at the moment but am looking ahead at the electronic needs.
The rover will use two 24VDC powerchair motors in a differential steering configuration controlled by a Sabertooth 2x25 using steering input from either a Futaba or homemade XBEE radio I plan to use a Prop 1 processor on the rover. I have a stand-alone video camera and TX (separate from the Propeller system) to allow operation from a remote, indoor location. Tests with the motors on a plywood mock-up showed that trim adjustments were needed pretty often to keep it going in a straight line. This was partially due to the nature of "all-terrain", and the gravel roads it was tested on. For that reason I've been researching optical encoder feedback to help maintain equal wheel speeds. Encoders can be easily mounted where brake assemblies were removed.
I've seen the quadrature encoder objects in the OBEX, and have read through "Running DC Motors with attached Incremental Encoders" in Chapter 28 of Harprit Sandhu's excellent book "Programming the Propeller with SPIN". All of these examples control a single motor/encoder, and I don't remember any that integrated RC control.
Question: Is there a Propeller example anywhere of two motor/encoders used in a differential steering configuration? Or how to modify any of the existing OBEX Objects to read two encoders.
I also plan to use RC control. It looks like most lot of the robot examples with encoders I've seen are configured for autonomous navigation without external input.
Question: Is it possible to integrate RC control with the feedback provided by quadrature encoders without the two steering inputs fighting each other
My idea was to limit the use of the encoder feedback to when the RC steering input was at a null position +/- 1 or 2 degrees. Outside of that narrow envelop the encoder feedback would be ignored.
I appreciate any comments, suggestions, remarks or links.
Falcon
The rover will use two 24VDC powerchair motors in a differential steering configuration controlled by a Sabertooth 2x25 using steering input from either a Futaba or homemade XBEE radio I plan to use a Prop 1 processor on the rover. I have a stand-alone video camera and TX (separate from the Propeller system) to allow operation from a remote, indoor location. Tests with the motors on a plywood mock-up showed that trim adjustments were needed pretty often to keep it going in a straight line. This was partially due to the nature of "all-terrain", and the gravel roads it was tested on. For that reason I've been researching optical encoder feedback to help maintain equal wheel speeds. Encoders can be easily mounted where brake assemblies were removed.
I've seen the quadrature encoder objects in the OBEX, and have read through "Running DC Motors with attached Incremental Encoders" in Chapter 28 of Harprit Sandhu's excellent book "Programming the Propeller with SPIN". All of these examples control a single motor/encoder, and I don't remember any that integrated RC control.
Question: Is there a Propeller example anywhere of two motor/encoders used in a differential steering configuration? Or how to modify any of the existing OBEX Objects to read two encoders.
I also plan to use RC control. It looks like most lot of the robot examples with encoders I've seen are configured for autonomous navigation without external input.
Question: Is it possible to integrate RC control with the feedback provided by quadrature encoders without the two steering inputs fighting each other
My idea was to limit the use of the encoder feedback to when the RC steering input was at a null position +/- 1 or 2 degrees. Outside of that narrow envelop the encoder feedback would be ignored.
I appreciate any comments, suggestions, remarks or links.
Falcon
Comments
There's probably be an output signal as well as the RC RX input. You'd probably want to try to sync the Prop-generated signal with the RX so that when switching back and forth there aren't any glitches. Rather than switching between Prop generated signal and RX signal, you could have the Prop generate the signal continuously. In the deadband, pulse width is set based on encoder feedback. Outside of that, you set the PW to match that of the incoming RX signal. Let me know if I'm not explaining well
You might find something useful in the code. The most up to date version (on the forum) is in post #69.
shimniok,
I think your explanation was fine. I think getting the RC signal into the Prop will not be too difficult. I think the problem will be integrating the "mixed" encoder signals with the RC.
falcon
Duane,
I'll have to try to work my way through that. My SPIN skills are still at a kindergarten level. It does prove the concept i have in mind.
Thanks,
falcon
It has a section on running an encoded servo remotely with an R/C signal/controller
Like what the guys on myth busters do all the time.
It is quite possible and easy to run two motors with two timers on a Prop
/code
PRI Run_Motor(Piny,Pinx)|WaveLength,period,WaveLengthx,periodx 'subroutine to PWM the output line
dira[diry..pwmy]~~
dira[dirX..pwmX]~~
ctra[30..26]:=100 'Set this cog's "A Counter" to PWM
ctrb[30..26]:=100 'Set this cog's "B Counter" to PWM
ctra[5..0]:=Piny 'Set the "A pin" of this cog to Pin=PWM
ctrb[5..0]:=PinX 'Set the "B pin" of this cog to Pin=PWMX
frqa:=1 'Set this counter's frqa value to 1
frqb:=1 'Set this counter's frqa value to 1
PulsWidth[1]:=0 'Start with position=0
PulsWidth[2]:=0 'Start with position=0
WaveLength:=clkfreq/10_000 'Set the time for the wave L to 1000 cycles
WaveLengthX:=clkfreq/10_000 'Set the time for the wave L to 1000 cycles
period:=cnt 'Store the current value of the counter
periodX:=cnt 'Store the current value of the counter
repeat 'power PWM routine.
phsa:=-PulsWidth[1] 'Send a high pulse for Pulsewidth counts
period:=period+WaveLength 'Calculate wave length
phsb:=-PulsWidth[2] 'Send a high pulse for Pulsewidth counts
periodX:=periodX+WaveLengthX 'Calculate wave length
if periodX>period
waitcnt(periodX) 'Wait for end of wavelength
else
waitcnt(period)
/Code
Harprit.
You can call me at 217 369 8737 to discuss.
Sounds like a great project. And a very complicated one. I love encoders indoors, but on an outdoor all terrain robot, my guess is that you'll need a lot more than that to get anything close to a straight line (and please don't tell me you have a caster). For tackling bumpy gravel roads, you probably need 4WD skid steering, pneumatic tires, a compass and GPS. Encoders can swag distance travelled & amount of turn
BTW, pneumatic tires introduce another variable: tyre pressure. Encoders can make sure your wheels all turn the same amount, but if one side has significantly lower tire pressure, it will turn toward that side.
Harprit, I appreciate you taking the time to respond. I actually have several of your books including that one. I highly recommend them.
I've since bought the Kangaroo X2 from www.dimensionengineering.com and two OMRON E6B2-CWZ6C rotary encoders. I haven't had the time to get it all together but hope to in the new year.
Falcon