Skip to content

Commit

Permalink
rmf_obstacle_ros2 (#210)
Browse files Browse the repository at this point in the history
* Publish nav graph

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Added ObstacleManager

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Moved ObstacleManager into src

Signed-off-by: Yadunund <yadunund@gmail.com>

* Build as ROS 2 component. Dynamically load detector and responder plugins

Signed-off-by: Yadunund <yadunund@gmail.com>

* Refactor into data struct

Signed-off-by: Yadunund <yadunund@gmail.com>

* Uncrustify

Signed-off-by: Yadunund <yadunund@gmail.com>

* Serialize using octomap

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Removed ObstacleData

Signed-off-by: Yadunund <yadunund@gmail.com>

* Detector accepts a callback

Signed-off-by: Yadunund <yadunund@gmail.com>

* Export dependencies

Signed-off-by: Yadunund <yadunund@gmail.com>

* Export include dir

Signed-off-by: Yadunund <yadunund@gmail.com>

* Explicitly link pluginlib

Signed-off-by: Yadunund <yadunund@gmail.com>

* Keep ClassLoaders alive

Signed-off-by: Yadunund <yadunund@gmail.com>

* Revert to msg builder API

Signed-off-by: Yadunund <yadunund@gmail.com>

* Explicitly include message headers

Signed-off-by: Yadunund <yadunund@gmail.com>

* Add skeleton for LaneBlocker

Signed-off-by: Yadunund <yadunund@gmail.com>

* Use api from rmf_traffic_ros2 for graph serialization

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Fix typo

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Uncrustify

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Implement speed limit API and publish lane_states

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Added speed limit request interface to legacy full_control

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Uncrustify

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Compute transfroms to rmf frame

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Added skeletop for processing

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Warn users of unsupported speed limits

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Serialize/deserialize speed limits

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Added logic for publishing lane closures

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Add cull timer

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Finished implementing cull

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Updated intersection checker

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* WIP

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Fix tf2_geometry_msgs dep for humble

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Rough collision check implementation

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Added tests for IntersectionChecker

Signed-off-by: Yadunund <yadunund@gmail.com>

* Fixes to SAT

Signed-off-by: Yadunund <yadunund@gmail.com>

* Debug rotation

Signed-off-by: Yadunund <yadunund@gmail.com>

* Kinda working

Signed-off-by: Yadunund <yadunund@gmail.com>

* Use lowest not min

Signed-off-by: Yadunund <yadunund@gmail.com>

* Added more failing tests

Signed-off-by: Yadunund <yadunund@gmail.com>

* Use dist

Signed-off-by: Yadunund <yadunund@gmail.com>

* Cleanup

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Many logic fixes

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Uncrustify

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Refactor

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Fix API and use bb msgs from rmf_obstacle_ros2

Signed-off-by: Yadunund <yadunund@gmail.com>

* Simplify pkg

Signed-off-by: Yadunund <yadunund@gmail.com>

* Fix rmf_obstacle_ros2 intersection checker (#219)

* fix intersection checker

Signed-off-by: Pranay Shirodkar <39498451+PranayShirodkar@users.noreply.github.com>

* fix uncrustify and build warning

Signed-off-by: Pranay Shirodkar <39498451+PranayShirodkar@users.noreply.github.com>

* use Eigen library for transformations

Signed-off-by: Pranay Shirodkar <39498451+PranayShirodkar@users.noreply.github.com>

* cleanup

Signed-off-by: Pranay Shirodkar <39498451+PranayShirodkar@users.noreply.github.com>

* Use local bb2d

Signed-off-by: Yadunund <yadunund@gmail.com>

* Uncrustify

Signed-off-by: Yadunund <yadunund@gmail.com>

* Added feeback

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>

* Add Speed Limit Requests (#222)

* add FleetUpdateHandle speed limit API to python bindings

Signed-off-by: Pranay Shirodkar <39498451+PranayShirodkar@users.noreply.github.com>

* add continuous checker option for dynamic obstacles

Signed-off-by: Pranay Shirodkar <39498451+PranayShirodkar@users.noreply.github.com>

* refactor Lane Close and Open msg building

Signed-off-by: Pranay Shirodkar <39498451+PranayShirodkar@users.noreply.github.com>

* add speed limits

Signed-off-by: Pranay Shirodkar <39498451+PranayShirodkar@users.noreply.github.com>

* Fix style

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Fix const correctness and do not pass unordered_map by ref to publisher

Signed-off-by: Yadunund <yadunund@openrobotics.org>

Signed-off-by: Pranay Shirodkar <39498451+PranayShirodkar@users.noreply.github.com>
Signed-off-by: Yadunund <yadunund@openrobotics.org>
Co-authored-by: Yadunund <yadunund@gmail.com>
Co-authored-by: Yadunund <yadunund@openrobotics.org>

* Filled PointCloud message

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>

* Insert lanes with their state

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>

* Added MessageFilter to rmf_obstacles topic

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>

* Added optional return value to deserialize_key method

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>

* Combine close/open and limit/unlimit functions

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>

* Use member variables instead of passing unordered_maps by reference between these functions

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>

* Defined templated pure abstract class to perform serialization/deserialization

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>

* Fix build

Signed-off-by: Yadunund <yadunund@openrobotics.org>

* Link against targets in test

Signed-off-by: Yadunund <yadunund@openrobotics.org>

---------

Signed-off-by: Yadunund <yadunund@openrobotics.org>
Signed-off-by: Yadunund <yadunund@gmail.com>
Signed-off-by: Pranay Shirodkar <39498451+PranayShirodkar@users.noreply.github.com>
Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
Co-authored-by: Pranay Shirodkar <39498451+PranayShirodkar@users.noreply.github.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
  • Loading branch information
3 people committed Mar 18, 2024
1 parent 4bbdf56 commit 38105d5
Show file tree
Hide file tree
Showing 14 changed files with 2,305 additions and 0 deletions.
145 changes: 145 additions & 0 deletions rmf_obstacle_ros2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
cmake_minimum_required(VERSION 3.8)
project(rmf_obstacle_ros2)

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

include(GNUInstallDirs)

find_package(ament_cmake REQUIRED)

set(dep_pkgs
geometry_msgs
rclcpp
rclcpp_components
rmf_utils
rmf_obstacle_msgs
rmf_fleet_msgs
rmf_building_map_msgs
sensor_msgs
OCTOMAP
rmf_fleet_adapter
rmf_traffic
rmf_traffic_ros2
tf2_ros
tf2_geometry_msgs
)
foreach(pkg ${dep_pkgs})
find_package(${pkg} REQUIRED)
endforeach()

#===============================================================================
file(GLOB_RECURSE core_lib_srcs "src/rmf_obstacle_ros2/*.cpp")
add_library(rmf_obstacle_ros2 SHARED ${core_lib_srcs})

target_link_libraries(rmf_obstacle_ros2
PUBLIC
rmf_utils::rmf_utils
${rclcpp_TARGETS}
${sensor_msgs_TARGETS}
${rmf_obstacle_msgs_TARGETS}
PRIVATE
${OCTOMAP_TARGETS}
)

target_include_directories(rmf_obstacle_ros2
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
${rclcpp_INCLUDE_DIRS}
${sensor_msgs_INCLUDE_DIRS}
${rmf_obstacle_msgs_INCLUDE_DIRS}
PRIVATE
${OCTOMAP_INCLUDE_DIRS}
)

target_compile_features(rmf_obstacle_ros2 INTERFACE cxx_std_17)

ament_export_targets(rmf_obstacle_ros2 HAS_LIBRARY_TARGET)

ament_export_dependencies(${dep_pkgs})

ament_export_include_directories(
include
)

#===============================================================================
file(GLOB_RECURSE lane_blocker_srcs
"src/lane_blocker/*.cpp"
)
add_library(lane_blocker SHARED ${lane_blocker_srcs})

target_link_libraries(lane_blocker
PRIVATE
rclcpp::rclcpp
${rclcpp_components_TARGETS}
${rmf_obstacle_msgs_TARGETS}
${rmf_fleet_msgs_TARGETS}
${rmf_building_map_msgs_TARGETS}
rmf_fleet_adapter::rmf_fleet_adapter
rmf_traffic::rmf_traffic
${rmf_traffic_ros2_TARGETS}
${tf2_ros_TARGETS}
${geometry_msgs_TARGETS}
tf2_geometry_msgs::tf2_geometry_msgs
)

target_include_directories(lane_blocker
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
${rclcpp_INCLUDE_DIRS}
${rclcpp_components_INCLUDE_DIRS}
${rmf_obstacle_msgs_INCLUDE_DIRS}
${rmf_fleet_msgs_INCLUDE_DIRS}
${rmf_building_map_msgs_INCLUDE_DIRS}
${rmf_fleet_adapter_INCLUDE_DIRS}
${rmf_traffic_INCLUDE_DIRS}
${rmf_traffic_ros2_INCLUDE_DIRS}
${tf2_ros_INCLUDE_DIRS}
${geometry_msgs_INCLUDE_DIRS}
${tf2_geometry_msgs_include_dirs}
)

target_compile_features(lane_blocker INTERFACE cxx_std_17)

rclcpp_components_register_node(lane_blocker
PLUGIN "LaneBlocker"
EXECUTABLE lane_blocker_node)

#===============================================================================
if(BUILD_TESTING)
find_package(ament_cmake_uncrustify REQUIRED)
find_package(ament_cmake_catch2 REQUIRED)

find_file(uncrustify_config_file
NAMES "rmf_code_style.cfg"
PATHS "${rmf_utils_DIR}/../../../share/rmf_utils/")

ament_uncrustify(
ARGN include src
CONFIG_FILE ${uncrustify_config_file}
MAX_LINE_LENGTH 80
)

add_subdirectory(src/lane_blocker/test)
endif()

#===============================================================================
install(
DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

install(
TARGETS
rmf_obstacle_ros2
lane_blocker
EXPORT rmf_obstacle_ros2
RUNTIME DESTINATION lib/rmf_obstacle_ros2
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)

ament_package()
29 changes: 29 additions & 0 deletions rmf_obstacle_ros2/include/rmf_obstacle_ros2/StandardNames.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (C) 2022 Open Source Robotics Foundation
*
* 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.
*
*/

#ifndef RMF_OBSTACLE_ROS2__STANDARDNAMES_HPP
#define RMF_OBSTACLE_ROS2__STANDARDNAMES_HPP

#include <string>

namespace rmf_obstacle_ros2 {

const std::string ObstacleTopicName = "rmf_obstacles";

} // namespace rmf_obstacle_ros2

#endif // RMF_OBSTACLE_ROS2__STANDARDNAMES_HPP
23 changes: 23 additions & 0 deletions rmf_obstacle_ros2/include/rmf_obstacle_ros2/obstacles/Convert.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (C) 2022 Open Source Robotics Foundation
*
* 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.
*
*/

#ifndef RMF_OBSTACLE_ROS2__OBSTACLES__CONVERT_HPP
#define RMF_OBSTACLE_ROS2__OBSTACLES__CONVERT_HPP

#include <rmf_obstacle_ros2/obstacles/convert/ConvertPointCloudObstacles.hpp>

#endif // RMF_OBSTACLE_ROS2__OBSTACLES__CONVERT_HPP
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2022 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.

#ifndef RMF_OBSTACLE_ROS2__OBSTACLES__CONVERTDECL_HPP
#define RMF_OBSTACLE_ROS2__OBSTACLES__CONVERTDECL_HPP

namespace rmf_obstacle_ros2 {
using Obstacle = rmf_obstacle_msgs::msg::Obstacle;

//==============================================================================
/// Serialize a SensorMsg into RMF Obstacle msg
template<typename SensorMsg>
void fill_obstacle_data(const SensorMsg& msg, Obstacle& obstacle);

//==============================================================================
/// Convert an RMF Obstacle msg into a SensorMsg type
template<typename SensorMsg>
SensorMsg convert(const Obstacle& msg);
} // namespace ros_gz_bridge

#endif // #indef RMF_OBSTACLE_ROS2__OBSTACLES__CONVERTDECL_HPP
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (C) 2022 Open Source Robotics Foundation
*
* 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.
*
*/

#ifndef RMF_OBSTACLE_ROS2__OBSTACLES__CONVERT__CONVERTPOINTCLOUDOBSTACLES_HPP
#define RMF_OBSTACLE_ROS2__OBSTACLES__CONVERT__CONVERTPOINTCLOUDOBSTACLES_HPP

#include <rmf_obstacle_msgs/msg/obstacle.hpp>
#include <sensor_msgs/msg/point_cloud2.hpp>
#include "rmf_obstacle_ros2/obstacles/ConvertDecl.hpp"

namespace rmf_obstacle_ros2 {

using PointCloud = sensor_msgs::msg::PointCloud2;

//==============================================================================
/// Serialize a PointCloud2 msg into RMF Obstacle msg
template<>
void fill_obstacle_data(const PointCloud& msg, Obstacle& obstacle);

//==============================================================================
/// Convert an RMF Obstacle msg into a PointCloud2 msg
template<>
PointCloud convert(const Obstacle& msg);
} // namespace rmf_obstacle_ros2

#endif // #indef RMF_OBSTACLE_ROS2__OBSTACLES__CONVERT__CONVERTPOINTCLOUDOBSTACLES_HPP
33 changes: 33 additions & 0 deletions rmf_obstacle_ros2/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>rmf_obstacle_ros2</name>
<version>2.1.0</version>
<description>A package containing utilities for managing obstacles in RMF</description>
<maintainer email="yadunund@openrobotics.org">Yadunund</maintainer>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>

<depend>geometry_msgs</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>rmf_utils</depend>
<depend>rmf_obstacle_msgs</depend>
<depend>rmf_fleet_msgs</depend>
<depend>rmf_building_map_msgs</depend>
<depend>sensor_msgs</depend>
<depend>octomap</depend>
<depend>rmf_fleet_adapter</depend>
<depend>rmf_traffic</depend>
<depend>rmf_traffic_ros2</depend>
<depend>tf2_ros</depend>
<depend>tf2_geometry_msgs</depend>

<test_depend>ament_cmake_catch2</test_depend>
<test_depend>ament_cmake_uncrustify</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
Loading

0 comments on commit 38105d5

Please sign in to comment.