What sort of robot would do well if it lived on a white table? How could it sense the edge and stop itself from tumbling over? If the robot had to keep moving, what sort of abilities would it need to keep from driving off? If the table were to change shape over time… or the robot were to be placed on a different table, what kind of robot rules would help it avoid a variety of edge shapes and angles of approach? How would it look? Could you reprogram the Cubelets to help ensure the survival of a table dwelling robot? These are the questions that guided the creation of the Cliff Scout.
Since the Cliff Scout will need to continuously move around the table, we can use two Drive Cubelets to create a robot that can travel and change directions. We could attempt to solve this problem by creating a robot that drives in a tight circle. Unfortunately, builders will discover that Cubelets robots will drift over time, and this may cause their robot to fall off the theoretical table.
So, we’ll need to reprogram the Drive Cubelets so they can spin in both directions and we’ll need to create some sort of triggering pattern to tell the robot when to turn. To detect the edge of a table, the Distance Sense Cubelets are placed at the front edges of the robot. This placement ensures that the robot can sense the edge as early as possible to avoid falling off. Placing the Distance Senses near the edges of the robot helps it avoid falls if it approaches an edge at an angle. The Distance Senses face down and are oriented in a way that allows them to detect the table edge quicker, giving the robot more time to react.
You’ll need the following Cubelets to build the Cliff Scout:
- 2 x Distance Cubelet
- 1 x Battery Cubelet
- 1 x Bluetooth Cubelet
- 2 x Passive Cubelet
- 1 x Flashlight Cubelet
- 1 x Rotate Cubelet
- 2 x Drive Cubelet
The C files for each Drive Cubelet are available for download by clicking HERE and HERE. Use Cubelets Flash to reprogram each Drive Cubelet. Ensure that you flash Drive Program 1 to one Drive Cubelet and Drive Program 2 to the other. If you don’t, your robot won’t turn properly.
In order for the Drive Cubelets to respond to table edge detections, you will need to update the Block IDs so that they match your two Distance Sensors.
- Use Cubelets Flash to identify your Block IDs by connecting your Bluetooth Cubelet, Battery Cubelet, and Distance Cubelets. If you’re not familiar with Cubelets Flash, click here to view a helpful tutorial video.
- Power on your robot and pair with the Bluetooth Cubelet using your system preferences or Bluetooth settings.
- Then open Cubelets Flash, select your Bluetooth Cubelet and click “Connect.”
- After you’ve successfully paired. You should see a Cubelets “block-map,” like the one pictured below.
- Click on the Distance Sense icon to bring up your block details.
- Write down the Block IDs for each of your Distance Sensors. Then power down your robot.
- Open the “Drive Program 1” C file in a plain-text-editor or other coding environment.
- Replace the Block ID markers in lines 11 and 12. They are noted with the marker “INSERT_BLOCK_ID.”
- Save your C file and repeat this sequence for the Drive Program 2 C file. Be sure to save your file as a “.c” file. Some text editors don’t save as .c by default so you may have to change the file extension manually!
- Reconstruct your robot to match the pictured robot. Below you will find a couple pictures to help you match the robot design.
- After you’ve completed your design, power on your robot and connect to the Bluetooth Cubelet. You should see a new map with more Cubelets.
- Select one of the two Drive Cubelets (for this robot it doesn’t really matter which one you choose.
- Find your modified Drive Program 1 C file and drag it into the box to reprogram your Drive Cubelet.
- Wait for the program to finish flashing, then click on the remaining Drive Cubelet.
- Find your modified Drive Program 2 C file and drag it into the box to reprogram the second Drive Cubelet.
- After you’ve successfully reprogrammed your Drive Cubelets, you’re ready to test out your robot.
- Place your robot in the center of the table. Bright surfaces work best, so you may have to lay down some white printer paper to get the proper behavior.
- Turn on your robot to see if it worked. You may want to be ready to catch your robot if you’re worried about your construction. But keep in mind you need to keep your hands away from the Distance Sensors, or they may interpret them as part of the table and you’ll cause your robot to fall!
- Once you’ve succeeded, or if you’ve devised a better robot solution let us know about it online with the hashtag #cubelets
Happy Building and stay tuned for more intensive robot activities!
Note: When you’re done playing with the Cliff Scout, you can restore your Cubelets to their default programming with Cubelets Flash. Just reconnect your robot, then select the Cubelet you’d like to restore. Then click “Restore Default Firmware.” Select the next Cubelet you’d like to restore and repeat.