Calibration is optional, but it will improve the accuracy of driving maneuvers. This one-time calibration aids the Robot blocks in measuring and correcting distances and speeds, using information from the servo's feedback connection.
Calibration
The calibration code takes about one minute to collect all of its data. You will need a smooth, and obstacle-free, floor area. While the calibration program is running, the ActivityBot 360° will pivot forward and backward, using only one wheel at a time. It will let you know when it's done by turning off its P26 and P27 lights (below the breadboard). This video shows an ActivityBot correctly performing the calibration.
IMPORTANT! USE FRESH BATTERIES FOR THIS STEP!
- Set the robot's power switch to 1, and connect it to your computer via the USB cable.
- In BlocklyProp, start a new project for the Activity Board.
- From the ROBOT block menu, place the Robot calibrate block in the workspace. Make sure ActivityBot 360° is visible in the drop-down menu.
- Click the Load and Run button. (Important: this program needs to be in EEPROM.)
- When the program is finished loading, the P26 and P27 lights will turn on. When they come on, turn off the robot's power (slide power switch to 0).
- Disconnect the robot from its programming cable and set it in a 1-meter square (3 ft. x 3 ft.), obstacle-free, smooth floor area.
- Set the power switch to 2 and move back to give it room to spin in place and slowly roam while it gathers wheel speed data.
- Leave it alone until the P26 and P27 lights turn off. After that, calibration is complete, and you can turn the power off again.
- IMPORTANT: Complete the Try This section on this page before doing anything else with your ActivityBot.
What if it didn't work?
If your robot did not move when you started the calibration program, or it started going backward first instead of forward, or if it started and stopped right away or just twitched, then double-check your electrical connections. You may have a servo cable or feedback signal wire plugged in incorrectly.
What if I need to restart or repeat the calibration?
To restart the calibration process, push the reset button any time while the P26 and P27 lights are on.
To repeat the calibration process once it has fully completed, you will need to use BlocklyProp to reload the program. That is because the program modifies itself at the end so that it cannot run a second time, which keeps your ActivityBot from trying to recalibrate the next time you turn power on to load a new program.
How it Works
Notice that the Robot calibrate block does not have any sockets or plugs for connecting it to other blocks. It is meant to be used by itself without any other blocks in a program, and it takes care of the entire calibration process automatically.
The Robot calibrate block collects requested speed vs. measured speed data and stores it in a part of the Activity Board’s EEPROM memory, where it can retain data even after you turn the power off. That way, the calibration data is available every time you turn the robot back on.
Later, when your project includes Robot blocks that set a certain wheel speed, the underlying code will use the calibration data from EEPROM to start driving the motors at speeds close to what your program asks. That way the code doesn’t have to make large corrections, just small ones, which improves overall accuracy.
Did You Know?
Encoders - An encoder converts information from one format to another. The ActivityBot's encoders convert wheel rotation or position into digital information that the Propeller microcontroller can use.
Encoder Ticks are not insects - Throughout this tutorial, you will see the term ticks when used to describe the ActivityBot's wheels turning. In this context, a tick means 1/64th of a wheel revolution. When the wheel makes one complete revolution, it has rotated 64 ticks. We use ticks per second to note how fast the wheels are turning. Ticks can also refer to distance traveled when considering the circumference of the ActivityBot wheel.
Feedback 360° Servo's Internal Encoders - Each Feedback 360° servo has a tiny magnet inside that is attached to the motor shaft. Also inside the servo's case is a Hall-effect sensor, which can detect changes in the position of the magnetic field as the motor shaft rotates. A tiny processor monitors the Hall-effect sensor and sends position information to the Propeller I/O pin. (For more details, see the Feedback 360° Servo product guide.)
Try This
There is a block that can check the ActivityBot's calibration data and tell you if there are any mistakes or problems with the ActivityBot's servo, encoder, and battery connections. If this test says the calibration was successful, your ActivityBot will be ready to run navigation programs. If not, then it will tell you what problem(s) it detects. After finding and fixing the problem, make sure to run both the calibration and this test again. Your ActivityBot will not be ready for navigation until it is calibrated AND it passes this test!
- Set the ActivityBot's power switch to 0, and reconnect the USB cable.
- Replace the ActivityBot 360° calibrate block with the ActivityBot 360° display calibration block,.
- Set the power switch back to 1, then click the Load and run (save to EEPROM) button.
- Check the Terminal output.
- If the Terminal output says "...calibration completed successfully", then you can skip to the Your Turn section because the servos, encoders, and power are all connected correctly. So, your ActivityBot is ready to run navigation programs.
- If the results in the Terminal say "...one or more problems were detected", it means that there is probably a mistake in the servo, encoder, or power connections.
- Make a note of the details that the Terminal reported; it provides for solving the problem.
- When you find and fix the first problem, rerun the calibration program above. Then, rerun this test. Repeat until you get the "...calibration completed successfully" message.
Your Turn
Now that you have successfully calibrated your ActivityBot 360°, it is time to run a simple test program to make it drive straight forward. The test code below makes both wheels rotate forward at 64 encoder ticks per second for 5 seconds, which should make your ActivityBot roll forward about 1 meter (3 ft.).
- Delete the calibration block, and build the project shown below.
- Reconnect your robot to your computer with the USB cable, and set the power switch to 1.
- Set the COM port, then click the Load and run (save to EEPROM) button.
- After the program loads, set the power switch to 0 and disconnect the USB cable.
- While holding the reset button down, set the power switch to 2, and set the robot down on a hard, smooth floor.
- Release the reset button, and monitor the robot’s travel.
Your robot should travel forward for about 1 meter (3 ft.) in a straight line. You may see slight shifts as the robot adjusts its course based on encoder feedback.
How it Works
The first block is Robot initialize, with the drop-down menu set to ActivityBot 360°. Place this block at the beginning of all projects that use other Robot set or Robot drive blocks.
Next is a Robot drive speed block with the number value 64 attached to both its left and right sockets. This makes both the left wheel and right wheel rotate forward at a rate of 64 ticks per second. The pause 5000 block allows the ActivityBot to drive forward at this rate for 5000 ms (5 seconds). After that, a second Robot drive speed block stops the right and left wheels with the number values 0, 0. We will explore this next.