mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-29 08:34:06 +08:00
initial commit for vagrant/docker based ros setup
This commit is contained in:
parent
8e15a5b9d0
commit
2d65e8cb3b
1
.gitignore
vendored
1
.gitignore
vendored
@ -43,3 +43,4 @@ src/modules/uORB/topics/*
|
||||
Firmware.zip
|
||||
unittests/build
|
||||
*.generated.h
|
||||
.vagrant
|
||||
|
||||
42
Tools/ros/docker/px4-ros/Dockerfile
Normal file
42
Tools/ros/docker/px4-ros/Dockerfile
Normal file
@ -0,0 +1,42 @@
|
||||
#
|
||||
# Base ROS Indigo
|
||||
#
|
||||
|
||||
FROM ubuntu:14.04.1
|
||||
MAINTAINER Andreas Antener "andreas@antener.name"
|
||||
|
||||
# Install basics
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install wget git mercurial
|
||||
|
||||
# Main ROS Setup
|
||||
# Following http://wiki.ros.org/indigo/Installation/Ubuntu
|
||||
# Also adding dependencies for gazebo http://gazebosim.org/tutorials?tut=drcsim_install
|
||||
|
||||
## add ROS repositories and keys
|
||||
## install main ROS pacakges
|
||||
RUN echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list \
|
||||
&& wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | apt-key add - \
|
||||
&& apt-get update \
|
||||
&& apt-get -y install ros-indigo-desktop-full
|
||||
|
||||
RUN rosdep init \
|
||||
&& rosdep update
|
||||
|
||||
## setup environment variables
|
||||
RUN echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc
|
||||
|
||||
## get rosinstall
|
||||
RUN apt-get -y install python-rosinstall
|
||||
|
||||
## additional dependencies
|
||||
RUN apt-get -y install ros-indigo-octomap-msgs
|
||||
|
||||
|
||||
## install drcsim
|
||||
#RUN echo "deb http://packages.osrfoundation.org/drc/ubuntu trusty main" > /etc/apt/sources.list.d/drc-latest.list \
|
||||
# && wget http://packages.osrfoundation.org/drc.key -O - | apt-key add - \
|
||||
# && apt-get update \
|
||||
# && apt-get -y install drcsim
|
||||
|
||||
CMD /bin/bash
|
||||
22
Tools/ros/docker/px4-ros/px4-ros-sitl/Dockerfile
Normal file
22
Tools/ros/docker/px4-ros/px4-ros-sitl/Dockerfile
Normal file
@ -0,0 +1,22 @@
|
||||
#
|
||||
# PX4 ROS SITL
|
||||
#
|
||||
|
||||
FROM px4ros/ros-base:no-drcsim
|
||||
MAINTAINER Andreas Antener "andreas@antener.name"
|
||||
|
||||
# TODO
|
||||
#USER px4
|
||||
|
||||
RUN . /opt/ros/indigo/setup.sh \
|
||||
&& mkdir -p /catkin_ws/src \
|
||||
&& cd /catkin_ws/src \
|
||||
&& catkin_init_workspace \
|
||||
&& cd /catkin_ws \
|
||||
&& catkin_make \
|
||||
&& echo "source /catkin_ws/devel/setup.bash" >> ~/.bashrc
|
||||
|
||||
COPY get-sources.sh /catkin_ws/src/
|
||||
RUN chmod +x /catkin_ws/src/get-sources.sh
|
||||
|
||||
CMD /bin/bash
|
||||
28
Tools/ros/docker/px4-ros/px4-ros-sitl/get-sources.sh
Normal file
28
Tools/ros/docker/px4-ros/px4-ros-sitl/get-sources.sh
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Fetch source repositories
|
||||
#
|
||||
|
||||
# PX4 Firmware
|
||||
git clone https://github.com/PX4/Firmware.git \
|
||||
&& cd Firmware \
|
||||
&& git checkout ros \
|
||||
&& cd ..
|
||||
|
||||
# euroc simulator
|
||||
git clone https://github.com/PX4/euroc_simulator.git \
|
||||
&& cd euroc_simulator \
|
||||
&& git checkout px4_nodes \
|
||||
&& cd ..
|
||||
|
||||
# mav comm
|
||||
git clone https://github.com/PX4/mav_comm.git
|
||||
|
||||
# glog catkin
|
||||
git clone https://github.com/ethz-asl/glog_catkin.git
|
||||
|
||||
# catkin simple
|
||||
git clone https://github.com/catkin/catkin_simple.git
|
||||
|
||||
echo "Execute catkin_make to compile all the sources."
|
||||
|
||||
59
Tools/ros/vagrant/docker-host-base/Vagrantfile
vendored
Normal file
59
Tools/ros/vagrant/docker-host-base/Vagrantfile
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
#
|
||||
# Vagrantfile to create docker-host-base
|
||||
#
|
||||
# After build, do "vagrant package --base docker-host-base" to package,
|
||||
# and import as box: "vagrant box add --name docker-host-base package.box"
|
||||
#
|
||||
# To add local docker images into the docker host, configure your local
|
||||
# docker client to control the docker daemon on the later running docker-host VM.
|
||||
# This box configures docker to listen on any IP on port 2375.
|
||||
# You can then also load an existing image, e.g.:
|
||||
# "docker load -i px4ros_ros-sitl_no-drcsim_a4209708a04a.tar"
|
||||
#
|
||||
Vagrant.configure(2) do |config|
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
|
||||
config.vm.define "docker-host-base"
|
||||
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
vb.name = "docker-host-base"
|
||||
vb.gui = true
|
||||
vb.memory = "1024"
|
||||
end
|
||||
|
||||
config.vm.provision "file", source: "config/docker-default", destination: "/home/vagrant/docker-default"
|
||||
config.vm.provision "file", source: "config/xsessionrc", destination: "/home/vagrant/.xsessionrc"
|
||||
|
||||
config.vm.provision "shell", inline: <<-SHELL
|
||||
# Update and install apps
|
||||
sudo apt-get update
|
||||
sudo apt-get upgrade -y
|
||||
sudo apt-get install -y --no-install-recommends ubuntu-desktop
|
||||
sudo apt-get install -y gnome-terminal unity-lens-applications
|
||||
|
||||
# Reset the ssh key (because vagrant regenerates it during provisioning)
|
||||
sudo wget --no-check-certificate https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub -O /home/vagrant/.ssh/authorized_keys
|
||||
sudo chmod 0700 /home/vagrant/.ssh
|
||||
sudo chmod 0600 /home/vagrant/.ssh/authorized_keys
|
||||
sudo chown -R vagrant /home/vagrant/.ssh
|
||||
|
||||
# Copy docker config
|
||||
sudo mv /home/vagrant/docker-default /etc/default/docker
|
||||
|
||||
# Enable autologin so docker can start GUI apps
|
||||
sudo echo "autologin-user=vagrant" >> /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf
|
||||
sudo echo "autologin-user-timeout=0" >> /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf
|
||||
|
||||
# X session RC
|
||||
chmod +x /home/vagrant/.xsessionrc
|
||||
SHELL
|
||||
|
||||
config.vm.provision "docker"
|
||||
|
||||
# Shutdown after provisioning. "vagrant halt" doesn't recognize the original ssh key anymore
|
||||
# and would just kill the VM. This might lead to FS inconsistencies (e.g. in the docker DB).
|
||||
config.vm.provision "shell", inline: "sudo shutdown -h now"
|
||||
end
|
||||
26
Tools/ros/vagrant/docker-host-base/config/docker-default
Normal file
26
Tools/ros/vagrant/docker-host-base/config/docker-default
Normal file
@ -0,0 +1,26 @@
|
||||
#
|
||||
# Default config for docker /etc/default/docker
|
||||
# Copied from a provisioned vagrant box
|
||||
#
|
||||
# Modifications:
|
||||
# - listen to TCP port
|
||||
# - removing deprecated "-r=true" option which apparently doesn't work anymore
|
||||
# > use restart policies for specific containers if necessary
|
||||
#
|
||||
|
||||
# Docker Upstart and SysVinit configuration file
|
||||
|
||||
# Customize location of Docker binary (especially for development testing).
|
||||
#DOCKER="/usr/local/bin/docker"
|
||||
|
||||
# Use DOCKER_OPTS to modify the daemon startup options.
|
||||
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
|
||||
|
||||
# If you need Docker to use an HTTP proxy, it can also be specified here.
|
||||
#export http_proxy="http://127.0.0.1:3128/"
|
||||
|
||||
# This is also a handy place to tweak where Docker's temporary files go.
|
||||
#export TMPDIR="/mnt/bigdrive/docker-tmp"
|
||||
|
||||
# Expose TCP port in addition to socket
|
||||
DOCKER_OPTS="${DOCKER_OPTS} -H unix:///var/run/docker.sock -H 0.0.0.0:2375"
|
||||
5
Tools/ros/vagrant/docker-host-base/config/xsessionrc
Normal file
5
Tools/ros/vagrant/docker-host-base/config/xsessionrc
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Disable X access control so we can easily start GUI apps
|
||||
#
|
||||
xhost +
|
||||
25
Tools/ros/vagrant/docker-host/Vagrantfile
vendored
Normal file
25
Tools/ros/vagrant/docker-host/Vagrantfile
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
Vagrant.configure(2) do |config|
|
||||
config.vm.box = "docker-host-base"
|
||||
|
||||
config.vm.define "docker-host"
|
||||
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
vb.name = "docker-host"
|
||||
vb.gui = true
|
||||
vb.memory = "4096"
|
||||
vb.cpus = 2
|
||||
vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxvga"]
|
||||
vb.customize ["modifyvm", :id, "--accelerate3d", "on"]
|
||||
vb.customize ["modifyvm", :id, "--ioapic", "on"]
|
||||
vb.customize ["modifyvm", :id, "--vram", "128"]
|
||||
vb.customize ["modifyvm", :id, "--hwvirtex", "on"]
|
||||
end
|
||||
|
||||
config.vm.network "private_network", ip: "192.168.59.104"
|
||||
|
||||
# TBD: would it be better to provision docker here instead of in the base box?
|
||||
#config.vm.provision "docker"
|
||||
end
|
||||
27
Tools/ros/vagrant/px4-ros-sitl/Vagrantfile
vendored
Normal file
27
Tools/ros/vagrant/px4-ros-sitl/Vagrantfile
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
Vagrant.configure(2) do |config|
|
||||
# Configure docker host
|
||||
config.vm.provider "docker" do |d|
|
||||
d.vagrant_machine = "docker-host"
|
||||
d.vagrant_vagrantfile = "../docker-host/Vagrantfile"
|
||||
end
|
||||
|
||||
# Configure docker apps to run
|
||||
config.vm.define "gazebo" do |app|
|
||||
app.vm.provider "docker" do |d|
|
||||
d.name = "gazebo"
|
||||
d.image = "px4ros/ros-sitl:no-drcsim"
|
||||
|
||||
# share docker host x11 socket
|
||||
d.volumes = ["/tmp/.X11-unix:/tmp/.X11-unix:ro"]
|
||||
# TODO: get display number from host system
|
||||
d.env = {
|
||||
"DISPLAY" => ":0"
|
||||
}
|
||||
|
||||
d.cmd = ["xterm"]
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user