Update Setup your computer authored by Guillaume Sanahuja's avatar Guillaume Sanahuja
# Flair directory
You need to put all flair related stuffs in the same directory, for example $HOME/flair:
`$ mkdir $HOME/flair`
# bashrc
Edit your .bashrc:
`$ nano ~/.bashrc`
and add:
```
# variable for Flair
export FLAIR_ROOT=$HOME/flair
# flair binaries
export PATH="$PATH":"$FLAIR_ROOT"/flair-src/bin
# flair completion script
source "$FLAIR_ROOT"/flair-src/scripts/flair_completion.sh
```
reload the script:
`$ source ~/.bashrc`
- `$FLAIR_ROOT` is a variable used in all flair documentation, in scripts and in CMakeLists.txt
- flair binaries are tools like flairrun or flairmake
- flair completion script is used for autocompletion with flair binaries
# Install packages
Install python needed by the toolchains installation scripts:
`sudo apt install python`
If it is not available install the following package:
`sudo apt install python-is-python3`
Install g++ to compile simulator and ground station: (flair does not use the toolchain for these programs to avoid problems with opengl):
`sudo apt install g++`
Install glxinfo needed to detect your graphic driver (for simulator):
`sudo apt install mesa-utils libgl1-mesa-dev`
Install an optional IDE (*Integrated Development Environment*), for example:
* CodeLite (all Flair documentation is based on it):
* Download the version corresponding to your OS : https://downloads.codelite.org/
* If the downloaded file is .deb, run:
`sudo dpkg install filename.deb`
* or eclipse:
`sudo apt-get install eclipse-cdt`
* or codeblocks (depreciated because of cmake and code completion problems, see next section if you want to use CodeBlocks):
`sudo apt-get install codeblocks codeblocks-contrib`
# Codeblocks
## if Codeblocks is slow or crashes
It seems that auto completion plugin of Codeblocks (version 12.11 and up) does not work very well with a cmake generated project.
One solution is to deactivate this plugin, another solution is to install an older version of Codeblocks (10.05), from [this page](http://sourceforge.net/projects/codeblocks/files/Binaries/10.05).
For example on a 64 bits computer:
```
$ cd
$ wget http://sourceforge.net/projects/codeblocks/files/Binaries/10.05/Linux%20%2864%20bit%29/codeblocks-10.05-1-debian-amd64.tar.bz2
$ tar -xjf codeblocks-10.05-1-debian-amd64.tar.bz2
$ cd amd64
$ sudo dpkg -i *.deb
$ cd ..
$ rm -rf amd64 codeblocks-10.05-1-debian-amd64.tar.bz2
```
## environment variables
When Codeblocks is not launched from command line, it does not read environment variables set in .bashrc.
This can make trouble when a CMakelists.txt is modified for example.
To solve this, go to *settings/environment* menu. Choose *environment variables* section on the left. Click on *Add* and fill the form:
* key: FLAIR_ROOT
* value: path to the FLAIR_ROOT directory
# Use rtprio
In order to use Flair without Xenoami, but with high priorities, you need to be root or to allow your user using the following file:
`$ sudo nano /etc/security/limits.conf`
And add these lines:
```
your_user soft rtprio 99
your_user hard rtprio 99
```
where *your_user* is your user login. Then logout and login.
You can also create a dedicated user for running flair programs, to avoid allowing this priorities for your regular user.
# Setup bluetooth for DualShock3 controller (optional)
Using bluetooth for the ds3 is not conventional. Thus, you need a small modification in the linux's bluetooth service. You just have to do it once.
## On newer distros (ubuntu >=16.4 or mint>=18)
`$ sudo nano /etc/systemd/system/bluetooth.target.wants/bluetooth.service`
And modify the *ExecStart* value:
```
ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=input
```
Then restart the dameon bluetoothd:
`$ sudo systemctl daemon-reload`
`$ sudo service bluetooth restart`
## On older distros
`$ sudo nano /etc/bluetooth/main.conf`
and add a line to DisablePlugins:
```
[General]
# List of plugins that should not be loaded on bluetoothd startup
DisablePlugins = network,input
```
Then restart bluetoothd:
`$ sudo service bluetooth restart`
# Configure SSH hosts (optional)
Alias can be defined in the *~/.ssh/config* file:
`$ mkdir -p ~/.ssh`
`$ nano ~/.ssh/config`
and add a line for each target
```
Host uav1
HostName 192.168.147.63
User root
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
```
change the name (uav1 in this example) and its address (192.168.147.63 in this example).
*NB*: the 2 last lines are optional, but it will help if you connect to 2 different targets with same IP. Yet, you will be exposed to the man in the middle attack (see [this page](http://en.wikipedia.org/wiki/Man-in-the-middle_attack)), which should not be a big deal in our case (target as no root password...).
Using this alias you can connect to the target that way:
`$ ssh uav1`
which is equivalent to:
`$ ssh root@192.168.147.63`
moreover, the command:
`$ scp toto uav1:`
is equivalent to:
`$ scp toto root@192.168.147.63:`
# Flair directory
You need to put all flair related stuffs in the same directory, for example $HOME/flair:
`$ mkdir $HOME/flair`
# bashrc
Edit your .bashrc:
`$ nano ~/.bashrc`
and add:
```
# variable for Flair
export FLAIR_ROOT=$HOME/flair
# flair binaries
export PATH="$PATH":"$FLAIR_ROOT"/flair-src/bin
# flair completion script
source "$FLAIR_ROOT"/flair-src/scripts/flair_completion.sh
```
reload the script:
`$ source ~/.bashrc`
- `$FLAIR_ROOT` is a variable used in all flair documentation, in scripts and in CMakeLists.txt
- flair binaries are tools like flairrun or flairmake
- flair completion script is used for autocompletion with flair binaries
# Install packages
Install python needed by the toolchains installation scripts:
`sudo apt install python`
If it is not available install the following package:
`sudo apt install python-is-python3`
Install g++ to compile simulator and ground station: (flair does not use the toolchain for these programs to avoid problems with opengl):
`sudo apt install g++`
Install glxinfo needed to detect your graphic driver (for simulator):
`sudo apt install mesa-utils libgl1-mesa-dev`
Install an optional IDE (*Integrated Development Environment*), for example:
* CodeLite (all Flair documentation is based on it):
* Download the version corresponding to your OS : https://downloads.codelite.org/
* If the downloaded file is .deb, run:
`sudo dpkg install filename.deb`
* or eclipse:
`sudo apt-get install eclipse-cdt`
* or codeblocks (depreciated because of cmake and code completion problems, see next section if you want to use CodeBlocks):
`sudo apt-get install codeblocks codeblocks-contrib`
# Codeblocks
## if Codeblocks is slow or crashes
It seems that auto completion plugin of Codeblocks (version 12.11 and up) does not work very well with a cmake generated project.
One solution is to deactivate this plugin, another solution is to install an older version of Codeblocks (10.05), from [this page](http://sourceforge.net/projects/codeblocks/files/Binaries/10.05).
For example on a 64 bits computer:
```
$ cd
$ wget http://sourceforge.net/projects/codeblocks/files/Binaries/10.05/Linux%20%2864%20bit%29/codeblocks-10.05-1-debian-amd64.tar.bz2
$ tar -xjf codeblocks-10.05-1-debian-amd64.tar.bz2
$ cd amd64
$ sudo dpkg -i *.deb
$ cd ..
$ rm -rf amd64 codeblocks-10.05-1-debian-amd64.tar.bz2
```
## environment variables
When Codeblocks is not launched from command line, it does not read environment variables set in .bashrc.
This can make trouble when a CMakelists.txt is modified for example.
To solve this, go to *settings/environment* menu. Choose *environment variables* section on the left. Click on *Add* and fill the form:
* key: FLAIR_ROOT
* value: path to the FLAIR_ROOT directory
# Use rtprio
In order to use Flair without Xenoami, but with high priorities, you need to be root or to allow your user using the following file:
`$ sudo nano /etc/security/limits.conf`
And add these lines:
```
your_user soft rtprio 99
your_user hard rtprio 99
```
where *your_user* is your user login. Then logout and login.
You can also create a dedicated user for running flair programs, to avoid allowing this priorities for your regular user.
# Setup bluetooth for DualShock3 controller (optional)
Using bluetooth for the ds3 is not conventional. Thus, you need a small modification in the linux's bluetooth service. You just have to do it once.
## On newer distros (ubuntu >=16.4 or mint>=18)
`$ sudo nano /etc/systemd/system/bluetooth.target.wants/bluetooth.service`
And modify the *ExecStart* value:
```
ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=input
```
Then restart the dameon bluetoothd:
`$ sudo systemctl daemon-reload`
`$ sudo service bluetooth restart`
## On older distros
`$ sudo nano /etc/bluetooth/main.conf`
and add a line to DisablePlugins:
```
[General]
# List of plugins that should not be loaded on bluetoothd startup
DisablePlugins = network,input
```
Then restart bluetoothd:
`$ sudo service bluetooth restart`
# Configure SSH hosts (optional)
Alias can be defined in the *~/.ssh/config* file:
`$ mkdir -p ~/.ssh`
`$ nano ~/.ssh/config`
and add a line for each target
```
Host uav1
HostName 192.168.147.63
User root
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
```
change the name (uav1 in this example) and its address (192.168.147.63 in this example).
*NB*: the 2 last lines are optional, but it will help if you connect to 2 different targets with same IP. Yet, you will be exposed to the man in the middle attack (see [this page](http://en.wikipedia.org/wiki/Man-in-the-middle_attack)), which should not be a big deal in our case (target as no root password...).
Using this alias you can connect to the target that way:
`$ ssh uav1`
which is equivalent to:
`$ ssh root@192.168.147.63`
moreover, the command:
`$ scp toto uav1:`
is equivalent to:
`$ scp toto root@192.168.147.63:`