Update circlefollower authored by Guillaume Sanahuja's avatar Guillaume Sanahuja
*NOTE*: For Flair version <= 0.2.2, see [this page](old/circlefollower). *NOTE*: For Flair version <= 0.2.2, see [this page](old/circlefollower).
# Testing Flair on a circle follower example (using motion capture) # Testing Flair on a circle follower example (using motion capture)
This page explains how to compile and test a program using Flair. It simulates an UAV (x4 or x8) and a man moving in a room with motion capture system. The uav is making a circle around the man, following its position. This page explains how to compile and test a program using Flair. It simulates an UAV (x4 or x8) and a man moving in a room with motion capture system. The uav is making a circle around the man, following its position.
## Compilation ## Compilation
There is various ways to compile/recompile it: 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! * [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) * [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) * [Generate and compile it alone](/uav-hds/flair/flair-src/-/wikis/build-system/#compile-your-own-project)
## Execution on a PC ## Execution on a PC: flairun
### ground control station run the following command to launch all programs
`$ $FLAIR_ROOT/flair-install/bin/tools/core2-64/launch_flairgcs.sh` `$ flairrun CircleFollower`
### programs for a x4 or for a x8:
On the first terminal (simulator program): `$ flairrun CircleFollower x8.flair`
`$ cd $FLAIR_ROOT/flair-install/bin/demos/core2-64/CircleFollower` ## Execution on a PC: manually
`$ ./simulator_x4.sh` ### ground control station
On a second one (control program): `$ $FLAIR_ROOT/flair-install/bin/tools/core2-64/launch_flairgcs.sh`
`$ cd $FLAIR_ROOT/flair-install/bin/demos/core2-64/CircleFollower` ### programs for a x4
`$ ./x4.sh` On the first terminal (simulator program):
These scripts, as for ground control station, launch the programs with some arguments. `$ cd $FLAIR_ROOT/flair-install/bin/demos/core2-64/CircleFollower`
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). `$ ./simulator_x4.sh`
### programs for a x8 On a second one (control program):
On the first terminal (simulator program): `$ cd $FLAIR_ROOT/flair-install/bin/demos/core2-64/CircleFollower`
`$ cd $FLAIR_ROOT/flair-install/bin/demos/core2-64/CircleFollower` `$ ./x4.sh`
`$ ./simulator_x8.sh` These scripts, as for ground control station, launch the programs with some arguments.
On a second one (control program): 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).
`$ cd $FLAIR_ROOT/flair-install/bin/demos/core2-64/CircleFollower` ### programs for a x8
`$ ./x8.sh` On the first terminal (simulator program):
These scripts, as for ground control station, launch the programs with some arguments. `$ cd $FLAIR_ROOT/flair-install/bin/demos/core2-64/CircleFollower`
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). `$ ./simulator_x8.sh`
### DualShock3 controller (optional) On a second one (control program):
If you have a DualShock3, you can use it to control the UAV. Make sure you have configured the bluetooth first (see [this page](setup-your-computer/#setup-bluetooth-for-dualshock3-controller-optional)). `$ cd $FLAIR_ROOT/flair-install/bin/demos/core2-64/CircleFollower`
`$ $FLAIR_ROOT/flair-install/bin/tools/core2-64/dualshock3_local_bt.sh` `$ ./x8.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. These scripts, as for ground control station, launch the programs with some arguments.
If you do not have bluetooth on your computer, you can use the USB connection of the DualShock3 with the following command: 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).
`$ $FLAIR_ROOT/flair-install/bin/tools/core2-64/dualshock3_local_usb.sh` ### DualShock3 controller (optional)
### setup If you have a DualShock3, you can use it to control the UAV. Make sure you have configured the bluetooth first (see [this page](setup-your-computer/#setup-bluetooth-for-dualshock3-controller-optional)).
When executing the programs, the ground control station should construct itself and show setup and graphs for the programs. `$ $FLAIR_ROOT/flair-install/bin/tools/core2-64/dualshock3_local_bt.sh`
In the tab *x4_0/uav* press the *take off* button to take off the uav, and then the *start_circle* button to start the trajectory. 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.
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. If you do not have bluetooth on your computer, you can use the USB connection of the DualShock3 with the following command:
### Changing 3D environment `$ $FLAIR_ROOT/flair-install/bin/tools/core2-64/dualshock3_local_usb.sh`
The 3D environment of the simulator is fixed by the launcher script (*simulator_x4.sh*); to change this environment edit the script and change the parameter *-s*. ## setup
For example, you can change it from When executing the programs, the ground control station should construct itself and show setup and graphs for the programs.
`-s $FLAIR_ROOT/flair-src/models/indoor_flight_arena.xml` In the tab *x4_0/uav* press the *take off* button to take off the uav, and then the *start_circle* button to start the trajectory.
to 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.
`-s $FLAIR_ROOT/flair-src/models/city_tile.xml` ## Changing 3D environment
You can also change the parameters inside the xml file. To change its size look at the section: The 3D environment of the simulator is fixed by the launcher script (*simulator_x4.sh*); to change this environment edit the script and change the parameter *-s*.
```
<mesh id="0" model="voliere.bsp" > For example, you can change it from
<position x="0" y="0" z="0" />
<rotation x="0" y="0" z="0" /> `-s $FLAIR_ROOT/flair-src/models/indoor_flight_arena.xml`
<scale x="10" y="10" z="3" />
</mesh> to
```
The scale is by defaults 10m * 10m *3m. `-s $FLAIR_ROOT/flair-src/models/city_tile.xml`
You can have a bigger one (double each dimension) using:
``` You can also change the parameters inside the xml file. To change its size look at the section:
<mesh id="0" model="voliere.bsp" > ```
<position x="0" y="0" z="0" /> <mesh id="0" model="voliere.bsp" >
<rotation x="0" y="0" z="0" /> <position x="0" y="0" z="0" />
<scale x="20" y="20" z="6" /> <rotation x="0" y="0" z="0" />
</mesh> <scale x="10" y="10" z="3" />
``` </mesh>
If you change the dimensions of the flight arena, you may also need to change the positions of the fixed cameras in the same xml file. ```
The scale is by defaults 10m * 10m *3m.
## Execution on target You can have a bigger one (double each dimension) using:
```
TODO... <mesh id="0" model="voliere.bsp" >
<position x="0" y="0" z="0" />
<rotation x="0" y="0" z="0" />
<scale x="20" y="20" z="6" />
</mesh>
```
If you change the dimensions of the flight arena, you may also need to change the positions of the fixed cameras in the same xml file.
## Execution on target
TODO...