Today we will continue to familiarize ourselves with using conditionals and sensory input in Blockly. We will also introduce the concept of angle arithmetic and how to use it to control multiple joints at once. We will then apply these concepts to a fun and competitive exercise where you will program your ClicBot to battle against your classmates' ClicBots.
The goal of this exercise is to create a ClicBot robot that is controlled by the rotation of one of it's joints. If you rotate the joint quickly, the robot will move fast. If you rotate the joint slowly, the robot will move slowly. Let's get started.
First, build a ClicBot that looks like the following picture:
As mentioned before, you'll rotate one of the ClicBot's joints to guide it's forward speed. We've attached the ClicBot holder to make this joint easier to rotate. See below for an example of how to rotate this joint for this exercise.
Now that we have the robot set up, let's get more specific about it's behavior. You'll design three "modes" for the robot:
You'll likely find the following code blocks helpful for this exercise:
You'll want to use the if
block to detect how fast your joint is moving. You'll use the sensor block Detect rotation speed of Joint [NO.X]
to get the rotation speed of the joint. You'll need to compare it to a numeric value. Then, you'll need to specify the wheel rotations that will follow that joint rotation speed using the Wheel [NO.X + Direction] rotation, speed
block.
Some tips for this exercise:
else
condition at the end and what that could be used for.The goal of this programming exercise is to design a robot dog that responds with emotion to your touch and/or gestures. This exercise is intentionally open ended so that you can express your creativity in the types of interactions and gestures you produce.
Examples of emotional reactions you could program include:
Some recommendations we have for you as you approach this exercise include:
Touch sensor detect touch on Brain's []
blocks, the Gesture sensor detect []
blocks, and the Touch screen detect
blocks to approach this task.In this first exercise, get some hands on experience with measuring joint angles and using that measurement to move other joints. To begin, build a ClicBot that has 6 joints with the base, a long arm, a gripper, and a brain, as pictured below.
Then, create a new program that measures the angle of joint A (pictured). HINT: use the "detect servo angle" sensor in the sensors tab.
Once you're familiar with how the angle reading of joint A changes as you rotate the joint upon its axis, add additional logic to make joint B mimic the movements of joint A.
HINT 1: you can use constant offsets to account for the angle difference in which joint A and joint B start at.
HINT 2: is your logic correct but the program not doing anything? Maybe it is doing something really but just doing once, really quickly that you didn't notice. How do you get it to keep doing it?
This is what your finished product should do.
Here's a link to today's exit ticket survey. The exit ticket will ask you for: