Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker #151

Merged
merged 11 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ vcs import src < src/repos.yaml
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install
```
Copy the Dockerfile and the container scripts to the lbr-stack directory. Build and start the container.
mhubii marked this conversation as resolved.
Show resolved Hide resolved
```shell
cp -r src/lbr_fri_ros2_stack/lbr_humble_docker/* .
chmod +x container_build.sh
sudo ./container_build.sh
```
Next, launch the simulation via
```shell
source install/setup.bash
Expand Down
26 changes: 26 additions & 0 deletions lbr_humble_docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM ros:humble-ros-base-jammy

SHELL ["/bin/bash", "-c"]

RUN apt update -y
RUN apt install vim python-is-python3 python3-pip python3-colcon-common-extensions -y
mhubii marked this conversation as resolved.
Show resolved Hide resolved
RUN pip3 install scipy numpy
# create workspace and build package
# source workspace
RUN source /opt/ros/humble/setup.bash && echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc

# create workspace
RUN mkdir -p home/ros2_ws/src
WORKDIR /home/ros2_ws/

COPY ./src /home/ros2_ws/src
RUN rosdep install -i --from-path src --rosdistro humble -y

# "--symlink-install" allows the code in the locally mounted volume ./src to be adjusted without rebuilding
RUN source /opt/ros/humble/setup.bash && colcon build --symlink-install

# source overlay workspace
RUN source /home/ros2_ws/install/setup.bash && echo "source /home/ros2_ws/install/setup.bash" >> ~/.bashrc
CMD ["/bin/bash"]


19 changes: 19 additions & 0 deletions lbr_humble_docker/container_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# dont forget to chmod +x container_build.sh
xhost +

docker rm lbr_stack_container

docker build -t lbr_stack_container .

docker run -it \
--network host \
--ipc host \
--volume ./src:/home/ros2_ws/src \
--volume /tmp/.X11-unix:/tmp/.X11-unix \
--volume /dev/shm:/dev/shm \
--volume /dev:/dev --privileged \
--env DISPLAY \
--env QT_X11_NO_MITSHM=1 \
--name lbr_stack_container \
lbr_stack_container

2 changes: 2 additions & 0 deletions lbr_humble_docker/container_new_console.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# dont forget to chmod +x container_new_console.sh
docker exec -it lbr_stack_container bash
5 changes: 5 additions & 0 deletions lbr_humble_docker/container_start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# dont forget to chmod +x container_new_console.sh
xhost +

docker start lbr_stack_container -i

Loading