Skip to content

Commit 12133c7

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 12133c7

30 files changed

Lines changed: 2022 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: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
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:latest
23+
24+
# Define arguments used in the metadata definition
25+
ARG VCS_REF
26+
ARG VERSION="preview"
27+
28+
# Specify the docker image metadata
29+
LABEL org.label-schema.schema-version="1.0"
30+
LABEL org.label-schema.name="Lunar Pole Exploration Rover"
31+
LABEL org.label-schema.description="Lunar Pole Exploration Rover entry for the NASA Space ROS Sim Summer Sprint Challenge"
32+
LABEL org.label-schema.vendor="Open Robotics"
33+
LABEL org.label-schema.version=${VERSION}
34+
LABEL org.label-schema.url="https://github.com/space-ros"
35+
LABEL org.label-schema.vcs-url="https://github.com/space-ros/demos"
36+
LABEL org.label-schema.vcs-ref=${VCS_REF}
37+
38+
# Disable prompting during package installation
39+
ARG DEBIAN_FRONTEND=noninteractive
40+
41+
# Define a few key variables
42+
ENV DEMO_DIR=${HOME_DIR}/demos_ws
43+
ENV IGNITION_VERSION=fortress
44+
ENV GZ_VERSION=fortress
45+
46+
# Clone all space-ros sources
47+
RUN mkdir ${SPACEROS_DIR}/src \
48+
&& vcs import ${SPACEROS_DIR}/src < ${SPACEROS_DIR}/exact.repos
49+
50+
# Define key locations
51+
RUN mkdir -p ${DEMO_DIR}/src
52+
WORKDIR ${DEMO_DIR}
53+
54+
55+
# Make sure the latest versions of packages are installed
56+
# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that
57+
# the cache won't make it into the built image but will be maintained between steps.
58+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
59+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
60+
sudo apt-get update
61+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
62+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
63+
sudo apt-get dist-upgrade -y
64+
RUN rosdep update
65+
66+
# Install the various build and test tools
67+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
68+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
69+
sudo apt install -y \
70+
build-essential \
71+
clang-format \
72+
cmake \
73+
git \
74+
libbullet-dev \
75+
python3-colcon-common-extensions \
76+
python3-flake8 \
77+
python3-pip \
78+
python3-pytest-cov \
79+
python3-rosdep \
80+
python3-setuptools \
81+
python3-vcstool \
82+
wget
83+
84+
# Install some pip packages needed for testing
85+
RUN python3 -m pip install -U \
86+
argcomplete \
87+
flake8-blind-except \
88+
flake8-builtins \
89+
flake8-class-newline \
90+
flake8-comprehensions \
91+
flake8-deprecated \
92+
flake8-docstrings \
93+
flake8-import-order \
94+
flake8-quotes \
95+
pytest-repeat \
96+
pytest-rerunfailures \
97+
pytest
98+
99+
# Get rosinstall_generator
100+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
101+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
102+
sudo apt-get update -y && sudo apt-get install -y python3-rosinstall-generator
103+
104+
105+
# Generate repos file for dependencies, excluding packages from Space ROS core.
106+
COPY --chown=${USERNAME}:${USERNAME} demo-pkgs.txt /tmp/
107+
COPY --chown=${USERNAME}:${USERNAME} excluded-pkgs.txt /tmp/
108+
RUN rosinstall_generator \
109+
--upstream \
110+
--rosdistro ${ROSDISTRO} \
111+
--deps \
112+
--exclude-path ${SPACEROS_DIR}/src \
113+
--exclude $(cat /tmp/excluded-pkgs.txt) -- \
114+
-- $(cat /tmp/demo-pkgs.txt) \
115+
> /tmp/demo_generated_pkgs.repos
116+
117+
RUN vcs import src < /tmp/demo_generated_pkgs.repos
118+
119+
# Get the source for the dependencies
120+
COPY --chown=${USERNAME}:${USERNAME} demo_manual_pkgs.repos /tmp/
121+
RUN vcs import src < /tmp/demo_manual_pkgs.repos && /bin/bash -c 'source "${SPACEROS_DIR}/install/setup.bash"'
122+
123+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
124+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
125+
sudo apt-get update -y \
126+
&& /bin/bash -c 'source "${SPACEROS_DIR}/install/setup.bash"' \
127+
&& rosdep install --from-paths src --ignore-src -r -y --rosdistro ${ROSDISTRO}
128+
129+
ENV MAKEFLAGS="-j1"
130+
131+
# build demo
132+
RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash \
133+
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --event-handlers desktop_notification- status-'
134+
135+
136+
# Add the user to the render group so that the user can access /dev/dri/renderD128
137+
RUN sudo usermod -aG render $USERNAME
138+
139+
# Add a couple sample GUI apps for testing
140+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
141+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
142+
sudo apt-get install -y \
143+
firefox \
144+
glmark2 \
145+
libcanberra-gtk3-0 \
146+
libpci-dev \
147+
xauth \
148+
xterm
149+
150+
# Setup the entrypoint
151+
COPY ./entrypoint.sh /
152+
ENTRYPOINT ["/entrypoint.sh"]
153+
CMD ["bash"]

0 commit comments

Comments
 (0)