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.
|
Implementation of the CostFunction interface. More...
#include <cost_system_cost_function.hpp>
Public Member Functions | |
CostSystemCostFunction () | |
Constructor for FixedPriorityCostFunction. More... | |
void | init (std::shared_ptr< carma_ros2_utils::CarmaLifecycleNode > nh) |
double | compute_total_cost (const carma_planning_msgs::msg::ManeuverPlan &plan) |
Compute the unit cost over distance of a given maneuver plan. More... | |
double | compute_cost_per_unit_distance (const carma_planning_msgs::msg::ManeuverPlan &plan) |
Compute the unit cost over distance of a given maneuver plan. More... | |
Public Member Functions inherited from arbitrator::CostFunction | |
virtual double | compute_total_cost (const carma_planning_msgs::msg::ManeuverPlan &plan)=0 |
Compute the cost of a given maneuver plan. More... | |
virtual double | compute_cost_per_unit_distance (const carma_planning_msgs::msg::ManeuverPlan &plan)=0 |
Compute the unit cost over distance of a given maneuver plan. More... | |
virtual | ~CostFunction () |
Virtual destructor provided for memory safety. More... | |
Private Attributes | |
carma_ros2_utils::ClientPtr< carma_planning_msgs::srv::ComputePlanCost > | cost_system_sc_ |
bool | initialized_ = false |
Implementation of the CostFunction interface.
Implements costs by utilizing a ROS service call to the CARMA cost plugin system. Passes on the input maneuver plan to the Cost Plugin System for computation of the actual cost and cost per unit distance.
Definition at line 36 of file cost_system_cost_function.hpp.
|
inline |
Constructor for FixedPriorityCostFunction.
Definition at line 42 of file cost_system_cost_function.hpp.
|
virtual |
Compute the unit cost over distance of a given maneuver plan.
plan | The plan to evaluate |
std::logic_error | if not initialized |
Implements arbitrator::CostFunction.
Definition at line 55 of file cost_system_cost_function.cpp.
References compute_total_cost(), arbitrator_utils::get_plan_end_distance(), and arbitrator_utils::get_plan_start_distance().
|
virtual |
Compute the unit cost over distance of a given maneuver plan.
plan | The plan to evaluate |
std::logic_error | if not initialized |
Implements arbitrator::CostFunction.
Definition at line 31 of file cost_system_cost_function.cpp.
References cost_system_sc_, and initialized_.
Referenced by compute_cost_per_unit_distance().
void arbitrator::CostSystemCostFunction::init | ( | std::shared_ptr< carma_ros2_utils::CarmaLifecycleNode > | nh | ) |
Initialize the CostSystemCostFunction to communicate over the network. Sets up any ROS service clients needed to interact with the cost plugin system.
Must be called before using this cost function implementation.
nh | A publicly namespaced nodehandle |
Definition at line 25 of file cost_system_cost_function.cpp.
References cost_system_sc_, and initialized_.
Referenced by arbitrator::ArbitratorNode::handle_on_configure().
|
private |
Definition at line 71 of file cost_system_cost_function.hpp.
Referenced by compute_total_cost(), and init().
|
private |
Definition at line 72 of file cost_system_cost_function.hpp.
Referenced by compute_total_cost(), and init().