Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7093029
added: Plugin example base
afxalz Jan 27, 2025
8e5cc18
fixed: example plugins are discoverable now, cmake target and plugins…
afxalz Jan 28, 2025
28ce29c
update: cleaned and made fixes to the plugin load
afxalz Jan 29, 2025
07506f9
fix: a cleaner method to export the headers
afxalz Jan 29, 2025
5a94529
merged: tomas branch
afxalz Jan 29, 2025
93550af
fixed: example plugins are discoverable now, cmake target and plugins…
afxalz Jan 28, 2025
47d1c63
update: cleaned and made fixes to the plugin load
afxalz Jan 29, 2025
d83f439
fix: a cleaner method to export the headers
afxalz Jan 29, 2025
ebe2bf4
minor changes
Feb 4, 2025
782c163
improving time handling
Feb 4, 2025
26213e5
first commit
Feb 4, 2025
e31cd5d
wip
Feb 19, 2025
85b8a70
+ wip clock management
Feb 19, 2025
23c7214
added: image-transport example
afxalz Mar 3, 2025
6b4f880
wip: playing with the param-loader example
afxalz Mar 4, 2025
954012e
added sub pub torture test
Mar 10, 2025
aaee0aa
wip: ros2 get_param isseues
afxalz Mar 10, 2025
9d81e17
disabled py part of packaage.xml that causes deb compilation issues
Mar 12, 2025
0b0f628
added: param-loader example for mrs_lib version
afxalz Mar 13, 2025
3c6540a
merged: vision-examples and param-example
afxalz Mar 17, 2025
acd787e
:
afxalz Mar 17, 2025
62b9042
updated: param-example to use Node ptr and custom-config from the cli
afxalz Mar 17, 2025
efc74a4
udpated: image-transport example with tmux session
afxalz Mar 17, 2025
02d831e
added: rqt file to tmux of image-tranport-example
afxalz Mar 17, 2025
3f2b397
added: a python module to help with launch file generation
afxalz Mar 17, 2025
e263ce5
minor changes
Mar 21, 2025
0fb0b6e
refactored the pluginlib examples
Mar 21, 2025
9544e05
Merge branch 'master' into afzal
Mar 21, 2025
059b6f3
updated cmakelists, removed optimizaation flags
Mar 24, 2025
5b05869
Merge branch 'master' into afzal
afxalz Mar 27, 2025
d1aac96
cleaned: image transport example
afxalz Mar 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ Everything is a component. We happily [nodelet everything](https://www.clearpath
* [o] **Tests**
* [X] unit testing works
* [X] integration testing works almost like in ROS1, more complex now but also more powerfull
* [ ] **Pluginlib**
* [ ] TODO
* [X] **Pluginlib**
* [X] TODO
* [ ] **Actionlib**
* [ ] TODO
* [ ] **Lifecycles** (new feature)
Expand All @@ -106,3 +106,4 @@ Everything is a component. We happily [nodelet everything](https://www.clearpath
This finds the relevant generated C++ code from ``AddressBook.msg`` and allows your target to link against it.

You may have noticed that this step was not necessary when the interfaces being used were from a package that was built separately. This CMake code is only required when you want to use interfaces in the same package as the one in which they are used. [Source](https://docs.ros.org/en/foxy/Tutorials/Single-Package-Define-And-Use-Interface.html#link-against-the-interface)
# download_artifact_test
Original file line number Diff line number Diff line change
@@ -1,69 +1,92 @@
cmake_minimum_required(VERSION 3.5)
project(example_plugin_manager)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# set the compile options to show code warnings
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(pluginlib REQUIRED)
find_package(ros2_examples REQUIRED)
find_package(Eigen3 REQUIRED)
set(DEPENDENCIES
ament_cmake
ament_cmake_ros
rclcpp
rclcpp_components
pluginlib
Eigen3
ros2_examples
)

set(LIBRARIES
ExamplePluginManager_PluginManager
)

set(Eigen_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIRS})
set(Eigen_LIBRARIES ${Eigen_LIBRARIES})
foreach(DEP IN LISTS DEPENDENCIES)
find_package(${DEP} REQUIRED)
endforeach()

include_directories(
include
${rclcpp_INCLUDE_DIRS}
${ros2_examples_INCLUDE_DIRS}
)

# ExamplePluginManager

add_library(example_plugin_manager SHARED
add_library(ExamplePluginManager_PluginManager SHARED
src/example_plugin_manager.cpp
)

# ament manages cmake related variables and dependency search (similar to catkin in ROS1)
ament_target_dependencies(example_plugin_manager
rclcpp
rclcpp_components
pluginlib
Eigen3
ros2_examples
ament_target_dependencies(ExamplePluginManager_PluginManager
${DEPENDENCIES}
)

# each component (nodelet) needs to be registered to make it discoverable at runtime
rclcpp_components_register_nodes(example_plugin_manager "example_plugin_manager::ExamplePluginManager")
rclcpp_components_register_nodes(ExamplePluginManager_PluginManager "example_plugin_manager::ExamplePluginManager")

## --------------------------------------------------------------
## | Install |
## --------------------------------------------------------------

install(TARGETS
example_plugin_manager
ament_export_libraries(
${LIBRARIES}
)

install(
TARGETS ${LIBRARIES}
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
)

install(
DIRECTORY include/
DESTINATION include/${PROJECT_NAME}
DIRECTORY include
DESTINATION .
)

install(DIRECTORY launch
install(
DIRECTORY launch
DESTINATION share/${PROJECT_NAME}
)

install(DIRECTORY config
install(
DIRECTORY config
DESTINATION share/${PROJECT_NAME}
)

ament_export_include_directories("include/${PROJECT_NAME}")
ament_export_include_directories(
include
)

ament_export_targets(
export_${PROJECT_NAME} HAS_LIBRARY_TARGET
)

ament_export_dependencies(
${DEPENDENCIES}
)

ament_package()
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# the list of "names" of the loaded plugins
# each plugin's properties are defined in 'plugins.yaml'
# each plugin's properties are defined in 'plugins.yaml' of the example_plugin package
plugins : [
"ExamplePlugin",
"ExamplePlugin2",
Expand All @@ -9,4 +9,4 @@ plugins : [
# should be within "plugins"
initial_plugin: "ExamplePlugin2"

update_timer_rate: 1 # [Hz]
update_timer_rate: 1.0 # [Hz]
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# define "running instances" of plugins, there can be more than one for each

ExamplePlugin:
address: "example_plugins/ExamplePlugin" # this is taken from the plugin's package.xml
name_space: "example_plugin" # useful for loading parameters into difference instances of the same plugin
address: "example_plugins::ExamplePlugin" # this is taken from the 'type' arg of plugins.xml which is inside the 'example_plugin' pkg
name_space: "example_plugin" # useful for loading parameters into different instances of the same plugin
some_property: 6.28 # this can be anything specific the manager needs to hold for each instance of each plugin

# We can run another instance of the same plugin
ExamplePlugin2:
address: "example_plugins/ExamplePlugin" # this is taken from the plugin's package.xml
name_space: "example_plugin_2"
address: "example_plugins::ExamplePlugin"
name_space: "example_plugin_2" # notice the different namespace to separate these plugins
some_property: 10.1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace example_plugin_manager

class Plugin {
public:
virtual void initialize(const rclcpp::Node &parent_node, const std::string& name, const std::string& name_space,
virtual void initialize(const std::shared_ptr<rclcpp::Node> &sub_node, const std::string& name,
std::shared_ptr<example_plugin_manager::CommonHandlers_t> common_handlers) = 0;

virtual bool activate(const int& some_number) = 0;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import launch
import os

from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode
from launch.substitutions import EnvironmentVariable

from ament_index_python.packages import get_package_share_directory

def generate_launch_description():

ld = launch.LaunchDescription()

pkg_name = "example_plugin_manager"
pkg_share_path = get_package_share_directory(pkg_name)

# param loaded from env variable
uav_type = EnvironmentVariable("UAV_TYPE", default_value="dummy")

ld.add_action(ComposableNodeContainer(

namespace="container_ns",
name="comp_container",
package="rclcpp_components",
executable="component_container_mt",

composable_node_descriptions=[

ComposableNode(

package=pkg_name,
plugin="example_plugin_manager::ExamplePluginManager",
namespace="node_ns",
name="example_plugin_manager",

parameters=[
pkg_share_path + "/config/example_plugin_manager.yaml",
pkg_share_path + "/config/plugins.yaml",
{"uav_type": uav_type},
],

# remappings=[
# # topics
# ("~/topic_out", "~/topic"),
# ],

),

],

output="screen",
))

return ld
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@

<author email="[email protected]">Afzal Ahmad</author>
<maintainer email="[email protected]">Afzal Ahmad</maintainer>
<maintainer email="[email protected]">Tomas Baca</maintainer>

<license>TODO: License declaration</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_ros</buildtool_depend>

<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>nodelet</depend>
<depend>mrs_lib</depend>
<depend>pluginlib </depend>
<depend>ros2_examples</depend>
<depend>eigen</depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
Loading