• Home
  • PictoBlox Blocks
  • set pins FR Hip () FL Hip () FR Leg () FL Leg() BR Hip () BL Hip () BR Leg () BL Leg ()

set pins FR Hip () FL Hip () FR Leg () FL Leg() BR Hip () BL Hip () BR Leg () BL Leg ()

Description

The block initializes the quadruped robot and maps the 8 servos to the specified pins. As the default, the servo motors should be connected to the following pins:

  1. Front Right Hip – Servo Pin 4
  2. Front Left Hip – Servo Pin 1
  3. Front Right Leg – Servo Pin 8
  4. Front Left Leg – Servo Pin 5
  5. Back Right Hip – Servo Pin 3
  6. Back Left Hip – Servo Pin 2
  7. Back Right Leg  – Servo Pin 7
  8. Back Left Leg – Servo Pin 6
Alert: If the connection is not done as specified, then you have to change the pin for code in this block.

Example

Introduction

Dance motion with humanoid refers to using a robot that has a human-like appearance to perform dance movements. These robots are pre-programmed with various dance sequences and can also be customized to create unique dance routines.

To make the robot move, we need to use code to control its motors and servos. The code can be created using a programming tools/language such Pictoblox, Python, or Arduino. The code tells the robot which movements to make, such as lifting its arms, bending its knees, or spinning around.

Different actions can be used to create different dance moves, and the dance can be accompanied by music or sound effects. The robot can also be programmed to display different colors or patterns on its body as it moves.

Humanoid robots is a fun and creative way to explore the intersection between technology and the arts.

Code

Logic

  1. Here, we use the pre-defined dance and sequence of humanoid in our code.
  2. To begin, we first initialize the humanoid extension and set up all the required pins by dragging and dropping the necessary blocks.
  3. We use a forever loop to continuously play the dance sequence along with different sounds and display matrices.
  4. To make the dance sequence more interesting, we use different actions with the ‘do() action()() times() speed’ block. It’s quite fascinating.
  5. You can even try out your own dance movements by using different actions and adding your own creativity.

Output

Read More
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.

Read More
Learn how to use PictoBlox to control the predefined motions of the Quadruped robot.

Activity Description

In this activity, you use a visual block-based coding environment to program a quadruped robot. The code shows how to set servo motor pins for each leg and define movement patterns such as forward, backward, lateral left, and lateral right. You also learn to control the robot’s speed and timing using variables and wait blocks. The robot starts in a neutral “home” position and performs motion sequences repeatedly or based on your inputs. This activity helps you understand basic robotics, motion control, and sequential logic in a hands-on, engaging way.

Activity 1: Quadruped Movements

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. Add when flag clicked block from the Event 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.
  9. Add a wait block after home. This gives the robot time to move to the home position before doing the next action.
  10. Add the do forward motion 1 time at Medium speed block. This block instructs the quadruped robot on how to movehow many times, and at what speed.
    For example:

    This makes the robot take one step forward at medium speed.
  11. Add the “home” block right after setting pins.. This will bring the robot to its initial position. Click on the green flag to run the motion sequence.
Note: You can change the direction, number of times, and speed of the motion block. There are 8 predefined motions to choose from for your robot’s movement!

Activity 2: Controlling Speed using Variables

Introduction to Variable

A variable is a named storage that holds a value which can change during the program. In programming, a variable is a named space in memory used to store data that can change during the execution of a program. It acts like a container that holds information—such as numbers, text, or other data types—which you can create, modify, and use throughout your code. Variables make programs flexible and dynamic by allowing data to be reused and updated.
Example:

Think of a school bag with your favourite toy inside. You can change the toy anytime — today it’s a car, tomorrow it’s a doll.

Let’s Code

  1. Click on the Variables category in the blocks palette.
  2. Create a New Variable: Click on the “Make a Variable” button.
  3. Enter Variable Name: In the New Variable window, type your variable name in the box.
    (e.g., type Speed as shown in the picture)
  4. Click the OK button to create your variable.
  5. Add when flag clicked block from the Event Palette.
  6. 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.
  7. Add the “home” block right after setting pins.. This will bring the robot to its initial position.
  8. Set the variable Speed to the value 5000 (this controls how fast the robot moves).
  9. Add a wait block after home. This gives the robot time to move to the home position before doing the next action.
  10. Add the do (forward) motion (1) times at () speed block to move forward for 1 motion cycle at the speed set by the variable Speed.
  11. Add the “home” block right after setting pins.. This will bring the robot to its initial position.

Note: You can change the value of the ‘Speed’ variable to test how it affects the robot’s movement, and program the quadruped robot to perform predefined motions such as forward, backward, left, and right using motion blocks.

Output

Activity 3: Quadruped Predefined Motions

  1. Click on the Events palette and choose the ‘when flag clicked’ block. This block starts the program when the green flag is clicked.
  2. Set the servo motion pins using the ‘set pins’ block from the Quarky Quadruped palette. Assign the pins exactly as shown in the image for all 8 legs and hips.
  3. Add the ‘home’ block from the Quarky Quadruped palette. This brings the robot to a stable starting position.
  4. Add a ‘forever’ block from the Control palette. This repeats the movement continuously.
  5. Inside the ‘forever’ block, add the block: do (forward) motion (1) times at (Medium) speed This makes the robot take one forward step at medium speed.
  6. Finally, add a ‘wait (0.2 seconds)’ block from the Control palette. This gives a short pause before the next step is repeated.
  7. Similarly, repeat Steps 5 and 6 for the movement of the Robot in the different directions.

Output

Read More
Learn the steps required to create a Humanoid dance sequence. This guide covers a Humanoid robot and refining the sequence to create an engaging and entertaining performance.

Introduction

A Humanoid dance sequence is a set of programmed instructions that allows a Humanoid robot to perform a dance routine. Typically, these sequences involve a combination of movements and actions performed by the robot in a coordinated manner, to create an entertaining and engaging dance performance.

The process typically involves the following steps:

  1. Define the dance moves
  2. Sequence the moves
  3. Program the robot
  4. Test and refine

Creating a Humanoid dance sequence involves a combination of creativity, technical skill, and attention to detail, and can result in an engaging and entertaining performance that showcases the capabilities of robotic technology.

Code

Logic

  1. Drag and drop set pin RHip () Lhip () RFooot () LFoot () RHand () LHand() block from the Humanoid extension – This block is used to set the pins of the robot to control its movement.
  2. Initialize Humanoid will be in the home position – This means that at the start of the program, the Humanoid robot will be in its default position.
  3. Drag and drop forever loop for a continuous loop – This is a programming construct that ensures that the code inside the loop is executed continuously.
  4. The first display will have some light and then it will play sound and do some action for a specific time and specific speed – This is not explicitly described in the given code, but it could refer to displaying some LED lights and playing some sound effects as the robot performs a specific action, which could involve movement in a certain direction with a particular speed.
  5. Then drag and drop the repeat block to repeat the block for a specific time – This block is used to repeat a particular action a specific number of times or for a particular period with do() action() times at () speed block.
  6. Then drag and drop different actions for a specific time with a specific speed – This could refer to performing a series of different movements or actions, each with a specific duration and speed with do() action() times at () speed block.

Output

Read More
In this tutorial, you will learn how to control a quadruped robot using the arrow key program.

Activity Description

In this activity, you will control your quadruped robot using the arrow keys on your keyboard. The robot’s hip and leg pins are set up first, then it goes to the home position. Inside a forever loop, the robot checks which arrow key is pressed and moves in that direction. You can make the robot walk forward, backward, or move sideways left or right. You can also change the motion direction, number of times, and speed to see how your robot moves differently!

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. Add when flag clicked block from the Event Palette. This block helps you to start the script.
  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.  FR Hip: 4, FL Hip: 1, FR Leg: 8, FL Leg: 5, BR Hip: 3, BL Hip: 2, BR Leg: 7, BL Leg: 6.
  8. Add the home block to move the robot to its starting position.
  9. Add the if block. Check if the up arrow key is pressed. If true, do forward motion 1 time at medium speed.
  10. Press and hold the up arrow key on the keyboard and click the green flag in PictoBlox to make the quadruped move one step forward.
  11. Can you think of a block that would help the quadruped move continuously without needing to click the green flag each time?
    Alert:  Forever block is missing. This block helps us to keep checking which key is pressed.
  12. Use the forever block to keep checking which key is pressed.
  13. Inside the forever loop, add an if block. Check if the up arrow key is pressed. If true, do forward motion 1 time at medium speed.

    Output

  14. Add another if block. Check if the down arrow key is pressed. If true, do backward motion 1 time at medium speed.
  15. Add Controls for Left Arrow. Add another if block. Check if the left arrow key is pressed. If true, do lateral left motion 1 time at medium speed.
  16. Add Controls for Right Arrow. Add another if block. Check if the right arrow key is pressed. If true, do lateral right Motion 1 time at medium speed.

Run and Test

  1. Click the green flag and press the arrow keys to move the robot forward, backward, or sideways.
  2. Try changing the motion direction, number of times, or speed to explore different movements!

Final Output

Read More
Learn about face-tracking, and how to code a face-tracking Quadruped robot using sensors and computer vision techniques.

Activity Description

In this activity, students will program Quarky to detect a face’s position using the camera and respond with movements. Based on which direction the face is (left, right, or center), Quarky will display a pattern and move accordingly. This teaches camera-based input, angle calculations, and conditional movements.

Let’s Learn

  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. Add when flag clicked block from the Event Palette. This block helps you to start the script.
  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.  FR Hip: 4, FL Hip: 1, FR Leg: 8, FL Leg: 5, BR Hip: 3, BL Hip: 2, BR Leg: 7, BL Leg: 6.
  8. Turn on the camera video on the stage with 0% transparency so it remains visible.
  9. Begin a forever loop to keep checking the face’s position continuously.
  10. Use the analyse image from camera block to start facial recognition.
  11. Declare the Variable ‘Angle’ Place get () of the face () at the first place of addition () + (), and 3 at the second place. From the dropdown, select X position.
  12. Set the variable Angle by calculating 90 + (x position of face ÷ 3) to decide how far the face is from the center.
  13. Use if-else blocks to respond based on the face’s horizontal position: If Angle > 90: Face is on the right side, show a face on the LED matrix and move left using “lateral left” motion.
  14. Else if Angle < 90: Face is on the left side, show a face and move right using “lateral right” motion.
  15. Else (Angle = 90): Face is centered, Show a smiley face and move to the home (neutral) position.
Note: Check by changing the angle value and also try to change the icons in the display matrix as L for left and R for right sid directions.

Output

Our next step is to check whether it is working right or not. Whenever your face will come in front of the camera, it should detect it and as you move to the right or left, the head of your  Quadruped robot should also move accordingly.

Read More
Learn how to create a crawling motion with a quadruped robot using individual servo control.

Introduction

The project demonstrates how to make the crawling motion with Quadruped using individual servo control.

Logic

For this project, we are using the set servos () () () () () () () () at () speed block that sets the servo motors of the quadruped to the specified angles at the specified speed.

There are four positions of the robot we are going to make to create the crawling motion:

  1. Position 1


  2. Position 2
  3. Position 3
     

  4. Position 4

Code

Output

Read More
Learn how to set the bounding box threshold, and detect signals such as 'Go', 'TurnRight', 'TurnLeft', and 'Stop' to control quadruped movements.

Introduction

A sign detector Quadruped robot is a robot that can recognize and interpret certain signs or signals, such as hand gestures or verbal commands, given by a human. The robot uses sensors, cameras, and machine learning algorithms to detect and understand the sign, and then performs a corresponding action based on the signal detected.

These robots are often used in manufacturing, healthcare, and customer service industries to assist with tasks that require human-like interaction and decision-making.

Code

Logic

  1. Then, it sets up the quadruped robot’s camera to look for hand signs and tells it how to recognize different signs.
  2. Next, the code starts a loop where the robot looks for hand signs. If it sees a sign, it says the name of the sign out loud.
  3. Finally, if the robot sees certain signs (like ‘Go’, ‘Turn Left’, ‘Turn Right’, or ‘U Turn’), it moves in a certain direction (forward, backward, left, or backward) based on the sign it sees.
  4. So, this code helps a robot understand hand signs and move in response to them!

Output

Read More
Learn about how hand gestures and motions can be translated into commands that control the movement of objects.

Introduction

The hand-controlled motion refers to the ability to control the movement of an object using hand gestures or motions. This can be accomplished through the use of various technologies, such as sensors or motion tracking devices, that detect the movements of the hand and translate them into commands that control the motion of the object.

Hand-controlled motion has a wide range of applications, including in virtual reality and gaming, robotics, prosthetics, and assistive technologies for individuals with disabilities. By allowing for intuitive and natural control of motion, hand-controlled motion can enhance the user’s experience and increase their ability to interact with and manipulate the world around them.

Code

Logic

  1. Begin by initializing the Humanoid extension.
  2. Set specific values for the speed, left-hand offset, left-hand amplifier, period, and phase variable using set() to ().
  3. Then use a forever loop to continuously execute the necessary tasks.
  4. Furthermore, utilize the repeat until loop to repeat the tasks until a specific period has passed.
  5. Calculate a specific angle to set the current position, then position the right hand accordingly to start oscillating from that angle using the set() to () block.
  6. Then apply similar mathematical calculations and set the left hand to the same angle.
  7. Finally, Both hands will move by the calculations due to the forever loop.

Output

Read More
Discover how the Quadruped robot can detect and respond to the presence of a hand in its environment.

The project demonstrates how to make the Quadruped detect the hand in front of it and move according.

Type 1 – Forward Backward

The logic is simple. If the distance measured from the ultrasonic sensor is less the robot will move toward the hand. Else the robot will lean backward.

Code


Type 2 – Upside Down

If the distance measured from the ultrasonic sensor is less the robot will face upwards towards the hand. Else the robot will look downward.

Code


Read More
Learn how to use Pose Classifier, an extension of ML Environment. Follow the step-by-step tutorial on using image classifier in block coding.

Introduction

The pose Classifier is the extension of the ML Environment used for classifying different body poses into different classes.

The model works by analyzing your body position with the help of 17 data points.

Pose Classifier Workflow

  1. Open PictoBlox and create a new file.
  2. You can click on “Machine Learning Environment” to open it.
  3. Click on “Create New Project“.
  4. A window will open. Type in a project name of your choice and select the “Pose Classifier” extension. Click the “Create Project” button to open the Pose Classifier window.
  5. You shall see the Pose Classifier workflow with two classes already made for you. Your environment is all set. Now it’s time to upload the data.

Class in Pose Classifier

Class is the category in which the Machine Learning model classifies the poses. Similar posts are put in one class.

There are 2 things that you have to provide in a class:

  1. Class Name: The name to which the class will be referred.
  2. Pose Data: This data can be taken from the webcam or uploaded from local storage.
Adding Data to Class

You can perform the following operations to manipulate the data into a class.

  1. Naming the Class: You can rename the class by clicking on the edit button.
  2. Adding Data to the Class: You can add the data using the Webcam or by Uploading the files from the local folder.
    1. Webcam:
  3. We use two classes, “up” and “down,” in our code, as depicted in the picture.
Training the Model

After data is added, it’s fit to be used in model training. To do this, we have to train the model. By training the model, we extract meaningful information from the hand pose, and that in turn updates the weights. Once these weights are saved, we can use our model to predict previously unseen data.

The accuracy of the model should increase over time. The x-axis of the graph shows the epochs, and the y-axis represents the accuracy at the corresponding epoch. Remember, the higher the reading in the accuracy graph, the better the model. The range of accuracy is 0 to 1.

Testing the Model

To test the model, simply enter the input values in the “Testing” panel and click on the “Predict” button.

The model will return the probability of the input belonging to the classes.

Export in Block Coding

Click on the “Export Model” button on the top right of the Testing box, and PictoBlox will load your model into the Block Coding Environment if you have opened the ML Environment in the Block Coding.

Code Explanation

  1. First, select the Humanoid extension from the palette.
  2. Drag and drop the “forever” block to create a continuous loop.
  3. Drag and drop the “if” and “else” blocks from the control palette. If the upper-class hand is detected in a pose, the Humanoid will move its left hand to 180 degrees and its right hand to 0 degrees, imitating a human-like pose.
  4. If the “down” class is indicated on the screen, PictoBlox will prompt saying “down” and the Humanoid will move its left and right hand to mimic a human pose, with a rotation of 90 degrees each.
  5. Otherwise, the Humanoid will assume a home position, remaining still with no movement.

Code

Logic

  1. The first model is used to identify the pose of a human, presumably using pose estimation techniques.
  2. Two classes, “up” and “down,” are added to represent the different angles of a person’s hand position.
  3. The model is trained using labeled data to learn to predict the class (up or down) based on the input image or video frame.
  4. The trained model is then used to predict the class of an image or video frame captured from a webcam, indicating the current position of the person.
  5. The code includes an if-else condition to handle the predicted class. If the model identifies the person’s pose as “up,” the Humanoid will mimic the same position and angle of the person’s hand.
  6. If the model identifies the person’s pose as “down, the Humanoid will set its hand angle to a down position.

Output

Read More
Learn how oscillators are utilized to create seamless movements in Quadruped robots.

Introduction

In this example, you will understand how the oscillator concept is used to create smooth motions for the Quadruped robot. The oscillator is the primary component for making the smooth movements of Quarky Quadruped like walking or turning.

How does the Oscillator work?

The purpose of the oscillator in the code is to generate a sinusoidal waveform that can be used to control the motion of a servo motor. The parameters of the oscillator are defined by the offset, amplitude, period, and phase difference.

  1. Offset: The offset is the starting angle of the servo motor (oscillator). It is the angle at which the servo motor starts moving.
  2. Amplitude: The amplitude of the servo motor (oscillator) is the maximum angle the servo motor can rotate.
  3. Period: The period is the total time taken by the oscillator to complete one full cycle.
  4. Phase Difference: The phase difference is the angular displacement of the oscillator from its starting point.

In mathematical terms, the servo angle is calculated using the following formula:

Angle = Offset + Amplitude * sin(Time / Timeperiod + Phasediff)

Single Servo Oscillation

Let’s apply the concept of oscillation to the Quadruped. We want the front right hip servo to oscillate like this:

As you can observe, the following are the oscillator parameters that can be used to get the desired motion:

  1. Offset: 45 degrees
  2. Amplitude: 45 degrees
  3. Time period: 1000
  4. Phase Difference: 0 degrees

Look at the parameters carefully and see if you can understand how it works.

Now to execute the following on Quarky, we will the set () amplitude () offset () period () phase difference () which sets the oscillator parameters for the selected servo motor.

Next, we will use oscillate for cycles () block to execute the oscillator for the complete cycle for the specified cycle times.

Create the following script:

Click on the green flag to test the script:

As you can observe the servo motor start from 45 degrees and do 1 oscillation. You can observe the servo angle here:

Single Servo Oscillation with Phase Difference

Let’s see how to use the Phase Difference to delay the move.

Create the following script:

Click on the green flag to test the script:

As you can observe the servo motor start from 90 degrees and do 1 oscillation. You can observe the servo angle here:

Hope you have understood the oscillator. Let’s change the difficulty level and try the oscillator on all servo motors.

All Servo Oscillator

Create the script to make the left-right motion:

Let’s decode it. Let us play the motion while keeping the Quadruped in the air.

As you can observe the following movements: All the hip joints are starting from the 45-degree angles and then oscillate. The script of the following is here:

Run the green flag and test the code.

Try Other Oscillator Motions

  1. Code 1:
  2. Code 2:

Try to change the parameters and create your actions.

Read More
Learn how to create custom sounds to control Quadruped with the Audio Classifier of the Machine Learning Environment in PictoBlox.

Introduction

A Sound-Based Quadruped with Machine Learning refers to a Quadruped robot that can perceive and interact with its environment through sound-based sensing and uses machine-learning techniques to process and analyze the auditory data it receives.
Quadruped robots with machine learning have the potential to greatly enhance the way we interact with machines and each other, making communication more natural and intuitive while also enabling new applications in fields such as healthcare, education, and entertainment.
In this activity, we will use the Machine Learning Environment of the Pictoblox Software. We will use the Audio Classifier of the Machine Learning Environment and create our custom sounds to control the Quadruped.

Audio Classifier Workflow

Follow the steps below to create your own Audio Classifier Model:

  1. Open PictoBlox and create a new file.
  2. Select the Block coding environment as the appropriate Coding Environment.
  3. Select the “Open ML Environment” option under the “Files” tab to access the ML Environment.
  4. A new window will open. Type in an appropriate project name of your choice and select the “Audio Classifier” extension. Click the “Create Project” button to open the Audio Classifier Window.
  5. You shall see the Classifier workflow with two classes already made for you. Your environment is all set. Now it’s time to upload the data.
  6. As you can observe in the above image, we will add two classes for audio. We will be able to add audio samples with the help of the microphone. Rename class 1 as “Clap” and class 2 as “Snap”.

Note: You can add more classes to the projects using the Add Class button.

Adding Data to Class

You can perform the following operations to manipulate the data into a class.

  1. Naming the Class: You can rename the class by clicking on the edit button.
  2. Adding Data to the Class: You can add the data using the Microphone.
  3. You will be able to add the audio sample in each class and make sure you add at least 20 samples for the model to run with good accuracy.
  4. Add the first class as “clap”  and record the audio for clap noises through the microphone.
  5. Add the second class as “snap” and record the audio for snap noises through the microphone.

Note: You will only be able to change the class name in the starting before adding any audio samples. You will not be able to change the class name after adding the audio samples in the respective class.

Training the Model

After data is added, it’s fit to be used in model training. To do this, we have to train the model. By training the model, we extract meaningful information from the hand pose, and that in turn updates the weights. Once these weights are saved, we can use our model to make predictions on data previously unseen.

The accuracy of the model should increase over time. The x-axis of the graph shows the epochs, and the y-axis represents the accuracy at the corresponding epoch. Remember, the higher the reading in the accuracy graph, the better the model. The range of accuracy is 0 to 1.

Testing the Model

To test the model simply, use the microphone directly and check the classes as shown in the below image:

You will be able to test the difference in audio samples recorded from the microphone as shown below:

Export in Block Coding

Click on the “Export Model” button on the top right of the Testing box, and PictoBlox will load your model into the Block Coding Environment if you have opened the ML Environment in the Block Coding.

 

The Quadruped will move according to the following logic:

  1. When the audio is identified as “clap” sound– Quadruped will move forward.
  2. When the “snap” sound is detected –Quadruped will move backward.


Note: You can add even more classes with different types of differentiating sounds to customize your control. This is just a small example from which you can build your own Sound Based Controlled Quadruped in a very easy stepwise procedure.

Code

Logic

  1. First, initialize the Quadruped extension.
  2. Then, initialize a forever loop to continuously loop and analyze the camera from the stage.
  3. If the program detects a clap sound, the Quadruped will move forward at a specific speed.
  4. Similarly, if it identifies a snap sound, the Quadruped will move backward at a specific speed.
  5. Otherwise, the Quadruped will remain in its initial position (home position).

Output

Read More
Learn how to create custom sounds to control Humanoid with the Audio Classifier of the Machine Learning Environment in PictoBlox.

Introduction

A Sound-Based Humanoid with Machine Learning refers to a Humanoid robot that can perceive and interact with its environment through sound-based sensing and uses machine-learning techniques to process and analyze the auditory data it receives.

Humanoid robots with machine learning have the potential to greatly enhance the way we interact with machines and each other, making communication more natural and intuitive while also enabling new applications in fields such as healthcare, education, and entertainment.

In this activity, we will use the Machine Learning Environment of the Pictoblox Software. We will use the Audio Classifier of the Machine Learning Environment and create our custom sounds to control the Humanoid.

Audio Classifier Workflow

Follow the steps below to create your own Audio Classifier Model:

  1. Open PictoBlox and create a new file.
  2. Select the Block coding environment as the appropriate Coding Environment.
  3. Select the “Open ML Environment” option under the “Files” tab to access the ML Environment.
  4. A new window will open. Type in an appropriate project name of your choice and select the “Audio Classifier” extension. Click the “Create Project” button to open the Audio Classifier Window.
  5. You shall see the Classifier workflow with two classes already made for you. Your environment is all set. Now it’s time to upload the data.
  6. As you can observe in the above image, we will add two classes for audio. We will be able to add audio samples with the help of the microphone. Rename class 1 as “Clap” and class 2 as “Snap”.

Note: You can add more classes to the projects using the Add Class button.

Adding Data to Class

You can perform the following operations to manipulate the data into a class.

  1. Naming the Class: You can rename the class by clicking on the edit button.
  2. Adding Data to the Class: You can add the data using the Microphone.
  3. You will be able to add the audio sample in each class and make sure you add at least 20 samples for the model to run with good accuracy.
  4. Add the first class as “clap”  and record the audio for clap noises through the microphone.
  5. Add the second class as “snap” and record the audio for snap noises through the microphone.

Note: You will only be able to change the class name in the starting before adding any audio samples. You will not be able to change the class name after adding the audio samples in the respective class.

Training the Model

After data is added, it’s fit to be used in model training. To do this, we have to train the model. By training the model, we extract meaningful information from the hand pose, and that in turn updates the weights. Once these weights are saved, we can use our model to make predictions on data previously unseen.

The accuracy of the model should increase over time. The x-axis of the graph shows the epochs, and the y-axis represents the accuracy at the corresponding epoch. Remember, the higher the reading in the accuracy graph, the better the model. The range of accuracy is 0 to 1.

Testing the Model

To test the model simply, use the microphone directly and check the classes as shown in the below image:

You will be able to test the difference in audio samples recorded from the microphone as shown below:

Export in Block Coding

Click on the “Export Model” button on the top right of the Testing box, and PictoBlox will load your model into the Block Coding Environment if you have opened the ML Environment in the Block Coding.

 

The Humanoid will move according to the following logic:

  1. When the audio is identified as “clap”- Humanoid will move forward.
  2. When the “snap” sound is detected –the Humanoid will move backward.

Note: You can add even more classes with different types of differentiating sounds to customize your control. This is just a small example from which you can build your own Sound Based Controlled Humanoid in a very easy stepwise procedure.

Code

Logic

  1. First, initialize the Humanoid extension.
  2. Then, initialize a forever loop to continuously loop and analyze the camera from the stage.
  3. If the program detects a clap sound, the Humanoid will move forward at a specific speed.
  4. Similarly, if it identifies a snap sound, the Humanoid will move backward at a specific speed.
  5. Otherwise, the Humanoid will remain in its initial position (home position).

Output

Read More
All articles loaded
No more articles to load
Table of Contents