Shop OBEX P1 Docs P2 Docs Learn Events
Sine Wave for boe bot. — Parallax Forums

Sine Wave for boe bot.

SGCool195SGCool195 Posts: 9
edited 2005-04-15 02:33 in Robotics
Me and my friends are having a bit of a problem with the Boe-Bot. we are workign on one of the earlier labs where we have to make the boe bot move in the shape of a sine wave. We have spent a large amount of time on thi sand still havent come up with a workable peice of code. WE tried doing half circles, didnt work out well, then we tried just programming different degrees of turn in, and that didnt really work.

Our instructor wants a really nice sine wave taht the boe bot rolls through smoothly. I have tried using subroutines, but am still getting problems.. any help would be appreciated.

Comments

  • edited 2005-04-14 01:56
    Look up the SIN and */ operators in either the BASIC Stamp Manual's online help (Help -> Index) or the BASIC Stamp Manual. They should be your necessary ingredients for converting the FOR...NEXT loop's index into values that vary like a sine function but are still useful to the PULSOUT commands. For this exercise, you'll probably want to use pulse widths that vary from 700 to 800 instead of 650 to 850. Reason being the pulse width control over the servos is more linear there.
  • SGCool195SGCool195 Posts: 9
    edited 2005-04-14 02:07
    could you break that down in to simpler terms for me?
  • edited 2005-04-14 03:23
    Sure, I recommend getting familiar with these three ingredients, and combining them in a single program to get your Boe-Bot to travel in a path described by a sine wave.

    1) Look up SIN in the BASIC Stamp Editor's online help. Read the explanation and try the example programs to get familiar with it.
    2) Repeat for the */ command so that you understand how to use it to multiply by values such as 1.5, 3.14, etc.
    3) Try the speed ramping activity in Chapter 4, Activity #4 of Robotics with the Boe-Bot v2.2 available for free download from www.parallax.com -> Downloads -> Stamps in Class Tutorials. This demonstrates how to use a FOR...NEXT loop's index variable in the PULSOUT command's Duration argument to give you variable servo speed control. The previous sentence might seem like jargon, but when you try the activity with the speed ramping (and read the explanations) it should start to make more sense.
  • SGCool195SGCool195 Posts: 9
    edited 2005-04-14 04:45
    where can i find the help page for the editor? i cant seem to find it.. sorry
  • edited 2005-04-14 05:04
    In the BASIC Stamp Editor, click Help and select index. If that doesn't work, you can always download the BASIC Stamp Manual from www.parallax.com -> Downloads -> Documentation.
  • SGCool195SGCool195 Posts: 9
    edited 2005-04-14 05:40
    Thanks, i found it. hasnt really helped me any tho.. justed confused me further.

    can it be done with subroutines, that about the most complicated thing i know how to do....
  • edited 2005-04-14 05:57
    You can get kind of a sine wave looking thing from ramping. As a minimum, you've got to know how to write code to make the Boe-Bot's wheels go gradually faster and slower. There should be an activity in your Robotics with the Boe-Bot book that has example code for ramping. It speeds up and slows down the servos with a FOR...NEXT loop. In Robotics with the Boe-Bot v.2.2, it's in Chapter 4, Activity #4. It makes the Boe-Bot gradually go faster, then slow down again. Although it's applied to forward motion, you can apply it to turning.

    Just reading can tend to bring confusion. If you read, type in the code, run and test it, tinker with it and figure out how it works before moving on to the next topic, it will help.
  • SGCool195SGCool195 Posts: 9
    edited 2005-04-14 18:51
    i do know how to ramp speed..

    use a for .. next loop with in creaing values that get added to the pulsout on the servo to sloly increase or decrease its speed. yes.. that i can do.
  • SGCool195SGCool195 Posts: 9
    edited 2005-04-14 19:10
    but i dont see how to apply that... unless you ramp one side of the boe bot fast then the other...
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-04-14 19:43
    here is a quick illustration, the top graph is the robot movement, the bottom graph is the corresponding servo speed. For simplicity sake the left servo is driven at a constant 50%, a tighter sinwave can be achieved by varying the left servo too, but this should get you on your way.

    attachment.php?attachmentid=37577
    567 x 421 - 4K
  • edited 2005-04-14 20:10
    Here is a hint:

    PULSOUT 13, 800 - index
    PULSOUT 12, 700 + (50 - index)
  • SGCool195SGCool195 Posts: 9
    edited 2005-04-14 21:41
    ok.. thats helps.. that i can understand.. haha.. thanks for all the help.. and for your pateince.. .. now i see why parallax is #1 ..

    also, my final project for this robotics class is taking the school owned R/c car and attacking a BoE, a sonar unit, and an IR unit to it. In the end it is supposed to wander around campus and search for random Tv's to turn on/ off and change their channels ( hopefully).
  • SGCool195SGCool195 Posts: 9
    edited 2005-04-15 02:05
    now im mad... my group was able to make a sin wave tnight.. but we didnt use subroutines... our instructor saw our code and then decided that we needed to do it with subroutines and DATA" " .. any ideas how to work it out with that?
  • edited 2005-04-15 02:33
    You might start by trying programs with subroutines and DATA. Chapter 4, Robotics with the Boe-Bot. Once you get familiar with how it works, some ideas will come to you.
Sign In or Register to comment.