Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

Line follow

Activities

Using a modified version of the GCTronic E-puck to do line following and object avoidance.

The Puck robot has a series of distance sensors looking outwards around the edge that can be used to percieve objects.

There are a series of light sensors around the edge looking downwards that can be used to percieve marks on the ground.

Sensor positions

Line follow

Simulation of a line following track from a competition such as RobotChallenge.

  1. Open Webots.
  2. File -> Open World
  3. Select the worlds/linefollow.wbt file from the same folder that contains this README file.
    • Probably the "My Documents" folder.
  4. If the simulation is not running, press the Play button at the top.
    • To reset the simulation press the Reset button at the top.
  5. If you want to visualise what the sensors are seeing, go View -> Optional Rending.
    • Enable Show DistanceSensor Rays.
  6. An incomplete line following controller has been provided.
    • example_line_py - Python version
    • example_line - C++ version
    • To see and edit the controller code, select the robot, go to the controller attribute and use the select and edit buttons.
  7. Complete the controller so that the robot can navigate the course as quickly as possible.

Writing control code

In order to change the controller code we need to open the edit window.

  1. Select robot in the scene tree (the menu on the left hand side).
  2. Select the controller attribute.
  3. Use "Edit" button to open the code window on the right hand side.
    • We can also use the "Select..." button to see existing available controllers.
  4. Controllers are stored in the "controllers" folder, each in a seperate directories.
    • The controller program must match the name of the folder to be automatically detected.
    • I.e. controllers/myController/myController.py for Python and controllers/myController/myController.cpp for C++.
    • You will need to compile C++ code, there is a compile button in the code window (the cog icon).

Documentation

The Webots documentation is available at https://cyberbotics.com/doc/guide/index.

In particular the programming documentation is available here https://cyberbotics.com/doc/reference/index.