Mission template software

From Rsewiki
(Difference between revisions)
Jump to: navigation, search
(Software structure)
 
(15 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
This is an example software in C++ to access both raspberry camera and REGBOT, and with an example mission controlled from the raspberry.
 
This is an example software in C++ to access both raspberry camera and REGBOT, and with an example mission controlled from the raspberry.
 +
 +
====Get software====
  
 
Get the ROBOBOT software from the svn repository:
 
Get the ROBOBOT software from the svn repository:
Line 10: Line 12:
  
 
  svn up
 
  svn up
 +
 +
====Compile====
  
 
To be able to compile the demo software CMAKE needs also to use the user installed library (raspicam installed above),  
 
To be able to compile the demo software CMAKE needs also to use the user installed library (raspicam installed above),  
Line 30: Line 34:
 
It should print that the camera is open and connected to the robot (bidge).
 
It should print that the camera is open and connected to the robot (bidge).
  
====Software structure====
+
===Software structure===
  
The software is structures as shown in figure 1 below.
+
The sound system can be used for debugging, e.g. add a C++ line like:
  
[[file:mission-software.png | 500px]]
+
system("espeak \"bettina reached point 3\" -ven+f4 -a30 -s130");
  
Figure 1. The example mission software intended as basis for full mission control. In the main.cpp file, three objects are created: bridge (UBridge reg(127.0.0.1)), camera (UCamera cam()) and mission (UMission mission(&reg, &cam)). The bridge handles communication and stores all data from the robot and the gamepad. The camera can capture images and image processing is intended here. The mission object is intended for splitting long missions into mission snippets that the REGBOT can execute.
+
This line makes the robot say "bettina reached point 3" the parameters "-a30" turns amplitude down to 30%, "-ven+f4" sets language to english with female voice 4 and "-s130" makes the speech a little slower and easier to understand.  
 +
It requires that espeak is installed (sudo apt install espeak).
  
The mission class has access to robot data and the camera at all times using the pointers "bot->" and "cam->". e.g. the heading (relative to the start position) and if the yellow gamepad button is pressed, can be fetched as:
+
To use on Raspberry pi, it is better to use
  
  float heading = bot->pose->h;
+
  system("espeak \"Mission paused.\" -ven+f4 -s130 -a60 2>/dev/null &");
bool yellowButton = bot->joy->button[3];
+
  
Details about the data code may be found in the upose.cpp, uinfo.cpp, ujoy.cpp, umotor.cpp ... files.
+
The "2>/dev/null" tell that error messages should be dumped, and the final "&" say that it should run in the background (not to pause the mission).
  
The sound system can be used for debugging, e.g. add a C++ line like:
+
===AruCo Marker===
  
system("espeak \"bettina reached point 3\" -ven+f4 -a30 -s130");
+
The camera class contains some functions to detect Aruco markers.
 +
It it described in more details on [[AruCo Markers]].
  
This line makes the robot say "bettina reached point 3" the parameters "-a30" turns amplitude down to 30%, "-ven+f4" sets language to english with female voice 4 and "-s130" makes the speech a little slower and easier to understand.  
+
===Software documentation (doxygen)===
It requires that espeak is installed (sudo apt install espeak).
+
 
 +
[[File:inherit_graph_2.png | 200px]]
 +
 
 +
Figure: generated with doxygen http://aut.elektro.dtu.dk/robobot/doc/html/classes.html
 +
 
 +
 
 +
The classes that inherit from UData are classes that makes data available for the mission, e.g. joystick buttons (in UJoy) event flags (in UEvent) or IR distance data (in UIRdist).
 +
 
 +
The classes that inherit from URun has a thread running to receive data from an external source, e.g. UBridge that handles communication with the ROBOBOT_BRIDGE.
 +
 
 +
The camera class (UCamera) is intended to do the image processing.
 +
 
 +
====HTML documentation - Doxygen====
 +
 
 +
To generate doxygen html files go to mission directory and run doxygen.
 +
 
 +
cd ~/mission
 +
doxygen Doxyfile
 +
 
 +
then open the index.html with a browser.
  
====Software documentation (doxygen)====
+
If doxygen is not installed, then install using
  
generated with doxygen http://aut.elektro.dtu.dk/robobot/doc/html/classes.html
+
sudo apt install doxygen

Latest revision as of 12:47, 12 January 2020

Contents

[edit] ROBOBOT mission demo C++

This is an example software in C++ to access both raspberry camera and REGBOT, and with an example mission controlled from the raspberry.

[edit] Get software

Get the ROBOBOT software from the svn repository:

svn checkout svn://repos.gbar.dtu.dk/jcan/regbot/mission mission

or just update if there already

svn up

[edit] Compile

To be able to compile the demo software CMAKE needs also to use the user installed library (raspicam installed above), so add the following line to ~/.bashrc:

export CMAKE_PREFIX_PATH=/usr/local/lib

Then build Makefiles and compile:

cd ~/mission
mkdir -p build
cd build
cmake ..
make

Then test-run the application:

./mission

It should print that the camera is open and connected to the robot (bidge).

[edit] Software structure

The sound system can be used for debugging, e.g. add a C++ line like:

system("espeak \"bettina reached point 3\" -ven+f4 -a30 -s130");

This line makes the robot say "bettina reached point 3" the parameters "-a30" turns amplitude down to 30%, "-ven+f4" sets language to english with female voice 4 and "-s130" makes the speech a little slower and easier to understand. It requires that espeak is installed (sudo apt install espeak).

To use on Raspberry pi, it is better to use

system("espeak \"Mission paused.\" -ven+f4 -s130 -a60 2>/dev/null &");

The "2>/dev/null" tell that error messages should be dumped, and the final "&" say that it should run in the background (not to pause the mission).

[edit] AruCo Marker

The camera class contains some functions to detect Aruco markers. It it described in more details on AruCo Markers.

[edit] Software documentation (doxygen)

Inherit graph 2.png

Figure: generated with doxygen http://aut.elektro.dtu.dk/robobot/doc/html/classes.html


The classes that inherit from UData are classes that makes data available for the mission, e.g. joystick buttons (in UJoy) event flags (in UEvent) or IR distance data (in UIRdist).

The classes that inherit from URun has a thread running to receive data from an external source, e.g. UBridge that handles communication with the ROBOBOT_BRIDGE.

The camera class (UCamera) is intended to do the image processing.

[edit] HTML documentation - Doxygen

To generate doxygen html files go to mission directory and run doxygen.

cd ~/mission
doxygen Doxyfile

then open the index.html with a browser.

If doxygen is not installed, then install using

sudo apt install doxygen
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox