Skip to content
Parallax Learn

Parallax Learn

  • Welcome
  • Tutorials
        • Tutorial Series head tag

          Tutorial Series
        • Tutorial Series

          The special, classroom-ready series pages are organized collections of tutorials for our most popular hardware and/or languages. The tutorials for each topic are conveniently accessible from a single page, shown in the order it is recommended that they be completed.
        • Robotics Series Head tag

          Robotics Series
        • Robotics Series

          • Artificial Intelligence
          • Cybersecurity: Radio Data tutorialCybersecurity
          • cyber:bot + Python
          • cyber:bot + MakeCode
          • Boe-Bot Tutorial SeriesBoe-Bot
          • Arduino Shield-Bot
          • ActivityBot with C TutorialsActivityBot + C
          • ActivityBot with BlocklyProp Tutorial SeriesActivityBot + BlocklyProp
          • Scribbler 3 Tutorial SeriesScribbler 3
        • Electronics & Programming Series Head tag

          Electronics & Programming Series
          • BS2 Board of Education Tutorial SeriesBS2 Board of Education
          • Propeller C-Language BasicsPropeller C Basics
          • FLiP Try-It Kit C Tutorial SeriesFLiP Try-It Kit + C
          • FLiP Try-It Kit BlocklyProp TutorialsFLiP Try-It Kit + BlocklyProp
          • Badge WX Tutorial SeriesBadge WX
          • Propeller BlocklyProp Basics and ProjectsPropeller BlocklyProp Basics
          • View All Tutorial Series »
        • Browse Tutorials
        • Browse Tutorials

          Individual tutorials sorted by robot or kit, and language.
        • By Robot or Kit
          • ActivityBot
          • SumoBot WX
          • Boe-Bot
          • Shield-Bot
          • cyber:bot
          • Badge WX
          • ELEV-8
          • ARLO
        • By Language
        • By Language

          • Propeller C
          • Arduino
          • BlocklyProp
          • PBASIC
          • Python
          • MakeCode
          • View All Tutorials »
  • Educators
  • Reference
  • Downloads
  • Home
  • All Courses
  • Upgrade Your cyber:bot with Feedback 360° Servos

Upgrade Your cyber:bot with Feedback 360° Servos

How the Distance Maneuver Tests Work

How distances_forward_left_right_left_backward Works

Like the previous script, this one uses the Feedback 360° servos, so it has to import both the cyberbot and feedback360 modules.  It also has to call drive.connect before calling any other drive methods. Unlike the previous script, the drive methods in this script are not the set-and-forget kind. Keep that in mind while reading!

# distances_forward_left_right_left_backward

from cyberbot import *
from feedback360 import *

drive.connect()

Forward 196 ticks is a total of three revolutions for a distance of approximately 192 x 3.25 / 25.4 ≈ 24.6 inches.  Unlike drive.speed, the drive.goto() method waits for the maneuver to be completed before it allows the next line to be executed.  The sleep(1000) is just there to provide a delay to see that the cyber:bot stopped before moving on to the next maneuver.

drive.goto(192, 192)            # Forward 3 turns
sleep(1000)

 

With turning by distance, a full circle is about +/- 104 ticks.  That makes +/-52 ticks a half turn and +/- 26 ticks a quarter turn.  You might need to tun this for your cyber:bot since the distance between wheels determines the robots ’turning radius’.  

drive.goto(-26, 26)             # 90 degrees left
sleep(1000)

drive.goto(52, -52)             # 180 degrees right
sleep(1000)

drive.goto(-26, 26)             # 90 degrees left
sleep(1000)

 

This makes the cyber:bot go backwards 192 ticks = 3 turns.  The sleep(1000) is there just in case you decide to add more maneuvers.

drive.goto(-192, -192)          # Backward 3 turns
sleep(1000)

 

Try This – Time-based Pivot

Let’s say that your application needs the cyber:bot to pivot by 90° instead of rotating in place.  For a pivot left, instead of drive.goto(-26, 26), your script would need drive.goto(0, 52).  Note that to make the 90° turn, the right wheel has to make up for the left wheel by turning twice as far!

  • Modify the script as shown below by changing the turns to pivots.
  • Change the project name to speeds_forward_left_right_left_backward_try_this.
  • Click Save to download a copy of your work, then click Send to micro:bit to flash the modified scripot into your cyber:bot’s micro:bit.
  • Reconnect your cyber:bot to USB.
  • Set the PWR switch to 0.
  • Click Send to micro:bit to flash the script into the cyber:bot.
  • Disconnect the cyber:bot from the USB cable.
  • Set it on the floor and set the PWR switch to 2.
  • Verify that the cyber:bot now makes approximately 90° pivots instead of turning in place.

 

 


Printer-friendly version
Maneuvers with Distance Control
Prev
Your Turn: Full Circles
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2024

© 2025 Parallax Learn • Built with GeneratePress