Boe Bot Navigation With RC Transmitter More Servos
jonathanmb
Posts: 24
OK so I got the navigation servos to work. Before that I had made a camera mount to mount a camera on my Boe Bot. Since I no longer have any more servo jacks on my BOE I plugged the servos in the way you would on the Homework Board with an extra battery. So I modified the program I already had and added the camera servos to it. I ran the program and I still had the navigation servos but no camera servos. My current program is attached to this message. Can anyone tell me whats wrong with it?
Thanks
Thanks
Comments
Be sure that the grounds of the servos are tied into the ground of the BS2.
OK I will post a picture on here
So you added another battery to power your pan & tilt servos. New battery - terminal goes to original battery - terminal, also to Stamp ground and servo black wires. Your new battery + only goes to both your pan/tilt servos' red wires, and control signals from Stamp into servo white or yellow wires...?
Priceless.
See anything wrong with your first DO loop? It just loops back on itself.
Thanks
First, try deleting your PAUSE 10 and see if your jitterbuggin' robot calms down a bit.
Next, tell us the range of values you're getting for tilt & turn. Throw some temporary DEBUG statements in your program to display them on your monitor.
DO
PULSIN Ch1 , state , drive
PULSIN Ch2 , state , steer
C_Target = drive - 750 + steer
D_Target = 750 - drive + steer
PULSOUT A_servo , A_Target
PULSOUT B_servo , B_Target
PULSOUT C_servo , C_Target
PULSOUT D_servo , D_Target
PULSIN Ch3 , state , tilt
PULSIN Ch4 , state , turn
A_Target = tilt - 500
B_Target = turn - 500
PULSOUT A_servo , A_Target
PULSOUT B_servo , B_Target
PULSOUT C_servo , C_Target
PULSOUT D_servo , D_Target
LOOP
DEBUG DEC tilt, " ", DEC turn, CR
I'm leaving on a trip in a few hours, but I wanted to wrap up. Here's an iterative method you can play with. Suggest you trim your transmitter first so that your program DEBUGs both numbers around 750 when the sticks are neutral. Work with one stick at at time, starting with TILT. Moving the stick will generate a range of TILT values read by the Stamp, perhaps ~600-900. We want to do some math to expand this range for A_Target to drive your servos more in both directions, perhaps 400-1100. And it has to be all integer math along the way. Start with this formula:
A_Target=400+((TILT-600)*5/2)
which outputs from 400-1150, centered at 775. That 400 is negotiable, that's the smallest pulsewidth you want to send to your servo. The 600 value is the minimum TILT value your Stamp can read from your receiver (don't let (Tilt-600) get less than zero!). The 5/2 is a negotiable fractional fudge factor (multiplier) to make the overall range bigger. By playing with those values and your trim a bit to maintain center, you should be able to hit the full range of your servos. Each one affects the output a bit, so work slowly and don't overdrive your servos.
Good luck,
erco
Thank you
DO
PULSIN Ch1 , state , drive
PULSIN Ch2 , state , steer
C_Target = drive - 750 + steer
D_Target = 750 - drive + steer
PULSOUT A_servo , A_Target
PULSOUT B_servo , B_Target
PULSOUT C_servo , C_Target
PULSOUT D_servo , D_Target
PULSIN Ch3 , state , tilt
PULSIN Ch4 , state , turn
A_Target = tilt - 500
B_Target = turn - 500
PULSOUT A_servo , A_Target
PULSOUT B_servo , B_Target
PULSOUT C_servo , C_Target
PULSOUT D_servo , D_Target
LOOP