Difference between revisions of "Pi-puck"

From GCtronic wiki
Jump to: navigation, search
(Getting started)
(Getting started)
Line 49: Line 49:
  
 
==Capture an image==
 
==Capture an image==
 +
 +
==Audio recording==
 +
 +
==Audio play==
 +
 +
==WiFi configuration==
 +
 +
==File transfer==
  
 
=Operating system=
 
=Operating system=

Revision as of 11:44, 17 April 2019

1 Overview


Features:

  • Raspberry Pi zero W (rPi) connected to the robot via I2C
  • interface between the robot base camera and the rPi via USB
  • 1 digital microphone and 1 speaker
  • USB hub connected to the rPi with 2 free ports
  • uUSB cable to the rPi uart port. Also ok for charging
  • 2 chargers. 1 for the robot battery and 1 for the auxiliary battery on top of the extension
  • charging contact points in front for automatic charging. External docking station available
  • several extension options. 6 i2C channels, 2 ADC inputs
  • several LED to show the status of the rPi and the power/chargers

2 Getting started

This introductory section explains the minimal procedures needed to work with the Raspberry Pi Zero W mounted on the Pi-puck extension board and gives a general overview of the available basic demos and scripts shipped with the system flashed on the micro SD. More advanced demos are described in the following separate sections (e.g. ROS), but the steps documented here are fundamental, so be sure to fully understand them.

The extension is mostly an interface between the e-puck robot and the Raspberry Pi, so you can exploit the computational power of a Linux machine to extend the robot capabilities.

In most cases, the Pi-puck extension will be attached to the robot, but it's interesting to note that it can be used also alone when the interaction with the robot isn't required.
The following sections assume the full configuration (robot + extension), unless otherwise stated.

2.1 Requirements

The robot must be programmed with a special firmware in order to communicate via I2C bus with the Raspberry Pi mounted on the Pi-puck extension.

2.1.1 e-puck1

2.1.2 e-puck2

The e-puck2 robot must be programmed with the following firmware e-puck2_main-processor_gumstix.elf and the selector must be placed in position 10.

2.2 Console mode

The Pi-puck extension board comes with a pre-configured system ready to run without any additional configuration.
In order to access the system from a PC in console mode, the following steps must be performed:
1. connect a micro USB cable from the PC to the extension module. If needed, the drivers are available in the following link USB to UART bridge drivers
2. execute a terminal program and configure the connection with 115200-8N1 (no flow control). The serial device is the one created when the extension is connected to the computer
3. switch on the robot (the extensino will turn on automatically); now the terminal should display the Raspberry Pi booting information. If the robot isn't present, then you can directly power on the extension board with the related button
4. login with user = pi, password = raspberry

2.3 Startup configuration

The following commands need to be executed at each startup, alternatively you can set to run them automatically at startup:

  • /home/pi/i2c_enable
this is neeeded to enable the I2C bus
  • sudo python3 /home/pi/camera-test.py
this is needed to correctly configure the camera of the robot

2.4 Communicate with the robot

2.5 Communicate with the IMU

2.6 Communicate with the ToF sensor

2.7 Capture an image

2.8 Audio recording

2.9 Audio play

2.10 WiFi configuration

2.11 File transfer

3 Operating system

The system is based on Raspbian Stretch and can be downloaded from the following link gctronic-stretch-ros-kinetic-opencv3.4.1.img.tar.gz.

user/pw: pi/raspberry
The system starts in console mode, to switch to desktop (LXDE) mode issue the command startx.

When booting the first time, the first thing to do is expanding the file system in order to use all the available space on the micro sd:
1. sudo raspi-config
2. Select Advanced Options and then Expand Filesystem
3. reboot

4 ROS

ROS Kinetic is integrated in the Pi-puck system.

4.1 Initial configuration

The ROS workspace is located in ~/rosbots_catkin_ws/
The e-puck2 ROS driver is located in ~/rosbots_catkin_ws/src/epuck_driver_cpp/
Follow the steps in the section Robot configuration, only once.
Follow the steps in the section System: Startup configuration, each time the system is powered on.
The PC (if used) and the Pi-puck extension are supposed to be configured in the same network.

4.2 Running roscore

roscore can be launched either from the PC or directly from the Pi-puck.
Before starting roscore, open a terminal and issue the following commands:

where roscore-ip is the IP of the machine that runs roscore
Then start roscore by issueing roscore.

4.3 Running the ROS node

Before starting the e-puck2 ROS node on the Pi-puck, issue the following commands:

where pipuck-ip is the IP of the Pi-puck extension and roscore-ip is the IP of the machine that runs roscore (can be the same IP if roscore runs directly on the Pi-puck).

To start the e-puck2 ROS node issue the command:
roslaunch epuck_driver_cpp epuck_minimal.launch debug_en:=true ros_rate:=20

The following graph shows all the topics published by the e-puck2 driver node:
Click to enlarge

4.4 Get the source code

The last version of the e-puck2 ROS node can be downloaded from the git: git clone -b e-puck2 https://github.com/gctronic/epuck_driver_cpp.git

5 OpenCV

OpenCV 3.4.1 is integrated in the Pi-puck system.

5.1 Blob tracking

A simple demo was developed to track an orange blob. It is thought to be run with the omnivision extension. The robot rotate in place towards the target when it finds one.
The code can be downloaded from the following repo: git clone https://github.com/e-puck2/e-puck2_pi_blob-tracking.git