For the SumoBot WX to roll forward, the left and right wheels have to turn in opposite directions. It may sound counterintuitive, but take a look at the left side of your SumoBot. See how the left wheel has to roll counterclockwise if it’s going forward? Now, look at the right side. The right wheel has to turn clockwise for forward motion.
Each wheel is independently controlled by its own block. The next diagram shows some examples of wheel speeds and how they relate to forward and backward with speed control.
For example, to make the SumoBot roll full speed forward, one block has to have its PIN set to 26 to control the left servo, with a speed of 100 for counterclockwise wheel rotation. A second block with its PIN set to 27 to control the right servo and speed -100 for clockwise rotation. For full speed reverse, one block would need PIN 26 and speed -100 for the left servo and PIN 27 and speed 100 for the right servo. To make the SumoBot stop, set both P26 and P27 block speeds to 0.
Since the wheels are controlled independently, you can get pretty creative with maneuvers. This animation shows the results of various combinations using -100, -50, 0, 50, and 100 for speed. Watch it carefully, and think about which direction and how fast each wheel turns in response to the speed values.
In this activity, you will test some of the pin and speed combinations.
Looking at the SumoBot from the above, its plow is attached to the front. If the SumoBot board is mounted correctly, the POWER switch should be at the back, and the SumoBot WX label should be at the front-right.
This program will make the SumoBot execute this sequence of 3-second maneuvers: roll forward, spin left, spin right, roll backward, stop. In addition to getting familiar with using speeds and times for maneuvers, it will also help verify that the serovs are connected properly with the left servo connected to the P26 port and the right to P27.
If you noticed that your SumoBot was veering slightly to the right or left at top speed, the trick to correcting it is to figure out which wheel is turning faster and slow it down with a lower speed value. More about that in the Your Turn section...
These blocks make the SumoBot roll forward at full speed, by making the left (P26) servo turn counterclockwise with a speed of 100 and the right P27 servo turn clockwise with a speed of -100. This maneuver continues for 3 seconds. It could potentially go longer than that if the next blocks are not CR servo PIN...speed… blocks.
These blocks make the SumoBot turn in place to the left at half speed, by making both the left (P26) and right P27 servo both turn clockwise with a speed of -50. The result is that the SumoBot spins in place turning left, and the maneuver also continues for 3 seconds.
These two blocks are almost identical to the previous ones. The only difference is that the speed values are both 50 instead of -50. Since both blocks are positive instead of negative, both wheels turn counterclockwise instead of clockwise. The result is that the SumoBot turns in place to the right (instead of to the left).
Compare these blocks to the full speed forward blocks at the beginning of this program. See how the negative signs are swapped? That’s a sure sign that the SumoBot will roll in the opposite direction—backward in this case. The P26 left wheel turns at a speed of -100, which is full speed clockwise, and the P27 right wheel turns at a speed of 100, which is full speed counterclockwise. As with the other maneuvers, this one continues for 3 seconds.
These two blocks set the servos to zero speed, and since no other blocks are below it, the program ends. Since another processor is managing the servo signals, it continues to send the zero speed signal to both servos.
Each maneuver involves two wheel speeds and an amount of time.
To decrease the distance of a forward or backward maneuver, you have a choice of decreasing either the speed or the time. Likewise, distance will increase with either a longer time traveled or a higher speed. Increasing the speed to increase distance only works if the servos are not already going at top speed though.
Turns can also be greater or smaller angles, and speed and time are the two variables that can be adjusted. If speed remains the same, but time is reduced, the angle turned will be less. Alternatively, the maneuver time can be left unchanged and the wheel speeds can be increased or decreased for smaller or larger angle turns.
When the SumoBot can “see” its opponent, top speed maneuvers to either start pushing or get out of the way are common. If the SumoBot is searching for its opponent, it is sometimes better to move slower while scanning left and right with sensors.
Let’s take a closer look at how changing the maneuver times changes the distances traveled and angles turned.
As mentioned at the beginning, the more practice you get with maneuvers, the better. So, here are some challenges to help build your maneuver creating and building skills.
If your SumoBot curved when you expected it to go straight, the solution is simple: slow down the faster wheel. Here are three short example programs. The top-center one is the test to see if your SumoBot curves. If it curves to the left, the first step is to change the CR servo PIN 27 block’s speed value from 100 to 90. If it curves to the right, the first step is to change the CR servo PIN 26 block’s speed value from 100 to 90.
Also, keep in mind that making the SumoBot go perfectly straight is not nearly as important in the Sumo ring as it would be in a dead reckoning contest where every little error adds up.
This activity began with an explanation of the variety of maneuvers two independent drive wheels could execute. Some examples we haven’t tried yet include pivots, where one wheel is set to speed zero, and curves, where the two wheel speeds are different, like one wheel with speed 100, and the other with speed 50.