Shop OBEX P1 Docs P2 Docs Learn Events
ramping is the bane of my existence. — Parallax Forums

ramping is the bane of my existence.

jcrue451jcrue451 Posts: 4
edited 2006-10-10 23:59 in BASIC Stamp
ok, so i'm stumped...

i'm working my way thru the "robotics with the boe-bot" manual, and have gotten to p. 139. on this page, the activity is to write a program that makes the bot move forward, turn left 90 degrees, right 90 degrees and move backward, ramping in and out of each maneuver.

here's the rub: the bot jerks when the program starts, won't roll forward straight, turns left & right (but decidedly not 90 degrees) and then rolls backward to rest approximately 4-5" right of the starting point.

is there a way to adjust the values in a pulse count to compensate for "mismatched" servos? is that even the problem?

grrr...
john

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"elementary chaos theory tells us that all robots will eventually turn against their masters and run amok in an orgy of blood and the kicking and the biting with the metal teeth and the hurting and shoving." —professor frink

Comments

  • edited 2006-10-10 23:59
    John,

    Here are a couple of different answers to your question.·

    The optimal answer isn't within the scope of the text at page 138, but it's still worth trying.··Go to Boe-Bot® Robot Navigation with Accelerometer Incline Sensing·and run EepromNavigationWithRamping.bs2.· The program reads·several different navigation instructions from the unused portion of the BASIC Stamp's EEPROM program memory, and each time through the main routine, eight lines of code automatically ramp from the previous speed/maneuver to the next speed/maneuver.· The program is already set up to work with your Boe-Bot, and it relies on the same wiring you·are working with in Chapter 4 of Robotics with the Boe-Bot.· So just copy and paste the program into your BASIC Stamp editor and then download it to your Boe-Bot's BASIC Stamp.· After you're done with Chapter 4, take a closer look at that example program.· At that point, all the elements in the program will have been introduced and the program will start to make sense.

    If the rest of the article catches your interest, there are·lots more like it on this page: Stamps in Class "Mini Projects".

    Alright, now back to an answer that's within the scope of that particular part of the Robotics with the Boe-Bot text.· It's important to set up the FOR...NEXT loop's StartValue and EndValue arguments so that there is never a sudden change in pulse duration to the servos.· That's what causes it to jerk.· In other words, you will have to tinker with the code snippets that were provided.·

    For example, if your Boe-Bot is going full speed forward and you want to make a smooth turn, your code should probably just slow one of the servos down, and then speed it back up again.· Below is an example.· Try replacing the 75 pulses of full speed forward in StartAndStopWithRamping.bs2 (from the book) with the code block below.· I "think" it'll do the trick.· (Not tested yet!)· Please let me know if it worked.·

    Take a close look at the second FOR...NEXT loop in the block below.· The first time through that second FOR...NEXT loop, the pulses to the servos·are still full speed for both sides.· The second time through, the pulse to the left servo·is ten below full speed.· The·third time through, the pulse to the left servo·is 20 below full speed, and so on...· The code should cause the left servo·to ramp down to full stop and then ramp back up again.· The result should be a smoother that other code examples with abrupt changes in direction.

    ' This code snippet should be substituted for the second of the three FOR...NEXT loops in StartAndStopWithRamping.bs2.
     
    ' Continue forward 75 pulses
     
    FOR pulseCount = 1 to 75
      PULSOUT 13, 850
      PULSOUT 12, 650
      PAUSE 20
    NEXT
     
    ' Ramp into turn
     
    FOR pulseCount = 0 to 100 STEP 10
      PULSOUT 13, 850 - pulseCount
      PULSOUT 12, 650
      PAUSE 20
    NEXT
     
    ' Ramp out of turn
     
    FOR pulseCount = 100 to 1 STEP 10
      PULSOUT 13, 850 - pulseCount
      PULSOUT 12, 650
      PAUSE 20
    NEXT
     
    ' Continue forward 75 more pulses
     
    FOR pulseCount = 1 to 75
      PULSOUT 13, 850
      PULSOUT 12, 650
      PAUSE 20
    NEXT
     
    
     
    
     
    

    ·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.

    Post Edited (Andy Lindsay (Parallax)) : 10/11/2006 1:37:20 AM GMT
Sign In or Register to comment.