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

Add RViz #48

Merged
merged 10 commits into from
Apr 29, 2023
Prev Previous commit
Next Next commit
Add rviz2 docker container
  • Loading branch information
hmakelin committed Apr 29, 2023
commit 1c61c257760b1c9bdc1b68e2b1dcbd943e15fb0b
4 changes: 2 additions & 2 deletions docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ build-offboard-sitl-test-%: build-offboard-sitl-middleware-%
# sitl development services: Gazebo simulation, ROS middleware, mapserver, torch-serve, QGC, but excluding GISNav
. PHONY: $(addprefix offboard-sitl-dev-, $(AUTOPILOTS))
offboard-sitl-dev-%: offboard-sitl-middleware-%
@docker compose up -d $* torch-serve mapserver qgc
@docker compose up -d $* torch-serve mapserver qgc rviz2

. PHONY: $(addprefix build-offboard-sitl-dev-, $(AUTOPILOTS))
build-offboard-sitl-dev-%: build-offboard-sitl-middleware-%
@docker compose build $* torch-serve mapserver qgc
@docker compose build $* torch-serve mapserver qgc rviz2

# offboard sitl middleware
. PHONY: $(addprefix offboard-sitl-middleware-, $(AUTOPILOTS))
Expand Down
23 changes: 23 additions & 0 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,26 @@ services:
- driver: nvidia
count: 1
capabilities: [ gpu ]

# Note: build context is repository root
rviz2:
build:
context: rviz2
dockerfile: Dockerfile
env_file:
- env/x11.env
environment:
- FASTRTPS_DEFAULT_PROFILES_FILE=/disable_shared_memory.xml
volumes:
- /dev/dri:/dev/dri
network_mode: host
stdin_open: true
tty: true
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [ gpu ]
command: rviz2
9 changes: 9 additions & 0 deletions docker/rviz2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM ros:foxy

RUN apt-get update && \
apt-get -y dist-upgrade && \
apt-get -y install ros-foxy-rviz2

COPY --chmod=755 disable_shared_memory.xml entrypoint.sh /

ENTRYPOINT ["/entrypoint.sh"]
17 changes: 17 additions & 0 deletions docker/rviz2/disable_shared_memory.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles" >
<transport_descriptors>
<transport_descriptor>
<transport_id>CustomUdpTransport</transport_id>
<type>UDPv4</type>
</transport_descriptor>
</transport_descriptors>
<participant profile_name="participant_profile" is_default_profile="true">
<rtps>
<userTransports>
<transport_id>CustomUdpTransport</transport_id>
</userTransports>
<useBuiltinTransports>false</useBuiltinTransports>
</rtps>
</participant>
</profiles>
6 changes: 6 additions & 0 deletions docker/rviz2/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e

source "/opt/ros/foxy/setup.bash"

exec "$@"