Version 4 (modified by 6 years ago) ( diff ) | ,
---|
NOTE: For Flair version <= 0.2.1, see this page.
Sinus demo
This page explains how to compile and test a simple program using Flair. Moreover, this program is commented to help understand how to code with Flair. You can also read Flair's documentation page.
The program generates a sinusoidal signal and low pass filters are added. Everything can be configured through the ground control station. This demo shows how filters are added and updated, and how to draw graphs on ground control station.
Sources are in flair-src/trunk/demos/Sinus.
NB: Filter and SensorActuator libraries sources are also a good starting point to see how to program with Flair. Yet, they use the pimpl idiom, which can be harder to read than this example.
Compilation
There is various ways to compile/recompile it
Compile among everything (recommended)
Use the flair_compile_all.sh script using documentation from this page.
All libs, tools and demos will be compiled for all supported architectures (the ones with an installed toolchain).
Recompile only this demo
If you have already done the previous step (compile among everything) and you want to just recompile this particular demo, do the following:
$ cd $FLAIR_ROOT/flair-build/build/demos/Sinus $ make install
It will compile for x86_64 architecture. To compile for a different architecture, go to the corresponding directory, for example:
$ cd $FLAIR_ROOT/flair-build/build_armv5te/demos/Sinus or $ cd $FLAIR_ROOT/flair-build/build_armv7a_neon/demos/Sinus or $ cd $FLAIR_ROOT/flair-build/build_cortexa7thf_neon_vfpv4/demos/Sinus
Calling make compile both real time and non real time version of the demo.
Generate and compile it alone
You can also generate this demo's project where you want, and compile it. Yet, you need to have compiled and installed Flair libs before to have all needed development files. But it is not necessary to recompile libs each time you want to compile the demo.
The following assumes you want to place the project in $FLAIR_ROOT/flair-build/mywork/sinus
$ mkdir -p $FLAIR_ROOT/flair-build/mywork/sinus $ cd $FLAIR_ROOT/flair-build/mywork/sinus $ $FLAIR_ROOT/flair-dev/scripts/cmake_codelite_outofsource.sh $FLAIR_ROOT/flair-src/demos/Sinus/ $ cd build $ make install
It will compile for x86_64 architecture. To compile for a different architecture, go to the corresponding directory, for example:
$ cd build_armv5te or $ cd build_armv7a_neon or $ cd build_cortexa7thf_neon_vfpv4
Execution on a PC
ground control station
$ $FLAIR_ROOT/flair-bin/tools/scripts/launch_flairgcs.sh
program
$ cd $FLAIR_ROOT/flair-bin/demos/core2-64/Sinus/ $ ./Sinus.sh
This script, as for ground control station, launches the program with some arguments.
Note that the script also detects if the system uses Xenomai or not, in order to launch the corresponding program version (real time or not).
setup
When executing the program, the ground control station should construct itself and show setup and graphs for the sinus.
Execution on a target
copying files to target
Adapt it to your target ip address and architecture:
$ scp $FLAIR_ROOT/flair-bin/demos/armv7a-neon/Sinus/* root@192.168.147.x:
x is the drone number, from 18 to 63 in the Heudiasyc configuration.
execution
PC side (ground control station)
$ $FLAIR_ROOT/flair-bin/tools/scripts/launch_FlairGCS.sh
target side
Open a terminal on the target and execute the program through its script:
# ./Sinus.sh PC_address
With PC_address your PC IP address.
This script, as for ground control station, launches the program with some arguments.
Note that the script also detects if the system uses Xenomai or not, in order to launch the corresponding program version (real time or not).
setup
When executing the program, the ground control station should construct itself and show setup and graphs for the sinus.