Control Quadruped Predefined Actions

Example Description
Learn how to program a quadruped robot to perform predefined actions using PictoBlox.

Activity Description

In this activity, students will use the Quarky Quadruped kit to make their four-legged robot perform a series of cool dance and movement actions. This helps them learn how to control servo motors and sequence movements step by step. In the end, the robot returns to its home position, ready for the next show!

Let’s Code

Follow the steps

  1. Open the PictoBlox application from the Start Menu.
  2. Select the inviting realm of Blocks as your coding environment.
  3. Connect “Quarky” to your computer using a USB cable. Then, click the Board button in the toolbar and select board as Quarky.
  4. Next, select the appropriate Serial port if the Quarky is connected via USB or the Bluetooth Port if you want to connect Quarky via Bluetooth and press Connect.
  5. Click on the Add Extension button and add the Quarky Quadruped extension.
  6. Drag and drop the “when green flag clicked” block from the Events palette.
  7. To set up the quadruped, you can drag and drop pins for each leg and hip into the initialisation block using set pins FR Hip () FL Hip () FR Leg () FL Leg() BR Hip () BL Hip () BR Leg () BL Leg () blocks. This block sets which pins on the Quarky controller board control each servo motor for the front right (FR), front left (FL), back right (BR), and back left (BL) hips and legs. Drag this block and set each PIN as shown.
  8. Add the “home” block right after setting pins.. This will bring the robot to its initial position before starting the dance.
  9. Add a wait block after home. This gives the robot time to move to home position before doing the next action.
  10. Add the “do action” block from the Robotics palette, select dance1, set times to 1, and speed to Medium.
  11. Add another “wait (0.5) seconds” block to allow time for the action to complete.
  12.  Repeat steps 10 and 11 seven more times and choose a different predefined action.
  13. Finally, to return the quadruped to its starting position, you can drag and drop the home position block.

Final Code

Output

Click the green flag and watch the robot perform the complete dance sequence step by step, returning to its home position at the end.

Table of Contents