\page install-docker Docker build
Here there are instructions on how to build and run the FSW using Docker.
The docker image for the astrobee FSW is divided throughout 2 docker files.
Available docker files:
astrobee_base_kinetic - Contains installation of all astrobee dependencies the Ubuntu 16.04 + ROS kinetic setup.
astrobee_base_melodic - Contains installation of all astrobee dependencies the Ubuntu 18.04 + ROS melodic setup.
astrobee_kinetic - Builds the astrobee FSW code on top of astrobee_base_kinetic.
astrobee_melodic - Builds the astrobee FSW code on top of astrobee_base_melodic.
rebuild_and_test_astrobee_kinetic - Rebuilds the astrobee FSW code on top of astrobee_kinetic and performs the unit tests. This makes for a faster rebuild leveraging the cached data and rebuilding only the nodes that were changed, for testing purposes only.
rebuild_and_test_astrobee_melodic - Rebuilds the astrobee FSW code on top of astrobee_melodic and performs the unit tests. This makes for a faster rebuild leveraging the cached data and rebuilding only the nodes that were changed, for testing purposes only.
To build the docker images, run:
./build.sh
The option -n is used for ubuntu 18 docker images
To run the docker container:
./run.sh
The option -n is used for ubuntu 18 docker images
To open another terminal inside the docker container:
docker exec -it astrobee bash
Once inside the container, don't forget to source astrobee to have access to all the commands:
source /build/astrobee/devel/setup.bash
To shutdown the docker container, run:
./shutdown.sh
To cross-compile Astrobee, you will need to install a cross-compile chroot and toolchain. Select two directories for these:
export ARMHF_CHROOT_DIR=$HOME/arm_cross/rootfs
export ARMHF_TOOLCHAIN=$HOME/arm_cross/toolchain/gcc
Append these lines to your .bashrc file, as you will need these two variables every time you cross compile.
Next, download the cross toolchain and install the chroot:
mkdir -p $ARMHF_TOOLCHAIN
cd $HOME/arm_cross
$SOURCE_PATH/submodules/platform/fetch_toolchain.sh
$SOURCE_PATH/submodules/platform/rootfs/make_xenial.sh dev $ARMHF_CHROOT_DIR
From the root of the repository, run:
./scripts/docker/cross_compile/cross_compile.sh
The code will be cross-compiles inside the docker container in /opt/astrobee, and can be copied to the robot.
After the debian files are generated inside the docker image, they are copied to in order of priority:
- To the INSTALL_PATH, if defined
- To ${DIR}/../../../../astrobee_install/armhf/, if the directoy already exists, where $DIR is the directory where the cross_compile.sh script is located.
- To $HOME/astrobee_build/armhf otherwise
This step assumes that the cross compile setup was successful and that ARMHF_CHROOT_DIR and ARMHF_TOOLCHAIN are defined. If not, please follow the cross-compile instructions.
To generate the debians, from the root of the repository, run:
./scripts/docker/cross_compile/debian_compile.sh
After the debian files are generated inside the docker image, they are copied to the folder before the root of the repository, ${DIR}/../../../../, where $DIR is the directory where the debian_compile.sh script is located.