TABLE OF CONTENTS
Software 1. ARC for Windows PC 2. Example Projects 3. Controls 4. Getting Help with Controls 5. ControlCommand() 6. Virtual Desktops 7. RoboScratch 8. Blockly 9. EZ-Script Mobile Software 1. Create a Mobile App Linear Programming 1. Create a Scene Using RoboScratch (Big Hero Six) 2. Create a Scene using Blockly (Avengers) Logical Programming 1. Programming Concepts (Variables, If/Else, Logic) 2. Counting Up 3. Counting Down Camera Input 1. Introduction to the EZ-B Camera 2. Face Detection with RoboScratch 3. Face Detection with Blockly 4. Face Detection with EZ-Script 5. Color Tracking with Servos 6. Color Tracking with Movement 7. Detecting Multiple Colors 8. Line Following with Roli, AdventureBot and Shell-E 9. Vision - Object Training & Recognition 10. Glyphs to Control Robot Movement 11. Detecting Glyphs & Augmented Reality 12. QR Code Detect 13. Microsoft Cognitive Emotion 14. Microsoft Cognitive Vision Audio Input 1. Speech Recognition RGB Output 1. RGB Animations Positioning 1. Servo Control 2. Introduction to Servo Motors 3. Create a Robot Dance 4. Program Robot to Dab 5. Program Robot to Play Piano 6. MYO Gesture Armband Navigation and Movement 1. Movement Panels 2. Navigating using RoboScratch 3. Navigating using Blockly Creative Applications 1. Customize Your EZ-Robot 2. Control Robot From Twitter 3. Nest Thermostat EZ-B v4 Robot Brain 1. EZ-B v4 Robot Brain Overview 2. DIY Autonomous Robot Vehicle 3. EZ-B v4 and IoTiny Wi-Fi Modes 4. Change WiFi Name 5. Resetting Your EZ-B v4 or IoTiny 6. USB WiFi or Ethernet Adapter Robot Troubleshooting 1. Which Robot are You Using? |
Color Tracking With
|
|
|
|
Introduction to Tracking
There are two kinds of tracking behaviors, each with its own parameters. Do not confuse a tracking behavior with a tracking type. Here are the differences...
Tracking Type: This is what the robot is looking for... The color red? Motion? A face? Glyph? An Object? Etc. Tracking types are found on the main screen of the Camera control under the Tracking tab. When a box is checked (or colored black) it means the associated tracking type is active.
Tracking Behavior: This is how the robot responds when it recognizes/tracks an object. The robot may move servos to follow the tracked object or it may move the entire robot toward the object. In addition to having the robot move in response to a tracked object, you may also have the robot execute scripts. This is also a behavior. The Tracking Behaviors are found in the Settings dialog of the Camera Control.
*Note: Movement Tracking will not work with JD due to camera movement during walking. Instead, JD can track an object with Servo Tracking.
What You Will Need
*Note: We will be tracking a color in this lesson. This means that any objects in the background of the same color (red) will confuse the robot. Always track colors in a room without other similar colors in the background.
Step 1
Locate the Camera Control and Start the Camera.
Press the Settings/Config Button (It's the "..." in the top right corner in ARC, or the Gear Icon in EZ-Builder). This will open the Config Dialog box.
Within the Config Dialog, it is important to ensure that neither Servo Tracking nor Movement Tracking are selected. The highlighted checkboxes should be empty (see below). We will activate these once all the other parameters are set up.
*Note: If Movement Tracking is activated, your robot may move unexpectedly, and could fall off your desk or table.
There are two kinds of tracking behaviors, each with its own parameters. Do not confuse a tracking behavior with a tracking type. Here are the differences...
Tracking Type: This is what the robot is looking for... The color red? Motion? A face? Glyph? An Object? Etc. Tracking types are found on the main screen of the Camera control under the Tracking tab. When a box is checked (or colored black) it means the associated tracking type is active.
Tracking Behavior: This is how the robot responds when it recognizes/tracks an object. The robot may move servos to follow the tracked object or it may move the entire robot toward the object. In addition to having the robot move in response to a tracked object, you may also have the robot execute scripts. This is also a behavior. The Tracking Behaviors are found in the Settings dialog of the Camera Control.
*Note: Movement Tracking will not work with JD due to camera movement during walking. Instead, JD can track an object with Servo Tracking.
What You Will Need
- A calibrated, assembled and connected Six, Roli or AdventureBot with a charged battery
- A red ball in a brightly lit room with little shadows
- Load the default example project for your robot on your computer (Roli, Six or AdventureBot)
*Note: We will be tracking a color in this lesson. This means that any objects in the background of the same color (red) will confuse the robot. Always track colors in a room without other similar colors in the background.
Step 1
Locate the Camera Control and Start the Camera.
Press the Settings/Config Button (It's the "..." in the top right corner in ARC, or the Gear Icon in EZ-Builder). This will open the Config Dialog box.
Within the Config Dialog, it is important to ensure that neither Servo Tracking nor Movement Tracking are selected. The highlighted checkboxes should be empty (see below). We will activate these once all the other parameters are set up.
*Note: If Movement Tracking is activated, your robot may move unexpectedly, and could fall off your desk or table.
Step 2
Within the Camera Control, activate the tracking function by pressing the Tracking Tab and selecting Color.
Step 3
Press the Color Tab in the Camera Control and hold your bright red/orange ball in front of the camera. We will tune the color settings to detect the object in the next step.
Step 4
Slide the Object Brightness dial left and right to fine tune the object detection. The preview window will display RED on any objects that the robot is detecting. You'll also notice a Blue Box around all detected objects. Adjust the sliders so that only the colored ball is detected, with a blue box around it.
*Note: Leave the Min Object Size slider at its default setting. There is no need to change this value at this time.
If you notice a lot of highlighted fragments in the image (see the picture below), then you'll need to lower the Object Brightness slider or change the background so that there are no Red/Orange objects in it.
These fragments are called false positives and will prevent your robot from knowing what color to follow.
*Note: If you are unable to adjust the Brightness slider to remove false positives, then it's possible the room is too dark, or the colored object is not vibrant enough.
Step 5
In the above pictures, you'll notice that each image has a grid with nine quadrants.
The robot knows which direction to turn by the location of the tracked color/object within that grid.
If the object is detected in the LEFT grid quadrant, the robot will turn left. If the color is in the RIGHT quadrant, the robot will turn right. If the object is detected in the CENTER quadrant, the robot will move forward. In this lesson, the TOP and BOTTOM quadrants are not used. You will only use the Top and Bottom quadrants for Movement Tracking when using a flying robot (i.e. AR Parrot Drone).
Step 6
How close do you hold the object to the camera? You want the object to be large enough to get a strong reading, but not so large that it spills out into other quadrants on the grid.
If you find that the robot isn't responding quickly enough when you move the colored object, you can adjust the location of the grid lines by pressing the Grid Tab and moving the top two sliders (see image below).
The closer to the middle that your lines are, the more responsive the robot will be, but if the lines are too close then the robot might get stuck turning back and forth, as the colored object moved between the left and right quadrants. The lines need to be far enough apart so the robot doesn't turn too far in between rechecking where the colored object is.
Step 7
Now that your Color Tracking Parameters are set up, you'll want to activate the Movement Tracking.
Press the Settings/Config Button (It's the "..." in the top right corner in ARC, or the Gear Icon in EZ-Builder). This will open the Config Dialog box
Within the Config Dialog, activate all of the following:
- Movement Tracking
- Allow Forward Movement
- Allow Left/Right Movement
- Movement Delay
When the robot detects a target color, it will move in that direction for the amount of time specified in the Movement Delay box (highlighted Green) before checking for the location of the color again. If this setting is too low, the robot might jerk but not move. If the setting is too high, the robot might turn too far and completely lose sight of the object.
In the example above, the Movement Delay field is set to 100. This value will need to be different for Roli and Six.
Roli usually has a Movement Delay setting around 100ms to 200ms, depending on the PWM speed of the HBridge. If you find that Roli is turning too quickly, you may want to adjust the PWM speed in the HBridge Movement Panel to a slower speed.
Six takes much longer to turn and requires a longer interval between checks. Setting Six's movement delay to 2000ms or 3000ms will allow enough time to turn.
Upon completion of this tutorial, you can find the optimal value for the Movement Delay based upon your robot speed and the distance to the colored object that it is tracking. For now, set it to the recommended values that we listed above.
You can also choose to use the Speed Settings for robots that have Continuous Rotation Servos or HBridges, such as AdventureBots and Roli. The Speed Settings will not work for robots that need to move regular servos, such as Six
*Note: Your robot is now set up to Track colors. As soon as you press the SAVE button, the Dialog box will close and your robot will begin tracking colors. Make sure your robot is on the ground, so it doesn't move unexpectedly and fall of the desk or table.
Press the SAVE button to save the settings.