Hello,·I made a pan and tilt rig of the boe bot.I·the controle rig·with my remote but because it sends pulses it moves a bit shakey.Is there any way I can smooth-up the movements?
Here's a random tilt/pan program that I did for StampNuts for his Wall-E head test. Please use it and change it around if you like, by increasing the STEP command in the pan and tilt routines this will speed up the servos as is the servos run very slow. Hope this helps out.
' {$STAMP BS2}
' {$PBASIC 2.5}
' random movements for tilt and pan movements
' Change the STEP command number higher to speed the scan up
' By: GWJax
' variables
Tilt PIN 1 ' set tilt to pin 1
Pan PIN 0 ' set pan to pin 0
tiltseed VAR Word ' set var seed for tilt
panseed VAR Word ' set var seed for pan
TPseed VAR Word ' set to check for tilt or pan
tpselect VAR tpseed.BIT0 ' Bit0 of the random number
tiltdelay VAR Word 'tiltdelay
pandelay VAR Word 'pandelay
i VAR Word 'counter
tilttime VAR Byte 'tilttime
pantime VAR Byte 'pantime
LastDelayTilt VAR Word ' used to ramp down speed for tilt
LastDelayPan VAR Word 'used to ramp down speed for pan
' initialization/maxline
LOW tilt
LOW pan
LastDelayTilt = 550 'set for center of tilt
LastDelayPan = 650 'set for center of pan
tiltdelay = 400
pandelay = 1000
TiltSeed = 400
PanSeed = 1000
TPseed = 1
TiltTime = 10
PanTime = 30
FOR i = 0 TO TiltTime 'center tilt/pan unit
PULSOUT tilt, LastDelayTilt
PAUSE 18
NEXT
FOR i = 0 TO PanTime
PULSOUT pan, LastDelayPan
PAUSE 18
NEXT
main:
RANDOM tpseed
IF tpselect = 0 THEN GOSUB panit 'for tilt or pan direction
RANDOM TiltSeed ' give a random number
tiltdelay = tiltseed
DO WHILE (tiltdelay > 750 OR tiltdelay < 550 ) 'check to see if tilt is within specs
RANDOM TiltSeed ' mixup numbers
tiltdelay = tiltseed
LOOP 'continue till values are right for movement
GOSUB tiltit
GOTO main ' start all over
tiltIt:
FOR i = LastDelayTilt TO TiltDelay STEP 1 'Change Step Number Higher to go faster
PULSOUT tilt, i 'send out pulse to servo
PAUSE 30
NEXT
LastDelayTilt = TiltDelay
RETURN
PanIt:
RANDOM panseed ' mix random number with seed value
pandelay=panseed
DO WHILE (pandelay > 1000 OR pandelay < 200 ) ' wait till within movement specs
RANDOM panseed ' mix numbers up again
pandelay=panseed
LOOP ' loop until numbers are within correct movement range
FOR i = Lastdelaypan TO pandelay STEP 1 'Change Step Number Higher to go faster
PULSOUT pan, i
PAUSE 30
NEXT
LastDelayPan = PanDelay
RETURN
Jax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If a robot has a screw then it must be romoved and hacked into..
Have you tried it with no load? A servo will automatically try to get back to it's desired position, so if you have a weight pulling down on a desired horizontal arm, then it jerk about.
Comments
' {$STAMP BS2}
' {$PBASIC 2.5}
' random movements for tilt and pan movements
' Change the STEP command number higher to speed the scan up
' By: GWJax
' variables
Tilt PIN 1 ' set tilt to pin 1
Pan PIN 0 ' set pan to pin 0
tiltseed VAR Word ' set var seed for tilt
panseed VAR Word ' set var seed for pan
TPseed VAR Word ' set to check for tilt or pan
tpselect VAR tpseed.BIT0 ' Bit0 of the random number
tiltdelay VAR Word 'tiltdelay
pandelay VAR Word 'pandelay
i VAR Word 'counter
tilttime VAR Byte 'tilttime
pantime VAR Byte 'pantime
LastDelayTilt VAR Word ' used to ramp down speed for tilt
LastDelayPan VAR Word 'used to ramp down speed for pan
' initialization/maxline
LOW tilt
LOW pan
LastDelayTilt = 550 'set for center of tilt
LastDelayPan = 650 'set for center of pan
tiltdelay = 400
pandelay = 1000
TiltSeed = 400
PanSeed = 1000
TPseed = 1
TiltTime = 10
PanTime = 30
FOR i = 0 TO TiltTime 'center tilt/pan unit
PULSOUT tilt, LastDelayTilt
PAUSE 18
NEXT
FOR i = 0 TO PanTime
PULSOUT pan, LastDelayPan
PAUSE 18
NEXT
main:
RANDOM tpseed
IF tpselect = 0 THEN GOSUB panit 'for tilt or pan direction
RANDOM TiltSeed ' give a random number
tiltdelay = tiltseed
DO WHILE (tiltdelay > 750 OR tiltdelay < 550 ) 'check to see if tilt is within specs
RANDOM TiltSeed ' mixup numbers
tiltdelay = tiltseed
LOOP 'continue till values are right for movement
GOSUB tiltit
GOTO main ' start all over
tiltIt:
FOR i = LastDelayTilt TO TiltDelay STEP 1 'Change Step Number Higher to go faster
PULSOUT tilt, i 'send out pulse to servo
PAUSE 30
NEXT
LastDelayTilt = TiltDelay
RETURN
PanIt:
RANDOM panseed ' mix random number with seed value
pandelay=panseed
DO WHILE (pandelay > 1000 OR pandelay < 200 ) ' wait till within movement specs
RANDOM panseed ' mix numbers up again
pandelay=panseed
LOOP ' loop until numbers are within correct movement range
FOR i = Lastdelaypan TO pandelay STEP 1 'Change Step Number Higher to go faster
PULSOUT pan, i
PAUSE 30
NEXT
LastDelayPan = PanDelay
RETURN
Jax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If a robot has a screw then it must be romoved and hacked into..