E-puck-mobile-robot“The e-puck is a small (7 cm) differential wheeled mobile robot. It was originally designed for micro-engineering education by Michael Bonani and Francesco Mondada at the ASL laboratory of Prof. Roland Siegwart at EPFL (Lausanne, Switzerland). The e-puck is open hardware and its onboard software is open source, and is built and soldby several companies.” (Wikipedia)

Probably I will not find best description that this one from Wikipedia. The e-puck is a fantastic robot, it is small, it is open-hardware and have a fantastic community. I’ve used this robot for my Msc studies and are the protagonist of my Msc Project. Its small processor is not enough for my algorithms, so, I have implemented two libraries to control the e-puck though a Bluetooth connection.


This library is implemented in Python, the e-puck robot is a single class that can be used in any program. Surely you will find useful the documentation. You can make use of almost all sensors, but keep in mind that as more sensors you use more Bluetooth bandwidth will be necessary.

The library can be cloned or downloaded from my GtiHub repository. The last release is the 1.2.2. This version is programmed for Python 2.6. Despite it should be upgraded to be used with Python 3, at the moment I have no plans/time/robot to do it, so, any help is welcome.

Following, a small example to implement a simple line-follower behaviour. You will find the full documented and functional example into the ‘examples’ directory.

from ePuck import ePuck

# Some variables for the line follower
global_speed = 180
fs_speed = 0.6

# First, create an ePuck object.
mac = 'Your epuck\'s MAC direction'
robot = ePuck(mac)

# Second, connect to it

# You can enable various sensors at the same time. Take a look to
# to DIC_SENSORS for know the name of the sensors

# Now, start the line follower algorithm
while True:
	# Important: when you execute 'step()', al sensors
	# and actuators are updated. All changes you do on the ePuck
	# will be effectives after this method, not before

	# Now, we can get updated information from the sensors
	floor_sensors = robot.get_floor_sensors()

	# line_follower behaviour
	delta = floor_sensors[2] - floor_sensors[0]
	l_speed = global_speed - fs_speed * delta
	r_speed = global_speed + fs_speed * delta

	# Now, we set the motor speed.
	# Remember that we need to execute 'step()'
	# to make this command effective
	robot.set_motors_speed(l_speed, r_speed)

And here the result:

Qt4 – C++

Due to changes related with my project, I started to use the Qt4 Framework and a code migration of my python library was required. In this case, the e-puck Qt4 library is based in the work of the monitor program that you can find with the robot (I am sorry, but I do not remember where to find it. If you are the author and read this, pleas, write me to add the appropriate acknowledgement).

This library can be used in two ways:

  • Making use of the Slot/Signal mechanism
  • Into an infinite loop.

The library is also in my GitHub repository. Clone or download it as your prefer. This video show the ePuckcpp class working together with the Virtual Sensor:

Leave a Reply

Your email address will not be published. Required fields are marked *