Skip to main content

First Steps

Welcome to the UNIFR API e-puck’s documentation.

unifr_api_epuck is a simple API wrapper that lets you control a real or simulated e-puck robot. Please find below the instructions to get started with the API for Python3.

Submitted by: David Roman Frischer

Object detection section by: Vincent Carrel

Supervisor: Dr. Julien Nembrini

documentation : https://unifr-api-epuck.readthedocs.io/en/latest/

Requirements

  • Python3.x on your computer.

  • Webots or a real e-puck.

How To Start

With Real Robots

  1. How to install the package from your terminal.

    $ pip install unifr_api_epuck
  2. How to implement
    • To import the package:

    from unifr_api_epuck import wrapper
    • To create an instance of the robot:

    #Put the IP address of your robot.
    MY_IP = '192.168.43.125'
    r = wrapper.get_robot(MY_IP)
    • To control the robot by calling its actions:

    r.init_sensors() #initiates the sensors
    r.set_speed(-2, 2) #makes it turn around itself
    
    #infinite loop
    while r.go_on():
        prox_values = r.get_prox() #gets the values of the proximity sensors
        print(prox_values)
    
    r.clean_up() #makes a reset
  3. To run the file

    $ python3 my_controller_file.py

With Webots

  1. How to install the package from your terminal.
    $ pip install unifr_api_epuck
  2. How to implement your Python controller
    • To import the wrapper from the package:

    from unifr_api_epuck import wrapper
    • To create an instance of the robot:

    r = wrapper.get_robot()
    • To control the robot by calling its actions:

    r.init_sensors() #initiates the sensors
    r.set_speed(-2, 2) #makes it turn around itself
    
    #infinite loop
    while r.go_on():
        prox_values = r.get_prox() #gets the values of the proximity sensors
        print(prox_values)
    
    r.clean_up() #makes a reset
  3. To run the file:

    • ⏯ press play on Webots

Simple Example Code

Q: What does it do ?
A: The robot goes forward at a speed of 2 and prints its proximitiy sensor values.
from unifr_api_epuck import wrapper

ip_addr = '192.168.43.125'
r = wrapper.get_robot(ip_addr)

r.set_speed(2)        #sets the speed of the wheels
r.init_sensors()      #initiates the proximity sensor

#infinite loop
while r.go_on():
    print(r.get_prox()) #prints the proximity sensor values on the terminal

    #inserts some more code here to control your robot

r.clean_up()

Graphic User Interface

  • A GUI is available in the package. To start it, please run the following command:

$ python3 -m unifr_api_epuck -g

Sources

Wifi Protocol between Robot <–> computer

https://www.gctronic.com/doc/index.php?title=e-puck2_PC_side_development#WiFi_2

http://projects.gctronic.com/epuck2/complete.py

https://github.com/nembrinj/epuckAPI/tree/master

Webots

https://www.cyberbotics.com/doc/reference/nodes-and-api-functions

Multiprocess

https://docs.python.org/3/library/multiprocessing.html#multiprocessing.managers.SyncManager

https://stackoverflow.com/questions/2545961/how-to-synchronize-a-python-dict-with-multiprocessing

Socket errors

https://docs.python.org/3/library/exceptions.html#OSError

Pi-Puck

https://pi-puck.readthedocs.io/en/latest/

https://github.com/yorkrobotlab/pi-puck

https://github.com/gctronic/Pi-puck

UNIFR logo Human-IST logo

Metadata

Release files for unifr-api-epuck 1.3.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unifr-api-epuck 1.3.11
File Size Uploaded
unifr_api_epuck-1.3.11.tar.gz 39.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for unifr-api-epuck 1.3.11
File Interpreter ABI Platform
unifr_api_epuck-1.3.11-py3-none-any.whl Python 3 none any Details

Total release size: 78.5 MB

Release files / unifr_api_epuck-1.3.11.tar.gz

Download URL unifr_api_epuck-1.3.11.tar.gz
Size 39.3 MB
Tags Source
SHA-256 checksum
How to use checksums
f0ed9861cb4bc4c732190d49ceb488cbc714f89dbbd90001ae16215d2fae34f0
BLAKE2b-256 checksum
How to use checksums
c22fefd151d4320aadf881dac9ba6587e6eb6dbdb42d529a6b8407d153f2437d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / unifr_api_epuck-1.3.11-py3-none-any.whl

Download URL unifr_api_epuck-1.3.11-py3-none-any.whl
Size 39.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
0ecc06d92c3b0f75e8ded9155be39bd15f519e4110d62c8d6cd0f29b6e9471c5
BLAKE2b-256 checksum
How to use checksums
0ebe4b9017201962c56d825c0b857251ba9be3d5fb97109dfc438c5b3410379f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.3.11 This release

2 release files

1.3.9

1 release file

1.3.8

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page