2. Self-driving

Self-driving

Self-driving cars, it may seem like something from the future.

Us at CodesCool are doing our part. Programme your mBot so it drives by itself.

You get 40 minutes to programme your robot.

Good luck!

You"ll learn how to:

  • Direct the mBot without using the remote.
  • Let the mBot drive and stop on its own.
  • Develop problem-solving skills. 
     

You'll be needing

STEP 1

Exercise

Before you can begin, you should plot the course. First, determine where you’re going to start and stop. You can mark the spots on the floor with adhesive tape. Or you can draw a rectangle (16x20 cm) on a piece of paper. The mBot will fit perfectly.

Challenge a friend. Who will park their mBot as accurately as possible?

To do:

  • Put your mBot in the right place in the rectangle.
  • Push the front button of the mBot to make it start. 
  • Park your mBot as accurately as possible on the intended spot.
  • As soon as you start the mBot, you’re not allowed to touch it anymore.
  • You get 40 minutes to write and finalise your programme.

STEP 2

Letting your mBot drive on its own

You already know about the button at the front of the mBot. You can programme this button by dragging the block into the script area.

blocks

The mBot has to drive, so you know from the previous class which blocks to use.

Tips

  • You can't programme the mBot to drive, for example, 1 metre forwards. You can make it drive at a certain speed for a certain amount of time.
  • Put the power on 100 % and drive for 2 seconds. How far will your mBot drive if you lower the power to 50 %?
  • Test it out and see if you want to drive quickly for a short amount of time. Or is it better to drive a bit slower?
  • To see if you have set up everything correctly, you should check if your mBot is parked well in its space. Does it have to turn slightly left after its drive because it didn’t drive straight ahead?
     

STEP 3

Extra

You can add as many assignments as you want. We’ll name a few, but please do use your own imagination.

  • Make the distance bigger between the place where you want to start and stop.
  • Make the space in which the mBot has to stop smaller. 
  • Provide multiple stopping places. The closer you get to each stopping place, the more points you earn.
  • Drive as closely as possible to an object without knocking it over.
  • Drive to the stopping place, wait 1 second and drive backwards to where you came from.
     

Don’t hesitate to let us know some of your ideas.

Have fun!!!