Update sinus authored by Guillaume Sanahuja's avatar Guillaume Sanahuja
**NOTE**: For Flair version <= 0.2.2, see [this page](old/sinus). **NOTE**: For Flair version <= 0.2.2, see [this page](old/sinus).
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](documentation). 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](documentation).
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. 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/demos/Sinus](https://gitlab.utc.fr/uav-hds/flair/flair-src/-/tree/main/demos/Sinus). Sources are in [flair-src/demos/Sinus](https://gitlab.utc.fr/uav-hds/flair/flair-src/-/tree/main/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](http://c2.com/cgi/wiki?PimplIdiom), which can be harder to read than this example. **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](http://c2.com/cgi/wiki?PimplIdiom), which can be harder to read than this example.
# Compilation # Compilation
There is various ways to compile/recompile it: There is various ways to compile/recompile it:
* [Compile among everything](build-system/#compile-flair-libraries-tools-and-demos-all-together) (recommended), maybe you have already done it! * [Compile among everything](build-system/#compile-flair-libraries-tools-and-demos-all-together) (recommended), maybe you have already done it!
* [Recompile only this demo](build-system/#recompile-a-particular-project) * [Recompile only this demo](build-system/#recompile-a-particular-project)
* [Generate and compile it alone](build-system/#compile-your-own-project) * [Generate and compile it alone](build-system/#compile-your-own-project)
# Execution on a PC # Execution on a PC: flairrun
## ground control station run the following command to launch all programs
`$ $FLAIR_ROOT/flair-install/bin/tools/core2-64/launch_flairgcs.sh` `$ flairrun Sinus`
## program # Execution on a PC: manually
`$ cd $FLAIR_ROOT/flair-install/bin/demos/core2-64/Sinus` ## ground control station
`$ ./Sinus.sh` `$ $FLAIR_ROOT/flair-install/bin/tools/core2-64/launch_flairgcs.sh`
This script, as for ground control station, launches the program with some arguments. ## program
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). `$ cd $FLAIR_ROOT/flair-install/bin/demos/core2-64/Sinus`
## setup `$ ./Sinus.sh`
When executing the program, the ground control station should construct itself and show setup and graphs for the sinus. This script, as for ground control station, launches the program with some arguments.
# Execution on a target 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).
## copying files to target # Execution on a target
Adapt it to your target ip address and architecture: ## copying files to target
`$ scp $FLAIR_ROOT/flair-install/bin/demos/armv7a-neon/Sinus/* root@172.26.209.x:` Adapt it to your target ip address and architecture:
where x is the drone number. `$ scp $FLAIR_ROOT/flair-install/bin/demos/armv7a-neon/Sinus/* root@172.26.209.x:`
## execution where x is the drone number.
### PC side (ground control station) ## execution
`$ $FLAIR_ROOT/flair-install/bin/tools/core2-64/launch_flairgcs.sh` ### PC side (ground control station)
### target side `$ $FLAIR_ROOT/flair-install/bin/tools/core2-64/launch_flairgcs.sh`
Open a terminal on the target and execute the program through its script: ### target side
`# ./Sinus.sh PC_address` Open a terminal on the target and execute the program through its script:
With *PC_address* your PC IP address. `# ./Sinus.sh PC_address`
This script, as for ground control station, launches the program with some arguments. With *PC_address* your PC IP address.
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). This script, as for ground control station, launches the program with some arguments.
### setup 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).
When executing the program, the ground control station should construct itself and show setup and graphs for the sinus. # setup
When executing the program, the ground control station should construct itself and show setup and graphs for the sinus.