Moving the Robot (miniBloq)

Introduction

Moving your Sparki is easy. Sparki is a differential drive (or differential wheeled) mobile robot. This means that the robot movements are driven by the difference in speed between the left and the right wheel. For example, if the right wheel is rotating faster than the left one, the robot will turn left: Moving the robot On the other hand, if the wheels move in opposite directions at the same speed, the robot will rotate around its center (which is also the exact place where it can hold a marker to draw): Moving the robot The following images demonstrates the main movements that we can program for Sparki, playing with different speeds on its left and right wheels::

Now let’s move it!

Having learned this, we are now going to see how to program the robot in order to move it. Warning_Triangle Please remember to check that the batteries are properly connected (and charged!). And as we are going to use the motors here, please check that the On/Off Switch is on. Another important thing to take care of when playing with the robot’s motors is to be careful not to be working over a table. A fall from that table could permanently damage your Sparki. So let’s start to program. Fortunately, the Sparki features some commands that will help us to program the desired movements, without worrying about controlling the individual speed of each wheel. These high level instructions are: 1. To move the robot forward and backward:   2. To rotate Sparki around its own center: The following example shows how to use these blocks to make Sparki move forward for 5 cm, move backward (again for 5 cm), then rotate 90 degrees to the right, and finally rotate 90 degrees to the left: See how easy is to move Sparki using miniBloq? Just with these four blocks, we can tell the Sparki to accurately rotate, advance, and go backward. In future lessons we will be making use of these blocks to achieve more complex behaviors with Sparki.   Questions
  1. Why do you think that moving the wheels at different speeds and with opposite directions does not make sense?
  2. What other vehicles in real life use this system (differential drive) to move?
  Extra Activities Why not try to make some trajectories using the commands that you have learned in this lesson? And of course, you can always attach a pen or a marker to start creating some drawings with your Sparki! Here are some ideas:

SparkiDuino Programming Environment

This lesson is also available for the SparkiDuino Programming Environment. SparkiDuino will allow you to program your Sparki using standard Arduino syntax.