Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete ign to gz migration #247

Merged
merged 14 commits into from
Sep 27, 2022
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
uses: tj-actions/[email protected]
with:
files: docker/base/*
since_last_remote_commit: true
use_fork_point: true
if: github.event_name != 'workflow_dispatch'
- name: Compute base image name
id: compute-base-image
Expand All @@ -65,7 +65,7 @@ jobs:
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
suffix="$GITHUB_REF_SLUG"
fi
if ${{ steps.base-image-files-full-diff.outputs.any_changed }}; then
if [[ "${{ steps.base-image-files-full-diff.outputs.any_changed }}" == "true" ]]; then
suffix="$GITHUB_REF_SLUG"
fi
fi
Expand Down
68 changes: 51 additions & 17 deletions docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
# Research Institute (MBARI) and the David and Lucile Packard Foundation
#

FROM mbari/lrauv-ignition-sim:unstable

USER root
FROM nvidia/opengl:1.0-glvnd-devel-ubuntu20.04

# This avoids keyboard interaction when asked for geographic area
ARG DEBIAN_FRONTEND=noninteractive
Expand All @@ -32,27 +30,62 @@ RUN echo 'Etc/UTC' > /etc/timezone && \

RUN apt-get update \
&& apt-get install -y \
build-essential \
cmake \
cppcheck \
curl \
gdb \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit : Do we need gdb, and libbluetooth for the docker ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, my mistake. I'll open up a follow-up PR.

git \
gnupg2 \
libbluetooth-dev \
libcwiid-dev \
libgoogle-glog-dev \
libpcl-dev \
libspnav-dev \
libusb-dev \
lsb-release \
tzdata \
wget \
mercurial \
python3-dbg \
python3-empy \
python3-numpy
python3-numpy \
python3-pip \
python3-venv \
software-properties-common \
sudo \
tzdata \
vim \
&& apt-get clean

RUN sudo /bin/sh -c 'echo "deb [arch=amd64,arm64] http://repo.ros2.org/ubuntu/main `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list' \
&& curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - \
&& sudo apt-get update \
&& sudo apt-get install -y python3-vcstool python3-colcon-common-extensions
# Install Ignition build tools
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment : Ignition -> Gazebo

# https://colcon.readthedocs.io/en/released/user/installation.html
RUN /bin/sh -c 'echo "deb [arch=amd64,arm64] http://repo.ros2.org/ubuntu/main `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list' \
&& curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
RUN apt-get -qq update && apt-get -q -y install \
build-essential \
wget \
python3-vcstool \
python3-colcon-common-extensions \
&& apt-get dist-upgrade -y \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get -qq clean

# Add a user with the same user_id as the user outside the container
ENV USERNAME developer
RUN useradd -U -ms /bin/bash $USERNAME \
&& echo "$USERNAME:$USERNAME" | chpasswd \
&& adduser $USERNAME sudo \
&& echo "$USERNAME ALL=NOPASSWD: ALL" >> /etc/sudoers.d/$USERNAME

# Commands below run as the developer user
USER $USERNAME

# Check out Ignition source
ENV IGN_WS /home/$USERNAME/ign_ws
COPY docker/base/gz-garden.yaml ${IGN_WS}/gz-garden.yaml
RUN mkdir -p ${IGN_WS}/src && cd ${IGN_WS} \
&& vcs import src < gz-garden.yaml
# When running a container start in the developer's home folder
WORKDIR /home/$USERNAME

# Check out Gazebo source
ENV GZ_WS /home/$USERNAME/gz_ws
COPY --chown=$USERNAME docker/base/gz-garden.yaml ${GZ_WS}/gz-garden.yaml
RUN mkdir -p ${GZ_WS}/src && cd ${GZ_WS} && \
vcs import src < gz-garden.yaml && vcs pull src

USER root

Expand All @@ -76,5 +109,6 @@ RUN rm -rf /var/lib/apt/lists/* \

USER $USERNAME

RUN cd ${IGN_WS} \
RUN cd ${GZ_WS} \
&& colcon build --merge-install --cmake-args -DBUILD_TESTING=OFF
ENV PYTHONPATH ${GZ_WS}/install/lib/python
2 changes: 1 addition & 1 deletion docker/debug_integration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Research Institute (MBARI) and the David and Lucile Packard Foundation
#

FROM mbari/lrauv-ignition-sim:unstable
FROM mbari/lrauv-ignition-sim:latest

USER root

Expand Down
4 changes: 2 additions & 2 deletions docker/tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Research Institute (MBARI) and the David and Lucile Packard Foundation
#

ARG BASE_IMAGE=mbari/lrauv-ignition-sim:unstable
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

ENV LRAUV_WS /home/$USERNAME/lrauv_ws
Expand All @@ -32,7 +32,7 @@ RUN rm -rf build log install src/lrauv
COPY . src/lrauv

# Build image
RUN [ "/bin/bash" , "-c" , ". ~/ign_ws/install/setup.sh; colcon build --cmake-args='-DBUILD_TESTING=true'" ]
RUN [ "/bin/bash" , "-c" , ". ~/gz_ws/install/setup.sh; colcon build --cmake-args='-DBUILD_TESTING=true'" ]

# Drop entrypoint
ENTRYPOINT []
Expand Down
30 changes: 8 additions & 22 deletions lrauv_gazebo_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,27 +152,18 @@ endfunction()
add_subdirectory(src/comms/)

add_lrauv_plugin(ControlPanelPlugin GUI
PROTO
lrauv_command
lrauv_state)
PROTO lrauv_gazebo_messages)
add_lrauv_plugin(DopplerVelocityLog
RENDERING
PROTO
dvl_beam_state
dvl_kinematic_estimate
dvl_range_estimate
dvl_tracking_target
dvl_velocity_tracking)
PROTO lrauv_gazebo_messages)
target_link_libraries(DopplerVelocityLog PUBLIC ${GZ_SENSORS}-rendering)
add_lrauv_plugin(DopplerVelocityLogSystem RENDERING)
target_link_libraries(DopplerVelocityLogSystem PUBLIC
DopplerVelocityLog ${GZ_SENSORS}-rendering)
add_lrauv_plugin(HydrodynamicsPlugin)
add_lrauv_plugin(RangeBearingPlugin
PROTO
lrauv_range_bearing_request
lrauv_range_bearing_response
lrauv_acoustic_message
lrauv_gazebo_messages
PRIVATE_LINK_LIBS
acoustic_comms_support)
add_lrauv_plugin(ReferenceAxis GUI RENDERING)
Expand All @@ -182,16 +173,12 @@ add_lrauv_plugin(ScienceSensorsSystem
${GZ_SENSORS}
${PCL_LIBRARIES})
add_lrauv_plugin(SpawnPanelPlugin GUI
PROTO
lrauv_init)
PROTO lrauv_gazebo_messages)
add_lrauv_plugin(TethysCommPlugin
PROTO
lrauv_command
lrauv_state)
PROTO lrauv_gazebo_messages)
add_lrauv_plugin(TimeAnalysisPlugin)
add_lrauv_plugin(WorldCommPlugin
PROTO
lrauv_init)
PROTO lrauv_gazebo_messages)
add_lrauv_plugin(WorldConfigPlugin GUI)

#============================================================================
Expand Down Expand Up @@ -225,9 +212,8 @@ foreach(EXAMPLE
target_include_directories(${EXAMPLE_EXEC} PUBLIC include)
target_link_libraries(${EXAMPLE_EXEC} PRIVATE
gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER}
dvl_velocity_tracking lrauv_acoustic_message lrauv_command lrauv_init
lrauv_internal_comms lrauv_range_bearing_request lrauv_range_bearing_response
lrauv_state)
acoustic_comms_support
lrauv_gazebo_messages)

install(
TARGETS ${EXAMPLE_EXEC}
Expand Down
70 changes: 21 additions & 49 deletions lrauv_gazebo_plugins/proto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,59 +5,31 @@

find_package(Protobuf REQUIRED)

function(add_lrauv_message MESSAGE)
add_library(${MESSAGE} SHARED ${PROJECT_NAME}/${MESSAGE}.proto)
target_link_libraries(${MESSAGE}
protobuf::libprotobuf
gz-msgs${GZ_MSGS_VER}::gz-msgs${GZ_MSGS_VER})
file(GLOB PROTO_SRCS ${PROJECT_NAME}/*.proto)
add_library(lrauv_gazebo_messages SHARED ${PROTO_SRCS})
target_link_libraries(lrauv_gazebo_messages
protobuf::libprotobuf
gz-msgs${GZ_MSGS_VER}::gz-msgs${GZ_MSGS_VER})
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/proto)
protobuf_generate(
TARGET ${MESSAGE}
LANGUAGE cpp
IMPORT_DIRS
${gz-msgs${GZ_MSGS_VER}_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}/proto
PROTOC_OUT_DIR ${CMAKE_BINARY_DIR}/proto
)
target_include_directories(${MESSAGE} PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/proto>
$<INSTALL_INTERFACE:include>
)
install(
TARGETS ${MESSAGE}
EXPORT ${PROJECT_NAME}
DESTINATION lib)
endfunction()

add_lrauv_message(lrauv_acoustic_message)
add_lrauv_message(lrauv_command)
add_lrauv_message(lrauv_init)
add_lrauv_message(lrauv_internal_comms)
add_lrauv_message(lrauv_range_bearing_request)
add_lrauv_message(lrauv_range_bearing_response)
add_lrauv_message(lrauv_state)

add_lrauv_message(dvl_range_estimate)
add_lrauv_message(dvl_kinematic_estimate)
add_lrauv_message(dvl_beam_state)
target_link_libraries(dvl_beam_state
dvl_kinematic_estimate
dvl_range_estimate
protobuf_generate(
TARGET lrauv_gazebo_messages
LANGUAGE cpp
IMPORT_DIRS
${gz-msgs${GZ_MSGS_VER}_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}/proto
PROTOC_OUT_DIR ${CMAKE_BINARY_DIR}/proto
)
add_lrauv_message(dvl_tracking_target)
target_link_libraries(dvl_tracking_target
dvl_kinematic_estimate
dvl_range_estimate
target_include_directories(lrauv_gazebo_messages PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/proto>
$<INSTALL_INTERFACE:include>
)
add_lrauv_message(dvl_velocity_tracking)
target_link_libraries(dvl_velocity_tracking
dvl_beam_state
dvl_tracking_target
dvl_kinematic_estimate
dvl_range_estimate
install(
TARGETS lrauv_gazebo_messages
EXPORT ${PROJECT_NAME}
DESTINATION lib
)

install(
DIRECTORY ${CMAKE_BINARY_DIR}/proto/${PROJECT_NAME}/
DESTINATION include/${PROJECT_NAME}/
FILES_MATCHING PATTERN "*.h")
FILES_MATCHING PATTERN "*.h"
)
7 changes: 6 additions & 1 deletion lrauv_gazebo_plugins/src/DopplerVelocityLog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,9 @@ class DopplerVelocityLog::Implementation
/// are to be defined in.
public: EnvironmentalData::ReferenceT waterVelocityReference;

/// \brief Whether water velocity was updated since last use.
public: bool waterVelocityUpdated{true};

/// \brief Depth sensor (i.e. a GPU raytracing sensor).
public: gz::rendering::GpuRaysPtr depthSensor;

Expand Down Expand Up @@ -1351,6 +1354,7 @@ void DopplerVelocityLog::SetEnvironmentalData(const EnvironmentalData &_data)

this->dataPtr->waterVelocity = VectorFieldT(xData, yData, zData);
this->dataPtr->waterVelocityReference = _data.reference;
this->dataPtr->waterVelocityUpdated = true;

gzmsg << "Water velocity data updated for "
<< "[" << this->Name() << "] sensor."
Expand Down Expand Up @@ -1857,12 +1861,13 @@ void DopplerVelocityLog::PostUpdate(
waterMassModeMessage =
this->dataPtr->TrackWaterMass(_now, &waterMassModeInfo);
}
else
else if (this->dataPtr->waterVelocityUpdated)
{
gzwarn << "No water velocity available, "
<< "skipping water-mass tracking."
<< std::endl;
}
this->dataPtr->waterVelocityUpdated = false;
}

double bottomModeScore, waterMassModeScore;
Expand Down
3 changes: 1 addition & 2 deletions lrauv_gazebo_plugins/src/comms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ add_library(acoustic_comms_support SHARED CommsPacket.cc)
target_link_libraries(acoustic_comms_support PUBLIC
gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER}
gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER}
lrauv_acoustic_message
lrauv_internal_comms
lrauv_gazebo_messages
)
target_include_directories(acoustic_comms_support PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
Expand Down
2 changes: 1 addition & 1 deletion lrauv_gazebo_plugins/worlds/dvl_at_portuguese_ledge.sdf.em
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import math
from dataclasses import dataclass
from gz.math import SphericalCoordinates, Vector3d, Angle
from gz.math7 import SphericalCoordinates, Vector3d, Angle

fuel_model_url = "https://fuel.gazebosim.org/1.0/OpenRobotics/models/Portuguese Ledge"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import math
from dataclasses import dataclass
from gz.math import SphericalCoordinates, Vector3d, Angle
from gz.math7 import SphericalCoordinates, Vector3d, Angle

fuel_model_url = "https://fuel.gazebosim.org/1.0/OpenRobotics/models/Portuguese Ledge"

Expand Down
2 changes: 1 addition & 1 deletion lrauv_gazebo_plugins/worlds/portuguese_ledge.sdf.em
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import math
from dataclasses import dataclass
from gz.math import SphericalCoordinates, Vector3d, Angle
from gz.math7 import SphericalCoordinates, Vector3d, Angle

fuel_model_url = "https://fuel.gazebosim.org/1.0/OpenRobotics/models/Portuguese Ledge"

Expand Down
9 changes: 1 addition & 8 deletions lrauv_system_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ find_package(gz-math7 REQUIRED)
find_package(gz-transport12 REQUIRED)
find_package(lrauv_gazebo_plugins REQUIRED)

# Add option to build without LRAUV integration
option(ENABLE_MISSION_TESTS
"Enable mission tests. (Requires integration with MBARI's controllers)"
ON)

# Build-time constants
set(PROJECT_BINARY_PATH ${CMAKE_CURRENT_BINARY_DIR})
set(PROJECT_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
Expand All @@ -34,7 +29,6 @@ include(GoogleTest)

# Build test support library
add_library(${PROJECT_NAME}_support
src/LRAUVController.cc
src/ModelManipulator.cc
src/ModelObserver.cc
src/Publisher.cc
Expand All @@ -45,8 +39,7 @@ target_link_libraries(${PROJECT_NAME}_support PUBLIC
gz-sim7::gz-sim7
gz-math7::gz-math7
gz-transport12::gz-transport12
lrauv_gazebo_plugins::lrauv_command
lrauv_gazebo_plugins::lrauv_state
lrauv_gazebo_plugins::lrauv_gazebo_messages
gtest)
target_compile_features(${PROJECT_NAME}_support PUBLIC cxx_std_17)
#============================================================================
Expand Down
3 changes: 0 additions & 3 deletions lrauv_system_tests/include/TestConstants.hh.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
#define __TEST_CONSTANTS_HH__
#define PROJECT_BINARY_PATH "@PROJECT_BINARY_PATH@"
#define PROJECT_SOURCE_PATH "@PROJECT_SOURCE_PATH@"

// Hardcode path, assume lrauv-application is a sibling of lrauv
#define LRAUV_APP_PATH "@PROJECT_SOURCE_PATH@/../../lrauv-application"
#endif
Loading