Quadruped Motions Controlled

Example Description
Learn how to use PictoBlox to control the predefined motions of the Quadruped robot.

Introduction

In this project, we will explain how to run predefined motions in PictoBlox for the Quadruped. The predefined motions allow users to make the robot move forward, backward, left, right, and much more.

Code

sprite = Sprite('Tobi')
quirky = Quarky()
import time
quad=Quadruped(4,1,8,5,3,2,7,6)

while True:
  quad.home()
  time.sleep(0.5)
  quad.move("forward",1000,2)
  time.sleep(0.5)
  quad.move("backward",1000,2)
  time.sleep(0.5)
  quad.move("lateral left",1000,2)
  time.sleep(0.5)
  quad.move("lateral Right",1000,2)
  quad.home()

Logic

  1. First, import time imports the built-in time module, which provides functions for dealing with time.
  2. While True creates an infinite loop that will continue running until the program is interrupted.
  3. Then we call quad.home() is the home method of the Quadruped class, which resets the position of the quadruped object to its starting position.
  4. Now,time.sleep(0.5) causes the program to pause for 0.5 seconds before continuing to the next line of code.
  5. Then quad.move(“forward”,1000,2) causes the quadruped to move forward 1000 steps at a speed of 2 steps per second.
  6. Steps 7 and 8 are repeated for the “backward“, “lateral left“, and “lateral right” movements, each with a pause in between.
  7. Furthermore,home () is called again to return the quadruped to its starting position.
  8. Overall, We can program a quadruped robot to move in predefined motions, such as forward, backward, left, and right.

Output

Table of Contents