Skip to content

Commit

Permalink
Add lunar_pole_exploration_rover demo (fix issue space-ros#36)
Browse files Browse the repository at this point in the history
Add the demo launch files and control nodes. Also adds
the controller configuration and a gazebo lunar world.

A dockerfile is included for test.
  • Loading branch information
RBinsonB authored and mkhansenbot committed Sep 9, 2024
1 parent 981bd60 commit a618cb0
Show file tree
Hide file tree
Showing 13 changed files with 1,131 additions and 0 deletions.
51 changes: 51 additions & 0 deletions lunar_pole_exploration_rover/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
cmake_minimum_required(VERSION 3.8)
project(lunar_pole_exploration_rover)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)
find_package(control_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(rclpy REQUIRED)
find_package(simulation REQUIRED)
find_package(std_msgs REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# comment the line when a copyright and license is added to all source files
set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# comment the line when this package is in a git repo and when
# a copyright and license is added to all source files
set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()

install(DIRECTORY
config
launch
worlds
DESTINATION share/${PROJECT_NAME}
)

ament_python_install_package(${PROJECT_NAME})

install(PROGRAMS
nodes/move_mast
nodes/move_wheel
nodes/run_demo
nodes/odom_tf_publisher
DESTINATION lib/${PROJECT_NAME}
)

ament_package()
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
controller_manager:
ros__parameters:
update_rate: 100

mast_camera_joint_trajectory_controller:
type: joint_trajectory_controller/JointTrajectoryController

wheel_velocity_controller:
type: velocity_controllers/JointGroupVelocityController

steer_position_controller:
type: joint_trajectory_controller/JointTrajectoryController

joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster


mast_camera_joint_trajectory_controller:
ros__parameters:
joints:
- mast_head_pivot_joint
- mast_camera_joint
interface_name: position
command_interfaces:
- position
state_interfaces:
- position
- velocity

wheel_velocity_controller:
ros__parameters:
joints:
- front_left_wheel_joint
- rear_left_wheel_joint
- front_right_wheel_joint
- rear_right_wheel_joint
interface_name: velocity

steer_position_controller:
ros__parameters:
joints:
- front_left_wheel_axle_joint
- rear_left_wheel_axle_joint
- front_right_wheel_axle_joint
- rear_right_wheel_axle_joint
interface_name: position
command_interfaces:
- position
state_interfaces:
- position
- velocity
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 "$@"
Loading

0 comments on commit a618cb0

Please sign in to comment.