Update simplefleet authored by Guillaume Sanahuja's avatar Guillaume Sanahuja
**NOTE**: For Flair version <= 0.2.2, see [this page](old/simplefleet).
# Testing Flair on a fleet of 2 uavs example (using motion capture)
This page explains how to compile and test a program using Flair. It simulates 2 UAVs moving in a room with motion capture system. UAVs are doing a choreography.
This demonstration is composed of a unique simulator program, which simulates 2 UAVs. The UAV program is also unique, but it is executed two times (with different command lines argument), one time for each UAV. An argument is used by the program to distinguish the UAV id (1 or 2).
## Compilation
There is various ways to compile/recompile it:
* [Compile among everything](/uav-hds/flair/flair-src/-/wikis/build-system/#compile-flair-libraries-tools-and-demos-all-together) (recommended), maybe you have already done it!
* [Recompile only this demo](/uav-hds/flair/flair-src/-/wikis/build-system/#recompile-a-particular-project)
* [Generate and compile it alone](/uav-hds/flair/flair-src/-/wikis/build-system/#compile-your-own-project)
## Execution on a PC
### ground control station
`$ $FLAIR_ROOT/flair-bin/tools/scripts/launch_flairgcs.sh`
### x4 simulator
Open a terminal and execute the simulator:
`$ cd $FLAIR_ROOT/flair-bin/demos/core2-64/SimpleFleet`
`$ ./simulator_x4.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).
### x8 simulator
Open a terminal and execute the simulator:
`$ cd $FLAIR_ROOT/flair-bin/demos/core2-64/SimpleFleet`
`$ ./simulator_x8.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).
### x4 UAVs
Open 2 terminals and execute each program through its script:
`$ cd $FLAIR_ROOT/flair-bin/demos/core2-64/SimpleFleet`
`$ ./x4_0.sh`
and
`$ cd $FLAIR_ROOT/flair-bin/demos/core2-64/SimpleFleet`
`$ ./x4_1.sh`
These scripts, as for ground control station, launch the programs with some arguments.
Note that the scripts also detect if the system uses Xenomai or not, in order to launch the corresponding program version (real time or not).
### x8 UAVs
Open 2 terminals and execute each program through its script:
`$ cd $FLAIR_ROOT/flair-bin/demos/core2-64/SimpleFleet`
`$ ./x8_0.sh`
and
`$ cd $FLAIR_ROOT/flair-bin/demos/core2-64/SimpleFleet`
`$ ./x8_1.sh`
These scripts, as for ground control station, launch the programs with some arguments.
Note that the scripts also detect if the system uses Xenomai or not, in order to launch the corresponding program version (real time or not).
### DualShock3 controller (optional)
If you have a DualShock3, you can use it to control the UAV. Make sure you have configured the bluetooth first (see [this page](/uav-hds/flair/flair-src/-/wikis/setup-your-computer/#setup-bluetooth-for-dualshock3-controller-optional)).
`$ $FLAIR_ROOT/flair-install/bin/tools/core2-64/dualshock3_local_bt.sh`
If it is the first time you use it with your computer, plug it first with an USB cable in order to pair it. Then you can use bluetooth connection.
If you do not have bluetooth on your computer, you can use the USB connection of the DualShock3 with the following command:
`$ $FLAIR_ROOT/flair-install/bin/tools/core2-64/dualshock3_local_usb.sh`
### setup
When executing the programs, the ground control station should construct itself and show setup and graphs for the programs.
In the tab *x4_0/uav* press the *take off* button to take off the uavs.
In the simulator window, you can change the camera (if configured) with *page up/down* keys. You can also press *a* to change the axis indicator.
### Changing 3D environment
The 3D environment of the simulator is fixed by the launcher script (*simulator_x8.sh*); to change this environment edit the script and change the parameter *-s*.
For example, you can change it from
`-s $FLAIR_ROOT/flair-bin/models/indoor_flight_arena.xml`
to
`-s $FLAIR_ROOT/flair-bin/models/city_tile.xml`
## Execution on target
TODO...
**NOTE**: For Flair version <= 0.2.2, see [this page](old/simplefleet).
# Testing Flair on a fleet of 2 uavs example (using motion capture)
This page explains how to compile and test a program using Flair. It simulates 2 UAVs moving in a room with motion capture system. UAVs are doing a choreography.
This demonstration is composed of a unique simulator program, which simulates 2 UAVs. The UAV program is also unique, but it is executed two times (with different command lines argument), one time for each UAV. An argument is used by the program to distinguish the UAV id (1 or 2).
## Compilation
There is various ways to compile/recompile it:
* [Compile among everything](/uav-hds/flair/flair-src/-/wikis/build-system/#compile-flair-libraries-tools-and-demos-all-together) (recommended), maybe you have already done it!
* [Recompile only this demo](/uav-hds/flair/flair-src/-/wikis/build-system/#recompile-a-particular-project)
* [Generate and compile it alone](/uav-hds/flair/flair-src/-/wikis/build-system/#compile-your-own-project)
## Execution on a PC: flairrun
run the following command to launch all programs
`$ flairrun SimpleFleet`
or for a X8:
`$ flairrun SimpleFleet x8.flair`
## Execution on a PC: manually
### ground control station
`$ $FLAIR_ROOT/flair-bin/tools/scripts/launch_flairgcs.sh`
### x4 simulator
Open a terminal and execute the simulator:
`$ cd $FLAIR_ROOT/flair-bin/demos/core2-64/SimpleFleet`
`$ ./simulator_x4.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).
### x8 simulator
Open a terminal and execute the simulator:
`$ cd $FLAIR_ROOT/flair-bin/demos/core2-64/SimpleFleet`
`$ ./simulator_x8.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).
### x4 UAVs
Open 2 terminals and execute each program through its script:
`$ cd $FLAIR_ROOT/flair-bin/demos/core2-64/SimpleFleet`
`$ ./x4_0.sh`
and
`$ cd $FLAIR_ROOT/flair-bin/demos/core2-64/SimpleFleet`
`$ ./x4_1.sh`
These scripts, as for ground control station, launch the programs with some arguments.
Note that the scripts also detect if the system uses Xenomai or not, in order to launch the corresponding program version (real time or not).
### x8 UAVs
Open 2 terminals and execute each program through its script:
`$ cd $FLAIR_ROOT/flair-bin/demos/core2-64/SimpleFleet`
`$ ./x8_0.sh`
and
`$ cd $FLAIR_ROOT/flair-bin/demos/core2-64/SimpleFleet`
`$ ./x8_1.sh`
These scripts, as for ground control station, launch the programs with some arguments.
Note that the scripts also detect if the system uses Xenomai or not, in order to launch the corresponding program version (real time or not).
### DualShock3 controller (optional)
If you have a DualShock3, you can use it to control the UAV. Make sure you have configured the bluetooth first (see [this page](/uav-hds/flair/flair-src/-/wikis/setup-your-computer/#setup-bluetooth-for-dualshock3-controller-optional)).
`$ $FLAIR_ROOT/flair-install/bin/tools/core2-64/dualshock3_local_bt.sh`
If it is the first time you use it with your computer, plug it first with an USB cable in order to pair it. Then you can use bluetooth connection.
If you do not have bluetooth on your computer, you can use the USB connection of the DualShock3 with the following command:
`$ $FLAIR_ROOT/flair-install/bin/tools/core2-64/dualshock3_local_usb.sh`
## setup
When executing the programs, the ground control station should construct itself and show setup and graphs for the programs.
In the tab *x4_0/uav* press the *take off* button to take off the uavs.
In the simulator window, you can change the camera (if configured) with *page up/down* keys. You can also press *a* to change the axis indicator.
## Changing 3D environment
The 3D environment of the simulator is fixed by the launcher script (*simulator_x8.sh*); to change this environment edit the script and change the parameter *-s*.
For example, you can change it from
`-s $FLAIR_ROOT/flair-bin/models/indoor_flight_arena.xml`
to
`-s $FLAIR_ROOT/flair-bin/models/city_tile.xml`
## Execution on target
TODO...