Skip to content

Commit 4712dea

Browse files
RBinsonBstevedanomodolor
authored andcommitted
Add lunar_pole_exploration_rover demo (#36).
This commit adds a lunar pole exploration rover demo modelled on NASA's VIPER mission, including a simulated rover model, and world and ground models to simulate the Mons Mouton. The commit also adds Gazebo plugins to simulate power generation and consumption in space robotics, which the simulation above uses. Plugins include: - A solar panel plugin to simulate power generation from the sun according to occlusion and angle between the sun and the panel. - A radioisotope thermal generator plugin to simulate the constant power from a radioisotope thermal generator. - A modified version of the linear battery plugin that is able to take as charge input the power outputs of the two previous plugins. - A sensor power load system plugin to simulate the power drawn by sensors Documentation, as well as a dockerfile to help build and try this demo, are included. Co-authored-by: stevedan <[email protected]>
1 parent 4657a2b commit 4712dea

27 files changed

Lines changed: 2065 additions & 0 deletions
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
cmake_minimum_required(VERSION 3.8)
2+
project(lunar_pole_exploration_rover)
3+
4+
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5+
add_compile_options(-Wall -Wextra -Wpedantic)
6+
endif()
7+
8+
# find dependencies
9+
find_package(ament_cmake REQUIRED)
10+
find_package(ament_cmake_python REQUIRED)
11+
find_package(control_msgs REQUIRED)
12+
find_package(geometry_msgs REQUIRED)
13+
find_package(rclcpp REQUIRED)
14+
find_package(rclcpp_action REQUIRED)
15+
find_package(rclpy REQUIRED)
16+
find_package(simulation REQUIRED)
17+
find_package(std_msgs REQUIRED)
18+
# uncomment the following section in order to fill in
19+
# further dependencies manually.
20+
# find_package(<dependency> REQUIRED)
21+
22+
if(BUILD_TESTING)
23+
find_package(ament_lint_auto REQUIRED)
24+
# the following line skips the linter which checks for copyrights
25+
# comment the line when a copyright and license is added to all source files
26+
set(ament_cmake_copyright_FOUND TRUE)
27+
# the following line skips cpplint (only works in a git repo)
28+
# comment the line when this package is in a git repo and when
29+
# a copyright and license is added to all source files
30+
set(ament_cmake_cpplint_FOUND TRUE)
31+
ament_lint_auto_find_test_dependencies()
32+
endif()
33+
34+
install(DIRECTORY
35+
config
36+
launch
37+
worlds
38+
DESTINATION share/${PROJECT_NAME}
39+
)
40+
41+
ament_python_install_package(${PROJECT_NAME})
42+
43+
install(PROGRAMS
44+
nodes/move_mast
45+
nodes/move_wheel
46+
nodes/run_demo
47+
nodes/odom_tf_publisher
48+
DESTINATION lib/${PROJECT_NAME}
49+
)
50+
51+
ament_package()
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# Copyright 2021 Open Source Robotics Foundation, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# A Docker configuration script to build the Space ROS image.
16+
#
17+
# The script provides the following build arguments:
18+
#
19+
# VCS_REF - The git revision of the Space ROS source code (no default value).
20+
# VERSION - The version of Space ROS (default: "preview")
21+
22+
FROM osrf/space-ros:humble-2024.10.0
23+
24+
# Define arguments used in the metadata definition
25+
ARG VCS_REF
26+
ARG VERSION="preview"
27+
ARG ROSDISTRO="humble"
28+
29+
# Specify the docker image metadata
30+
LABEL org.label-schema.schema-version="1.0"
31+
LABEL org.label-schema.name="Lunar Pole Exploration Rover"
32+
LABEL org.label-schema.description="Lunar Pole Exploration Rover entry for the NASA Space ROS Sim Summer Sprint Challenge"
33+
LABEL org.label-schema.vendor="Open Robotics"
34+
LABEL org.label-schema.version=${VERSION}
35+
LABEL org.label-schema.url="https://github.com/space-ros"
36+
LABEL org.label-schema.vcs-url="https://github.com/space-ros/demos"
37+
LABEL org.label-schema.vcs-ref=${VCS_REF}
38+
39+
# Disable prompting during package installation
40+
ARG DEBIAN_FRONTEND=noninteractive
41+
42+
# Update the ROS package keys
43+
ADD --chmod=644 https://raw.githubusercontent.com/ros/rosdistro/master/ros.key /usr/share/keyrings/ros-archive-keyring.gpg
44+
45+
# Make sure the latest versions of packages are installed
46+
# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that
47+
# the cache won't make it into the built image but will be maintained between steps.
48+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
49+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
50+
sudo apt-get update
51+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
52+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
53+
sudo apt-get dist-upgrade -y
54+
55+
# Install the various build and test tools
56+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
57+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
58+
sudo apt install -y \
59+
build-essential \
60+
clang-format \
61+
cmake \
62+
git \
63+
git-lfs \
64+
libbullet-dev \
65+
python3-colcon-common-extensions \
66+
python3-flake8 \
67+
python3-pip \
68+
python3-pytest-cov \
69+
python3-rosdep \
70+
python3-rosinstall-generator \
71+
python3-setuptools \
72+
python3-vcstool \
73+
wget
74+
75+
# Install some pip packages needed for testing
76+
RUN python3 -m pip install -U \
77+
argcomplete \
78+
flake8-blind-except \
79+
flake8-builtins \
80+
flake8-class-newline \
81+
flake8-comprehensions \
82+
flake8-deprecated \
83+
flake8-docstrings \
84+
flake8-import-order \
85+
flake8-quotes \
86+
pytest-repeat \
87+
pytest-rerunfailures \
88+
pytest
89+
90+
# Define a few key variables
91+
ENV DEMO_DIR=${HOME_DIR}/demos_ws
92+
ENV IGNITION_VERSION=fortress
93+
ENV GZ_VERSION=fortress
94+
95+
# Clone all space-ros sources. We use lfs specifically to pull resources
96+
# from the simulation repo.
97+
RUN mkdir ${SPACEROS_DIR}/src \
98+
&& vcs import ${SPACEROS_DIR}/src < ${SPACEROS_DIR}/exact.repos \
99+
&& vcs custom ${SPACEROS_DIR}/src --args lfs pull
100+
101+
# Define key locations
102+
RUN mkdir -p ${DEMO_DIR}/src
103+
WORKDIR ${DEMO_DIR}
104+
105+
COPY . src/lunar_pole_exploration_rover
106+
RUN rosdep update
107+
108+
# Generate repos file for dependencies, excluding packages from Space ROS core.
109+
COPY --chown=${USERNAME}:${USERNAME} demo-pkgs.txt /tmp/
110+
COPY --chown=${USERNAME}:${USERNAME} excluded-pkgs.txt /tmp/
111+
RUN rosinstall_generator \
112+
--upstream \
113+
--rosdistro ${ROSDISTRO} \
114+
--deps \
115+
--exclude-path ${SPACEROS_DIR}/src \
116+
--exclude $(cat /tmp/excluded-pkgs.txt) -- \
117+
-- $(cat /tmp/demo-pkgs.txt) \
118+
> /tmp/demo_generated_pkgs.repos
119+
120+
RUN vcs import src < /tmp/demo_generated_pkgs.repos \
121+
&& vcs custom ${SPACEROS_DIR}/src --args lfs pull
122+
123+
# Get the source for the dependencies
124+
COPY --chown=${USERNAME}:${USERNAME} demo_manual_pkgs.repos /tmp/
125+
RUN vcs import src < /tmp/demo_manual_pkgs.repos \
126+
&& vcs custom ${SPACEROS_DIR}/src --args lfs pull \
127+
&& /bin/bash -c 'source "${SPACEROS_DIR}/install/setup.bash"'
128+
129+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
130+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
131+
sudo apt-get update -y \
132+
&& /bin/bash -c 'source "${SPACEROS_DIR}/install/setup.bash"' \
133+
&& rosdep install --from-paths src --ignore-src -r -y --rosdistro ${ROSDISTRO}
134+
135+
ENV MAKEFLAGS="-j1"
136+
137+
# build demo
138+
RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash \
139+
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --event-handlers desktop_notification- status-'
140+
141+
# Add the user to the render group so that the user can access /dev/dri/renderD128
142+
RUN sudo usermod -aG render $USERNAME
143+
144+
# Setup the entrypoint
145+
COPY ./entrypoint.sh /
146+
ENTRYPOINT ["/entrypoint.sh"]
147+
CMD ["bash"]

0 commit comments

Comments
 (0)