Shop OBEX P1 Docs P2 Docs Learn Events
Programming help with BoeBot — Parallax Forums

Programming help with BoeBot

JeffNJeffN Posts: 18
edited 2006-03-15 23:25 in Robotics
I'm new at this, so please be gentle....tongue.gif
Stock BoeBot with 2x16 serial LCD and Hitachi HM55B Compass.
I combined a modified Roaming with IR and the Test Calibrated compass program.
Amazing to me it ran..after some syntax error problem fixes.
But what it does now....when the degrees from north displays, the servos stop, when the display goes·blank, the servos start again.· I think it is because the display part of the program is within the do-loop section.· I've tried to move that, but I can't find the spot.· How can I program this so that the forward·pulse continues without pausing for the "degrees" display?
The program is attached (hopefully).

This is driving me carzy....so it must be simple.

This roboticis is a great hobby, has given me some ideas to use at work.

Thanks,

Jeff

PS-Not the BoeBot with the tank treads....from my·other post.

Comments

  • Russ FergusonRuss Ferguson Posts: 206
    edited 2006-02-26 03:18
    Your main loop includes the subroutines for the servos. I think that it will work differently if you change the DO - LOOP to exclude the these lines.

    LOOP' Repeat main loop

    Forward_Pulse: ' Send a single forward pulse.
    FOR pulseCount = 0 TO 20
    PULSOUT 13,850
    PULSOUT 12,650
    PAUSE 20
    NEXT
    RETURN

    Turn_Left: ' Left turn, about 90-degrees.
    FOR pulseCount = 0 TO 20
    PULSOUT 13, 650
    PULSOUT 12, 650
    PAUSE 20
    NEXT
    RETURN

    Turn_Right:
    FOR pulseCount = 0 TO 20 ' Right turn, about 90-degrees.
    PULSOUT 13, 850
    PULSOUT 12, 850
    PAUSE 20
    NEXT
    RETURN

    Back_Up: ' Back up.
    FOR pulseCount = 0 TO 40
    PULSOUT 13, 650
    PULSOUT 12, 850
    PAUSE 20
    NEXT
    RETURN

    LOOP' Repeat main loop
  • JeffNJeffN Posts: 18
    edited 2006-02-26 15:38
    Thanks Russ, but unfortunatly it didn't work, servos still stop when LCD displays degrees.

    Jeff
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-02-26 15:46
    If you are reseting the BasicStamp, it could be a low power condition.

    1.·Check to see if your batteries are fresh.

    2. Try running from an AC supply.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "When all think alike, no one is thinking very much.' - Walter Lippmann (1889-1974)

    ······································································ Warm regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-02-26 16:06
    Jeff -

    The beginning of your program presently looks like this:

    '
    [noparse][[/noparse] Initialization ]
    HIGH TX ' setup serial output pin
    PAUSE 100 ' allow LCD to initialize
    '
    [noparse][[/noparse] Main Routine ]

    Just after that coding above, and before any other, please add the following line:

    DEBUG "Starting"

    That message "Starting" should only appear once during any run of the program. If is appears more than once, the Stamp is being RESET. If it is resetting, then you can go on with the debugging procedures to determine why. Without knowing that, you're shooting in the dark.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • JeffNJeffN Posts: 18
    edited 2006-02-26 16:34
    Thanks for all the help!
    Entered the debug "starting" just before the Do.
    When the program runs the "starting" only appears once.
    Batteries are new and the bot roams all over, but the servos stop only when going forward when the LCD displays the degrees.
  • DerekDerek Posts: 15
    edited 2006-02-26 21:07
    The problem may be that the stamp can only handle one process at a time. so it is stopping the command to move the motors to calculate the degrees. Parallax has a servo contoller where you send the command for the motors to the servo controller and it "moves" the wheels rather than the microcontroller on the BOE.

    So this would allow moving the motors while calculating the degrees.

    Servo controller:
    http://www.parallax.com/detail.asp?product_id=28023

    Post Edited (Derek) : 2/26/2006 9:10:52 PM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-26 22:22
    Well, one thing that will affect motion is excessive delays and you have PAUSE statements all over the code mostly after writing to the LCD.And of course, as I think Russ pointed out, the end of your main loop falls right into the Subroutines.· That is bad.· That causes a RETURN for which there was no GOSUB.· Your LOOP is after a RETURN at the end of the subroutines where it will never be executed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-26 22:25
    One other thing that stands out is that your Compass code, which appears to be kind of stuffed in at the end, waits for a status flag to continue.· Perhaps this is never happening.· Try placing a DEBUG at the entry and exit of that section to see if it ever makes it out.· My guess is it doesn't.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • JeffNJeffN Posts: 18
    edited 2006-03-15 23:25
    Thanks for all the help.

    I think Derek is right, the bot can't turn the servos and display the heading at the same time.

    Chris, I did the debug at the begining and at the end of each subroutines and it runs through the program with no problem. The pauses are for the LCD to stay on so that you can read the message displayed. This was a great learning experience!

    I moved the code for displaying the heading so that when the bot detects an object it stops, then displays the heading and continues to backup.
Sign In or Register to comment.