Skip to content

Commit

Permalink
Add README for the challenge and dockerfile (fix issue space-ros#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
RBinsonB committed Sep 6, 2024
1 parent 048a68b commit ffd82c3
Show file tree
Hide file tree
Showing 12 changed files with 507 additions and 5 deletions.
321 changes: 321 additions & 0 deletions lunar_pole_exploration_rover/README.md

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
97 changes: 97 additions & 0 deletions lunar_pole_exploration_rover/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Copyright 2021 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# A Docker configuration script to build the Space ROS image.
#
# The script provides the following build arguments:
#
# VCS_REF - The git revision of the Space ROS source code (no default value).
# VERSION - The version of Space ROS (default: "preview")

FROM openrobotics/moveit2:latest

# Define arguments used in the metadata definition
ARG VCS_REF
ARG VERSION="preview"

# Specify the docker image metadata
LABEL org.label-schema.schema-version="1.0"
LABEL org.label-schema.name="Lunar Pole Exploration Rover"
LABEL org.label-schema.description="Lunar Pole Exploration Rover entry for the NASA Space ROS Sim Summer Sprint Challenge"
LABEL org.label-schema.vendor="Open Robotics"
LABEL org.label-schema.version=${VERSION}
LABEL org.label-schema.url="https://github.com/space-ros"
LABEL org.label-schema.vcs-url="https://github.com/space-ros/demos"
LABEL org.label-schema.vcs-ref=${VCS_REF}

# Define a few key variables
ENV DEMO_DIR=${HOME_DIR}/demos_ws
ENV IGNITION_VERSION=fortress
ENV GZ_VERSION=fortress

# Disable prompting during package installation
ARG DEBIAN_FRONTEND=noninteractive

# Get rosinstall_generator
# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that
# the cache won't make it into the built image but will be maintained between steps.
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sudo apt-get update -y && sudo apt-get install -y python3-rosinstall-generator


RUN mkdir -p ${DEMO_DIR}/src
WORKDIR ${DEMO_DIR}


# Install libmongoc for development
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sudo apt-get install libmongoc-dev -y

# Compile mongo cxx driver https://mongocxx.org/mongocxx-v3/installation/linux/
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sudo apt-get install libssl-dev build-essential devscripts debian-keyring fakeroot debhelper cmake libboost-dev libsasl2-dev libicu-dev libzstd-dev doxygen -y
RUN wget https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.6.7/mongo-cxx-driver-r3.6.7.tar.gz
RUN tar -xzf mongo-cxx-driver-r3.6.7.tar.gz
RUN cd mongo-cxx-driver-r3.6.7/build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local && sudo cmake --build . --target EP_mnmlstc_core && cmake --build . && sudo cmake --build . --target install

# Get the source for the dependencies
# RUN vcs import src < /tmp/demo_generated_pkgs.repos
COPY --chown=${USERNAME}:${USERNAME} demos/lunar_pole_exploration_rover/docker/demo_manual_pkgs.repos /tmp/
RUN vcs import src < /tmp/demo_manual_pkgs.repos && /bin/bash -c 'source "${SPACEROS_DIR}/install/setup.bash"'

# Copy the "demos" and "simulation" repos into the workspace
COPY demos ./src/demos
COPY simulation ./src/simulation

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sudo apt-get update -y \
&& /bin/bash -c 'source "${SPACEROS_DIR}/install/setup.bash"' \
&& /bin/bash -c 'source "${MOVEIT2_DIR}/install/setup.bash"' \
&& rosdep install --from-paths src --ignore-src -r -y --rosdistro ${ROSDISTRO}

# Build the demo
RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash && source ${MOVEIT2_DIR}/install/setup.bash \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release'

# Add the user to the render group so that the user can access /dev/dri/renderD128
RUN sudo usermod -aG render $USERNAME

# Setup the entrypoint
COPY demos/lunar_pole_exploration_rover/docker/entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
CMD ["bash"]
34 changes: 34 additions & 0 deletions lunar_pole_exploration_rover/docker/demo_manual_pkgs.repos
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
repositories:
gz_ros2_control:
type: git
url: https://github.com/ros-controls/gz_ros2_control.git
version: humble
qt_gui_core:
type: git
url: https://github.com/ros-visualization/qt_gui_core.git
version: humble
ros2_controllers:
type: git
url: https://github.com/tonylitianyu/ros2_controllers.git
version: effort_group_position_controller_2
actuator_msgs:
type: git
url: https://github.com/rudislabs/actuator_msgs.git
version: main
ros_gz:
type: git
url: https://github.com/gazebosim/ros_gz.git
version: humble
ros-humble-warehouse-ros-mongo:
type: git
url: https://github.com/ros-planning/warehouse_ros_mongo.git
version: ros2
vision_msgs:
type: git
url: https://github.com/ros-perception/vision_msgs.git
version: ros2
gps_msgs:
type: git
url: https://github.com/swri-robotics/gps_umd.git
path: gps_msgs
version: 113782d
6 changes: 6 additions & 0 deletions lunar_pole_exploration_rover/docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e

# Setup the Demo environment
source "${DEMO_DIR}/install/setup.bash"
exec "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -83,27 +83,64 @@ def generate_launch_description():
'/model/lunar_pole_exploration_rover/left_solar_panel/solar_panel_output@std_msgs/msg/[email protected]',
'/model/lunar_pole_exploration_rover/right_solar_panel/solar_panel_output@std_msgs/msg/[email protected]',
'/model/lunar_pole_exploration_rover/rear_solar_panel/solar_panel_output@std_msgs/msg/[email protected]',
'/model/lunar_pole_exploration_rover/battery/rechargeable_battery/state@sensor_msgs/msg/[email protected]',
],
output='screen')

image_bridge = Node(
navcam_left_image_bridge = Node(
package='ros_gz_image',
executable='image_bridge',
arguments=['navcam_left/image_raw', 'navcam_left/image_raw'],
output='screen')
image_bridge = Node(

navcam_right_image_bridge = Node(
package='ros_gz_image',
executable='image_bridge',
arguments=['navcam_right/image_raw', 'navcam_right/image_raw'],
output='screen')

aftcam_left_image_bridge = Node(
package='ros_gz_image',
executable='image_bridge',
arguments=['aftcam_left/image_raw', 'aftcam_left/image_raw'],
output='screen')

aftcam_right_image_bridge = Node(
package='ros_gz_image',
executable='image_bridge',
arguments=['aftcam_right/image_raw', 'aftcam_right/image_raw'],
output='screen')

hazcam_left_front_image_bridge = Node(
package='ros_gz_image',
executable='image_bridge',
arguments=['hazcam_left_front/image_raw', 'hazcam_left_front/image_raw'],
output='screen')

hazcam_left_rear_image_bridge = Node(
package='ros_gz_image',
executable='image_bridge',
arguments=['hazcam_left_rear/image_raw', 'hazcam_left_rear/image_raw'],
output='screen')

hazcam_right_front_image_bridge = Node(
package='ros_gz_image',
executable='image_bridge',
arguments=['hazcam_right_front/image_raw', 'hazcam_right_front/image_raw'],
output='screen')

hazcam_right_rear_image_bridge = Node(
package='ros_gz_image',
executable='image_bridge',
arguments=['hazcam_right_rear/image_raw', 'hazcam_right_rear/image_raw'],
output='screen')

spawn = Node(
package='ros_ign_gazebo', executable='create',
arguments=[
'-name', 'lunar_pole_exploration_rover',
'-topic', robot_description,
'-z', '0.5'
'-z', '0.0',
],
output='screen'

Expand Down Expand Up @@ -156,7 +193,14 @@ def generate_launch_description():
run_node,
odom_node,
ros_gz_bridge,
image_bridge,
navcam_left_image_bridge,
navcam_right_image_bridge,
aftcam_left_image_bridge,
aftcam_right_image_bridge,
hazcam_left_front_image_bridge,
hazcam_left_rear_image_bridge,
hazcam_right_front_image_bridge,
hazcam_right_rear_image_bridge,

RegisterEventHandler(
OnProcessExit(
Expand Down

0 comments on commit ffd82c3

Please sign in to comment.