Introduction
In this project, we will explain how to run predefined actions for Quadruped. By the end of the tutorial, learners will have gained knowledge and practical experience in programming a quadruped robot and controlling its movements using PictoBlox.
Code
sprite = Sprite('Tobi')
quarky = Quarky()
import time
quad=Quadruped(4,1,8,5,3,2,76)
while True:
quad.home()
time.sleep(0.2)
quad.action("dance1",1000,1)
time.sleep(0.5/2)
quad.action("updown1",1000,2)
time.sleep(0.2)
quad.action("front back",1000,1)
time.sleep(0.2)
quad.action("march in place",1000,1)
time.sleep(0.2)
quad.action("left hand wave",1000,1)
time.sleep(0.2)
quad.action("right hand wave",1000,1)
time.sleep(0.2)
quad.action("bodyshake4",1000,2)
time.sleep(0.2)
quad.action("dance5",1000,2)
time.sleep(0.2)
quad.action("creepy",1000,2)
quad.home()
Logic
- The robot has been programmed to perform various actions such as dance, wave, and march in place using
- action() code.
- The program uses a while loop to continuously repeat the actions in a sequence with small pauses in between each action.
- The ‘time.sleep’ function is used to control the duration of each action and the pauses in between them using time.sleep() code.
- The quad.home() function is used to reset the robot’s position to its initial position after each sequence of actions.