Skip to content

Commit

Permalink
movit2 permission issue fixed, building moveit2 ws
Browse files Browse the repository at this point in the history
  • Loading branch information
Mechazo11 committed Sep 11, 2024
1 parent 31b4e9a commit a2e43cc
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 81 deletions.
169 changes: 88 additions & 81 deletions o3de_mars_rover/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,105 +93,112 @@ RUN colcon build --packages-ignore test_rmw_implementation

### Delete CycloneDDS and install from apt to resolve cmake conflict ###


#### Install MOVEIT2_WS ####

# Make sure the latest versions of packages are installed
# 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
# RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
# --mount=type=cache,target=/var/lib/apt,sharing=locked \
# sudo apt-get dist-upgrade -y
# RUN rosdep update

# # Install the various build and test tools
# RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
# --mount=type=cache,target=/var/lib/apt,sharing=locked \
# sudo apt install -y \
# build-essential \
# clang-format \
# cmake \
# git \
# libbullet-dev \
# python3-colcon-common-extensions \
# python3-flake8 \
# python3-pip \
# python3-pytest-cov \
# python3-rosdep \
# python3-setuptools \
# python3-vcstool \
# wget

# # Install some pip packages needed for testing
# RUN python3 -m pip install -U \
# argcomplete \
# flake8-blind-except \
# flake8-builtins \
# flake8-class-newline \
# flake8-comprehensions \
# flake8-deprecated \
# flake8-docstrings \
# flake8-import-order \
# flake8-quotes \
# pytest-repeat \
# pytest-rerunfailures \
# pytest
# Install the various build and test tools
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sudo apt install -y \
build-essential \
clang-format \
cmake \
git \
libbullet-dev \
python3-colcon-common-extensions \
python3-flake8 \
python3-pip \
python3-pytest-cov \
python3-rosdep \
python3-setuptools \
python3-vcstool \
wget

# Install some pip packages needed for testing
RUN python3 -m pip install -U \
argcomplete \
flake8-blind-except \
flake8-builtins \
flake8-class-newline \
flake8-comprehensions \
flake8-deprecated \
flake8-docstrings \
flake8-import-order \
flake8-quotes \
pytest-repeat \
pytest-rerunfailures \
pytest

# # Get the MoveIt2 source code
# WORKDIR ${HOME_DIR}
# RUN sudo git clone https://github.com/moveit/moveit2.git -b ${ROSDISTRO} moveit2/src
# RUN cd ${MOVEIT2_DIR}/src \
# && sudo git clone https://github.com/moveit/moveit2_tutorials.git -b ${ROSDISTRO}
WORKDIR ${HOME_DIR}
RUN sudo git clone https://github.com/moveit/moveit2.git -b ${ROSDISTRO} moveit2/src
RUN cd ${MOVEIT2_DIR}/src \
&& sudo git clone https://github.com/moveit/moveit2_tutorials.git -b ${ROSDISTRO}

# # Update the ownership of the source files (had to use sudo above to work around
# # a possible inherited 'insteadof' from the host that forces use of ssh
# RUN sudo chown -R ${USERNAME}:${USERNAME} ${MOVEIT2_DIR}
# Update the ownership of the source files (had to use sudo above to work around
# a possible inherited 'insteadof' from the host that forces use of ssh
RUN sudo chown -R ${USERNAME}:${USERNAME} ${MOVEIT2_DIR}

# # Get rosinstall_generator
# 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 --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

# # Generate repos file for moveit2 dependencies, excluding packages from Space ROS core.
# COPY --chown=${USERNAME}:${USERNAME} moveit2-pkgs.txt /tmp/
# COPY --chown=${USERNAME}:${USERNAME} excluded-pkgs.txt /tmp/
# RUN rosinstall_generator \
# --rosdistro ${ROSDISTRO} \
# --deps \
# --exclude-path ${SPACEROS_DIR}/src \
# --exclude $(cat /tmp/excluded-pkgs.txt) -- \
# -- $(cat /tmp/moveit2-pkgs.txt) \
# > /tmp/moveit2_generated_pkgs.repos
COPY --chown=${USERNAME}:${USERNAME} moveit2-pkgs.txt /tmp/
COPY --chown=${USERNAME}:${USERNAME} excluded-pkgs.txt /tmp/
RUN rosinstall_generator \
--rosdistro ${ROSDISTRO} \
--deps \
--exclude-path ${SPACEROS_DIR}/src \
--exclude $(cat /tmp/excluded-pkgs.txt) -- \
-- $(cat /tmp/moveit2-pkgs.txt) \
> /tmp/moveit2_generated_pkgs.repos

# # Get the repositories required by MoveIt2, but not included in Space ROS
# WORKDIR ${MOVEIT2_DIR}
# RUN vcs import src < /tmp/moveit2_generated_pkgs.repos
# COPY --chown=${USERNAME}:${USERNAME} moveit2_tutorials.repos /tmp/
# RUN vcs import src < /tmp/moveit2_tutorials.repos
WORKDIR ${MOVEIT2_DIR}
RUN vcs import src < /tmp/moveit2_generated_pkgs.repos
COPY --chown=${USERNAME}:${USERNAME} moveit2_tutorials.repos /tmp/
RUN vcs import src < /tmp/moveit2_tutorials.repos

# # Update the ownership of the source files (had to use sudo above to work around
# # a possible inherited 'insteadof' from the host that forces use of ssh
# RUN sudo chown -R ${USERNAME}:${USERNAME} ${MOVEIT2_DIR}
# TODO open PR this library is missing?
#WORKDIR ${MOVEIT2_DIR}/src
#RUN git clone --branch main --single-branch https://github.com/PickNikRobotics/generate_parameter_library.git

# # Install system dependencies
# RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
# --mount=type=cache,target=/var/lib/apt,sharing=locked \
# /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash' \
# && rosdep install --from-paths ../spaceros/src src --ignore-src --rosdistro ${ROSDISTRO} -r -y --skip-keys "console_bridge generate_parameter_library fastcdr fastrtps rti-connext-dds-5.3.1 urdfdom_headers rmw_connextdds ros_testing rmw_connextdds rmw_fastrtps_cpp rmw_fastrtps_dynamic_cpp composition demo_nodes_py lifecycle rosidl_typesupport_fastrtps_cpp rosidl_typesupport_fastrtps_c ikos diagnostic_aggregator diagnostic_updater joy qt_gui rqt_gui rqt_gui_py"
# Update the ownership of the source files (had to use sudo above to work around
# a possible inherited 'insteadof' from the host that forces use of ssh
WORKDIR ${MOVEIT2_DIR}
RUN sudo chown -R ${USERNAME}:${USERNAME} ${MOVEIT2_DIR}

# # Apply a patch to octomap_msgs to work around a build issue
# COPY --chown=${USERNAME}:${USERNAME} octomap_fix.diff ./src/octomap_msgs
# RUN cd src/octomap_msgs && git apply octomap_fix.diff
# Install system dependencies
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
/bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash' \
&& rosdep install --from-paths ../spaceros/src src --ignore-src --rosdistro ${ROSDISTRO} -r -y --skip-keys "console_bridge generate_parameter_library fastcdr fastrtps rti-connext-dds-5.3.1 urdfdom_headers rmw_connextdds ros_testing rmw_connextdds rmw_fastrtps_cpp rmw_fastrtps_dynamic_cpp composition demo_nodes_py lifecycle rosidl_typesupport_fastrtps_cpp rosidl_typesupport_fastrtps_c ikos diagnostic_aggregator diagnostic_updater joy qt_gui rqt_gui rqt_gui_py"

# # Build MoveIt2
# Apply a patch to octomap_msgs to work around a build issue
COPY --chown=${USERNAME}:${USERNAME} octomap_fix.diff ./src/octomap_msgs
RUN cd src/octomap_msgs && git apply octomap_fix.diff

# Unknown issue with generate_parameter_library delete and reinstall
WORKDIR ${MOVEIT2_DIR}/src
RUN sudo rm -rf generate_parameter_library
RUN git clone --branch main --single-branch https://github.com/PickNikRobotics/generate_parameter_library.git

# Build MoveIt2
# RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash \
# && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --event-handlers desktop_notification- status-'
# && colcon build --packages-select generate_parameter_library --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --event-handlers desktop_notification- status'

#### Install MOVEIT2_WS ####
# Manually fix for permission denined error
RUN sudo chown -R ${USERNAME}:${USERNAME} ${SPACEROS_DIR}

WORKDIR ${MOVEIT2_DIR}

# Build MoveIt2
RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --event-handlers desktop_notification- status-'


#### Install MOVEIT2_WS ####



Expand Down
13 changes: 13 additions & 0 deletions o3de_mars_rover/octomap_fix.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cd3112a..72403c5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,7 +36,7 @@ rosidl_generate_interfaces(${PROJECT_NAME}
)

install(DIRECTORY include/
- DESTINATION include
+ DESTINATION include/${PROJECT_NAME}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE)

0 comments on commit a2e43cc

Please sign in to comment.