Shop OBEX P1 Docs P2 Docs Learn Events
Accelerate boe bot up to speed — Parallax Forums

Accelerate boe bot up to speed

lakers78lakers78 Posts: 3
edited 2009-10-30 21:49 in BASIC Stamp
I'm wondering if there is a way to start the boe bot from rest and accelerate the boe bot up to full speed. The reason is because we are putting some bigger wheels on it, and we don't want the servo gears to strip.
I'm completely new to this stuff so please be descriptive. Any help would be appreciated.

thanks

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-29 13:24
    Yes

    Read the Robotics with the BoeBot tutorial. It describes how servos work. In particular, continuous motion servos respond to the width of the control pulse they're sent and the farther the pulse width is from the "stop" setting of 1.5ms, the faster they go. Many of the examples use a more or less maximum setting to move the BoeBot, but you can start with pulse widths close to the stop point and slowly change them. Experiment with the servos and see what you get with different pulse widths.

    For example, a "PULSOUT <pin>,750" will produce a pulse of 1.5ms which should hold the servo in a stopped position (see the calibration program in the tutorial). A "PULSOUT <pin>,800" should move the servo slowly in one direction while a "PULSOUT <pin>,700" should move it slowly in the other direction. Values of 500 and 1000 should move the servo at full speed in each direction.
  • lakers78lakers78 Posts: 3
    edited 2009-10-30 21:35
    Ok so I figured out how to ramp, that was fine. (I didn't realize that it was in the book).

    But here's my problem:

    How can I get the boe bot to do 2 things at the same time? I want to tell the boebot to go forward x number of feet along a line, and if and only if the boebot deviates from that line, then I want the QTI sensors to get it back on track.

    Here is my code for the dead reckoning:

    FOR counter = 1 TO 232
    PULSOUT 13, 850
    PULSOUT 12, 650
    Next

    If the boebot gets off the line, or the line curves somewhere in between 1 and 232 pulscounts, then I want to do a subroutine that will use the QTI sensors from the line following kit to get it back on track, and most importantly, pick up from the pulscount that it left off on before the boebot deviated from the path.

    Is there a way to use the PULSIN command to store the pulswith just before the boebot does the QTI subroutine, and then continue the counter from that stored value when the boe bot is back on track?
    Or better yet continue the counter while the QTI subroutine is running?
    Or how else could I program this?

    Thanks.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-30 21:49
    You need to combine the servo pulse generation with the QTI sensing. If you haven't already, look at the Robotics with the BoeBot tutorial. That may give you some ideas.

    The code you posted for "dead reckoning" won't work because it continually generates control pulses, much too fast for a servo to respond to. You need a pause of about 20ms. Usually you'd put a "PAUSE 20" just before the NEXT statement. A servo expects control pulses about 50 times a second. That comes out to one pulse about every 20ms.

    During the 20ms pause, the Stamp is just sitting there. That time (20ms) is available to do something else like reading the sensors and doing some calculations based on the sensor data. Typically, reading some sensors will take less than 20ms and you'd still have some kind of pause. Instead of "PAUSE 20", you might have "GOSUB QTIread" followed by "PAUSE 5" assuming that the QTIread routine takes around 15ms to execute. Read Tracy Allan's website for information on execution time for PBasic statements (www.emesystems.com, then use "app-notes" link at bottom of page).
Sign In or Register to comment.