Shop OBEX P1 Docs P2 Docs Learn Events
Understanding ramping on BOE-Bot — Parallax Forums

Understanding ramping on BOE-Bot

abpccpbaabpccpba Posts: 3
edited 2010-06-18 21:34 in BASIC Stamp
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

Comments

  • W9GFOW9GFO Posts: 4,010
    edited 2010-06-18 19:34
    Ramping is pretty easy really. What you want to do is send a slightly different value of pulse width each time through the FOR..NEXT loop. You can use the accumulating value in PulseCount and add (or subtract) that to a base pulse width. The following will take longer to execute but should get you started.

    Back_Up: 'back up
    FOR PulseCount = 0 TO 100
    PULSOUT 13, 750 - PulseCount
    PULSOUT 12, 750 + PulseCount
    PAUSE 20
    NEXT
    RETURN
    



    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 SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-06-18 21:34
    Your cross (duplicate) post in the Robotics Forum was removed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    ·
Sign In or Register to comment.