Skip to content

Commit 1e1f939

Browse files
committed
Adding refactor for nav2_ros_common and new ROS interface factories
Signed-off-by: Steve Macenski <[email protected]>
1 parent 821004d commit 1e1f939

File tree

699 files changed

+6733
-5009
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

699 files changed

+6733
-5009
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ _commands:
3333
- restore_cache:
3434
name: Restore Cache << parameters.key >>
3535
keys:
36-
- "<< parameters.key >>-v33\
36+
- "<< parameters.key >>-v36\
3737
-{{ arch }}\
3838
-{{ .Branch }}\
3939
-{{ .Environment.CIRCLE_PR_NUMBER }}\
4040
-{{ checksum \"<< parameters.workspace >>/lockfile.txt\" }}"
41-
- "<< parameters.key >>-v33\
41+
- "<< parameters.key >>-v36\
4242
-{{ arch }}\
4343
-main\
4444
-<no value>\
@@ -58,7 +58,7 @@ _commands:
5858
steps:
5959
- save_cache:
6060
name: Save Cache << parameters.key >>
61-
key: "<< parameters.key >>-v33\
61+
key: "<< parameters.key >>-v36\
6262
-{{ arch }}\
6363
-{{ .Branch }}\
6464
-{{ .Environment.CIRCLE_PR_NUMBER }}\

.devcontainer/devcontainer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
// "--pid=host", // DDS discovery with host, without --network=host
1515
// "--privileged", // device access to host peripherals, e.g. USB
1616
// "--security-opt=seccomp=unconfined", // enable debugging, e.g. gdb
17+
// "--volume=/tmp/.X11-unix:/tmp/.X11-unix", // X11 socket for GUI applications
18+
// "--gpus=all" // access to all GPUs, e.g. for GPU-accelerated applications
1719
],
1820
"workspaceFolder": "/opt/overlay_ws/src/navigation2",
1921
"workspaceMount": "source=${localWorkspaceFolder},target=${containerWorkspaceFolder},type=bind",
@@ -23,6 +25,8 @@
2325
"remoteEnv": {
2426
"OVERLAY_MIXINS": "release ccache lld",
2527
"CCACHE_DIR": "/tmp/.ccache"
28+
// "QT_X11_NO_MITSHM": "1", // disable MIT-SHM for X11 forwarding
29+
// "DISPLAY": "${localEnv:DISPLAY}", // X11 forwarding
2630
},
2731
"mounts": [
2832
{

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@
5353
- [ ] Check that any new features have test coverage
5454
- [ ] Check that any new plugins is added to the plugins page
5555
- [ ] If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists
56+
- [ ] Should this be backported to current distributions? If so, tag with `backport-*`.

.github/mergify.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ pull_request_rules:
2626
branches:
2727
- humble
2828

29+
- name: backport to kilted at reviewers discretion
30+
conditions:
31+
- base=main
32+
- "label=backport-kilted"
33+
actions:
34+
backport:
35+
branches:
36+
- kilted
37+
2938
- name: delete head branch after merge
3039
conditions:
3140
- merged

.github/workflows/build_main_against_distros.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
ros_distro: [jazzy]
16+
ros_distro: [jazzy, kilted]
1717

1818
steps:
1919
- name: Checkout repository

.github/workflows/update_ci_image.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
push:
99
branches:
1010
- main
11+
- kilted
1112
- jazzy
1213
- humble
1314
paths:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ install
4545
__pycache__/
4646
*.py[cod]
4747
.ipynb_checkpoints
48+
.pytest_cache/
4849

4950
sphinx_doc/_build
5051

README.md

Lines changed: 37 additions & 36 deletions
Large diffs are not rendered by default.

nav2_amcl/CMakeLists.txt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ find_package(std_srvs REQUIRED)
1717
find_package(tf2 REQUIRED)
1818
find_package(tf2_geometry_msgs REQUIRED)
1919
find_package(tf2_ros REQUIRED)
20+
find_package(nav2_ros_common REQUIRED)
2021

2122
nav2_package()
2223

@@ -38,7 +39,8 @@ add_library(pf_lib SHARED
3839
target_include_directories(pf_lib
3940
PUBLIC
4041
"$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>"
41-
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")
42+
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
43+
"$<BUILD_INTERFACE:${nav2_ros_common_INCLUDE_DIRS}>")
4244
if(HAVE_DRAND48)
4345
target_compile_definitions(pf_lib PRIVATE "HAVE_DRAND48")
4446
endif()
@@ -52,7 +54,8 @@ add_library(map_lib SHARED
5254
target_include_directories(map_lib
5355
PUBLIC
5456
"$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>"
55-
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")
57+
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
58+
"$<BUILD_INTERFACE:${nav2_ros_common_INCLUDE_DIRS}>")
5659

5760
add_library(motions_lib SHARED
5861
src/motion_model/omni_motion_model.cpp
@@ -61,7 +64,8 @@ add_library(motions_lib SHARED
6164
target_include_directories(motions_lib
6265
PUBLIC
6366
"$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>"
64-
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")
67+
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
68+
"$<BUILD_INTERFACE:${nav2_ros_common_INCLUDE_DIRS}>")
6569
target_link_libraries(motions_lib PUBLIC
6670
pf_lib
6771
pluginlib::pluginlib
@@ -77,7 +81,8 @@ add_library(sensors_lib SHARED
7781
target_include_directories(sensors_lib
7882
PUBLIC
7983
"$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>"
80-
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")
84+
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
85+
"$<BUILD_INTERFACE:${nav2_ros_common_INCLUDE_DIRS}>")
8186
target_link_libraries(sensors_lib PUBLIC
8287
pf_lib
8388
map_lib
@@ -96,7 +101,8 @@ endif()
96101
target_include_directories(${library_name}
97102
PUBLIC
98103
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
99-
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")
104+
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
105+
"$<BUILD_INTERFACE:${nav2_ros_common_INCLUDE_DIRS}>")
100106
target_link_libraries(${library_name} PUBLIC
101107
${geometry_msgs_TARGETS}
102108
message_filters::message_filters
@@ -123,7 +129,8 @@ add_executable(${executable_name}
123129
target_include_directories(${executable_name}
124130
PUBLIC
125131
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
126-
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")
132+
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
133+
"$<BUILD_INTERFACE:${nav2_ros_common_INCLUDE_DIRS}>")
127134
target_link_libraries(${executable_name} PRIVATE
128135
${library_name}
129136
)
@@ -169,6 +176,7 @@ ament_export_dependencies(
169176
std_srvs
170177
tf2
171178
tf2_ros
179+
nav2_ros_common
172180
)
173181
ament_export_targets(${library_name})
174182
pluginlib_export_plugin_description_file(nav2_amcl plugins.xml)

nav2_amcl/include/nav2_amcl/amcl_node.hpp

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
#include <vector>
3030

3131
#include "message_filters/subscriber.hpp"
32+
#include "rclcpp/version.h"
3233

3334
#include "geometry_msgs/msg/pose_stamped.hpp"
34-
#include "nav2_util/lifecycle_node.hpp"
35+
#include "nav2_ros_common/lifecycle_node.hpp"
3536
#include "nav2_amcl/motion_model/motion_model.hpp"
3637
#include "nav2_amcl/sensors/laser/laser.hpp"
3738
#include "nav2_msgs/msg/particle.hpp"
@@ -41,7 +42,7 @@
4142
#include "pluginlib/class_loader.hpp"
4243
#include "rclcpp/node_options.hpp"
4344
#include "sensor_msgs/msg/laser_scan.hpp"
44-
#include "nav2_util/service_server.hpp"
45+
#include "nav2_ros_common/service_server.hpp"
4546
#include "std_srvs/srv/empty.hpp"
4647
#include "tf2_ros/message_filter.h"
4748
#include "tf2_ros/transform_broadcaster.h"
@@ -55,7 +56,7 @@ namespace nav2_amcl
5556
* @class AmclNode
5657
* @brief ROS wrapper for AMCL
5758
*/
58-
class AmclNode : public nav2_util::LifecycleNode
59+
class AmclNode : public nav2::LifecycleNode
5960
{
6061
public:
6162
/*
@@ -72,23 +73,23 @@ class AmclNode : public nav2_util::LifecycleNode
7273
/*
7374
* @brief Lifecycle configure
7475
*/
75-
nav2_util::CallbackReturn on_configure(const rclcpp_lifecycle::State & state) override;
76+
nav2::CallbackReturn on_configure(const rclcpp_lifecycle::State & state) override;
7677
/*
7778
* @brief Lifecycle activate
7879
*/
79-
nav2_util::CallbackReturn on_activate(const rclcpp_lifecycle::State & state) override;
80+
nav2::CallbackReturn on_activate(const rclcpp_lifecycle::State & state) override;
8081
/*
8182
* @brief Lifecycle deactivate
8283
*/
83-
nav2_util::CallbackReturn on_deactivate(const rclcpp_lifecycle::State & state) override;
84+
nav2::CallbackReturn on_deactivate(const rclcpp_lifecycle::State & state) override;
8485
/*
8586
* @brief Lifecycle cleanup
8687
*/
87-
nav2_util::CallbackReturn on_cleanup(const rclcpp_lifecycle::State & state) override;
88+
nav2::CallbackReturn on_cleanup(const rclcpp_lifecycle::State & state) override;
8889
/*
8990
* @brief Lifecycle shutdown
9091
*/
91-
nav2_util::CallbackReturn on_shutdown(const rclcpp_lifecycle::State & state) override;
92+
nav2::CallbackReturn on_shutdown(const rclcpp_lifecycle::State & state) override;
9293

9394
/**
9495
* @brief Callback executed when a parameter change is detected
@@ -108,7 +109,7 @@ class AmclNode : public nav2_util::LifecycleNode
108109
// in order to isolate TF timer used in message filter.
109110
rclcpp::CallbackGroup::SharedPtr callback_group_;
110111
rclcpp::executors::SingleThreadedExecutor::SharedPtr executor_;
111-
std::unique_ptr<nav2_util::NodeThread> executor_thread_;
112+
std::unique_ptr<nav2::NodeThread> executor_thread_;
112113

113114
// Pose hypothesis
114115
typedef struct
@@ -171,8 +172,15 @@ class AmclNode : public nav2_util::LifecycleNode
171172
* @brief Initialize incoming data message subscribers and filters
172173
*/
173174
void initMessageFilters();
175+
176+
// To Support Kilted and Older from Message Filters API change
177+
#if RCLCPP_VERSION_GTE(29, 6, 0)
178+
std::unique_ptr<message_filters::Subscriber<sensor_msgs::msg::LaserScan>> laser_scan_sub_;
179+
#else
174180
std::unique_ptr<message_filters::Subscriber<sensor_msgs::msg::LaserScan,
175-
rclcpp_lifecycle::LifecycleNode>> laser_scan_sub_;
181+
nav2::LifecycleNode>> laser_scan_sub_;
182+
#endif
183+
176184
std::unique_ptr<tf2_ros::MessageFilter<sensor_msgs::msg::LaserScan>> laser_scan_filter_;
177185
message_filters::Connection laser_scan_connection_;
178186

@@ -201,8 +209,7 @@ class AmclNode : public nav2_util::LifecycleNode
201209
* @brief Initialize state services
202210
*/
203211
void initServices();
204-
nav2_util::ServiceServer<std_srvs::srv::Empty,
205-
std::shared_ptr<nav2_util::LifecycleNode>>::SharedPtr global_loc_srv_;
212+
nav2::ServiceServer<std_srvs::srv::Empty>::SharedPtr global_loc_srv_;
206213
/*
207214
* @brief Service callback for a global relocalization request
208215
*/
@@ -212,8 +219,7 @@ class AmclNode : public nav2_util::LifecycleNode
212219
std::shared_ptr<std_srvs::srv::Empty::Response> response);
213220

214221
// service server for providing an initial pose guess
215-
nav2_util::ServiceServer<nav2_msgs::srv::SetInitialPose,
216-
std::shared_ptr<nav2_util::LifecycleNode>>::SharedPtr initial_guess_srv_;
222+
nav2::ServiceServer<nav2_msgs::srv::SetInitialPose>::SharedPtr initial_guess_srv_;
217223
/*
218224
* @brief Service callback for an initial pose guess request
219225
*/
@@ -223,8 +229,7 @@ class AmclNode : public nav2_util::LifecycleNode
223229
std::shared_ptr<nav2_msgs::srv::SetInitialPose::Response> response);
224230

225231
// Let amcl update samples without requiring motion
226-
nav2_util::ServiceServer<std_srvs::srv::Empty,
227-
std::shared_ptr<nav2_util::LifecycleNode>>::SharedPtr nomotion_update_srv_;
232+
nav2::ServiceServer<std_srvs::srv::Empty>::SharedPtr nomotion_update_srv_;
228233
/*
229234
* @brief Request an AMCL update even though the robot hasn't moved
230235
*/

0 commit comments

Comments
 (0)