Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
SUB::Node Class Reference

TODO for USER: Add class description. More...

#include <template_control_plugin_node.hpp>

Inheritance diagram for SUB::Node:
Inheritance graph
Collaboration diagram for SUB::Node:
Collaboration graph

Public Member Functions

 Node (const rclcpp::NodeOptions &)
 Node constructor. More...
 
rcl_interfaces::msg::SetParametersResult parameter_update_callback (const std::vector< rclcpp::Parameter > &parameters)
 Example callback for dynamic parameter updates. More...
 
void example_timer_callback ()
 Example timer callback. More...
 
void example_callback (std_msgs::msg::String::UniquePtr msg)
 Example subscription callback. More...
 
void example_service_callback (const std::shared_ptr< rmw_request_id_t > header, const std::shared_ptr< std_srvs::srv::Empty::Request > request, std::shared_ptr< std_srvs::srv::Empty::Response > response)
 Example service callback. More...
 
autoware_msgs::msg::ControlCommandStamped generate_command () override
 Extending class provided method which should generate a command message which will be published to the required topic by the base class. More...
 
bool get_availability () override
 Get the availability status of this plugin based on the current operating environment. Method must be overriden by extending classes. More...
 
std::string get_version_id () override
 Returns the version id of this plugin. More...
 
carma_ros2_utils::CallbackReturn on_configure_plugin ()
 This method should be used to load parameters and will be called on the configure state transition. More...
 
 Node (const rclcpp::NodeOptions &)
 Node constructor. More...
 
rcl_interfaces::msg::SetParametersResult parameter_update_callback (const std::vector< rclcpp::Parameter > &parameters)
 Example callback for dynamic parameter updates. More...
 
void example_timer_callback ()
 Example timer callback. More...
 
void example_callback (std_msgs::msg::String::UniquePtr msg)
 Example subscription callback. More...
 
void example_service_callback (const std::shared_ptr< rmw_request_id_t > header, const std::shared_ptr< std_srvs::srv::Empty::Request > request, std::shared_ptr< std_srvs::srv::Empty::Response > response)
 Example service callback. More...
 
carma_ros2_utils::CallbackReturn handle_on_configure (const rclcpp_lifecycle::State &prev_state)
 
 Node (const rclcpp::NodeOptions &)
 Node constructor. More...
 
rcl_interfaces::msg::SetParametersResult parameter_update_callback (const std::vector< rclcpp::Parameter > &parameters)
 Example callback for dynamic parameter updates. More...
 
void example_timer_callback ()
 Example timer callback. More...
 
void example_callback (std_msgs::msg::String::UniquePtr msg)
 Example subscription callback. More...
 
void example_service_callback (const std::shared_ptr< rmw_request_id_t > header, const std::shared_ptr< std_srvs::srv::Empty::Request > request, std::shared_ptr< std_srvs::srv::Empty::Response > response)
 Example service callback. More...
 
void plan_maneuvers_callback (std::shared_ptr< rmw_request_id_t >, carma_planning_msgs::srv::PlanManeuvers::Request::SharedPtr req, carma_planning_msgs::srv::PlanManeuvers::Response::SharedPtr resp) override
 Extending class provided callback which should return a planned trajectory based on the provided trajectory planning request. More...
 
bool get_availability () override
 Get the availability status of this plugin based on the current operating environment. Method must be overriden by extending classes. More...
 
std::string get_version_id () override
 Returns the version id of this plugin. More...
 
carma_ros2_utils::CallbackReturn on_configure_plugin ()
 This method should be used to load parameters and will be called on the configure state transition. More...
 
 Node (const rclcpp::NodeOptions &)
 Node constructor. More...
 
rcl_interfaces::msg::SetParametersResult parameter_update_callback (const std::vector< rclcpp::Parameter > &parameters)
 Example callback for dynamic parameter updates. More...
 
void example_timer_callback ()
 Example timer callback. More...
 
void example_callback (std_msgs::msg::String::UniquePtr msg)
 Example subscription callback. More...
 
void example_service_callback (const std::shared_ptr< rmw_request_id_t > header, const std::shared_ptr< std_srvs::srv::Empty::Request > request, std::shared_ptr< std_srvs::srv::Empty::Response > response)
 Example service callback. More...
 
void plan_trajectory_callback (std::shared_ptr< rmw_request_id_t >, carma_planning_msgs::srv::PlanTrajectory::Request::SharedPtr req, carma_planning_msgs::srv::PlanTrajectory::Response::SharedPtr resp) override
 Extending class provided callback which should return a planned trajectory based on the provided trajectory planning request. More...
 
bool get_availability () override
 Get the availability status of this plugin based on the current operating environment. Method must be overriden by extending classes. More...
 
std::string get_version_id () override
 Returns the version id of this plugin. More...
 
carma_ros2_utils::CallbackReturn on_configure_plugin ()
 This method should be used to load parameters and will be called on the configure state transition. More...
 
- Public Member Functions inherited from carma_guidance_plugins::ControlPlugin
 ControlPlugin (const rclcpp::NodeOptions &)
 ControlPlugin constructor. More...
 
virtual ~ControlPlugin ()=default
 Virtual destructor for safe deletion. More...
 
virtual autoware_msgs::msg::ControlCommandStamped generate_command ()=0
 Extending class provided method which should generate a command message which will be published to the required topic by the base class. More...
 
std::string get_capability () override
 Get the capability string representing this plugins capabilities Method must be overriden by extending classes. Expectation is that abstract plugin type parent classes will provide a default implementation. More...
 
uint8_t get_type () override final
 Returns the type of this plugin according to the carma_planning_msgs::Plugin type enum. Extending classes for the specific type should override this method. More...
 
carma_ros2_utils::CallbackReturn handle_on_configure (const rclcpp_lifecycle::State &) override final
 
carma_ros2_utils::CallbackReturn handle_on_activate (const rclcpp_lifecycle::State &) override final
 
carma_ros2_utils::CallbackReturn handle_on_deactivate (const rclcpp_lifecycle::State &) override final
 
carma_ros2_utils::CallbackReturn handle_on_cleanup (const rclcpp_lifecycle::State &) override final
 
carma_ros2_utils::CallbackReturn handle_on_shutdown (const rclcpp_lifecycle::State &) override final
 
carma_ros2_utils::CallbackReturn handle_on_error (const rclcpp_lifecycle::State &, const std::string &exception_string) override final
 
- Public Member Functions inherited from carma_guidance_plugins::PluginBaseNode
 PluginBaseNode (const rclcpp::NodeOptions &)
 PluginBaseNode constructor. More...
 
virtual ~PluginBaseNode ()=default
 Virtual destructor for safe deletion. More...
 
virtual std::shared_ptr< carma_wm::WMListenerget_world_model_listener () final
 Method to return the default world model listener provided as a convience by this base class If this method or get_world_model() are not called then the world model remains uninitialized and will not create unnecessary subscriptions. More...
 
virtual carma_wm::WorldModelConstPtr get_world_model () final
 Method to return the default world model provided as a convience by this base class If this method or get_world_model_listener() are not called then the world model remains uninitialized and will not create unnecessary subscriptions. More...
 
virtual bool get_activation_status () final
 Returns the activation status of this plugin. The plugins API callbacks will only be triggered when this method returns true. More...
 
virtual uint8_t get_type ()
 Returns the type of this plugin according to the carma_planning_msgs::Plugin type enum. Extending classes for the specific type should override this method. More...
 
std::string get_plugin_name_and_ns () const
 Return the name of this plugin with namespace. NOTE: If only the name of the plugin is required, use get_plugin_name() More...
 
std::string get_plugin_name () const
 Return the name of this plugin. More...
 
virtual bool get_availability ()=0
 Get the availability status of this plugin based on the current operating environment. Method must be overriden by extending classes. More...
 
virtual std::string get_capability ()=0
 Get the capability string representing this plugins capabilities Method must be overriden by extending classes. Expectation is that abstract plugin type parent classes will provide a default implementation. More...
 
virtual std::string get_version_id ()=0
 Returns the version id of this plugin. More...
 
virtual carma_ros2_utils::CallbackReturn on_configure_plugin ()=0
 Method which is triggered when this plugin is moved from the UNCONFIGURED to INACTIVE states. This method should be used to load parameters and is required to be implemented. More...
 
virtual carma_ros2_utils::CallbackReturn on_activate_plugin ()
 Method which is triggered when this plugin is moved from the INACTIVE to ACTIVE states. This method should be used to prepare for future callbacks for plugin's capabilites. More...
 
virtual carma_ros2_utils::CallbackReturn on_deactivate_plugin ()
 Method which is triggered when this plugin is moved from the ACTIVE to INACTIVE states. This method should be used to disable any functionality which should cease execution when plugin is inactive. More...
 
virtual carma_ros2_utils::CallbackReturn on_cleanup_plugin ()
 Method which is triggered when this plugin is moved from the INACTIVE to UNCONFIGURED states. This method should be used to fully reset the plugin such that a future call to on_configure_plugin would leave the plugin in a fresh state as though just launched. More...
 
virtual carma_ros2_utils::CallbackReturn on_shutdown_plugin ()
 Method which is triggered when this plugin is moved from any state to FINALIZED This method should be used to generate any shutdown logs or final cleanup. More...
 
virtual carma_ros2_utils::CallbackReturn on_error_plugin (const std::string &exception_string)
 Method which is triggered when an unhandled exception occurs in this plugin This method should be used to cleanup such that the plugin could be moved to UNCONFIGURED state if possible. More...
 
carma_ros2_utils::CallbackReturn handle_on_configure (const rclcpp_lifecycle::State &) override
 
carma_ros2_utils::CallbackReturn handle_on_activate (const rclcpp_lifecycle::State &) override
 
carma_ros2_utils::CallbackReturn handle_on_deactivate (const rclcpp_lifecycle::State &) override
 
carma_ros2_utils::CallbackReturn handle_on_cleanup (const rclcpp_lifecycle::State &) override
 
carma_ros2_utils::CallbackReturn handle_on_shutdown (const rclcpp_lifecycle::State &) override
 
carma_ros2_utils::CallbackReturn handle_on_error (const rclcpp_lifecycle::State &, const std::string &exception_string) override
 
 FRIEND_TEST (carma_guidance_plugins_test, connections_test)
 
- Public Member Functions inherited from carma_guidance_plugins::StrategicPlugin
 StrategicPlugin (const rclcpp::NodeOptions &)
 StrategicPlugin constructor. More...
 
virtual ~StrategicPlugin ()=default
 Virtual destructor for safe deletion. More...
 
virtual void plan_maneuvers_callback (std::shared_ptr< rmw_request_id_t > srv_header, carma_planning_msgs::srv::PlanManeuvers::Request::SharedPtr req, carma_planning_msgs::srv::PlanManeuvers::Response::SharedPtr resp)=0
 Extending class provided callback which should return a planned trajectory based on the provided trajectory planning request. More...
 
std::string get_capability () override
 Get the capability string representing this plugins capabilities Method must be overriden by extending classes. Expectation is that abstract plugin type parent classes will provide a default implementation. More...
 
uint8_t get_type () override final
 Returns the type of this plugin according to the carma_planning_msgs::Plugin type enum. Extending classes for the specific type should override this method. More...
 
carma_ros2_utils::CallbackReturn handle_on_configure (const rclcpp_lifecycle::State &) override final
 
carma_ros2_utils::CallbackReturn handle_on_activate (const rclcpp_lifecycle::State &) override final
 
carma_ros2_utils::CallbackReturn handle_on_deactivate (const rclcpp_lifecycle::State &) override final
 
carma_ros2_utils::CallbackReturn handle_on_cleanup (const rclcpp_lifecycle::State &) override final
 
carma_ros2_utils::CallbackReturn handle_on_shutdown (const rclcpp_lifecycle::State &) override final
 
carma_ros2_utils::CallbackReturn handle_on_error (const rclcpp_lifecycle::State &, const std::string &exception_string) override final
 
- Public Member Functions inherited from carma_guidance_plugins::TacticalPlugin
 TacticalPlugin (const rclcpp::NodeOptions &)
 TacticalPlugin constructor. More...
 
virtual ~TacticalPlugin ()=default
 Virtual destructor for safe deletion. More...
 
virtual void plan_trajectory_callback (std::shared_ptr< rmw_request_id_t > srv_header, carma_planning_msgs::srv::PlanTrajectory::Request::SharedPtr req, carma_planning_msgs::srv::PlanTrajectory::Response::SharedPtr resp)=0
 Extending class provided callback which should return a planned trajectory based on the provided trajectory planning request. More...
 
std::string get_capability () override
 Get the capability string representing this plugins capabilities Method must be overriden by extending classes. Expectation is that abstract plugin type parent classes will provide a default implementation. More...
 
uint8_t get_type () override final
 Returns the type of this plugin according to the carma_planning_msgs::Plugin type enum. Extending classes for the specific type should override this method. More...
 
carma_ros2_utils::CallbackReturn handle_on_configure (const rclcpp_lifecycle::State &) override final
 
carma_ros2_utils::CallbackReturn handle_on_activate (const rclcpp_lifecycle::State &) override final
 
carma_ros2_utils::CallbackReturn handle_on_deactivate (const rclcpp_lifecycle::State &) override final
 
carma_ros2_utils::CallbackReturn handle_on_cleanup (const rclcpp_lifecycle::State &) override final
 
carma_ros2_utils::CallbackReturn handle_on_shutdown (const rclcpp_lifecycle::State &) override final
 
carma_ros2_utils::CallbackReturn handle_on_error (const rclcpp_lifecycle::State &, const std::string &exception_string) override final
 

Private Attributes

carma_ros2_utils::SubPtr< std_msgs::msg::String > example_sub_
 
carma_ros2_utils::PubPtr< std_msgs::msg::String > example_pub_
 
carma_ros2_utils::ClientPtr< std_srvs::srv::Empty > example_client_
 
carma_ros2_utils::ServicePtr< std_srvs::srv::Empty > example_service_
 
rclcpp::TimerBase::SharedPtr example_timer_
 
Config config_
 

Additional Inherited Members

- Protected Member Functions inherited from carma_guidance_plugins::ControlPlugin
void current_pose_callback (geometry_msgs::msg::PoseStamped::UniquePtr msg)
 
void current_twist_callback (geometry_msgs::msg::TwistStamped::UniquePtr msg)
 
virtual void current_trajectory_callback (carma_planning_msgs::msg::TrajectoryPlan::UniquePtr msg)
 Extending class provided method which can optionally handle trajectory plan callbacks. More...
 
- Protected Attributes inherited from carma_guidance_plugins::ControlPlugin
boost::optional< geometry_msgs::msg::PoseStamped > current_pose_
 The most recent pose message received by this node. More...
 
boost::optional< geometry_msgs::msg::TwistStamped > current_twist_
 The most recent velocity message received by this node. More...
 
boost::optional< carma_planning_msgs::msg::TrajectoryPlan > current_trajectory_
 The most recent trajectory received by this plugin. More...
 

Detailed Description

TODO for USER: Add class description.

Definition at line 34 of file template_tactical_plugin_node.hpp.

Constructor & Destructor Documentation

◆ Node() [1/4]

SUB::Node::Node ( const rclcpp::NodeOptions &  options)
explicit

Node constructor.

Definition at line 22 of file template_control_plugin_node.cpp.

24 {
25 // Create initial config
26 config_ = Config();
27
28 // Declare parameters
29 config_.example_param = declare_parameter<std::string>("example_param", config_.example_param);
30 }
ControlPlugin base class which can be extended by user provided plugins which wish to implement the C...
std::string example_param
Example parameter.

◆ Node() [2/4]

SUB::Node::Node ( const rclcpp::NodeOptions &  )
explicit

Node constructor.

◆ Node() [3/4]

SUB::Node::Node ( const rclcpp::NodeOptions &  )
explicit

Node constructor.

◆ Node() [4/4]

SUB::Node::Node ( const rclcpp::NodeOptions &  )
explicit

Node constructor.

Member Function Documentation

◆ example_callback() [1/4]

void SUB::Node::example_callback ( std_msgs::msg::String::UniquePtr  msg)

Example subscription callback.

Definition at line 97 of file template_control_plugin_node.cpp.

98 {
99 RCLCPP_INFO_STREAM( get_logger(), "example_sub_ callback called with value: " << msg->data);
100 }

◆ example_callback() [2/4]

void SUB::Node::example_callback ( std_msgs::msg::String::UniquePtr  msg)

Example subscription callback.

◆ example_callback() [3/4]

void SUB::Node::example_callback ( std_msgs::msg::String::UniquePtr  msg)

Example subscription callback.

◆ example_callback() [4/4]

void SUB::Node::example_callback ( std_msgs::msg::String::UniquePtr  msg)

Example subscription callback.

◆ example_service_callback() [1/4]

void SUB::Node::example_service_callback ( const std::shared_ptr< rmw_request_id_t >  header,
const std::shared_ptr< std_srvs::srv::Empty::Request >  request,
std::shared_ptr< std_srvs::srv::Empty::Response >  response 
)

Example service callback.

Definition at line 82 of file template_control_plugin_node.cpp.

85 {
86 RCLCPP_INFO( get_logger(), "Example service callback");
87 }

◆ example_service_callback() [2/4]

void SUB::Node::example_service_callback ( const std::shared_ptr< rmw_request_id_t >  header,
const std::shared_ptr< std_srvs::srv::Empty::Request >  request,
std::shared_ptr< std_srvs::srv::Empty::Response >  response 
)

Example service callback.

◆ example_service_callback() [3/4]

void SUB::Node::example_service_callback ( const std::shared_ptr< rmw_request_id_t >  header,
const std::shared_ptr< std_srvs::srv::Empty::Request >  request,
std::shared_ptr< std_srvs::srv::Empty::Response >  response 
)

Example service callback.

◆ example_service_callback() [4/4]

void SUB::Node::example_service_callback ( const std::shared_ptr< rmw_request_id_t >  header,
const std::shared_ptr< std_srvs::srv::Empty::Request >  request,
std::shared_ptr< std_srvs::srv::Empty::Response >  response 
)

Example service callback.

◆ example_timer_callback() [1/4]

void SUB::Node::example_timer_callback ( )

Example timer callback.

Definition at line 89 of file template_control_plugin_node.cpp.

90 {
91 RCLCPP_DEBUG(get_logger(), "Example timer callback");
92 std_msgs::msg::String msg;
93 msg.data = "Hello World!";
94 example_pub_->publish(msg);
95 }
carma_ros2_utils::PubPtr< std_msgs::msg::String > example_pub_

◆ example_timer_callback() [2/4]

void SUB::Node::example_timer_callback ( )

Example timer callback.

◆ example_timer_callback() [3/4]

void SUB::Node::example_timer_callback ( )

Example timer callback.

◆ example_timer_callback() [4/4]

void SUB::Node::example_timer_callback ( )

Example timer callback.

◆ generate_command()

autoware_msgs::msg::ControlCommandStamped SUB::Node::generate_command ( )
overridevirtual

Extending class provided method which should generate a command message which will be published to the required topic by the base class.

NOTE: Implementer can determine if trajectory has changed based on current_trajectory_->trajectory_id

Returns
The command message to publish

Implements carma_guidance_plugins::ControlPlugin.

Definition at line 102 of file template_control_plugin_node.cpp.

103 {
104 autoware_msgs::msg::ControlCommandStamped msg;
105 // TODO for user: Implement logic to generate control commands here
106 return msg;
107 }

◆ get_availability() [1/3]

bool SUB::Node::get_availability ( )
overridevirtual

Get the availability status of this plugin based on the current operating environment. Method must be overriden by extending classes.

Returns
This method should return true if the plugin's current understanding of the world means it would be capable of planning or executing its capability.

Implements carma_guidance_plugins::PluginBaseNode.

Definition at line 109 of file template_control_plugin_node.cpp.

109 {
110 return true; // TODO for user implement actual check on availability if applicable to plugin
111 }

◆ get_availability() [2/3]

bool SUB::Node::get_availability ( )
overridevirtual

Get the availability status of this plugin based on the current operating environment. Method must be overriden by extending classes.

Returns
This method should return true if the plugin's current understanding of the world means it would be capable of planning or executing its capability.

Implements carma_guidance_plugins::PluginBaseNode.

◆ get_availability() [3/3]

bool SUB::Node::get_availability ( )
overridevirtual

Get the availability status of this plugin based on the current operating environment. Method must be overriden by extending classes.

Returns
This method should return true if the plugin's current understanding of the world means it would be capable of planning or executing its capability.

Implements carma_guidance_plugins::PluginBaseNode.

◆ get_version_id() [1/3]

std::string SUB::Node::get_version_id ( )
overridevirtual

Returns the version id of this plugin.

Returns
The version id represented as a string

Implements carma_guidance_plugins::PluginBaseNode.

Definition at line 113 of file template_control_plugin_node.cpp.

113 {
114 return "TODO for user specify plugin version id here";
115 }

◆ get_version_id() [2/3]

std::string SUB::Node::get_version_id ( )
overridevirtual

Returns the version id of this plugin.

Returns
The version id represented as a string

Implements carma_guidance_plugins::PluginBaseNode.

◆ get_version_id() [3/3]

std::string SUB::Node::get_version_id ( )
overridevirtual

Returns the version id of this plugin.

Returns
The version id represented as a string

Implements carma_guidance_plugins::PluginBaseNode.

◆ handle_on_configure()

carma_ros2_utils::CallbackReturn SUB::Node::handle_on_configure ( const rclcpp_lifecycle::State &  prev_state)

Definition at line 44 of file template_package_node.cpp.

45 {
46 // Reset config
47 config_ = Config();
48
49 // Load parameters
50 get_parameter<std::string>("example_param", config_.example_param);
51
52 // Register runtime parameter update callback
53 add_on_set_parameters_callback(std::bind(&Node::parameter_update_callback, this, std_ph::_1));
54
55 // Setup subscribers
56 example_sub_ = create_subscription<std_msgs::msg::String>("example_input_topic", 10,
57 std::bind(&Node::example_callback, this, std_ph::_1));
58
59 // Setup publishers
60 example_pub_ = create_publisher<std_msgs::msg::String>("example_output_topic", 10);
61
62 // Setup service clients
63 example_client_ = create_client<std_srvs::srv::Empty>("example_used_service");
64
65 // Setup service servers
66 example_service_ = create_service<std_srvs::srv::Empty>("example_provided_service",
67 std::bind(&Node::example_service_callback, this, std_ph::_1, std_ph::_2, std_ph::_3));
68
69 // Setup timers
70 // NOTE: You will not be able to actually publish until in the ACTIVE state
71 // so it may often make more sense for timers to be created in handle_on_activate
72 example_timer_ = create_timer(
73 get_clock(),
74 std::chrono::milliseconds(1000),
75 std::bind(&Node::example_timer_callback, this));
76
77 // Return success if everything initialized successfully
78 return CallbackReturn::SUCCESS;
79 }
carma_ros2_utils::ClientPtr< std_srvs::srv::Empty > example_client_
void example_service_callback(const std::shared_ptr< rmw_request_id_t > header, const std::shared_ptr< std_srvs::srv::Empty::Request > request, std::shared_ptr< std_srvs::srv::Empty::Response > response)
Example service callback.
void example_timer_callback()
Example timer callback.
carma_ros2_utils::ServicePtr< std_srvs::srv::Empty > example_service_
rclcpp::TimerBase::SharedPtr example_timer_
void example_callback(std_msgs::msg::String::UniquePtr msg)
Example subscription callback.
carma_ros2_utils::SubPtr< std_msgs::msg::String > example_sub_
rcl_interfaces::msg::SetParametersResult parameter_update_callback(const std::vector< rclcpp::Parameter > &parameters)
Example callback for dynamic parameter updates.

◆ on_configure_plugin() [1/3]

carma_ros2_utils::CallbackReturn SUB::Node::on_configure_plugin ( )
virtual

This method should be used to load parameters and will be called on the configure state transition.

Implements carma_guidance_plugins::PluginBaseNode.

Definition at line 44 of file template_control_plugin_node.cpp.

45 {
46 // Reset config
47 config_ = Config();
48
49 // Load parameters
50 get_parameter<std::string>("example_param", config_.example_param);
51
52 // Register runtime parameter update callback
53 add_on_set_parameters_callback(std::bind(&Node::parameter_update_callback, this, std_ph::_1));
54
55 // Setup subscribers
56 example_sub_ = create_subscription<std_msgs::msg::String>("example_input_topic", 10,
57 std::bind(&Node::example_callback, this, std_ph::_1));
58
59 // Setup publishers
60 example_pub_ = create_publisher<std_msgs::msg::String>("example_output_topic", 10);
61
62 // Setup service clients
63 example_client_ = create_client<std_srvs::srv::Empty>("example_used_service");
64
65 // Setup service servers
66 example_service_ = create_service<std_srvs::srv::Empty>("example_provided_service",
67 std::bind(&Node::example_service_callback, this, std_ph::_1, std_ph::_2, std_ph::_3));
68
69 // Setup timers
70 // NOTE: You will not be able to actually publish until in the ACTIVE state
71 // so it may often make more sense for timers to be created in handle_on_activate
72 example_timer_ = create_timer(
73 get_clock(),
74 std::chrono::milliseconds(1000),
75 std::bind(&Node::example_timer_callback, this));
76
77 // Return success if everthing initialized successfully
78 return CallbackReturn::SUCCESS;
79 }

◆ on_configure_plugin() [2/3]

carma_ros2_utils::CallbackReturn SUB::Node::on_configure_plugin ( )
virtual

This method should be used to load parameters and will be called on the configure state transition.

Implements carma_guidance_plugins::PluginBaseNode.

◆ on_configure_plugin() [3/3]

carma_ros2_utils::CallbackReturn SUB::Node::on_configure_plugin ( )
virtual

This method should be used to load parameters and will be called on the configure state transition.

Implements carma_guidance_plugins::PluginBaseNode.

◆ parameter_update_callback() [1/4]

rcl_interfaces::msg::SetParametersResult SUB::Node::parameter_update_callback ( const std::vector< rclcpp::Parameter > &  parameters)

Example callback for dynamic parameter updates.

Definition at line 32 of file template_control_plugin_node.cpp.

33 {
34 // TODO for the USER: Ensure all parameters can be updated dynamically by adding them to this method
35 auto error = update_params<std::string>({{"example_param", config_.example_param}}, parameters);
36
37 rcl_interfaces::msg::SetParametersResult result;
38
39 result.successful = !error;
40
41 return result;
42 }

◆ parameter_update_callback() [2/4]

rcl_interfaces::msg::SetParametersResult SUB::Node::parameter_update_callback ( const std::vector< rclcpp::Parameter > &  parameters)

Example callback for dynamic parameter updates.

◆ parameter_update_callback() [3/4]

rcl_interfaces::msg::SetParametersResult SUB::Node::parameter_update_callback ( const std::vector< rclcpp::Parameter > &  parameters)

Example callback for dynamic parameter updates.

◆ parameter_update_callback() [4/4]

rcl_interfaces::msg::SetParametersResult SUB::Node::parameter_update_callback ( const std::vector< rclcpp::Parameter > &  parameters)

Example callback for dynamic parameter updates.

◆ plan_maneuvers_callback()

void SUB::Node::plan_maneuvers_callback ( std::shared_ptr< rmw_request_id_t >  srv_header,
carma_planning_msgs::srv::PlanManeuvers::Request::SharedPtr  req,
carma_planning_msgs::srv::PlanManeuvers::Response::SharedPtr  resp 
)
overridevirtual

Extending class provided callback which should return a planned trajectory based on the provided trajectory planning request.

Parameters
srv_headerRCL header for services calls. Can usually be ignored by implementers.
reqThe service request containing the previously planned maneuvers and vehicle state
respThe response containing the additional maneuvers generated by this plugin

Implements carma_guidance_plugins::StrategicPlugin.

Definition at line 102 of file template_strategic_plugin_node.cpp.

106 {
107 // TODO for user: Implement maneuver planning logic here to populate resp based on req.
108 }

◆ plan_trajectory_callback()

void SUB::Node::plan_trajectory_callback ( std::shared_ptr< rmw_request_id_t >  srv_header,
carma_planning_msgs::srv::PlanTrajectory::Request::SharedPtr  req,
carma_planning_msgs::srv::PlanTrajectory::Response::SharedPtr  resp 
)
overridevirtual

Extending class provided callback which should return a planned trajectory based on the provided trajectory planning request.

Parameters
srv_headerRCL header for services calls. Can usually be ignored by implementers.
reqThe service request containing the maneuvers to plan trajectories for and current vehicle state
respThe response containing the planned trajectory

Implements carma_guidance_plugins::TacticalPlugin.

Definition at line 102 of file template_tactical_plugin_node.cpp.

106 {
107 // TODO for user: Implement trajectory planning logic here by populating resp base on req.
108 }

Member Data Documentation

◆ config_

Config SUB::Node::config_
private

Definition at line 54 of file template_control_plugin_node.hpp.

◆ example_client_

carma_ros2_utils::ClientPtr< std_srvs::srv::Empty > SUB::Node::example_client_
private

Definition at line 45 of file template_control_plugin_node.hpp.

◆ example_pub_

carma_ros2_utils::PubPtr< std_msgs::msg::String > SUB::Node::example_pub_
private

Definition at line 42 of file template_control_plugin_node.hpp.

◆ example_service_

carma_ros2_utils::ServicePtr< std_srvs::srv::Empty > SUB::Node::example_service_
private

Definition at line 48 of file template_control_plugin_node.hpp.

◆ example_sub_

carma_ros2_utils::SubPtr< std_msgs::msg::String > SUB::Node::example_sub_
private

Definition at line 39 of file template_control_plugin_node.hpp.

◆ example_timer_

rclcpp::TimerBase::SharedPtr SUB::Node::example_timer_
private

Definition at line 51 of file template_control_plugin_node.hpp.


The documentation for this class was generated from the following files: