🤸Lesson 1: Movement
Last updated
Last updated
Welcome to your very first lesson in Misty Blockly! The aim of this lesson is to explore Misty's range of motion and help you understand how to program her to move. If you have any questions about the individual movement blocks, you can check out the Movement section under Blockly Elements.
When you meet a robot for the first time it can be a little scary since you don't know what it will do, that's why it's important to start your interaction with a greeting. It's not only an ice-breaker, but also a fun way to let humans know that Misty is a friend. Let's get Misty to wave her arms! Select the arm block from the 'Movement' tab in Misty Blocks and place it in your Blockly workspace. With this block you can control both her arms, since her arm range is limited, you can choose values between -90 (up) and 90 (down). You can also choose the speed of the arm movements with values between 0 and 100. Try out different combinations!
If you don't want to get stuck changing the values of your arms every time, you can create a sequence by adding a second arm movement block. To run your arms in a timed sequence you'll need to use the timer block between the two arm blocks. This block will help you to determine the amount of time you need for each block to run. You can find the timer block in the 'Miscellaneous' tab in Misty Blocks. The minimum amount of time you can set is 0.1 seconds (100ms). Try starting with 1 second (1000ms).
Note: If you don't use a timer block the program will try to run every block at the same time in the sequence and the sequence may not be completed. When you are testing your program adjust the timer to allow Misty to complete each action in the sequence. It's not necessary to insert a timer block between two movement blocks of different kinds. For example, Misty's arms and head have different motors so they will still execute the code independently, but if you put two arm blocks together, they will both try to run at the same time.
Now you can connect the second arm block to your timer to make Misty raise her right hand and pull down her left hand. Wait one second and then switch them. You can also try out using different values. What's missing? Make the greeting as natural as you can!
Now that you are comfortable with moving Misty's arms, let's explore how to get her to look around the room. Select the head block from the 'Movement' tab in Misty blocks and place it under your arm sequence, don't connect it just yet. Pitch is the first head range that you can use to make Misty look up or down. The pitch range values are -40 (up) to 25 (down). To make Misty roll her head left or right, you can change the roll range values from -90 (right) to 90 (left). Finally, if you want Misty to simply turn her head left or right, you can use the head yaw range values -42 (left) to 42 (right). Remember that you can choose the movement velocity. Give it a go!
Once you are familiar with how to move Misty's head, you can start combining different movement blocks, let's try to connect the head block to an arm sequence and program Misty to dance. Remember to use the timer block to time your sequence.
Do you want to run the sequence again? Instead of clicking the 'Run' button every time, you can use the repeat block found in the Basic Blocks 'Loops' tab and choose how many time you would like Misty to repeat the sequence. Repeat blocks are very useful if you would like to save time and avoid rebuilding the same sequences. Find out more about loops here: Loops
Now that you have a hang of how to move Misty's arms and head, let's get Misty rolling. Misty has tracks that allow her to drive anywhere in your room and turn at any angle, giving you full control of where you want her to go. Select the drive block and choose the values for linear velocity, angular velocity and time. The linear velocity sets Misty's speed in a straight line, its range is -100(backward) to 100(forward). The angular velocity sets Misty's speed in rotation, its range is -100(clockwise) to 100 (counter-clockwise). You can also set the duration in seconds. Try it out!
Great job! You've got Misty rolling, let's give her a little guidance on where to go. Connect the blocks to make Misty drive forward for 3 seconds, turn right, and drive forward for 3 seconds more. Try out different combinations until you feel happy with your path plan.
If you don't like going in a straight line, well then Misty has the right block for you. The drive arc block allows you to make Misty drive at a curve. Select the block and choose a value for heading, radius and duration. For example, you can run this block to make Misty drive an arc of 0.5 meters of radius, doing half circumference in 5 seconds. Try it out and find the values that you are most comfortable with.
Finally, let's combine what we've learned and imagine Misty just rolled out onto a red carpet to show off her incredible talents. You can get her to drive forward and greet everyone on the left and right two times, and stop her one second after she has finished saying hello to all her fans.