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.
|
This class includes node-level logic for Platooning Control such as its publishers, subscribers, and their callback functions. Platooning Control is used for generating control commands to maintain the gap in platoon as well as generating longitudinal and lateral control commands to follow the trajectory. More...
#include <platooning_control.hpp>
Public Member Functions | |
PlatooningControlPlugin (const rclcpp::NodeOptions &options) | |
PlatooningControlPlugin constructor. More... | |
autoware_msgs::msg::ControlCommandStamped | generate_control_signals (const carma_planning_msgs::msg::TrajectoryPlanPoint &first_trajectory_point, const geometry_msgs::msg::PoseStamped ¤t_pose, const geometry_msgs::msg::TwistStamped ¤t_twist) |
generate control signal by calculating speed and steering commands. More... | |
geometry_msgs::msg::TwistStamped | compose_twist_cmd (double linear_vel, double angular_vel) |
Compose twist message from linear and angular velocity commands. More... | |
motion::motion_common::State | convert_state (const geometry_msgs::msg::PoseStamped &pose, const geometry_msgs::msg::TwistStamped &twist) const |
rcl_interfaces::msg::SetParametersResult | parameter_update_callback (const std::vector< rclcpp::Parameter > ¶meters) |
Callback for dynamic parameter updates. More... | |
void | current_trajectory_callback (const carma_planning_msgs::msg::TrajectoryPlan::UniquePtr tp) |
callback function for trajectory plan More... | |
autoware_msgs::msg::ControlCommandStamped | compose_ctrl_cmd (double linear_vel, double steering_angle) |
Compose control message from speed and steering commands. More... | |
bool | get_availability () override |
Returns availability of plugin. Always true. More... | |
std::string | get_version_id () override |
Returns version id of plugn. 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... | |
carma_ros2_utils::CallbackReturn | on_configure_plugin () override |
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::WMListener > | get_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 Attributes | |
double | trajectory_speed_ = 0.0 |
std::shared_ptr< pure_pursuit::PurePursuit > | pp_ |
Private Member Functions | |
void | platoon_info_cb (const carma_planning_msgs::msg::PlatooningInfo::SharedPtr msg) |
callback function for platoon info More... | |
double | get_trajectory_speed (const std::vector< carma_planning_msgs::msg::TrajectoryPlanPoint > &trajectory_points) |
calculate average speed of a set of trajectory points More... | |
FRIEND_TEST (PlatooningControlPluginTest, test_platoon_info_cb) | |
FRIEND_TEST (PlatooningControlPluginTest, test_get_trajectory_speed) | |
FRIEND_TEST (PlatooningControlPluginTest, test_generate_controls) | |
FRIEND_TEST (PlatooningControlPluginTest, test_current_trajectory_callback) | |
Private Attributes | |
PlatooningControlPluginConfig | config_ |
PlatooningControlWorker | pcw_ |
PlatoonLeaderInfo | platoon_leader_ |
double | prev_input_time_ms_ = 0 |
long | consecutive_input_counter_ = 0 |
carma_ros2_utils::SubPtr< carma_planning_msgs::msg::TrajectoryPlan > | trajectory_plan_sub_ |
carma_ros2_utils::SubPtr< carma_planning_msgs::msg::PlatooningInfo > | platoon_info_sub_ |
carma_ros2_utils::PubPtr< carma_planning_msgs::msg::PlatooningInfo > | platoon_info_pub_ |
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... | |
This class includes node-level logic for Platooning Control such as its publishers, subscribers, and their callback functions. Platooning Control is used for generating control commands to maintain the gap in platoon as well as generating longitudinal and lateral control commands to follow the trajectory.
Definition at line 41 of file platooning_control.hpp.
|
explicit |
PlatooningControlPlugin constructor.
Definition at line 22 of file platooning_control.cpp.
References platooning_control::PlatooningControlPluginConfig::adjustment_cap_mps, platooning_control::PlatooningControlPluginConfig::cmd_timestamp_ms, config_, platooning_control::PlatooningControlWorker::ctrl_config_, platooning_control::PlatooningControlPluginConfig::dist_front_rear_wheels, platooning_control::PlatooningControlPluginConfig::dt, platooning_control::PlatooningControlPluginConfig::emergency_stop_distance, platooning_control::PlatooningControlPluginConfig::enable_max_accel_filter, platooning_control::PlatooningControlPluginConfig::enable_max_adjustment_filter, platooning_control::PlatooningControlPluginConfig::ignore_initial_inputs, platooning_control::PlatooningControlPluginConfig::integrator_max, platooning_control::PlatooningControlPluginConfig::integrator_max_pp, platooning_control::PlatooningControlPluginConfig::integrator_min, platooning_control::PlatooningControlPluginConfig::integrator_min_pp, platooning_control::PlatooningControlPluginConfig::is_delay_compensation, platooning_control::PlatooningControlPluginConfig::is_integrator_enabled, platooning_control::PlatooningControlPluginConfig::is_interpolate_lookahead_point, platooning_control::PlatooningControlPluginConfig::kd, platooning_control::PlatooningControlPluginConfig::ki, platooning_control::PlatooningControlPluginConfig::ki_pp, platooning_control::PlatooningControlPluginConfig::kp, platooning_control::PlatooningControlPluginConfig::max_accel_mps2, platooning_control::PlatooningControlPluginConfig::max_delta_speed_per_timestep, platooning_control::PlatooningControlPluginConfig::max_lookahead_dist, platooning_control::PlatooningControlPluginConfig::min_delta_speed_per_timestep, platooning_control::PlatooningControlPluginConfig::min_lookahead_dist, pcw_, platooning_control::PlatooningControlPluginConfig::shutdown_timeout, platooning_control::PlatooningControlPluginConfig::speed_thres_traveling_direction, platooning_control::PlatooningControlPluginConfig::speed_to_lookahead_ratio, platooning_control::PlatooningControlPluginConfig::stand_still_headway_m, platooning_control::PlatooningControlPluginConfig::vehicle_id, and platooning_control::PlatooningControlPluginConfig::vehicle_response_lag.
autoware_msgs::msg::ControlCommandStamped platooning_control::PlatooningControlPlugin::compose_ctrl_cmd | ( | double | linear_vel, |
double | steering_angle | ||
) |
Compose control message from speed and steering commands.
linear_vel | linear velocity in m/s |
steering_angle | steering angle in rad |
Definition at line 334 of file platooning_control.cpp.
Referenced by generate_control_signals().
geometry_msgs::msg::TwistStamped platooning_control::PlatooningControlPlugin::compose_twist_cmd | ( | double | linear_vel, |
double | angular_vel | ||
) |
Compose twist message from linear and angular velocity commands.
linear_vel | linear velocity in m/s |
angular_vel | angular velocity in rad/s |
Definition at line 325 of file platooning_control.cpp.
motion::motion_common::State platooning_control::PlatooningControlPlugin::convert_state | ( | const geometry_msgs::msg::PoseStamped & | pose, |
const geometry_msgs::msg::TwistStamped & | twist | ||
) | const |
Definition at line 296 of file platooning_control.cpp.
Referenced by generate_control_signals().
|
virtual |
callback function for trajectory plan
msg | trajectory plan msg |
Reimplemented from carma_guidance_plugins::ControlPlugin.
Definition at line 310 of file platooning_control.cpp.
References consecutive_input_counter_, carma_guidance_plugins::ControlPlugin::current_trajectory_, and prev_input_time_ms_.
Referenced by on_configure_plugin().
|
private |
|
private |
|
private |
|
private |
|
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
Implements carma_guidance_plugins::ControlPlugin.
Definition at line 201 of file platooning_control.cpp.
References config_, consecutive_input_counter_, carma_guidance_plugins::ControlPlugin::current_pose_, carma_guidance_plugins::ControlPlugin::current_trajectory_, carma_guidance_plugins::ControlPlugin::current_twist_, generate_control_signals(), get_trajectory_speed(), platooning_control::PlatooningControlPluginConfig::ignore_initial_inputs, prev_input_time_ms_, platooning_control::PlatooningControlPluginConfig::shutdown_timeout, and trajectory_speed_.
autoware_msgs::msg::ControlCommandStamped platooning_control::PlatooningControlPlugin::generate_control_signals | ( | const carma_planning_msgs::msg::TrajectoryPlanPoint & | first_trajectory_point, |
const geometry_msgs::msg::PoseStamped & | current_pose, | ||
const geometry_msgs::msg::TwistStamped & | current_twist | ||
) |
generate control signal by calculating speed and steering commands.
point0 | start point of control window |
point_end | end point of control wondow |
Definition at line 272 of file platooning_control.cpp.
References compose_ctrl_cmd(), config_, convert_state(), carma_guidance_plugins::ControlPlugin::current_trajectory_, platooning_control::PlatooningControlWorker::generate_speed(), pcw_, platoon_leader_, pp_, basic_autonomy::waypoint_generation::process_trajectory_plan(), platooning_control::PlatooningControlWorker::set_current_speed(), platooning_control::PlatooningControlWorker::set_leader(), platooning_control::PlatooningControlWorker::speedCmd_, trajectory_speed_, and platooning_control::PlatooningControlPluginConfig::vehicle_response_lag.
Referenced by generate_command().
|
overridevirtual |
Returns availability of plugin. Always true.
Implements carma_guidance_plugins::PluginBaseNode.
Definition at line 346 of file platooning_control.cpp.
|
private |
calculate average speed of a set of trajectory points
trajectory_points | set of trajectory points |
Definition at line 355 of file platooning_control.cpp.
References process_bag::i.
Referenced by generate_command().
|
overridevirtual |
Returns version id of plugn.
Implements carma_guidance_plugins::PluginBaseNode.
Definition at line 350 of file platooning_control.cpp.
|
overridevirtual |
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 114 of file platooning_control.cpp.
References platooning_control::PlatooningControlPluginConfig::adjustment_cap_mps, platooning_control::PlatooningControlPluginConfig::cmd_timestamp_ms, config_, current_trajectory_callback(), platooning_control::PlatooningControlPluginConfig::dist_front_rear_wheels, platooning_control::PlatooningControlPluginConfig::dt, platooning_control::PlatooningControlPluginConfig::emergency_stop_distance, platooning_control::PlatooningControlPluginConfig::enable_max_accel_filter, platooning_control::PlatooningControlPluginConfig::enable_max_adjustment_filter, platooning_control::PlatooningControlPluginConfig::ignore_initial_inputs, platooning_control::PlatooningControlPluginConfig::integrator_max, platooning_control::PlatooningControlPluginConfig::integrator_max_pp, platooning_control::PlatooningControlPluginConfig::integrator_min, platooning_control::PlatooningControlPluginConfig::integrator_min_pp, platooning_control::PlatooningControlPluginConfig::is_delay_compensation, platooning_control::PlatooningControlPluginConfig::is_integrator_enabled, platooning_control::PlatooningControlPluginConfig::is_interpolate_lookahead_point, platooning_control::PlatooningControlPluginConfig::kd, platooning_control::PlatooningControlPluginConfig::ki, platooning_control::PlatooningControlPluginConfig::ki_pp, platooning_control::PlatooningControlPluginConfig::kp, platooning_control::PlatooningControlPluginConfig::max_accel_mps2, platooning_control::PlatooningControlPluginConfig::max_delta_speed_per_timestep, platooning_control::PlatooningControlPluginConfig::max_lookahead_dist, platooning_control::PlatooningControlPluginConfig::min_delta_speed_per_timestep, platooning_control::PlatooningControlPluginConfig::min_lookahead_dist, parameter_update_callback(), platoon_info_cb(), platoon_info_pub_, platoon_info_sub_, pp_, platooning_control::PlatooningControlPluginConfig::shutdown_timeout, platooning_control::PlatooningControlPluginConfig::speed_thres_traveling_direction, platooning_control::PlatooningControlPluginConfig::speed_to_lookahead_ratio, platooning_control::PlatooningControlPluginConfig::stand_still_headway_m, trajectory_plan_sub_, platooning_control::PlatooningControlPluginConfig::vehicle_id, and platooning_control::PlatooningControlPluginConfig::vehicle_response_lag.
rcl_interfaces::msg::SetParametersResult platooning_control::PlatooningControlPlugin::parameter_update_callback | ( | const std::vector< rclcpp::Parameter > & | parameters | ) |
Callback for dynamic parameter updates.
Definition at line 66 of file platooning_control.cpp.
References platooning_control::PlatooningControlPluginConfig::adjustment_cap_mps, platooning_control::PlatooningControlPluginConfig::cmd_timestamp_ms, config_, platooning_control::PlatooningControlPluginConfig::dist_front_rear_wheels, platooning_control::PlatooningControlPluginConfig::dt, platooning_control::PlatooningControlPluginConfig::emergency_stop_distance, platooning_control::PlatooningControlPluginConfig::enable_max_accel_filter, platooning_control::PlatooningControlPluginConfig::enable_max_adjustment_filter, platooning_control::PlatooningControlPluginConfig::integrator_max, platooning_control::PlatooningControlPluginConfig::integrator_max_pp, platooning_control::PlatooningControlPluginConfig::integrator_min, platooning_control::PlatooningControlPluginConfig::integrator_min_pp, platooning_control::PlatooningControlPluginConfig::is_delay_compensation, platooning_control::PlatooningControlPluginConfig::is_integrator_enabled, platooning_control::PlatooningControlPluginConfig::is_interpolate_lookahead_point, platooning_control::PlatooningControlPluginConfig::kd, platooning_control::PlatooningControlPluginConfig::ki, platooning_control::PlatooningControlPluginConfig::ki_pp, platooning_control::PlatooningControlPluginConfig::kp, platooning_control::PlatooningControlPluginConfig::max_accel_mps2, platooning_control::PlatooningControlPluginConfig::max_delta_speed_per_timestep, platooning_control::PlatooningControlPluginConfig::max_lookahead_dist, platooning_control::PlatooningControlPluginConfig::min_delta_speed_per_timestep, platooning_control::PlatooningControlPluginConfig::min_lookahead_dist, platooning_control::PlatooningControlPluginConfig::speed_thres_traveling_direction, platooning_control::PlatooningControlPluginConfig::speed_to_lookahead_ratio, platooning_control::PlatooningControlPluginConfig::stand_still_headway_m, and platooning_control::PlatooningControlPluginConfig::vehicle_response_lag.
Referenced by on_configure_plugin().
|
private |
callback function for platoon info
msg | platoon info msg |
Definition at line 239 of file platooning_control.cpp.
References platooning_control::PlatooningControlWorker::actual_gap_, platooning_control::PlatoonLeaderInfo::commandSpeed, platooning_control::PlatooningControlWorker::desired_gap_, platooning_control::PlatoonLeaderInfo::leaderIndex, platooning_control::PlatoonLeaderInfo::NumberOfVehicleInFront, pcw_, platoon_info_pub_, platoon_leader_, platooning_control::PlatooningControlWorker::speedCmd_, platooning_control::PlatoonLeaderInfo::staticId, and platooning_control::PlatoonLeaderInfo::vehiclePosition.
Referenced by on_configure_plugin().
|
private |
Definition at line 115 of file platooning_control.hpp.
Referenced by PlatooningControlPlugin(), generate_command(), generate_control_signals(), on_configure_plugin(), and parameter_update_callback().
|
private |
Definition at line 123 of file platooning_control.hpp.
Referenced by current_trajectory_callback(), and generate_command().
|
private |
Definition at line 118 of file platooning_control.hpp.
Referenced by PlatooningControlPlugin(), generate_control_signals(), and platoon_info_cb().
|
private |
Definition at line 144 of file platooning_control.hpp.
Referenced by on_configure_plugin(), and platoon_info_cb().
|
private |
Definition at line 141 of file platooning_control.hpp.
Referenced by on_configure_plugin().
|
private |
Definition at line 121 of file platooning_control.hpp.
Referenced by generate_control_signals(), and platoon_info_cb().
std::shared_ptr<pure_pursuit::PurePursuit> platooning_control::PlatooningControlPlugin::pp_ |
Definition at line 109 of file platooning_control.hpp.
Referenced by generate_control_signals(), and on_configure_plugin().
|
private |
Definition at line 122 of file platooning_control.hpp.
Referenced by current_trajectory_callback(), and generate_command().
|
private |
Definition at line 140 of file platooning_control.hpp.
Referenced by on_configure_plugin().
double platooning_control::PlatooningControlPlugin::trajectory_speed_ = 0.0 |
Definition at line 67 of file platooning_control.hpp.
Referenced by generate_command(), and generate_control_signals().