From 30a5bb0505f3a82bf558a79c6c7a74578c3ff494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ellensohn?= Date: Wed, 2 Aug 2023 13:56:21 +0000 Subject: [PATCH] update --- README.md | 17 ++++-- docker-compose.yaml | 78 +++++++++++++++----------- docker/Dockerfile | 16 ++++++ test.rviz | 133 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 207 insertions(+), 37 deletions(-) create mode 100644 test.rviz diff --git a/README.md b/README.md index b13dbee..42ea1fe 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,17 @@ # ros2_rmp +For the build with docker buildx bake you will need binfmt dependencies for arm64 architecture, as we are doing a multiplatform build (Works on PCs as well as Jetson Nano, Raspberry Pi, Apple Silicon Devices). +For Robot: +docker buildx bake overlay --load +docker buildx bake overlay --push +e.g.: +docker compose up -d controller - -docker buildx bake -f docker-compose.yaml overlay --load - -docker buildx bake -f docker-compose.yaml overlay --push \ No newline at end of file +For PC: +docker buildx bake guis --load +docker buildx bake guis --push +--> get into container shell: +docker compose run guis +or +docker compose up rviz2 \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 320512d..2bb5036 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,5 @@ version: "3.9" + services: # Base image containing dependencies. base: @@ -46,22 +47,26 @@ services: platforms: - linux/arm64 - linux/amd64 + volumes: + - .:/repo - # # Overlay image containing the project specific source code. - # final: - # extends: overlay - # image: ghcr.io/bjoernellens1/ros2_rmp/rmp:final - # build: - # context: . - # dockerfile: docker/Dockerfile - # tags: - # - ghcr.io/bjoernellens1/ros2_rmp/rmp:final - # target: final - # x-bake: - # platforms: - # - linux/arm64 - # - linux/amd64 - # command: /bin/bash + # Additional dependencies for GUI applications + guis: + extends: overlay + image: ghcr.io/bjoernellens1/ros2_rmp/rmp:guis + build: + context: . + dockerfile: docker/Dockerfile + tags: + - ghcr.io/bjoernellens1/ros2_rmp/rmp:guis + target: guis + x-bake: + platforms: + - linux/arm64 + - linux/amd64 + #entrypoint: /bin/bash + command: > + /bin/bash # Robot State Publisher robot_state_publisher: @@ -98,7 +103,7 @@ services: teleop: extends: overlay command: > - ros2 launch cps_rmp220_support robot_joystick.launch.py --ros-args -r __ns:=/probeNamespace + ros2 launch cps_rmp220_support robot_joystick.launch.py devices: - /dev/ttyUSB0:/dev/ttyUSB0 - /dev/ttyACM0:/dev/ttyACM0 @@ -160,20 +165,27 @@ services: network_mode: host ipc: host - # # Behavior demo using Python and py_trees - # demo-behavior-py: - # extends: overlay - # command: > - # ros2 launch tb3_autonomy tb3_demo_behavior_py.launch.py - # tree_type:=${BT_TYPE:?} - # enable_vision:=${ENABLE_VISION:?} - # target_color:=${TARGET_COLOR:?} - - # # Behavior demo using C++ and BehaviorTree.CPP - # demo-behavior-cpp: - # extends: overlay - # command: > - # ros2 launch tb3_autonomy tb3_demo_behavior_cpp.launch.py - # tree_type:=${BT_TYPE:?} - # enable_vision:=${ENABLE_VISION:?} - # target_color:=${TARGET_COLOR:?} + # rviz2 + rviz2: + extends: guis + # command: > + # ros2 launch cps_rmp220_support robot_rviz2.launch.py + command: > + rviz2 + # Interactive shell + stdin_open: true + tty: true + # Networking and IPC for ROS 2 + network_mode: host + ipc: host + # Needed to display graphical applications + privileged: true + environment: + # Allows graphical programs in the container. + - DISPLAY=${DISPLAY} + - QT_X11_NO_MITSHM=1 + - NVIDIA_DRIVER_CAPABILITIES=all + volumes: + # Allows graphical programs in the container. + - /tmp/.X11-unix:/tmp/.X11-unix:rw + - ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index a282cb8..01a3156 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -89,4 +89,20 @@ RUN chmod +x /localization_startup.sh ENTRYPOINT [ "/entrypoint.sh" ] +########################################### +# GUI Additions for Ros2 # +########################################### +FROM overlay AS guis + +# Install additional GUI tools +RUN source /rmp_ws/install/setup.bash \ + && colcon build --symlink-install \ + && apt-get update \ + && apt-get install -y --no-install-recommends ros-${ROS_DISTRO}-rviz2 \ + && rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y \ + && rm -rf /var/lib/apt/lists/* + +# Set up the entrypoint +ENTRYPOINT [ "/entrypoint.sh" ] + LABEL org.opencontainers.image.source=https://github.com/bjoernellens1/ros2_rmp \ No newline at end of file diff --git a/test.rviz b/test.rviz new file mode 100644 index 0000000..ec86523 --- /dev/null +++ b/test.rviz @@ -0,0 +1,133 @@ +Panels: + - Class: rviz_common/Displays + Help Height: 85 + Name: Displays + Property Tree Widget: + Expanded: + - /Global Options1 + - /Status1 + Splitter Ratio: 0.5 + Tree Height: 528 + - Class: rviz_common/Selection + Name: Selection + - Class: rviz_common/Tool Properties + Expanded: + - /2D Goal Pose1 + - /Publish Point1 + Name: Tool Properties + Splitter Ratio: 0.5886790156364441 + - Class: rviz_common/Views + Expanded: + - /Current View1 + Name: Views + Splitter Ratio: 0.5 + - Class: rviz_common/Time + Experimental: false + Name: Time + SyncMode: 0 + SyncSource: "" +Visualization Manager: + Class: "" + Displays: + - Alpha: 0.5 + Cell Size: 1 + Class: rviz_default_plugins/Grid + Color: 160; 160; 164 + Enabled: true + Line Style: + Line Width: 0.029999999329447746 + Value: Lines + Name: Grid + Normal Cell Count: 0 + Offset: + X: 0 + Y: 0 + Z: 0 + Plane: XY + Plane Cell Count: 10 + Reference Frame: + Value: true + Enabled: true + Global Options: + Background Color: 48; 48; 48 + Fixed Frame: map + Frame Rate: 30 + Name: root + Tools: + - Class: rviz_default_plugins/Interact + Hide Inactive Objects: true + - Class: rviz_default_plugins/MoveCamera + - Class: rviz_default_plugins/Select + - Class: rviz_default_plugins/FocusCamera + - Class: rviz_default_plugins/Measure + Line color: 128; 128; 0 + - Class: rviz_default_plugins/SetInitialPose + Covariance x: 0.25 + Covariance y: 0.25 + Covariance yaw: 0.06853891909122467 + Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /initialpose + - Class: rviz_default_plugins/SetGoal + Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /goal_pose + - Class: rviz_default_plugins/PublishPoint + Single click: true + Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /clicked_point + Transformation: + Current: + Class: rviz_default_plugins/TF + Value: true + Views: + Current: + Class: rviz_default_plugins/Orbit + Distance: 10 + Enable Stereo Rendering: + Stereo Eye Separation: 0.05999999865889549 + Stereo Focal Distance: 1 + Swap Stereo Eyes: false + Value: false + Focal Point: + X: 0 + Y: 0 + Z: 0 + Focal Shape Fixed Size: true + Focal Shape Size: 0.05000000074505806 + Invert Z Axis: false + Name: Current View + Near Clip Distance: 0.009999999776482582 + Pitch: 0.785398006439209 + Target Frame: + Value: Orbit (rviz) + Yaw: 0.785398006439209 + Saved: ~ +Window Geometry: + Displays: + collapsed: false + Height: 845 + Hide Left Dock: false + Hide Right Dock: false + QMainWindow State: 000000ff00000000fd00000004000000000000015a000002a6fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006b00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c0061007900730100000044000002a6000000eb00fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002a6fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a005600690065007700730100000044000002a6000000b900fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004af0000003efc0100000002fb0000000800540069006d00650100000000000004af000002d200fffffffb0000000800540069006d0065010000000000000450000000000000000000000238000002a600000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 + Selection: + collapsed: false + Time: + collapsed: false + Tool Properties: + collapsed: false + Views: + collapsed: false + Width: 1199 + X: 199 + Y: 115