Skip to content

Commit

Permalink
we ARE going to use Docker with Spot
Browse files Browse the repository at this point in the history
  • Loading branch information
zkytony committed Feb 24, 2022
1 parent d52067c commit 1305204
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 1 deletion.
47 changes: 47 additions & 0 deletions Dockerfile.noetic
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This image allows you to have a Ubuntu 20.04 + ROS Noetic setup.
# You can mount the path to the 'robotdev' repository in your host
# machine to the same path in the container. We ask you to use the
# same username in the container as in your host machine. This
# simplifies the maintenance of the 'robotdev' repository.
# This setup relies on the nice ros:noetic image provided
# on Docker Hub.
# /author: Kaiyu Zheng
FROM ros:noetic

# Install software
RUN apt-get update
RUN apt-get install -y --no-install-recommends apt-utils
RUN apt-get install -y emacs
RUN apt-get install -y sudo
RUN apt-get install -y python-pip
RUN apt-get install -y net-tools
RUN apt-get install -y iputils-ping
RUN apt-get install -y gdb
RUN apt-get install -y mlocate
RUN apt-get install -y openssh-client openssh-server
RUN apt-get install -y ros-noetic-desktop-full
RUN apt-get install -y ros-noetic-rviz-imu-plugin


# create a user
ARG hostuser=kaiyu

RUN adduser --disabled-password --gecos '' $hostuser
RUN adduser $hostuser sudo
# Ensure sudo group users are not asked for a p3assword when using sudo command
# by ammending sudoers file
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> \
/etc/sudoers

USER $hostuser
WORKDIR /home/$hostuser
ENV HOME=/home/$hostuser
RUN mkdir $HOME/repo

# Different shell color
RUN echo "export PS1='\e[33;1m\u@\h:\e[31m\w\e[0m\$ '" >> $HOME/.bashrc

# print some info on start
RUN echo "echo -e 'Welcome! You are now in a docker container ().'" >> $HOME/.bashrc
RUN echo "echo -e \"Docker ID: $(basename $(cat /proc/1/cpuset))\"" >> $HOME/.bashrc
CMD ["bash"]
42 changes: 42 additions & 0 deletions docker/build.noetic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Make sure we are in the right directory.
# the rest of the script assumes we are in robotdev/docker
if [[ $PWD = *robotdev ]]; then
cd docker
elif [[ ! $PWD = *robotdev/docker ]]; then
echo -e "You must be in either 'robotdev' or the 'robotdev/docker' directory to run this command."
return 1
fi

# load tools
. "../tools.sh"

# parse args
hostuser=$USER # the user inside the container
nvidia=""
for arg in "$@"
do
if parse_var_arg arg; then
if [[ $var_name = "hostuser" ]]; then
hostuser=$var_value
else
echo -e "Unrecognized argument variable: ${var_name}"
fi
elif is_flag arg; then
# we are not there yet (with nvidia)
# if [[ $arg = "--nvidia" ]]; then
# nvidia=".nvidia"
# fi
echo "unhandled arg: $arg"
fi
done

# Build the docker image. The `--rm` option is for you to more conveniently
# rebuild the image.
cd $PWD/../ # get to the root of the repository
docker build -f Dockerfile.noetic${nvidia}\
-t robotdev:noetic\
--build-arg hostuser=$hostuser\
--rm\
.
# Explain the options above:
# -t: tag
13 changes: 12 additions & 1 deletion spot/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# Spot

Activate spot workspace:
# Activate spot workspace:
```
# at robotdev root directory:
$ source setup_spot.bash
```


## Build

Similar to MOVO, we use Docker for Spot too (but we are using
Ubuntu 20.04 with ROS noetic). First, build the docker image:
```
source docker/build.noetic.sh
```
TODO FINISH THIS


To build spot, don't run `catkin_make`. Instead,
after sourcing `setup_spot.bash`, run:

Expand Down

0 comments on commit 1305204

Please sign in to comment.