Understanding ramping on BOE-Bot
abpccpba
Posts: 3
Hello
I am using the Boe-Bot and the book it came with.
I am working with the whisker project.
I got is to work right of the bat.
When It backs up the rear wheel jumps off the table.
I am confused about ramping the motors.
Here is the code segment from the program for back up.
You will find the whole code below; right from the book.
Back_Up: 'back up
FOR PulseCount = 0 TO 40
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
RETURN
'roamingwithwhiskers
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "program running"
'----[noparse][[/noparse]Variables]
PulseCount VAR Byte 'for...next loop counter
'----[noparse][[/noparse]Initialization]
FREQOUT 4, 2000, 5000 'signal program start/reset
'======================[noparse][[/noparse]Main Routine]=======================================
DO
IF (IN5 = 0) AND (IN7 =0) THEN 'both whiskers detect obstacle
GOSUB Back_Up 'back up and u turn (left twice)
GOSUB Turn_Left
GOSUB Turn_Left
ELSEIF (IN5 = 0) THEN 'left whisker contacts
GOSUB Back_Up 'back up and turn right
GOSUB Turn_Right
ELSEIF (IN7 = 0) THEN 'right whisker contacts
GOSUB Back_Up 'back up and turn left
GOSUB Turn_Left
ELSE 'both whiskers 1, not contact
GOSUB Forward_Pulse 'apply a forward pulse
ENDIF 'and check again
LOOP
'+++++++++++++++++++++[noparse][[/noparse] Subroutines ]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Forward_Pulse: 'send a single forward pulse
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
RETURN
Turn_Left: 'left turn near 90 deg
FOR PulseCount = 0 TO 20
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
NEXT
RETURN
Turn_Right:
FOR PulseCount = 0 TO 20 'right turn near 90 deg
PULSOUT 13, 850
PULSOUT 12, 850
PAUSE 20
NEXT
RETURN
Back_Up: 'back up
FOR PulseCount = 0 TO 40
PULSOUT 13, 650 'add ramping if I can find out and is possible.
PULSOUT 12, 850
PAUSE 20
NEXT
RETURN
I am using the Boe-Bot and the book it came with.
I am working with the whisker project.
I got is to work right of the bat.
When It backs up the rear wheel jumps off the table.
I am confused about ramping the motors.
Here is the code segment from the program for back up.
You will find the whole code below; right from the book.
Back_Up: 'back up
FOR PulseCount = 0 TO 40
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
RETURN
'roamingwithwhiskers
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "program running"
'----[noparse][[/noparse]Variables]
PulseCount VAR Byte 'for...next loop counter
'----[noparse][[/noparse]Initialization]
FREQOUT 4, 2000, 5000 'signal program start/reset
'======================[noparse][[/noparse]Main Routine]=======================================
DO
IF (IN5 = 0) AND (IN7 =0) THEN 'both whiskers detect obstacle
GOSUB Back_Up 'back up and u turn (left twice)
GOSUB Turn_Left
GOSUB Turn_Left
ELSEIF (IN5 = 0) THEN 'left whisker contacts
GOSUB Back_Up 'back up and turn right
GOSUB Turn_Right
ELSEIF (IN7 = 0) THEN 'right whisker contacts
GOSUB Back_Up 'back up and turn left
GOSUB Turn_Left
ELSE 'both whiskers 1, not contact
GOSUB Forward_Pulse 'apply a forward pulse
ENDIF 'and check again
LOOP
'+++++++++++++++++++++[noparse][[/noparse] Subroutines ]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Forward_Pulse: 'send a single forward pulse
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
RETURN
Turn_Left: 'left turn near 90 deg
FOR PulseCount = 0 TO 20
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
NEXT
RETURN
Turn_Right:
FOR PulseCount = 0 TO 20 'right turn near 90 deg
PULSOUT 13, 850
PULSOUT 12, 850
PAUSE 20
NEXT
RETURN
Back_Up: 'back up
FOR PulseCount = 0 TO 40
PULSOUT 13, 650 'add ramping if I can find out and is possible.
PULSOUT 12, 850
PAUSE 20
NEXT
RETURN
Comments
The rear wheel may still jump off the table because of the sudden stop before it begins to ramp backwards. If it does you could add a pause before beginning the ramping.
Rich H
p.s. You should delete your duplicate post in the Robotics forum, it is against forum rules to cross post. Just click the little red "X" at the upper right to delete it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Simple Servo Tester, a kit from Gadget Gangster.
Post Edited (W9GFO) : 6/18/2010 8:23:05 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
·