Shop OBEX P1 Docs P2 Docs Learn Events
Boe Bot degree turns in Arduino — Parallax Forums

Boe Bot degree turns in Arduino

hungryTechiehungryTechie Posts: 14
edited 2015-05-13 20:01 in Learn with BlocklyProp
Hi ,

I use the Boe Bot with Arduino in my CS class and have completed lots of exercises and practices from the pdf manual available.

Question #1
In chapter 4 there is a challenge that goes like this: " Let’s say that you tested your servos and discovered that it takes 1.2 seconds to make a 180°turn with right-rotate. With this information, write routines to make the BOE Shield-Bot perform 30, 45, and 60 degree turns." Can anybody explain the Math behind this and how it relates to the formula: time = (BOE Shield-Bot distance / BOE Shield-Bot speed) * (1000 ms / s)? The goal here is to easily calculate degrees and implement with the Arduino code for Boe Bot turning maneuvers.

Question # 2
Does anybody have suggestions, ideas on how we can further modify Boe-Bot to look differently ( maybe have 4 wheels or case it) or even combine Arduino with Lego EV3?

Comments

  • Steph LindsaySteph Lindsay Posts: 767
    edited 2015-05-13 08:53
    Hi hungryTechie,

    Regarding Question #2: There are additional sensors and add-ons that you can use with the Parallax "Shield-Bot." This page has a list of Parallax sensors and kits with Arduino Uno example code: https://www.parallax.com/product/arduino. The first product on that page is the Ping))) Ultrasonic Distance Sensor with Mounting Bracket Kit. I posted a project using this kit on the Shield-Bot:

    attachment.php?attachmentid=114167&d=1431532150


    http://learn.parallax.com/project/shield-bot-roaming-ping
    650 x 467 - 343K
  • edited 2015-05-13 10:56
    [edit] Sorry, I see that you are a teacher. For some reason, I misread "CS student" and replied accordinly. I will post some more info in a thread to the Educators Forum for you. [/edit]

    Question 1 really has three parts: (A) about turning, and (B) about the distance equation, and (C) how are they related

    (A) If you know how long it takes the bot to turn a 360, program it to turn for half the time and it'll give you half the turn. A quarter of a turn will take a quarter of the time, and so on. More generally, whatever fraction of 360 you need, make it turn that fraction of the full circle time.

    (B) Since you are a CS student, start by grabbing a pencil, paper, and calculator and doing the math problems on this page: http://learn.parallax.com/node/222. Also, hand enter the example program on that page and carefully follow the red checklist instructions. Once you've got a feel for them, the goal would be to solve the run time you need for a desired distance with an equation.

    In case its still not clear, here is an additional hint: You need to multiply the run time result by 1000 ms/ 1 s because it converts seconds to the ms the program needs to do the job. That's because 1 s = 1000 ms. So divide both sides by 1 s, and you get 1 = 1000 ms / 1 s. Multiplying by 1000 ms / 1 s is equivalent to multiplying by 1, except that when you cancel the units, the result will be in ms instead of s.

    (C) Once you are familiar with calculating and programming linear distance, rotational distance works the same way. Just as time = distance / speed, we also have time = angular distance / angular speed. Let's say it takes the bot 3 seconds to make a pivot 360. That's an angular speed of 360 degrees per 3 seconds, or 120 degrees per second. With that piece of info, you can go through the same exercise in http://learn.parallax.com/node/222 and come up with an equation for turning that can also be converted to code.
  • kwinnkwinn Posts: 8,697
    edited 2015-05-13 11:12
    Don't forget the motors do not get to full speed instantly. This may not make a significant difference for a single turn of many degrees, but if you are trying to draw a circle using 360 one degree turns it will be very apparent.
  • edited 2015-05-13 11:14
    Thanks, yeah, I forgot to mention that this is a "first approximation", and requires tuning.
  • hungryTechiehungryTechie Posts: 14
    edited 2015-05-13 17:45
    I like your quote.
  • Ken GraceyKen Gracey Posts: 7,395
    edited 2015-05-13 20:01
    Dear Mr. Lindsay,

    I want to thank you for your time answering this question in such detail for hungryTechie (ahem, ahem).

    I realize that you took a break from a significant workload to compose the reply.

    So, thank you!

    Ken Gracey
Sign In or Register to comment.