Carma-platform v4.11.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.
plan_delegator::PlanDelegator Class Reference

#include <plan_delegator.hpp>

Inheritance diagram for plan_delegator::PlanDelegator:
Inheritance graph
Collaboration diagram for plan_delegator::PlanDelegator:
Collaboration graph

Public Member Functions

 PlanDelegator (const rclcpp::NodeOptions &)
 PlanDelegator constructor. More...
 
void maneuverPlanCallback (carma_planning_msgs::msg::ManeuverPlan::UniquePtr plan)
 Callback function of maneuver plan subscriber. More...
 
void guidanceStateCallback (carma_planning_msgs::msg::GuidanceState::UniquePtr plan)
 Callback function of guidance state subscriber. More...
 
void poseCallback (geometry_msgs::msg::PoseStamped::UniquePtr pose_msg)
 Callback function for vehicle pose subscriber. Updates latest_pose_ and makes calls to publishUpcomingLaneChangeStatus() and publishTurnSignalCommand(). More...
 
carma_ros2_utils::ClientPtr< carma_planning_msgs::srv::PlanTrajectory > getPlannerClientByName (const std::string &planner_name)
 Get PlanTrajectory service client by plugin name and create new PlanTrajectory service client if specified name does not exist. More...
 
bool isManeuverExpired (const carma_planning_msgs::msg::Maneuver &maneuver, rclcpp::Time current_time) const
 Example if a maneuver end time has passed current system time. More...
 
std::shared_ptr< carma_planning_msgs::srv::PlanTrajectory::Request > composePlanTrajectoryRequest (const carma_planning_msgs::msg::TrajectoryPlan &latest_trajectory_plan, const carma_planning_msgs::msg::ManeuverPlan &locked_maneuver_plan, const uint16_t &current_maneuver_index) const
 Generate new PlanTrajecory service request based on current planning progress. More...
 
void lookupFrontBumperTransform ()
 Lookup transfrom from front bumper to base link. More...
 
void updateManeuverParameters (carma_planning_msgs::msg::Maneuver &maneuver)
 Update the starting downtrack, ending downtrack, and maneuver-specific Lanelet ID parameters associated with a given maneuver. These updates are required since the starting and ending downtrack values of each maneuver are shifted based on the distance between the base_link frame and the vehicle_front frame. More...
 
carma_ros2_utils::CallbackReturn handle_on_configure (const rclcpp_lifecycle::State &)
 
carma_ros2_utils::CallbackReturn handle_on_activate (const rclcpp_lifecycle::State &)
 

Static Public Attributes

static const constexpr double MILLISECOND_TO_SECOND = 0.001
 

Protected Attributes

Config config_
 
std::unordered_map< std::string, carma_ros2_utils::ClientPtr< carma_planning_msgs::srv::PlanTrajectory > > trajectory_planners_
 
carma_ros2_utils::ClientPtr< carma_planning_msgs::srv::PlanTrajectory > yield_client_
 
carma_planning_msgs::msg::ManeuverPlan latest_maneuver_plan_
 
bool received_maneuver_plan_ = false
 
geometry_msgs::msg::PoseStamped latest_pose_
 
geometry_msgs::msg::TwistStamped latest_twist_
 
carma_wm::WMListener wml_
 
carma_wm::WorldModelConstPtr wm_
 

Private Member Functions

void onTrajPlanTick ()
 Callback function for triggering trajectory planning. More...
 
bool isManeuverPlanValid (const carma_planning_msgs::msg::ManeuverPlan &maneuver_plan) const noexcept
 Example if a maneuver plan contains at least one maneuver. More...
 
bool isTrajectoryValid (const carma_planning_msgs::msg::TrajectoryPlan &trajectory_plan) const noexcept
 Example if a trajectory plan contains at least two trajectory points. More...
 
bool isTrajectoryLongEnough (const carma_planning_msgs::msg::TrajectoryPlan &plan) const noexcept
 Example if a trajectory plan is longer than configured time thresheld. More...
 
carma_planning_msgs::msg::TrajectoryPlan planTrajectory ()
 Plan trajectory based on latest maneuver plan via ROS service call to plugins. More...
 
LaneChangeInformation getLaneChangeInformation (const carma_planning_msgs::msg::Maneuver &lane_change_maneuver)
 Function for generating a LaneChangeInformation object from a provided lane change maneuver. More...
 
void publishUpcomingLaneChangeStatus (const boost::optional< LaneChangeInformation > &upcoming_lane_change_information)
 Function for processing an optional LaneChangeInformation object pertaining to an upcoming lane change. If not empty, an UpcomingLaneChangeStatus message is created and published based on the contents of the LaneChangeInformation. The published UpcomingLaneChangeStatus message is stored in upcoming_lane_change_status_. More...
 
void publishTurnSignalCommand (const boost::optional< LaneChangeInformation > &current_lane_change_information, const carma_planning_msgs::msg::UpcomingLaneChangeStatus &upcoming_lane_change_status)
 Function for processing an optional LaneChangeInformation object pertaining to the currently-occurring lane change and an UpcomingLaneChangeStatus message. If the optional object pertaining to the currently-occurring lane change is not empty, then a turn signal command is published based on the current lane change direction. Otherwise, a turn signal command in the direction of the UpcomingLaneChangeStatus message is published if the vehicle is estimated to begin that lane change in under the time threshold defined by config_.duration_to_signal_before_lane_change. The published TurnSignalComand message is stored in latest_turn_signal_command_. More...
 
 FRIEND_TEST (TestPlanDelegator, UnitTestPlanDelegator)
 
 FRIEND_TEST (TestPlanDelegator, TestPlanDelegator)
 
 FRIEND_TEST (TestPlanDelegator, TestLaneChangeInformation)
 
 FRIEND_TEST (TestPlanDelegator, TestUpcomingLaneChangeAndTurnSignals)
 
 FRIEND_TEST (TestPlanDelegator, TestUpdateManeuverParameters)
 
 FRIEND_TEST (TestPlanDelegator, TestGetLaneChangeInformation)
 

Private Attributes

std::optional< carma_planning_msgs::msg::TrajectoryPlan > last_successful_traj_
 
carma_ros2_utils::PubPtr< carma_planning_msgs::msg::TrajectoryPlan > traj_pub_
 
carma_ros2_utils::PubPtr< carma_planning_msgs::msg::UpcomingLaneChangeStatus > upcoming_lane_change_status_pub_
 
carma_ros2_utils::PubPtr< autoware_msgs::msg::LampCmd > turn_signal_command_pub_
 
carma_ros2_utils::SubPtr< carma_planning_msgs::msg::ManeuverPlan > plan_sub_
 
carma_ros2_utils::SubPtr< geometry_msgs::msg::PoseStamped > pose_sub_
 
carma_ros2_utils::SubPtr< geometry_msgs::msg::TwistStamped > twist_sub_
 
carma_ros2_utils::SubPtr< carma_planning_msgs::msg::GuidanceState > guidance_state_sub_
 
rclcpp::TimerBase::SharedPtr traj_timer_
 
rclcpp::CallbackGroup::SharedPtr timer_callback_group_
 
bool guidance_engaged = false
 
int consecutive_traj_gen_failure_num_ = 0
 
double length_to_front_bumper_ = 3.0
 
std::shared_ptr< tf2_ros::Buffer > tf2_buffer_
 
std::shared_ptr< tf2_ros::TransformListener > tf2_listener_
 
boost::optional< LaneChangeInformationupcoming_lane_change_information_
 
boost::optional< LaneChangeInformationcurrent_lane_change_information_
 
carma_planning_msgs::msg::UpcomingLaneChangeStatus upcoming_lane_change_status_
 
autoware_msgs::msg::LampCmd latest_turn_signal_command_
 

Detailed Description

Definition at line 113 of file plan_delegator.hpp.

Constructor & Destructor Documentation

◆ PlanDelegator()

plan_delegator::PlanDelegator::PlanDelegator ( const rclcpp::NodeOptions &  options)
explicit

PlanDelegator constructor.

Definition at line 132 of file plan_delegator.cpp.

132 : carma_ros2_utils::CarmaLifecycleNode(options),
133 tf2_buffer_(std::make_shared<tf2_ros::Buffer>(this->get_clock())),
134 wml_(this->get_node_base_interface(), this->get_node_logging_interface(),
135 this->get_node_topics_interface(), this->get_node_parameters_interface())
136 {
137 // Create initial config
138 config_ = Config();
139
140 config_.planning_topic_prefix = declare_parameter<std::string>("planning_topic_prefix", config_.planning_topic_prefix);
141 config_.planning_topic_suffix = declare_parameter<std::string>("planning_topic_suffix", config_.planning_topic_suffix);
142 config_.trajectory_planning_rate = declare_parameter<double>("trajectory_planning_rate", config_.trajectory_planning_rate);
143 config_.max_trajectory_duration = declare_parameter<double>("trajectory_duration_threshold", config_.max_trajectory_duration);
144 config_.min_crawl_speed = declare_parameter<double>("min_speed", config_.min_crawl_speed);
145 config_.duration_to_signal_before_lane_change = declare_parameter<double>("duration_to_signal_before_lane_change", config_.duration_to_signal_before_lane_change);
146 config_.max_traj_generation_reattempt = declare_parameter<int>("max_traj_generation_reattempt", config_.max_traj_generation_reattempt);
147 config_.tactical_plugin_service_call_timeout = declare_parameter<int>("tactical_plugin_service_call_timeout", config_.tactical_plugin_service_call_timeout);
148 config_.enable_object_avoidance = declare_parameter<bool>("enable_object_avoidance", config_.enable_object_avoidance);
149 }
std::shared_ptr< tf2_ros::Buffer > tf2_buffer_
std::string planning_topic_suffix
std::string planning_topic_prefix
double duration_to_signal_before_lane_change

References config_, plan_delegator::Config::duration_to_signal_before_lane_change, plan_delegator::Config::enable_object_avoidance, plan_delegator::Config::max_traj_generation_reattempt, plan_delegator::Config::max_trajectory_duration, plan_delegator::Config::min_crawl_speed, plan_delegator::Config::planning_topic_prefix, plan_delegator::Config::planning_topic_suffix, plan_delegator::Config::tactical_plugin_service_call_timeout, and plan_delegator::Config::trajectory_planning_rate.

Member Function Documentation

◆ composePlanTrajectoryRequest()

std::shared_ptr< carma_planning_msgs::srv::PlanTrajectory::Request > plan_delegator::PlanDelegator::composePlanTrajectoryRequest ( const carma_planning_msgs::msg::TrajectoryPlan &  latest_trajectory_plan,
const carma_planning_msgs::msg::ManeuverPlan &  locked_maneuver_plan,
const uint16_t &  current_maneuver_index 
) const

Generate new PlanTrajecory service request based on current planning progress.

Parameters
latest_trajectory_planThe trajectory plan to append the resulting trajectory
locked_maneuver_planThe maneuver plan to send to the tactical plugin
current_maneuver_indexThe idx of the maneuver in the maneuver plan that this request is for
Returns
a PlanTrajectoryRequest to be used in the service call to the tactical plugin

Definition at line 471 of file plan_delegator.cpp.

475 {
476 auto plan_req = std::make_shared<carma_planning_msgs::srv::PlanTrajectory::Request>();
477 plan_req->maneuver_plan = locked_maneuver_plan;
478
479 // set current vehicle state if we have NOT planned any previous trajectories
480 if(latest_trajectory_plan.trajectory_points.empty())
481 {
482 plan_req->header.stamp = latest_pose_.header.stamp;
483 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"), "latest_pose_.header.stamp: " << std::to_string(rclcpp::Time(latest_pose_.header.stamp).seconds()));
484 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"), "plan_req->header.stamp: " << std::to_string(rclcpp::Time(plan_req->header.stamp).seconds()));
485
486 plan_req->vehicle_state.longitudinal_vel = latest_twist_.twist.linear.x;
487 plan_req->vehicle_state.x_pos_global = latest_pose_.pose.position.x;
488 plan_req->vehicle_state.y_pos_global = latest_pose_.pose.position.y;
489 double roll, pitch, yaw;
490 carma_wm::geometry::rpyFromQuaternion(latest_pose_.pose.orientation, roll, pitch, yaw);
491 plan_req->vehicle_state.orientation = yaw;
492 plan_req->maneuver_index_to_plan = current_maneuver_index;
493 }
494 // set vehicle state based on last two planned trajectory points
495 else
496 {
497 carma_planning_msgs::msg::TrajectoryPlanPoint last_point = latest_trajectory_plan.trajectory_points.back();
498 carma_planning_msgs::msg::TrajectoryPlanPoint second_last_point = *(latest_trajectory_plan.trajectory_points.rbegin() + 1);
499 plan_req->vehicle_state.x_pos_global = last_point.x;
500 plan_req->vehicle_state.y_pos_global = last_point.y;
501 auto distance_diff = std::sqrt(std::pow(last_point.x - second_last_point.x, 2) + std::pow(last_point.y - second_last_point.y, 2));
502 rclcpp::Duration time_diff = rclcpp::Time(last_point.target_time) - rclcpp::Time(second_last_point.target_time);
503 auto time_diff_sec = time_diff.seconds();
504 plan_req->maneuver_index_to_plan = current_maneuver_index;
505 // this assumes the vehicle does not have significant lateral velocity
506 plan_req->header.stamp = latest_trajectory_plan.trajectory_points.back().target_time;
507 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"), "plan_req->header.stamp: " << std::to_string(rclcpp::Time(plan_req->header.stamp).seconds()));
508
509 plan_req->vehicle_state.longitudinal_vel = distance_diff / time_diff_sec;
510 // TODO develop way to set yaw value for future points
511 }
512 return plan_req;
513 }
geometry_msgs::msg::TwistStamped latest_twist_
geometry_msgs::msg::PoseStamped latest_pose_
rclcpp::Logger get_logger()
Return the module-level logger used by all basic_autonomy functions.
Definition: log.cpp:32
auto to_string(const UtmZone &zone) -> std::string
Definition: utm_zone.cpp:21
void rpyFromQuaternion(const tf2::Quaternion &q, double &roll, double &pitch, double &yaw)
Extract extrinsic roll-pitch-yaw from quaternion.
Definition: Geometry.cpp:52

References basic_autonomy::get_logger(), latest_pose_, latest_twist_, carma_wm::geometry::rpyFromQuaternion(), and carma_cooperative_perception::to_string().

Referenced by planTrajectory().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FRIEND_TEST() [1/6]

plan_delegator::PlanDelegator::FRIEND_TEST ( TestPlanDelegator  ,
TestGetLaneChangeInformation   
)
private

◆ FRIEND_TEST() [2/6]

plan_delegator::PlanDelegator::FRIEND_TEST ( TestPlanDelegator  ,
TestLaneChangeInformation   
)
private

◆ FRIEND_TEST() [3/6]

plan_delegator::PlanDelegator::FRIEND_TEST ( TestPlanDelegator  ,
TestPlanDelegator   
)
private

◆ FRIEND_TEST() [4/6]

plan_delegator::PlanDelegator::FRIEND_TEST ( TestPlanDelegator  ,
TestUpcomingLaneChangeAndTurnSignals   
)
private

◆ FRIEND_TEST() [5/6]

plan_delegator::PlanDelegator::FRIEND_TEST ( TestPlanDelegator  ,
TestUpdateManeuverParameters   
)
private

◆ FRIEND_TEST() [6/6]

plan_delegator::PlanDelegator::FRIEND_TEST ( TestPlanDelegator  ,
UnitTestPlanDelegator   
)
private

◆ getLaneChangeInformation()

LaneChangeInformation plan_delegator::PlanDelegator::getLaneChangeInformation ( const carma_planning_msgs::msg::Maneuver &  lane_change_maneuver)
private

Function for generating a LaneChangeInformation object from a provided lane change maneuver.

Parameters
lane_change_maneuverThe lane change maneuver that a LaneChangeInformation object shall be generated from.
Returns
A LaneChangeInformation object containing information on the provided lane change maneuver.

Definition at line 265 of file plan_delegator.cpp.

265 {
266 LaneChangeInformation lane_change_information;
267
268 lane_change_information.starting_downtrack = lane_change_maneuver.lane_change_maneuver.start_dist;
269
270 // Get the starting and ending lanelets for this lane change maneuver
271 lanelet::ConstLanelet starting_lanelet = wm_->getMap()->laneletLayer.get(std::stoi(lane_change_maneuver.lane_change_maneuver.starting_lane_id));
272 lanelet::ConstLanelet ending_lanelet = wm_->getMap()->laneletLayer.get(std::stoi(lane_change_maneuver.lane_change_maneuver.ending_lane_id));
273
274 // Determine if lane change is a left or right lane change and update lane_change_information accordingly.
275 // This function runs directly inside the final_maneuver_plan subscription callback (once per received
276 // plan), so it must never throw here: an uncaught exception in a subscription callback can crash this
277 // node outright. Previously it did throw whenever the walk from starting_lanelet to a shared boundary
278 // with ending_lanelet hit a lanelet with no routable successor -- which happens whenever an intervening
279 // lanelet is closed (e.g. by a TCM) or simply missing adjacency data in the map. Below, that same walk
280 // is attempted first since it is exact when it works, but any inability to complete it (no following
281 // lanelet, a routing loop) now falls through to a purely geometric left/right estimate instead of
282 // failing, so a lane change is always reported instead of crashing.
283 boost::optional<bool> is_right_lane_change;
284
285 if(starting_lanelet.leftBound() == ending_lanelet.rightBound()){
286 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"), "Lanelet " << std::to_string(starting_lanelet.id()) << " shares left boundary with " << std::to_string(ending_lanelet.id()));
287 is_right_lane_change = false;
288 }
289 else if(starting_lanelet.rightBound() == ending_lanelet.leftBound()){
290 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"), "Lanelet " << std::to_string(starting_lanelet.id()) << " shares right boundary with " << std::to_string(ending_lanelet.id()));
291 is_right_lane_change = true;
292 }
293 else
294 {
295 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"), "Searching for shared boundary with starting lanechange lanelet " << std::to_string(starting_lanelet.id()) << " and ending lanelet " << std::to_string(ending_lanelet.id()));
296 lanelet::ConstLanelet current_lanelet = starting_lanelet;
297 std::unordered_set<lanelet::Id> visited{current_lanelet.id()};
298
299 while(!is_right_lane_change){
300 // Assumption: Adjacent lanelets share lane boundary
301 auto following_lanelets = wm_->getMapRoutingGraph()->following(current_lanelet, false);
302 bool no_successor = following_lanelets.empty();
303 lanelet::ConstLanelet candidate_lanelet = no_successor ? current_lanelet : following_lanelets.front();
304 bool loop_detected = !no_successor && visited.count(candidate_lanelet.id()) > 0;
305
306 if(no_successor)
307 {
308 RCLCPP_WARN_STREAM(rclcpp::get_logger("plan_delegator"), "No following lanelets from lanelet " << current_lanelet.id()
309 << " reachable without a lane change (possibly closed or missing from the map); "
310 << "falling back to a geometric left/right estimate for lane change from "
311 << starting_lanelet.id() << " to " << ending_lanelet.id());
312 }
313
314 if (loop_detected)
315 {
316 RCLCPP_WARN_STREAM(rclcpp::get_logger("plan_delegator"), "Detected a routing loop while searching for a shared boundary between lanelet "
317 << starting_lanelet.id() << " and " << ending_lanelet.id() << "; falling back to a geometric left/right estimate");
318 }
319
320 if(no_successor || loop_detected)
321 {
322 break;
323 }
324
325 current_lanelet = candidate_lanelet;
326 visited.insert(current_lanelet.id());
327
328 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"), "Now checking for shared lane boundary with lanelet " << std::to_string(current_lanelet.id()) << " and ending lanelet " << std::to_string(ending_lanelet.id()));
329 if(current_lanelet.leftBound() == ending_lanelet.rightBound()){
330 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"), "Lanelet " << std::to_string(current_lanelet.id()) << " shares left boundary with " << std::to_string(ending_lanelet.id()));
331 is_right_lane_change = false;
332 }
333 else if(current_lanelet.rightBound() == ending_lanelet.leftBound()){
334 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"), "Lanelet " << std::to_string(current_lanelet.id()) << " shares right boundary with " << std::to_string(ending_lanelet.id()));
335 is_right_lane_change = true;
336 }
337 }
338 }
339
340 if(!is_right_lane_change)
341 {
342 // Could not confirm a shared boundary via routing (e.g. an intervening lanelet was closed or missing
343 // from the map). Fall back to pure geometry: which side of the starting lanelet's heading does the
344 // ending lanelet fall on? This only needs the two lanelets' own centerlines, so it works even when
345 // they are otherwise disconnected in the routing graph.
346 lanelet::BasicLineString2d starting_centerline = starting_lanelet.centerline2d().basicLineString();
347 lanelet::BasicPoint2d start_pt = starting_centerline.front();
348 lanelet::BasicPoint2d heading_vec = starting_centerline.back() - start_pt;
349 lanelet::BasicPoint2d to_target = ending_lanelet.centerline2d().basicLineString().front() - start_pt;
350 double cross = heading_vec.x() * to_target.y() - heading_vec.y() * to_target.x();
351
352 RCLCPP_WARN_STREAM(rclcpp::get_logger("plan_delegator"), "Could not find a shared lane boundary between starting lanelet "
353 << starting_lanelet.id() << " and ending lanelet " << ending_lanelet.id()
354 << "; estimating lane change direction geometrically instead.");
355
356 is_right_lane_change = (cross < 0.0);
357 }
358
359 lane_change_information.is_right_lane_change = is_right_lane_change.get();
360 return lane_change_information;
361 }
carma_wm::WorldModelConstPtr wm_

References basic_autonomy::get_logger(), plan_delegator::LaneChangeInformation::is_right_lane_change, plan_delegator::LaneChangeInformation::starting_downtrack, carma_cooperative_perception::to_string(), and wm_.

Referenced by maneuverPlanCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPlannerClientByName()

carma_ros2_utils::ClientPtr< carma_planning_msgs::srv::PlanTrajectory > plan_delegator::PlanDelegator::getPlannerClientByName ( const std::string &  planner_name)

Get PlanTrajectory service client by plugin name and create new PlanTrajectory service client if specified name does not exist.

Returns
a ServiceClient object which corresponse to the target planner

Definition at line 431 of file plan_delegator.cpp.

432 {
433 if(planner_name.size() == 0)
434 {
435 throw std::invalid_argument("Invalid trajectory planner name because it has zero length!");
436 }
437 if(trajectory_planners_.find(planner_name) == trajectory_planners_.end())
438 {
439 RCLCPP_INFO_STREAM(rclcpp::get_logger("plan_delegator"),"Discovered new trajectory planner: " << planner_name);
440
441 trajectory_planners_.emplace(
442 planner_name, create_client<carma_planning_msgs::srv::PlanTrajectory>(config_.planning_topic_prefix + planner_name + config_.planning_topic_suffix));
443 }
444 return trajectory_planners_[planner_name];
445 }
std::unordered_map< std::string, carma_ros2_utils::ClientPtr< carma_planning_msgs::srv::PlanTrajectory > > trajectory_planners_

References config_, basic_autonomy::get_logger(), plan_delegator::Config::planning_topic_prefix, plan_delegator::Config::planning_topic_suffix, and trajectory_planners_.

Referenced by planTrajectory().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ guidanceStateCallback()

void plan_delegator::PlanDelegator::guidanceStateCallback ( carma_planning_msgs::msg::GuidanceState::UniquePtr  plan)

Callback function of guidance state subscriber.

Definition at line 198 of file plan_delegator.cpp.

References lightbar_manager::ENGAGED, and guidance_engaged.

Referenced by handle_on_configure().

Here is the caller graph for this function:

◆ handle_on_activate()

carma_ros2_utils::CallbackReturn plan_delegator::PlanDelegator::handle_on_activate ( const rclcpp_lifecycle::State &  )

Definition at line 189 of file plan_delegator.cpp.

190 {
191 timer_callback_group_ = create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive);
192 traj_timer_ = create_timer(get_clock(),
193 std::chrono::milliseconds((int)(1 / config_.trajectory_planning_rate * 1000)),
195 return CallbackReturn::SUCCESS;
196 }
void onTrajPlanTick()
Callback function for triggering trajectory planning.
rclcpp::TimerBase::SharedPtr traj_timer_
rclcpp::CallbackGroup::SharedPtr timer_callback_group_

References config_, onTrajPlanTick(), timer_callback_group_, traj_timer_, and plan_delegator::Config::trajectory_planning_rate.

Here is the call graph for this function:

◆ handle_on_configure()

carma_ros2_utils::CallbackReturn plan_delegator::PlanDelegator::handle_on_configure ( const rclcpp_lifecycle::State &  )

Definition at line 151 of file plan_delegator.cpp.

152 {
153 // Reset config
154 config_ = Config();
155
156 get_parameter<std::string>("planning_topic_prefix", config_.planning_topic_prefix);
157 get_parameter<std::string>("planning_topic_suffix", config_.planning_topic_suffix);
158 get_parameter<double>("trajectory_planning_rate", config_.trajectory_planning_rate);
159 get_parameter<double>("trajectory_duration_threshold", config_.max_trajectory_duration);
160 get_parameter<double>("min_speed", config_.min_crawl_speed);
161 get_parameter<double>("duration_to_signal_before_lane_change", config_.duration_to_signal_before_lane_change);
162 get_parameter<int>("tactical_plugin_service_call_timeout", config_.tactical_plugin_service_call_timeout);
163 get_parameter<int>("max_traj_generation_reattempt", config_.max_traj_generation_reattempt);
164 get_parameter<bool>("enable_object_avoidance", config_.enable_object_avoidance);
165
166 RCLCPP_INFO_STREAM(rclcpp::get_logger("plan_delegator"),"Done loading parameters: " << config_);
167
168 // Setup publishers
169 traj_pub_ = create_publisher<carma_planning_msgs::msg::TrajectoryPlan>("plan_trajectory", 5);
170 upcoming_lane_change_status_pub_ = create_publisher<carma_planning_msgs::msg::UpcomingLaneChangeStatus>("upcoming_lane_change_status", 1);
171 turn_signal_command_pub_ = create_publisher<autoware_msgs::msg::LampCmd>("lamp_cmd", 1);
172
173 // Setup yield_plugin client; plan_delegator is the sole caller of yield_plugin, invoking it on the
174 // final trajectory before publishing rather than having every tactical plugin call it independently
175 yield_client_ = create_client<carma_planning_msgs::srv::PlanTrajectory>("plugins/yield_plugin/plan_trajectory");
176
177 // Setup subscribers
178 plan_sub_ = create_subscription<carma_planning_msgs::msg::ManeuverPlan>("final_maneuver_plan", 5, std::bind(&PlanDelegator::maneuverPlanCallback, this, std_ph::_1));
179 twist_sub_ = create_subscription<geometry_msgs::msg::TwistStamped>("current_velocity", 5,
180 [this](geometry_msgs::msg::TwistStamped::UniquePtr twist) {this->latest_twist_ = *twist;});
181 pose_sub_ = create_subscription<geometry_msgs::msg::PoseStamped>("current_pose", 5, std::bind(&PlanDelegator::poseCallback, this, std_ph::_1));
182 guidance_state_sub_ = create_subscription<carma_planning_msgs::msg::GuidanceState>("guidance_state", 5, std::bind(&PlanDelegator::guidanceStateCallback, this, std_ph::_1));
183
186 return CallbackReturn::SUCCESS;
187 }
WorldModelConstPtr getWorldModel()
Returns a pointer to an intialized world model instance.
Definition: WMListener.cpp:184
carma_ros2_utils::SubPtr< carma_planning_msgs::msg::GuidanceState > guidance_state_sub_
carma_ros2_utils::ClientPtr< carma_planning_msgs::srv::PlanTrajectory > yield_client_
void poseCallback(geometry_msgs::msg::PoseStamped::UniquePtr pose_msg)
Callback function for vehicle pose subscriber. Updates latest_pose_ and makes calls to publishUpcomin...
carma_ros2_utils::SubPtr< geometry_msgs::msg::TwistStamped > twist_sub_
carma_ros2_utils::PubPtr< carma_planning_msgs::msg::UpcomingLaneChangeStatus > upcoming_lane_change_status_pub_
void guidanceStateCallback(carma_planning_msgs::msg::GuidanceState::UniquePtr plan)
Callback function of guidance state subscriber.
carma_ros2_utils::SubPtr< carma_planning_msgs::msg::ManeuverPlan > plan_sub_
carma_ros2_utils::PubPtr< carma_planning_msgs::msg::TrajectoryPlan > traj_pub_
carma_ros2_utils::PubPtr< autoware_msgs::msg::LampCmd > turn_signal_command_pub_
carma_ros2_utils::SubPtr< geometry_msgs::msg::PoseStamped > pose_sub_
void lookupFrontBumperTransform()
Lookup transfrom from front bumper to base link.
void maneuverPlanCallback(carma_planning_msgs::msg::ManeuverPlan::UniquePtr plan)
Callback function of maneuver plan subscriber.

References config_, plan_delegator::Config::duration_to_signal_before_lane_change, plan_delegator::Config::enable_object_avoidance, basic_autonomy::get_logger(), carma_wm::WMListener::getWorldModel(), guidance_state_sub_, guidanceStateCallback(), latest_twist_, lookupFrontBumperTransform(), maneuverPlanCallback(), plan_delegator::Config::max_traj_generation_reattempt, plan_delegator::Config::max_trajectory_duration, plan_delegator::Config::min_crawl_speed, plan_sub_, plan_delegator::Config::planning_topic_prefix, plan_delegator::Config::planning_topic_suffix, pose_sub_, poseCallback(), plan_delegator::Config::tactical_plugin_service_call_timeout, traj_pub_, plan_delegator::Config::trajectory_planning_rate, turn_signal_command_pub_, twist_sub_, upcoming_lane_change_status_pub_, wm_, wml_, and yield_client_.

Here is the call graph for this function:

◆ isManeuverExpired()

bool plan_delegator::PlanDelegator::isManeuverExpired ( const carma_planning_msgs::msg::Maneuver &  maneuver,
rclcpp::Time  current_time 
) const

Example if a maneuver end time has passed current system time.

Returns
if input maneuver is expires NOTE: current_time is assumed to be same clock type as this node

Definition at line 459 of file plan_delegator.cpp.

460 {
461 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"), "maneuver start time:" << std::to_string(rclcpp::Time(GET_MANEUVER_PROPERTY(maneuver, start_time)).seconds()));
462 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"), "maneuver end time:" << std::to_string(rclcpp::Time(GET_MANEUVER_PROPERTY(maneuver, end_time)).seconds()));
463 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"), "current time:" << std::to_string(now().seconds()));
464 bool isexpired = rclcpp::Time(GET_MANEUVER_PROPERTY(maneuver, end_time), get_clock()->get_clock_type()) <= current_time; // TODO maneuver expiration should maybe be based off of distance not time? https://github.com/usdot-fhwa-stol/carma-platform/issues/1107
465 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"), "isexpired:" << isexpired);
466 // TODO: temporary disabling expiration check
467 return false;
468 }
#define GET_MANEUVER_PROPERTY(mvr, property)
Macro definition to enable easier access to fields shared across the maneuver types.

References basic_autonomy::get_logger(), GET_MANEUVER_PROPERTY, and carma_cooperative_perception::to_string().

Referenced by planTrajectory().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isManeuverPlanValid()

bool plan_delegator::PlanDelegator::isManeuverPlanValid ( const carma_planning_msgs::msg::ManeuverPlan &  maneuver_plan) const
privatenoexcept

Example if a maneuver plan contains at least one maneuver.

Returns
if input maneuver plan is valid

Definition at line 447 of file plan_delegator.cpp.

448 {
449 // currently it only checks if maneuver list is empty
450 return !maneuver_plan.maneuvers.empty();
451 }

Referenced by maneuverPlanCallback().

Here is the caller graph for this function:

◆ isTrajectoryLongEnough()

bool plan_delegator::PlanDelegator::isTrajectoryLongEnough ( const carma_planning_msgs::msg::TrajectoryPlan &  plan) const
privatenoexcept

Example if a trajectory plan is longer than configured time thresheld.

Returns
if input trajectory plan is long enough

Definition at line 515 of file plan_delegator.cpp.

516 {
517 rclcpp::Duration time_diff = rclcpp::Time(plan.trajectory_points.back().target_time) - rclcpp::Time(plan.trajectory_points.front().target_time);
518 return time_diff.seconds() >= config_.max_trajectory_duration;
519 }

Referenced by planTrajectory().

Here is the caller graph for this function:

◆ isTrajectoryValid()

bool plan_delegator::PlanDelegator::isTrajectoryValid ( const carma_planning_msgs::msg::TrajectoryPlan &  trajectory_plan) const
privatenoexcept

Example if a trajectory plan contains at least two trajectory points.

Returns
if input trajectory plan is valid

Definition at line 453 of file plan_delegator.cpp.

454 {
455 // currently it only checks if trajectory contains less than 2 points
456 return !(trajectory_plan.trajectory_points.size() < 2);
457 }

Referenced by onTrajPlanTick(), and planTrajectory().

Here is the caller graph for this function:

◆ lookupFrontBumperTransform()

void plan_delegator::PlanDelegator::lookupFrontBumperTransform ( )

Lookup transfrom from front bumper to base link.

Definition at line 857 of file plan_delegator.cpp.

858 {
859 tf2_listener_ = std::make_shared<tf2_ros::TransformListener>(*tf2_buffer_);
860 tf2_buffer_->setUsingDedicatedThread(true);
861 try
862 {
863 geometry_msgs::msg::TransformStamped tf = tf2_buffer_->lookupTransform("base_link", "vehicle_front", rclcpp::Time(0), rclcpp::Duration(20.0, 0)); //save to local copy of transform 20 sec timeout
864 length_to_front_bumper_ = tf.transform.translation.x;
865 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"),"length_to_front_bumper_: " << length_to_front_bumper_);
866
867 }
868 catch (const tf2::TransformException &ex)
869 {
870 RCLCPP_WARN_STREAM(rclcpp::get_logger("plan_delegator"), ex.what());
871 }
872 }
std::shared_ptr< tf2_ros::TransformListener > tf2_listener_

References basic_autonomy::get_logger(), length_to_front_bumper_, tf2_buffer_, and tf2_listener_.

Referenced by handle_on_configure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ maneuverPlanCallback()

void plan_delegator::PlanDelegator::maneuverPlanCallback ( carma_planning_msgs::msg::ManeuverPlan::UniquePtr  plan)

Callback function of maneuver plan subscriber.

Definition at line 203 of file plan_delegator.cpp.

204 {
205 RCLCPP_INFO_STREAM(rclcpp::get_logger("plan_delegator"),"Received request to delegate plan ID " << std::string(plan->maneuver_plan_id));
206 // do basic check to see if the input is valid
207 auto copy_plan = *plan;
209 if (isManeuverPlanValid(copy_plan))
210 {
211 latest_maneuver_plan_ = copy_plan;
212 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"),"Received plan with " << latest_maneuver_plan_.maneuvers.size() << " maneuvers");
213
214 // Update the parameters associated with each maneuver
215 for (auto& maneuver : latest_maneuver_plan_.maneuvers) {
216 updateManeuverParameters(maneuver);
217 }
218 }
219 else {
220 RCLCPP_WARN_STREAM(rclcpp::get_logger("plan_delegator"),"Received empty plan, no maneuvers found in plan ID " << std::string(plan->maneuver_plan_id));
221 }
222
223 // Update upcoming_lane_change_information_ and current_lane_change_information_ based on the received maneuver plan
224 if(!latest_maneuver_plan_.maneuvers.empty()){
225 // Get ego vehicle's current downtrack
226 lanelet::BasicPoint2d current_loc(latest_pose_.pose.position.x, latest_pose_.pose.position.y);
227 double current_downtrack = wm_->routeTrackPos(current_loc).downtrack;
228
229 // Set upcoming_lane_change_information_ based on the first found lane change in the plan that begins after current_downtrack, if one exists
230 upcoming_lane_change_information_ = boost::optional<LaneChangeInformation>(); // Reset to empty optional
231 for(const auto& maneuver : latest_maneuver_plan_.maneuvers){
232 if(maneuver.type == carma_planning_msgs::msg::Maneuver::LANE_CHANGE){
233 if(current_downtrack >= maneuver.lane_change_maneuver.start_dist){
234 // Skip this lane change maneuver since ego vehicle has passed the lane change start point (this is not an 'upcoming' lane change)
235 continue;
236 }
237 else{
238 LaneChangeInformation upcoming_lane_change_information = getLaneChangeInformation(maneuver);
239 upcoming_lane_change_information_ = boost::optional<LaneChangeInformation>(upcoming_lane_change_information);
240 break;
241 }
242 }
243 }
244
245 // Set current_lane_change_information_ if the first maneuver is a lane change
246 current_lane_change_information_ = boost::optional<LaneChangeInformation>(); // Reset to empty optional
247 if(latest_maneuver_plan_.maneuvers[0].type == carma_planning_msgs::msg::Maneuver::LANE_CHANGE){
248 LaneChangeInformation current_lane_change_information = getLaneChangeInformation(latest_maneuver_plan_.maneuvers[0]);
249 current_lane_change_information_ = boost::optional<LaneChangeInformation>(current_lane_change_information);
250 }
251 }
252 }
LaneChangeInformation getLaneChangeInformation(const carma_planning_msgs::msg::Maneuver &lane_change_maneuver)
Function for generating a LaneChangeInformation object from a provided lane change maneuver.
boost::optional< LaneChangeInformation > upcoming_lane_change_information_
void updateManeuverParameters(carma_planning_msgs::msg::Maneuver &maneuver)
Update the starting downtrack, ending downtrack, and maneuver-specific Lanelet ID parameters associat...
carma_planning_msgs::msg::ManeuverPlan latest_maneuver_plan_
boost::optional< LaneChangeInformation > current_lane_change_information_
bool isManeuverPlanValid(const carma_planning_msgs::msg::ManeuverPlan &maneuver_plan) const noexcept
Example if a maneuver plan contains at least one maneuver.

References current_lane_change_information_, basic_autonomy::get_logger(), getLaneChangeInformation(), isManeuverPlanValid(), latest_maneuver_plan_, latest_pose_, received_maneuver_plan_, upcoming_lane_change_information_, updateManeuverParameters(), and wm_.

Referenced by handle_on_configure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onTrajPlanTick()

void plan_delegator::PlanDelegator::onTrajPlanTick ( )
private

Callback function for triggering trajectory planning.

Definition at line 779 of file plan_delegator.cpp.

780 {
781 // Guidance not engaged or haven't received a maneuver plan yet
783 {
784 return;
785 }
786 carma_planning_msgs::msg::TrajectoryPlan trajectory_plan = planTrajectory();
787
788 // Aside from the flag, yield_plugin should not be called on invalid trajectories
789 if (config_.enable_object_avoidance && isTrajectoryValid(trajectory_plan))
790 {
791 auto yield_req = std::make_shared<carma_planning_msgs::srv::PlanTrajectory::Request>();
792 yield_req->vehicle_state.longitudinal_vel = latest_twist_.twist.linear.x;
793 yield_req->vehicle_state.x_pos_global = latest_pose_.pose.position.x;
794 yield_req->vehicle_state.y_pos_global = latest_pose_.pose.position.y;
795 double roll, pitch, yaw;
796 carma_wm::geometry::rpyFromQuaternion(latest_pose_.pose.orientation, roll, pitch, yaw);
797 yield_req->vehicle_state.orientation = yaw;
798
799 auto yield_resp = std::make_shared<carma_planning_msgs::srv::PlanTrajectory::Response>();
800 yield_resp->trajectory_plan = trajectory_plan;
801
803 shared_from_this(), yield_req, yield_resp, yield_client_, config_.tactical_plugin_service_call_timeout);
804
805 trajectory_plan = yield_resp->trajectory_plan;
806 }
807 else
808 {
809 RCLCPP_DEBUG(rclcpp::get_logger("plan_delegator"), "Ignored Object Avoidance");
810 }
811
812 // Check if planned trajectory is valid before send out
813 if(isTrajectoryValid(trajectory_plan))
814 {
815 trajectory_plan.header.stamp = get_clock()->now();
816 last_successful_traj_ = trajectory_plan;
817 traj_pub_->publish(trajectory_plan);
819 }
820 else
821 {
823 RCLCPP_WARN_STREAM(rclcpp::get_logger("plan_delegator"),
824 "Guidance is engaged, but new planned trajectory has less than 2 points. " <<
825 "It will not be published! Consecutive failure count: "
827
828 // Case where traj generation fails after a successful one
829 if (last_successful_traj_.has_value()
832 {
833 RCLCPP_WARN_STREAM(rclcpp::get_logger("plan_delegator"),
834 "Instead, last available trajectory is published with outdated timestamp of:"
836 rclcpp::Time(last_successful_traj_.value().header.stamp).seconds()));
837 traj_pub_->publish(last_successful_traj_.value());
838 }
839 // Case where traj generation fails from the beginning.
840 // Attempt replanning for configured number of tries before throwing runtime error.
841 else if (!last_successful_traj_.has_value() &&
843 {
844 RCLCPP_WARN_STREAM(rclcpp::get_logger("plan_delegator"),
845 "Instead, tried publishing last available trajectory, but it's not available!");
846 }
847 else
848 {
849 RCLCPP_ERROR_STREAM(rclcpp::get_logger("plan_delegator"),
850 "No valid trajectory is available to publish! "
851 "Please check the planner plugins and their configurations.");
852 throw std::runtime_error("No valid trajectory is available to publish!");
853 }
854 }
855 }
carma_planning_msgs::msg::TrajectoryPlan planTrajectory()
Plan trajectory based on latest maneuver plan via ROS service call to plugins.
bool isTrajectoryValid(const carma_planning_msgs::msg::TrajectoryPlan &trajectory_plan) const noexcept
Example if a trajectory plan contains at least two trajectory points.
std::optional< carma_planning_msgs::msg::TrajectoryPlan > last_successful_traj_
carma_planning_msgs::srv::PlanTrajectory::Response::SharedPtr modify_trajectory_to_yield_to_obstacles(const std::shared_ptr< carma_ros2_utils::CarmaLifecycleNode > &node_handler, const carma_planning_msgs::srv::PlanTrajectory::Request::SharedPtr &req, const carma_planning_msgs::srv::PlanTrajectory::Response::SharedPtr &resp, const carma_ros2_utils::ClientPtr< carma_planning_msgs::srv::PlanTrajectory > &yield_client, int yield_plugin_service_call_timeout)
Applies a yield trajectory to the original trajectory set in response.

References config_, consecutive_traj_gen_failure_num_, plan_delegator::Config::enable_object_avoidance, basic_autonomy::get_logger(), guidance_engaged, isTrajectoryValid(), last_successful_traj_, latest_pose_, latest_twist_, plan_delegator::Config::max_traj_generation_reattempt, basic_autonomy::waypoint_generation::modify_trajectory_to_yield_to_obstacles(), planTrajectory(), received_maneuver_plan_, carma_wm::geometry::rpyFromQuaternion(), plan_delegator::Config::tactical_plugin_service_call_timeout, carma_cooperative_perception::to_string(), traj_pub_, and yield_client_.

Referenced by handle_on_activate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ planTrajectory()

carma_planning_msgs::msg::TrajectoryPlan plan_delegator::PlanDelegator::planTrajectory ( )
private

Plan trajectory based on latest maneuver plan via ROS service call to plugins.

Returns
a TrajectoryPlan object which contains PlanTrajectory response from plugins

Definition at line 652 of file plan_delegator.cpp.

653 {
654 carma_planning_msgs::msg::TrajectoryPlan latest_trajectory_plan;
655 bool full_plan_generation_failed = false;
657 {
658 RCLCPP_INFO_STREAM(rclcpp::get_logger("plan_delegator"),"Guidance is not engaged. Plan delegator will not plan trajectory.");
659 return latest_trajectory_plan;
660 }
661 // latest_maneuver_plan may get updated, so local copy to avoid race condition
662 auto locked_maneuver_plan = latest_maneuver_plan_;
663
664 // Flag for the first received trajectory plan service response
665 bool first_trajectory_plan = true;
666
667 // Track the index of the starting maneuver in the maneuver plan that this trajectory plan service request is for
668 uint16_t current_maneuver_index = 0;
669
670 // Loop through maneuver list to make service call to applicable Tactical Plugin
671 while(current_maneuver_index < locked_maneuver_plan.maneuvers.size())
672 {
673 auto& maneuver = locked_maneuver_plan.maneuvers[current_maneuver_index];
674
675 // ignore expired maneuvers
676 if(isManeuverExpired(maneuver, get_clock()->now()))
677 {
678 RCLCPP_INFO_STREAM(rclcpp::get_logger("plan_delegator"),"Dropping expired maneuver: " << GET_MANEUVER_PROPERTY(maneuver, parameters.maneuver_id));
679 // Update the maneuver plan index for the next loop
680 ++current_maneuver_index;
681 continue;
682 }
683 lanelet::BasicPoint2d current_loc(latest_pose_.pose.position.x, latest_pose_.pose.position.y);
684 double current_downtrack = wm_->routeTrackPos(current_loc).downtrack;
685 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"),"current_downtrack" << current_downtrack);
686 double maneuver_end_dist = GET_MANEUVER_PROPERTY(maneuver, end_dist);
687 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"),"maneuver_end_dist" << maneuver_end_dist);
688
689 // ignore maneuver that is passed.
690 if (current_downtrack > maneuver_end_dist)
691 {
692 RCLCPP_INFO_STREAM(rclcpp::get_logger("plan_delegator"),"Dropping passed maneuver: " << GET_MANEUVER_PROPERTY(maneuver, parameters.maneuver_id));
693 // Update the maneuver plan index for the next loop
694 ++current_maneuver_index;
695 continue;
696 }
697
698 // get corresponding ros service client for plan trajectory
699 auto maneuver_planner = GET_MANEUVER_PROPERTY(maneuver, parameters.planning_tactical_plugin);
700
701 auto client = getPlannerClientByName(maneuver_planner);
702
703 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"),"Current planner: " << maneuver_planner);
704
705 // compose service request
706 auto plan_req = composePlanTrajectoryRequest(
707 latest_trajectory_plan, locked_maneuver_plan, current_maneuver_index);
708
709 auto future_response = client->async_send_request(plan_req);
710
711 auto future_status = future_response.wait_for(std::chrono::milliseconds(config_.tactical_plugin_service_call_timeout));
712
713 if (future_status != std::future_status::ready)
714 {
715 RCLCPP_WARN_STREAM(rclcpp::get_logger("plan_delegator"),"Unsuccessful service call to trajectory planner:" << maneuver_planner << " for plan ID " << std::string(locked_maneuver_plan.maneuver_plan_id));
716 // if one service call fails, it should end plan immediately because it is there is no point to generate plan with empty space
717 full_plan_generation_failed = true;
718 break;
719 }
720
721 // If successful service request
722 auto plan_response = future_response.get();
723 // validate trajectory before add to the plan
724 if(!isTrajectoryValid(plan_response->trajectory_plan))
725 {
726 RCLCPP_WARN_STREAM(rclcpp::get_logger("plan_delegator"),
727 "Found invalid trajectory with less than 2 trajectory "
728 << "points for maneuver_plan_id: "
729 << std::string(locked_maneuver_plan.maneuver_plan_id));
730 full_plan_generation_failed = true;
731 break;
732 }
733 //Remove duplicate point from start of trajectory
734 if(latest_trajectory_plan.trajectory_points.size() != 0 &&
735 latest_trajectory_plan.trajectory_points.back().target_time == plan_response->trajectory_plan.trajectory_points.front().target_time)
736 {
737 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"),"Removing duplicate point for planner: " << maneuver_planner);
738 plan_response->trajectory_plan.trajectory_points.erase(plan_response->trajectory_plan.trajectory_points.begin());
739 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"),"plan_response->trajectory_plan size: " << plan_response->trajectory_plan.trajectory_points.size());
740 }
741 latest_trajectory_plan.trajectory_points.insert(latest_trajectory_plan.trajectory_points.end(),
742 plan_response->trajectory_plan.trajectory_points.begin(),
743 plan_response->trajectory_plan.trajectory_points.end());
744 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"),"new latest_trajectory_plan size: " << latest_trajectory_plan.trajectory_points.size());
745
746 // Assign the trajectory plan's initial longitudinal velocity based on the first tactical plugin's response
747 if(first_trajectory_plan == true)
748 {
749 latest_trajectory_plan.initial_longitudinal_velocity = plan_response->trajectory_plan.initial_longitudinal_velocity;
750 first_trajectory_plan = false;
751 }
752
753 if(isTrajectoryLongEnough(latest_trajectory_plan))
754 {
755 RCLCPP_INFO_STREAM(rclcpp::get_logger("plan_delegator"),"Plan Trajectory completed for " << std::string(locked_maneuver_plan.maneuver_plan_id));
756 break;
757 }
758
759 // Update the maneuver plan index based on the last maneuver index converted to a trajectory
760 // This is required since inlanecruising_plugin can plan a trajectory over contiguous LANE_FOLLOWING maneuvers
761 if(plan_response->related_maneuvers.size() > 0)
762 {
763 current_maneuver_index = plan_response->related_maneuvers.back() + 1;
764 }
765 }
766
767 if (full_plan_generation_failed)
768 {
769 RCLCPP_WARN_STREAM(rclcpp::get_logger("plan_delegator"),
770 "Plan_delegator's current run wasn't fully able to generate trajectory!");
771
772 carma_planning_msgs::msg::TrajectoryPlan empty_plan;
773 return empty_plan;
774 }
775
776 return latest_trajectory_plan;
777 }
carma_ros2_utils::ClientPtr< carma_planning_msgs::srv::PlanTrajectory > getPlannerClientByName(const std::string &planner_name)
Get PlanTrajectory service client by plugin name and create new PlanTrajectory service client if spec...
std::shared_ptr< carma_planning_msgs::srv::PlanTrajectory::Request > composePlanTrajectoryRequest(const carma_planning_msgs::msg::TrajectoryPlan &latest_trajectory_plan, const carma_planning_msgs::msg::ManeuverPlan &locked_maneuver_plan, const uint16_t &current_maneuver_index) const
Generate new PlanTrajecory service request based on current planning progress.
bool isManeuverExpired(const carma_planning_msgs::msg::Maneuver &maneuver, rclcpp::Time current_time) const
Example if a maneuver end time has passed current system time.
bool isTrajectoryLongEnough(const carma_planning_msgs::msg::TrajectoryPlan &plan) const noexcept
Example if a trajectory plan is longer than configured time thresheld.

References composePlanTrajectoryRequest(), config_, basic_autonomy::get_logger(), GET_MANEUVER_PROPERTY, getPlannerClientByName(), guidance_engaged, isManeuverExpired(), isTrajectoryLongEnough(), isTrajectoryValid(), latest_maneuver_plan_, latest_pose_, plan_delegator::Config::tactical_plugin_service_call_timeout, and wm_.

Referenced by onTrajPlanTick().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ poseCallback()

void plan_delegator::PlanDelegator::poseCallback ( geometry_msgs::msg::PoseStamped::UniquePtr  pose_msg)

Callback function for vehicle pose subscriber. Updates latest_pose_ and makes calls to publishUpcomingLaneChangeStatus() and publishTurnSignalCommand().

Parameters
pose_msgThe received pose message.

Definition at line 254 of file plan_delegator.cpp.

255 {
256 latest_pose_ = *pose_msg;
257
258 // Publish the upcoming lane change status
260
261 // Publish the current turn signal command
263 }
carma_planning_msgs::msg::UpcomingLaneChangeStatus upcoming_lane_change_status_
void publishTurnSignalCommand(const boost::optional< LaneChangeInformation > &current_lane_change_information, const carma_planning_msgs::msg::UpcomingLaneChangeStatus &upcoming_lane_change_status)
Function for processing an optional LaneChangeInformation object pertaining to the currently-occurrin...
void publishUpcomingLaneChangeStatus(const boost::optional< LaneChangeInformation > &upcoming_lane_change_information)
Function for processing an optional LaneChangeInformation object pertaining to an upcoming lane chang...

References current_lane_change_information_, latest_pose_, publishTurnSignalCommand(), publishUpcomingLaneChangeStatus(), upcoming_lane_change_information_, and upcoming_lane_change_status_.

Referenced by handle_on_configure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ publishTurnSignalCommand()

void plan_delegator::PlanDelegator::publishTurnSignalCommand ( const boost::optional< LaneChangeInformation > &  current_lane_change_information,
const carma_planning_msgs::msg::UpcomingLaneChangeStatus &  upcoming_lane_change_status 
)
private

Function for processing an optional LaneChangeInformation object pertaining to the currently-occurring lane change and an UpcomingLaneChangeStatus message. If the optional object pertaining to the currently-occurring lane change is not empty, then a turn signal command is published based on the current lane change direction. Otherwise, a turn signal command in the direction of the UpcomingLaneChangeStatus message is published if the vehicle is estimated to begin that lane change in under the time threshold defined by config_.duration_to_signal_before_lane_change. The published TurnSignalComand message is stored in latest_turn_signal_command_.

Parameters
current_lane_change_informationAn optional LaneChangeInformation object pertaining to the current lane change. Empty if vehicle is not currently changing lanes.
upcoming_lane_change_statusAn UpcomingLaneChangeStatus message containing the lane change direction of an upcoming lane change, along with the downtrack distance to that lane change.

Definition at line 393 of file plan_delegator.cpp.

394 {
395 // Initialize turn signal command message
396 // NOTE: A LampCmd message can have its 'r' OR 'l' field set to 1 to indicate an activated right or left turn signal, respectively. Both fields cannot be set to 1 at the same time.
397 autoware_msgs::msg::LampCmd turn_signal_command;
398
399 // Publish turn signal command with priority placed on the current lane change, if one exists
400 if(current_lane_change_information){
401 // Publish turn signal command for the current lane change based on the lane change direction
402 if(current_lane_change_information.get().is_right_lane_change){
403 turn_signal_command.r = 1;
404 }
405 else{
406 turn_signal_command.l = 1;
407 }
408 turn_signal_command_pub_->publish(turn_signal_command);
409 }
410 else if(upcoming_lane_change_status.lane_change != carma_planning_msgs::msg::UpcomingLaneChangeStatus::NONE){
411 // Only publish turn signal command for upcoming lane change if it will begin in less than the time defined by config_.duration_to_signal_before_lane_change
412 if((upcoming_lane_change_status.downtrack_until_lanechange / latest_twist_.twist.linear.x) <= config_.duration_to_signal_before_lane_change){
413 if(upcoming_lane_change_status.lane_change == carma_planning_msgs::msg::UpcomingLaneChangeStatus::RIGHT){
414 turn_signal_command.r = 1;
415 }
416 else{
417 turn_signal_command.l = 1;
418 }
419 turn_signal_command_pub_->publish(turn_signal_command);
420 }
421 }
422 else{
423 // Publish turn signal command with neither turn signal activated
424 turn_signal_command_pub_->publish(turn_signal_command);
425 }
426
427 // Store turn signal command in latest_turn_signal_command_
428 latest_turn_signal_command_ = turn_signal_command;
429 }
autoware_msgs::msg::LampCmd latest_turn_signal_command_

References config_, plan_delegator::Config::duration_to_signal_before_lane_change, latest_turn_signal_command_, latest_twist_, and turn_signal_command_pub_.

Referenced by poseCallback().

Here is the caller graph for this function:

◆ publishUpcomingLaneChangeStatus()

void plan_delegator::PlanDelegator::publishUpcomingLaneChangeStatus ( const boost::optional< LaneChangeInformation > &  upcoming_lane_change_information)
private

Function for processing an optional LaneChangeInformation object pertaining to an upcoming lane change. If not empty, an UpcomingLaneChangeStatus message is created and published based on the contents of the LaneChangeInformation. The published UpcomingLaneChangeStatus message is stored in upcoming_lane_change_status_.

Parameters
upcoming_lane_change_informationAn optional LaneChangeInformation object. Empty if no upcoming lane change exists.

Definition at line 363 of file plan_delegator.cpp.

363 {
364 // Initialize an UpcomingLaneChangeStatus message, which will be populated based on upcoming_lane_change_information
365 carma_planning_msgs::msg::UpcomingLaneChangeStatus upcoming_lane_change_status;
366
367 // Update upcoming_lane_change_status
368 if(upcoming_lane_change_information){
369 // Get the downtrack distance between the ego vehicle and the start of the upcoming lane change maneuver
370 lanelet::BasicPoint2d current_loc(latest_pose_.pose.position.x, latest_pose_.pose.position.y);
371 double current_downtrack = wm_->routeTrackPos(current_loc).downtrack;
372 upcoming_lane_change_status.downtrack_until_lanechange = std::max(0.0, upcoming_lane_change_information.get().starting_downtrack - current_downtrack);
373
374 // Set upcoming lane change status as a right lane change or left lane change
375 if(upcoming_lane_change_information.get().is_right_lane_change){
376 upcoming_lane_change_status.lane_change = carma_planning_msgs::msg::UpcomingLaneChangeStatus::RIGHT;
377 }
378 else{
379 upcoming_lane_change_status.lane_change = carma_planning_msgs::msg::UpcomingLaneChangeStatus::LEFT;
380 }
381 }
382 else{
383 upcoming_lane_change_status.lane_change = carma_planning_msgs::msg::UpcomingLaneChangeStatus::NONE;
384 }
385
386 // Publish upcoming_lane_change_status
387 upcoming_lane_change_status_pub_->publish(upcoming_lane_change_status);
388
389 // Store UpcomingLaneChangeStatus in upcoming_lane_change_status_
390 upcoming_lane_change_status_ = upcoming_lane_change_status;
391 }

References latest_pose_, upcoming_lane_change_status_, upcoming_lane_change_status_pub_, and wm_.

Referenced by poseCallback().

Here is the caller graph for this function:

◆ updateManeuverParameters()

void plan_delegator::PlanDelegator::updateManeuverParameters ( carma_planning_msgs::msg::Maneuver &  maneuver)

Update the starting downtrack, ending downtrack, and maneuver-specific Lanelet ID parameters associated with a given maneuver. These updates are required since the starting and ending downtrack values of each maneuver are shifted based on the distance between the base_link frame and the vehicle_front frame.

Parameters
maneuverThe maneuver to be updated.

Definition at line 521 of file plan_delegator.cpp.

522 {
523 if (!wm_->getMap())
524 {
525 RCLCPP_ERROR_STREAM(rclcpp::get_logger("plan_delegator"), "Map is not set yet");
526 return;
527 }
528
529 // Update maneuver starting and ending downtrack distances
530 double original_start_dist = GET_MANEUVER_PROPERTY(maneuver, start_dist);
531 double original_end_dist = GET_MANEUVER_PROPERTY(maneuver, end_dist);
532 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"),"Changing maneuver distances for planner: " << GET_MANEUVER_PROPERTY(maneuver, parameters.planning_tactical_plugin));
533 double adjusted_start_dist = original_start_dist - length_to_front_bumper_;
534 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"),"original_start_dist:" << original_start_dist);
535 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"),"adjusted_start_dist:" << adjusted_start_dist);
536 double adjusted_end_dist = original_end_dist - length_to_front_bumper_;
537 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"),"original_end_dist:" << original_end_dist);
538 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"),"adjusted_end_dist:" << adjusted_end_dist);
539 SET_MANEUVER_PROPERTY(maneuver, start_dist, adjusted_start_dist);
540 SET_MANEUVER_PROPERTY(maneuver, end_dist, adjusted_end_dist);
541
542 // Shift maneuver starting and ending lanelets
543 // NOTE: Assumes that maneuver start and end downtrack distances have not been shifted by more than one lanelet
544 if(maneuver.type == carma_planning_msgs::msg::Maneuver::LANE_FOLLOWING && !maneuver.lane_following_maneuver.lane_ids.empty()){
545 // (1) Add new beginning lanelet to maneuver if necessary and (2) remove ending lanelet from maneuver if necessary
546
547 // Obtain the original starting lanelet from the maneuver
548 lanelet::Id original_starting_lanelet_id = std::stoi(maneuver.lane_following_maneuver.lane_ids.front());
549 lanelet::ConstLanelet original_starting_lanelet = wm_->getMap()->laneletLayer.get(original_starting_lanelet_id);
550
551 // Get the downtrack of the start of the original starting lanelet
552 lanelet::BasicPoint2d original_starting_lanelet_centerline_start_point = lanelet::utils::to2D(original_starting_lanelet.centerline()).front();
553 double original_starting_lanelet_centerline_start_point_dt = wm_->routeTrackPos(original_starting_lanelet_centerline_start_point).downtrack;
554
555 if(adjusted_start_dist < original_starting_lanelet_centerline_start_point_dt){
556
557 auto previous_lanelets = wm_->getMapRoutingGraph()->previous(original_starting_lanelet, false);
558
559 if(!previous_lanelets.empty()){
560
561 auto llt_on_route_optional = wm_->getFirstLaneletOnShortestPath(previous_lanelets);
562
563 lanelet::ConstLanelet previous_lanelet_to_add;
564
565 if (llt_on_route_optional){
566 previous_lanelet_to_add = llt_on_route_optional.value();
567 }
568 else{
569 RCLCPP_WARN_STREAM(rclcpp::get_logger("plan_delegator"), "When adjusting maneuver for lane follow, no previous lanelet found on the shortest path for lanelet "
570 << original_starting_lanelet.id() << ". Picking arbitrary lanelet: " << previous_lanelets[0].id() << ", instead");
571 previous_lanelet_to_add = previous_lanelets[0];
572 }
573
574 // lane_ids array is ordered by increasing downtrack, so this new starting lanelet is inserted at the front
575 maneuver.lane_following_maneuver.lane_ids.insert(maneuver.lane_following_maneuver.lane_ids.begin(), std::to_string(previous_lanelet_to_add.id()));
576
577 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"), "Inserted lanelet " << std::to_string(previous_lanelet_to_add.id()) << " to beginning of maneuver.");
578 }
579 else{
580 RCLCPP_WARN_STREAM(rclcpp::get_logger("plan_delegator"), "No previous lanelet was found for lanelet " << original_starting_lanelet.id());
581 }
582 }
583
584 // Obtain the maneuver ending lanelet
585 lanelet::Id original_ending_lanelet_id = std::stoi(maneuver.lane_following_maneuver.lane_ids.back());
586 lanelet::ConstLanelet original_ending_lanelet = wm_->getMap()->laneletLayer.get(original_ending_lanelet_id);
587
588 // Get the downtrack of the start of the maneuver ending lanelet
589 lanelet::BasicPoint2d original_ending_lanelet_centerline_start_point = lanelet::utils::to2D(original_ending_lanelet.centerline()).front();
590 double original_ending_lanelet_centerline_start_point_dt = wm_->routeTrackPos(original_ending_lanelet_centerline_start_point).downtrack;
591
592 if(adjusted_end_dist < original_ending_lanelet_centerline_start_point_dt){
593 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("plan_delegator"),"Original ending lanelet " << original_ending_lanelet.id() << " removed from lane_ids since the updated maneuver no longer crosses it");
594
595 // lane_ids array is ordered by increasing downtrack, so the last element in the array corresponds to the original ending lanelet
596 maneuver.lane_following_maneuver.lane_ids.pop_back();
597 }
598 }
599 else if (maneuver.type != carma_planning_msgs::msg::Maneuver::LANE_FOLLOWING){
600 // (1) Update starting maneuver lanelet if necessary and (2) Update ending maneuver lanelet if necessary
601
602 // Obtain the original starting lanelet from the maneuver
603 lanelet::Id original_starting_lanelet_id = std::stoi(getManeuverStartingLaneletId(maneuver));
604 lanelet::ConstLanelet original_starting_lanelet = wm_->getMap()->laneletLayer.get(original_starting_lanelet_id);
605
606 // Get the downtrack of the start of the lanelet
607 lanelet::BasicPoint2d original_starting_lanelet_centerline_start_point = lanelet::utils::to2D(original_starting_lanelet.centerline()).front();
608 double original_starting_lanelet_centerline_start_point_dt = wm_->routeTrackPos(original_starting_lanelet_centerline_start_point).downtrack;
609
610 if(adjusted_start_dist < original_starting_lanelet_centerline_start_point_dt){
611 auto previous_lanelets = wm_->getMapRoutingGraph()->previous(original_starting_lanelet, false);
612 if(!previous_lanelets.empty()){
613 auto llt_on_route_optional = wm_->getFirstLaneletOnShortestPath(previous_lanelets);
614 lanelet::ConstLanelet previous_lanelet_to_add;
615
616 if (llt_on_route_optional){
617 previous_lanelet_to_add = llt_on_route_optional.value();
618 }
619 else{
620 RCLCPP_WARN_STREAM(rclcpp::get_logger("plan_delegator"), "When adjusting non-lane follow maneuver, no previous lanelet found on the shortest path for lanelet "
621 << original_starting_lanelet.id() << ". Picking arbitrary lanelet: " << previous_lanelets[0].id() << ", instead");
622 previous_lanelet_to_add = previous_lanelets[0];
623 }
624 setManeuverStartingLaneletId(maneuver, previous_lanelet_to_add.id());
625 }
626 else{
627 RCLCPP_WARN_STREAM(rclcpp::get_logger("plan_delegator"), "No previous lanelet was found for lanelet " << original_starting_lanelet.id());
628 }
629 }
630
631 // Obtain the original ending lanelet from the maneuver
632 lanelet::Id original_ending_lanelet_id = std::stoi(getManeuverEndingLaneletId(maneuver));
633 lanelet::ConstLanelet original_ending_lanelet = wm_->getMap()->laneletLayer.get(original_ending_lanelet_id);
634
635 // Get the downtrack of the start of the ending lanelet
636 lanelet::BasicPoint2d original_ending_lanelet_centerline_start_point = lanelet::utils::to2D(original_ending_lanelet.centerline()).front();
637 double original_ending_lanelet_centerline_start_point_dt = wm_->routeTrackPos(original_ending_lanelet_centerline_start_point).downtrack;
638
639 if(adjusted_end_dist < original_ending_lanelet_centerline_start_point_dt){
640 auto previous_lanelets = wm_->getMapRoutingGraph()->previous(original_ending_lanelet, false);
641
642 if(!previous_lanelets.empty()){
643 setManeuverEndingLaneletId(maneuver, previous_lanelets[0].id());
644 }
645 else{
646 RCLCPP_WARN_STREAM(rclcpp::get_logger("plan_delegator"), "No previous lanelet was found for lanelet " << original_starting_lanelet.id());
647 }
648 }
649 }
650 }
std::string getManeuverEndingLaneletId(carma_planning_msgs::msg::Maneuver mvr)
Anonymous function to get the ending lanelet id for all maneuver types except lane following....
void setManeuverEndingLaneletId(carma_planning_msgs::msg::Maneuver &mvr, lanelet::Id end_id)
Anonymous function to set the ending_lane_id for all maneuver types except lane following....
std::string getManeuverStartingLaneletId(carma_planning_msgs::msg::Maneuver mvr)
Anonymous function to get the starting lanelet id for all maneuver types except lane following....
void setManeuverStartingLaneletId(carma_planning_msgs::msg::Maneuver &mvr, lanelet::Id start_id)
Anonymous function to set the starting_lane_id for all maneuver types except lane following....
#define SET_MANEUVER_PROPERTY(mvr, property, value)

References basic_autonomy::get_logger(), GET_MANEUVER_PROPERTY, plan_delegator::anonymous_namespace{plan_delegator.cpp}::getManeuverEndingLaneletId(), plan_delegator::anonymous_namespace{plan_delegator.cpp}::getManeuverStartingLaneletId(), length_to_front_bumper_, SET_MANEUVER_PROPERTY, plan_delegator::anonymous_namespace{plan_delegator.cpp}::setManeuverEndingLaneletId(), plan_delegator::anonymous_namespace{plan_delegator.cpp}::setManeuverStartingLaneletId(), carma_cooperative_perception::to_string(), and wm_.

Referenced by maneuverPlanCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ config_

Config plan_delegator::PlanDelegator::config_
protected

◆ consecutive_traj_gen_failure_num_

int plan_delegator::PlanDelegator::consecutive_traj_gen_failure_num_ = 0
private

Definition at line 225 of file plan_delegator.hpp.

Referenced by onTrajPlanTick().

◆ current_lane_change_information_

boost::optional<LaneChangeInformation> plan_delegator::PlanDelegator::current_lane_change_information_
private

Definition at line 237 of file plan_delegator.hpp.

Referenced by maneuverPlanCallback(), and poseCallback().

◆ guidance_engaged

bool plan_delegator::PlanDelegator::guidance_engaged = false
private

Definition at line 224 of file plan_delegator.hpp.

Referenced by guidanceStateCallback(), onTrajPlanTick(), and planTrajectory().

◆ guidance_state_sub_

carma_ros2_utils::SubPtr<carma_planning_msgs::msg::GuidanceState> plan_delegator::PlanDelegator::guidance_state_sub_
private

Definition at line 218 of file plan_delegator.hpp.

Referenced by handle_on_configure().

◆ last_successful_traj_

std::optional<carma_planning_msgs::msg::TrajectoryPlan> plan_delegator::PlanDelegator::last_successful_traj_
private

Definition at line 209 of file plan_delegator.hpp.

Referenced by onTrajPlanTick().

◆ latest_maneuver_plan_

carma_planning_msgs::msg::ManeuverPlan plan_delegator::PlanDelegator::latest_maneuver_plan_
protected

Definition at line 198 of file plan_delegator.hpp.

Referenced by maneuverPlanCallback(), and planTrajectory().

◆ latest_pose_

geometry_msgs::msg::PoseStamped plan_delegator::PlanDelegator::latest_pose_
protected

◆ latest_turn_signal_command_

autoware_msgs::msg::LampCmd plan_delegator::PlanDelegator::latest_turn_signal_command_
private

Definition at line 243 of file plan_delegator.hpp.

Referenced by publishTurnSignalCommand().

◆ latest_twist_

geometry_msgs::msg::TwistStamped plan_delegator::PlanDelegator::latest_twist_
protected

◆ length_to_front_bumper_

double plan_delegator::PlanDelegator::length_to_front_bumper_ = 3.0
private

Definition at line 227 of file plan_delegator.hpp.

Referenced by lookupFrontBumperTransform(), and updateManeuverParameters().

◆ MILLISECOND_TO_SECOND

const constexpr double plan_delegator::PlanDelegator::MILLISECOND_TO_SECOND = 0.001
staticconstexpr

Definition at line 118 of file plan_delegator.hpp.

◆ plan_sub_

carma_ros2_utils::SubPtr<carma_planning_msgs::msg::ManeuverPlan> plan_delegator::PlanDelegator::plan_sub_
private

Definition at line 215 of file plan_delegator.hpp.

Referenced by handle_on_configure().

◆ pose_sub_

carma_ros2_utils::SubPtr<geometry_msgs::msg::PoseStamped> plan_delegator::PlanDelegator::pose_sub_
private

Definition at line 216 of file plan_delegator.hpp.

Referenced by handle_on_configure().

◆ received_maneuver_plan_

bool plan_delegator::PlanDelegator::received_maneuver_plan_ = false
protected

Definition at line 199 of file plan_delegator.hpp.

Referenced by maneuverPlanCallback(), and onTrajPlanTick().

◆ tf2_buffer_

std::shared_ptr<tf2_ros::Buffer> plan_delegator::PlanDelegator::tf2_buffer_
private

Definition at line 230 of file plan_delegator.hpp.

Referenced by lookupFrontBumperTransform().

◆ tf2_listener_

std::shared_ptr<tf2_ros::TransformListener> plan_delegator::PlanDelegator::tf2_listener_
private

Definition at line 231 of file plan_delegator.hpp.

Referenced by lookupFrontBumperTransform().

◆ timer_callback_group_

rclcpp::CallbackGroup::SharedPtr plan_delegator::PlanDelegator::timer_callback_group_
private

Definition at line 222 of file plan_delegator.hpp.

Referenced by handle_on_activate().

◆ traj_pub_

carma_ros2_utils::PubPtr<carma_planning_msgs::msg::TrajectoryPlan> plan_delegator::PlanDelegator::traj_pub_
private

Definition at line 210 of file plan_delegator.hpp.

Referenced by handle_on_configure(), and onTrajPlanTick().

◆ traj_timer_

rclcpp::TimerBase::SharedPtr plan_delegator::PlanDelegator::traj_timer_
private

Definition at line 220 of file plan_delegator.hpp.

Referenced by handle_on_activate().

◆ trajectory_planners_

std::unordered_map<std::string, carma_ros2_utils::ClientPtr<carma_planning_msgs::srv::PlanTrajectory> > plan_delegator::PlanDelegator::trajectory_planners_
protected

Definition at line 194 of file plan_delegator.hpp.

Referenced by getPlannerClientByName().

◆ turn_signal_command_pub_

carma_ros2_utils::PubPtr<autoware_msgs::msg::LampCmd> plan_delegator::PlanDelegator::turn_signal_command_pub_
private

Definition at line 212 of file plan_delegator.hpp.

Referenced by handle_on_configure(), and publishTurnSignalCommand().

◆ twist_sub_

carma_ros2_utils::SubPtr<geometry_msgs::msg::TwistStamped> plan_delegator::PlanDelegator::twist_sub_
private

Definition at line 217 of file plan_delegator.hpp.

Referenced by handle_on_configure().

◆ upcoming_lane_change_information_

boost::optional<LaneChangeInformation> plan_delegator::PlanDelegator::upcoming_lane_change_information_
private

Definition at line 234 of file plan_delegator.hpp.

Referenced by maneuverPlanCallback(), and poseCallback().

◆ upcoming_lane_change_status_

carma_planning_msgs::msg::UpcomingLaneChangeStatus plan_delegator::PlanDelegator::upcoming_lane_change_status_
private

Definition at line 240 of file plan_delegator.hpp.

Referenced by poseCallback(), and publishUpcomingLaneChangeStatus().

◆ upcoming_lane_change_status_pub_

carma_ros2_utils::PubPtr<carma_planning_msgs::msg::UpcomingLaneChangeStatus> plan_delegator::PlanDelegator::upcoming_lane_change_status_pub_
private

Definition at line 211 of file plan_delegator.hpp.

Referenced by handle_on_configure(), and publishUpcomingLaneChangeStatus().

◆ wm_

◆ wml_

carma_wm::WMListener plan_delegator::PlanDelegator::wml_
protected

Definition at line 204 of file plan_delegator.hpp.

Referenced by handle_on_configure().

◆ yield_client_

carma_ros2_utils::ClientPtr<carma_planning_msgs::srv::PlanTrajectory> plan_delegator::PlanDelegator::yield_client_
protected

Definition at line 196 of file plan_delegator.hpp.

Referenced by handle_on_configure(), and onTrajPlanTick().


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