You can find these installation instructions here.
Install docker using convenience script
curl -fsSL get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo groupadd docker
# Add your user to the docker group.
sudo usermod -aG docker $USER
# Close the terminal or restart computer to see effects
We are setting up the workspace on users computer which will be linked to the container. You could do the same inside the container itself, but you will loose all your data once you remove the container.
mkdir -p pheonix_project/home
cd pheonix_project/home
git clone https://github.com/PX4/PX4-Autopilot.git
mv PX4-Autopilot px4
cd px4
Run the container in interactive mode terminal with bash. If the image is not present, it is automatically downloaded form docker hub. Here we are mounting hosts directory (where the catkin workspace and firmware is present) to the container directory using -v command. Changes are bidirectional.
- privilaged : it will enable access to hosts ports such as usb
- v : linking host and docker folders
- it : enable interactive terminal
- p : port mapping from host to container, format of < host >:< container >
- name : name of container
image location (docker hub) : sohananisetty/pheonix-ros-melodic-px4-gazebo
# enable access to xhost from the container
xhost +
# Run docker and open bash shell
docker run -it --privileged --env=LOCAL_USER_ID="$(id -u)" -v ~/pheonix_project/home:/home/:rw -v /tmp/.X11-unix:/tmp/.X11-unix:ro -e DISPLAY=:0 -p 14556:14556/udp --name=px4container sohananisetty/pheonix-ros-melodic-px4-gazebo bash
Build SITL (run in px4 directory). This is for building quadcopter with gazebo simulator. For other vehicle types or other simulators see the documentation.
cd home/px4 #This is in container
make px4_sitl_default gazebo
# start the container
docker start container_name
# open a new bash shell in this container
docker exec -it container_name bash
docker ps -a ##list all containers
docker rm container_name
start your docker container if previously stopped. Closing the terminal does not stop the container.
docker ps
mkdir -p home/catkin_ws/src
cd home/catkin_ws/src
git clone https://github.com/vanquish630/pheonix.git
cd ..
catkin_make
source devel/setup.bash
home
--catkin_ws
--src
--pheonix
--px4
px4_dir=/home/px4
source /opt/ros/melodic/setup.bash
source /home/catkin_ws/devel/setup.bash
source $px4_dir/Tools/setup_gazebo.bash $px4_dir $px4_dir/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$px4_dir
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$px4_dir/Tools/sitl_gazebo
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH/home/catkin_ws/src/gazebo_models:/home/catkin_ws/src/pheonix/models
export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH/usr/lib/x86_64-linux-gnu/gazebo-9/plugins
export GAZEBO_RESOURCE_PATH=$GAZEBO_RESOURCE_PATH/home/catkin_ws/src/pheonix/worlds
roslaunch pheonix gazebo_sitl.launch
roslaunch pheonix mavros.launch
roslaunch pheonix simple_control.launch
rosrun pheonix triangle.py
#run this in the host machine
xhost +
# download models from git
git clone https://github.com/osrf/gazebo_models.git
# copy contents of downloaded directory to gazebo model directory
cp -r <download_location>/* ~/.gazebo/models
source ~/.bashrc
In case gazebo error 255 comes or if gazebo reloading past session instead of bringing up a fresh session
killall gzserver