Acceleration is a measurement of how quickly something speeds up or slows down. The ActivityBot's acceleration can be adjusted, which will be important in some robotic applications. For example, if your ActivityBot is bringing you a drink, you could make the acceleration gradual to prevent spills. Another example: if your ActivityBot is in a race, it might be more important to make it speed up as quickly as possible.
The ActivityBot robot's acceleration can be adjusted with the Robot set acceleration for block, which has settings for both distance and speed. The acceleration setting for distance maneuvers is typically slower to help improve accuracy. The acceleration setting for speed is usually a little faster to give the robot more peppy responses in sensor navigation.
You can also configure the speed limits for speed and distance maneuvers. The default speed limit for Robot drive distance maneuvers is 64 ticks per second. That's the cruising speed the ActivityBot reaches while on its way to its distance goal. For transporting a drink, it might be safer to pick a slower cruising speed. In a timed dead reckoning navigation contest, you might want to experiment with higher cruising speeds. The default speed limit for Robot drive speed is 128 ticks per second. Even though your code can change the speed at any time, there are some cases when sensors and variables might work together to ask for some unreasonably high speeds. Limiting the speed can prevent some "runaway" conditions.
This example sets the acceleration and cruising speed for Robot drive distance blocks to high values and then makes the ActivityBot travel 265 ticks forward. Then, it sets acceleration to a low value, cuts the cruising speed in half, and backs up the same distance. As you watch the ActivityBot, pay close attention to two things: (1) acceleration - how quickly it speeds up and slows down, and (2) cruising speed - the top speed it runs at for most of the trip.
The first block in the program is a comment noting the project name. The second block is frequency out, which makes a piezospeaker tone. If that tone plays in the middle of the program instead of at the beginning, it could indicate that the batteries are low. The third block is the required ActivityBot initialize. Make sure you set this one to match your particular robot - ActivityBot or ActivityBot 360. These first three blocks are used in all example programs that make the ActivityBot move.
Next, Robot set acceleration for distance blocks to 600 ticks/s2 uses a higher acceleration setting to make the ActivityBot speed up and slow down abruptly. The Robot set speed (+/-) for distance blocks 128 sets the top speed. That will be the Robot drive distance block's cruising speed, which is 2 full revolutions per second. After these settings, the first Robot drive distance block makes the ActivityBot go 256 ticks forward. The high acceleration setting causes the ActivityBot to speed up and slow down abruptly, while the high Robot set speed for distance setting directs the ActivityBot to use a high cruising speed to travel the distance.
When your robot completes the first maneuver, the next set of Robot set acceleration and Robot set max speed blocks has lower values. Then, a Robot drive distance block tells the ActivityBot to back up the same distance it just went forward. You will see that with the new acceleration setting, the ActivityBot gradually speeds up and slows down. With the new speed setting, the cruising speed is slower.
Step on the accelerator — Acceleration is the change in velocity over time. When the robot speeds up or slows down, that's acceleration. Keeping the ActivityBot's motions from being too jerky with sudden starts and stops, the Robot drive speed block gradually starts and stops maneuvers by accelerating and decelerating at a default rate of 600 ticks per second squared. You can change this default rate with the Robot set acceleration block. Be aware though, that it takes time for the robot to accelerate and decelerate, so changing this setting can change distance traveled. Also, be aware that, for individual robots, some combinations of speed and acceleration work better together than others.
Acceleration rules for Robot drive distance — The default acceleration is 200 ticks/s2 when using the Robot drive distance block. To change this default, use the Robot set acceleration for distance block. As above, be aware that increasing the acceleration may reduce distance accuracy. We recommend 200 ticks/s2 for speeds at 64 ticks per second or below, but feel free to experiment with higher values. Of course, results may vary with driving surface and whether your ActivityBot is carrying anything. So, test and tune!
Setting the acceleration and speed limit for Robot drive speed blocks is about the same as it is for distance. The main difference is that the Robot set max speed block can override a speed you set with the Robot drive speed block. The second Robot drive speed block in this example program tries to set the speed to left -128 and right -128. However, the Robot set max speed block immediately before it prevents the ActivityBot from ever going faster than 64 ticks per second.
Let's examine how the program can still think it is telling the ActivityBot to go a certain speed even though the Robot set max speed block has clamped the actual speed to a lower value. The terminal will show the speeds that it's telling the ActivityBot to go, and you can watch and see which speed it reaches.