19#include <rclcpp/rclcpp.hpp>
21#include <carma_planning_msgs/srv/plan_maneuvers.hpp>
22#include <carma_planning_msgs/msg/plugin.hpp>
23#include <carma_planning_msgs/msg/guidance_state.hpp>
24#include <carma_v2x_msgs/msg/mobility_operation.hpp>
27#include <carma_ros2_utils/carma_lifecycle_node.hpp>
28#include <bsm_helper/bsm_helper.h>
30#include <lanelet2_core/Forward.h>
31#include <gtest/gtest_prod.h>
32#include <boost/property_tree/ptree.hpp>
33#include <boost/property_tree/json_parser.hpp>
34#include <carma_v2x_msgs/msg/bsm.hpp>
35#include <boost/algorithm/string/split.hpp>
36#include <boost/algorithm/string/classification.hpp>
81 std::shared_ptr<rmw_request_id_t> srv_header,
82 carma_planning_msgs::srv::PlanManeuvers::Request::SharedPtr req,
83 carma_planning_msgs::srv::PlanManeuvers::Response::SharedPtr resp);
88 rcl_interfaces::msg::SetParametersResult
102 void currentPoseCb(geometry_msgs::msg::PoseStamped::UniquePtr msg);
119 double target_speed, rclcpp::Time start_time,
double time_to_stop,
120 std::vector<lanelet::Id> lane_ids);
123 const lanelet::Id& starting_lane_id,
const lanelet::Id& ending_lane_id,
124 double stopping_accel, rclcpp::Time start_time, rclcpp::Time end_time)
const;
127 double target_speed, rclcpp::Time start_time, rclcpp::Time end_time,
TurnDirection turn_direction,
128 const lanelet::Id& starting_lane_id,
const lanelet::Id& ending_lane_id)
const;
146 bool shortest_path_only =
false,
147 bool bounds_inclusive =
true)
const;
220 void caseOneSpeedProfile(
double speed_before_decel,
double current_speed,
double stop_time, std::vector<double>* float_metadata_list)
const;
236 void caseTwoSpeedProfile(
double stop_dist,
double speed_before_decel,
double current_speed,
double stop_time,
double speed_limit, std::vector<double>* float_metadata_list)
const;
262 void BSMCb(carma_v2x_msgs::msg::BSM::UniquePtr msg);
268 void guidance_state_cb(
const carma_planning_msgs::msg::GuidanceState::UniquePtr msg);
323 carma_ros2_utils::SubPtr<carma_v2x_msgs::msg::BSM>
bsm_sub_;
356 FRIEND_TEST(SCIStrategicPluginTest, determine_speed_profile_casetest);
360 FRIEND_TEST(SCIStrategicPluginTest, testIntersectionturndirection);
StrategicPlugin base class which can be extended by user provided plugins which wish to implement the...
FRIEND_TEST(SCIStrategicPluginTest, maneuvercbtest)
carma_wm::WorldModelConstPtr wm_
World Model pointer.
unsigned long long scheduled_depart_time_
std::vector< lanelet::ConstLanelet > getLaneletsBetweenWithException(double start_downtrack, double end_downtrack, bool shortest_path_only=false, bool bounds_inclusive=true) const
Helper method which calls carma_wm::WorldModel::getLaneletsBetween(start_downtrack,...
FRIEND_TEST(SCIStrategicPluginTest, moboperationcbtest)
void set_wm(carma_wm::WorldModelConstPtr new_wm)
double calcEstimatedStopTime(double stop_dist, double current_speed) const
calculate the time vehicle will stop with optimal decelarion
void guidance_state_cb(const carma_planning_msgs::msg::GuidanceState::UniquePtr msg)
Callback for the Guidance State.
int determine_speed_profile_case(double stop_dist, double current_speed, double schedule_stop_time, double speed_limit)
Determine the speed profile case fpr approaching an intersection.
unsigned long long street_msg_timestamp_
carma_ros2_utils::SubPtr< geometry_msgs::msg::PoseStamped > current_pose_sub_
uint32_t scheduled_departure_position_
unsigned long long scheduled_enter_time_
VehicleState extractInitialState(const carma_planning_msgs::srv::PlanManeuvers::Request &req) const
Helper method to extract the initial vehicle state from the planning request method based on if the p...
void parseStrategyParams(const std::string &strategy_params)
parse strategy parameters
FRIEND_TEST(SCIStrategicPluginTest, caseTwoSpeedProfiletest)
void BSMCb(carma_v2x_msgs::msg::BSM::UniquePtr msg)
BSM callback function.
TurnDirection getTurnDirectionAtIntersection(std::vector< lanelet::ConstLanelet > lanelets_list)
Determine the turn direction at intersection.
rcl_interfaces::msg::SetParametersResult parameter_update_callback(const std::vector< rclcpp::Parameter > ¶meters)
Callback for dynamic parameter updates.
unsigned long long scheduled_stop_time_
FRIEND_TEST(SCIStrategicPluginTest, determine_speed_profile_casetest)
double caseThreeSpeedProfile(double stop_dist, double current_speed, double stop_time) const
Determine the desired speed profile parameters for Case 3.
FRIEND_TEST(SCIStrategicPluginTest, caseOneSpeedProfiletest)
bool approaching_stop_controlled_interction_
void plan_maneuvers_callback(std::shared_ptr< rmw_request_id_t > srv_header, carma_planning_msgs::srv::PlanManeuvers::Request::SharedPtr req, carma_planning_msgs::srv::PlanManeuvers::Response::SharedPtr resp)
Service callback for arbitrator maneuver planning.
double current_downtrack_
carma_ros2_utils::SubPtr< carma_planning_msgs::msg::GuidanceState > guidance_state_sub_
carma_ros2_utils::CallbackReturn on_activate_plugin()
Method which is triggered when this plugin is moved from the INACTIVE to ACTIVE states....
std::string previous_strategy_params_
rclcpp::TimerBase::SharedPtr mob_op_pub_timer_
bool get_availability()
Get the availability status of this plugin based on the current operating environment....
FRIEND_TEST(SCIStrategicPluginTest, parseStrategyParamstest)
FRIEND_TEST(SCIStrategicPluginTest, calc_speed_before_deceltest)
carma_ros2_utils::PubPtr< carma_v2x_msgs::msg::MobilityOperation > mobility_operation_pub_
void currentPoseCb(geometry_msgs::msg::PoseStamped::UniquePtr msg)
callback function for current pose
void publishMobilityOperation()
Method to publish mobility operation msgs at a fixed rate of 10hz if approaching intersection.
boost::optional< double > intersection_end_downtrack_
carma_ros2_utils::SubPtr< carma_v2x_msgs::msg::MobilityOperation > mob_operation_sub_
carma_ros2_utils::CallbackReturn on_configure_plugin()
Method which is triggered when this plugin is moved from the UNCONFIGURED to INACTIVE states....
carma_planning_msgs::msg::Maneuver composeIntersectionTransitMessage(double start_dist, double end_dist, double start_speed, double target_speed, rclcpp::Time start_time, rclcpp::Time end_time, TurnDirection turn_direction, const lanelet::Id &starting_lane_id, const lanelet::Id &ending_lane_id) const
FRIEND_TEST(SCIStrategicPluginTest, caseThreeSpeedProfiletest)
std::string stop_controlled_intersection_strategy_
FRIEND_TEST(SCIStrategicPluginTest, DISABLED_maneuvercbtest)
carma_wm::WorldModelConstPtr get_wm()
double calc_speed_before_decel(double stop_time, double stop_dist, double current_speed) const
calculate the speed, right before the car starts to decelerate for stopping
SCIStrategicPluginConfig config_
Config containing configurable algorithm parameters.
carma_v2x_msgs::msg::MobilityOperation generateMobilityOperation()
Generates Mobility Operation messages.
void mobilityOperationCb(carma_v2x_msgs::msg::MobilityOperation::UniquePtr msg)
callback function for mobility operation
carma_ros2_utils::SubPtr< carma_v2x_msgs::msg::BSM > bsm_sub_
FRIEND_TEST(SCIStrategicPluginTest, findSpeedLimit)
double findSpeedLimit(const lanelet::ConstLanelet &llt) const
Given a Lanelet, find it's associated Speed Limit.
std::string get_version_id()
Returns the version id of this plugin.
boost::optional< double > intersection_speed_
Cache variables for storing the current intersection state between state machine transitions.
FRIEND_TEST(SCIStrategicPluginTest, testIntersectionturndirection)
void caseOneSpeedProfile(double speed_before_decel, double current_speed, double stop_time, std::vector< double > *float_metadata_list) const
Determine the desired speed profile parameters for Case 1.
carma_planning_msgs::msg::Maneuver composeStopAndWaitManeuverMessage(double current_dist, double end_dist, double start_speed, const lanelet::Id &starting_lane_id, const lanelet::Id &ending_lane_id, double stopping_accel, rclcpp::Time start_time, rclcpp::Time end_time) const
SCIStrategicPlugin(const rclcpp::NodeOptions &)
Default constructor for RouteFollowingPlugin class.
carma_planning_msgs::msg::Maneuver composeLaneFollowingManeuverMessage(int case_num, double start_dist, double end_dist, double start_speed, double target_speed, rclcpp::Time start_time, double time_to_stop, std::vector< lanelet::Id > lane_ids)
Compose a lane keeping maneuver message based on input params.
void caseTwoSpeedProfile(double stop_dist, double speed_before_decel, double current_speed, double stop_time, double speed_limit, std::vector< double > *float_metadata_list) const
Determine the desired speed profile parameters for Case 2.
TurnDirection intersection_turn_direction_
FRIEND_TEST(SCIStrategicPluginTest, calcEstimatedStopTimetest)
std::shared_ptr< const WorldModel > WorldModelConstPtr
Struct to store the configuration settings for the WzStrategicPlugin class.
Struct representing a vehicle state for the purposes of planning.