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.
|
The class containing the primary business logic for the Motion Computation Package. More...
#include <motion_computation_worker.hpp>
Public Types | |
using | PublishObjectCallback = std::function< void(const carma_perception_msgs::msg::ExternalObjectList &)> |
using | LookUpTransform = std::function< void()> |
Public Member Functions | |
MotionComputationWorker (const PublishObjectCallback &obj_pub, rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger, rclcpp::node_interfaces::NodeClockInterface::SharedPtr node_clock) | |
Constructor for MotionComputationWorker. More... | |
void | predictionLogic (carma_perception_msgs::msg::ExternalObjectList::UniquePtr obj_list) |
Function to populate duplicated detected objects along with their velocity, yaw, yaw_rate and static/dynamic class to the provided ExternalObjectList message. More... | |
void | setPredictionTimeStep (double time_step) |
void | setPredictionPeriod (double period) |
void | setXAccelerationNoise (double noise) |
void | setYAccelerationNoise (double noise) |
void | setProcessNoiseMax (double noise_max) |
void | setConfidenceDropRate (double drop_rate) |
void | setDetectionInputFlags (bool enable_sensor_processing, bool enable_bsm_processing, bool enable_psm_processing, bool enable_mobility_path_processing) |
void | setDetectionMotionModelFlags (bool enable_ctrv_for_unknown_obj, bool enable_ctrv_for_motorcycle_obj, bool enable_ctrv_for_small_vehicle_obj, bool enable_ctrv_for_large_vehicle_obj, bool enable_ctrv_for_pedestrian_obj) |
void | mobilityPathCallback (const carma_v2x_msgs::msg::MobilityPath::UniquePtr msg) |
void | bsmCallback (const carma_v2x_msgs::msg::BSM::UniquePtr msg) |
void | psmCallback (const carma_v2x_msgs::msg::PSM::UniquePtr msg) |
void | georeferenceCallback (const std_msgs::msg::String::UniquePtr msg) |
Callback for map projection string to define lat/lon -> map conversion. More... | |
carma_perception_msgs::msg::ExternalObject | mobilityPathToExternalObject (const carma_v2x_msgs::msg::MobilityPath::UniquePtr &msg) const |
Converts from MobilityPath's predicted points in ECEF to local map and other fields in an ExternalObject object. More... | |
carma_perception_msgs::msg::ExternalObjectList | synchronizeAndAppend (const carma_perception_msgs::msg::ExternalObjectList &base_objects, carma_perception_msgs::msg::ExternalObjectList new_objects) const |
Appends external objects list behind base_objects. This does not do sensor fusion. When doing so, it drops the predictions points that start before the first prediction is sensor list. And interpolates the remaining predictions points to match the timestep using its average speed between points. More... | |
carma_perception_msgs::msg::ExternalObject | matchAndInterpolateTimeStamp (carma_perception_msgs::msg::ExternalObject path, const rclcpp::Time &time_to_match) const |
It cuts ExternalObject's prediction points before the time_to_match. And uses the average velocity in its predictions to match the starting point to the point it would have crossed at time_to_match It uses mobility_path_time_step between prediction points to interpolate. More... | |
Private Member Functions | |
FRIEND_TEST (MotionComputationWorker, MobilityPathToExternalObject) | |
FRIEND_TEST (MotionComputationWorker, PsmToExternalObject) | |
FRIEND_TEST (MotionComputationWorker, BSMtoExternalObject) | |
Private Attributes | |
PublishObjectCallback | obj_pub_ |
double | prediction_time_step_ = 0.1 |
double | prediction_period_ = 2.0 |
double | cv_x_accel_noise_ = 9.0 |
double | cv_y_accel_noise_ = 9.0 |
double | prediction_process_noise_max_ = 1000.0 |
double | prediction_confidence_drop_rate_ = 0.9 |
bool | enable_sensor_processing_ = true |
bool | enable_bsm_processing_ = false |
bool | enable_psm_processing_ = false |
bool | enable_mobility_path_processing_ = false |
bool | enable_ctrv_for_unknown_obj_ = true |
bool | enable_ctrv_for_motorcycle_obj_ = true |
bool | enable_ctrv_for_small_vehicle_obj_ = true |
bool | enable_ctrv_for_large_vehicle_obj_ = true |
bool | enable_ctrv_for_pedestrian_obj_ = false |
std::string | map_frame_id_ = "map" |
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr | logger_ |
rclcpp::node_interfaces::NodeClockInterface::SharedPtr | node_clock_ |
carma_perception_msgs::msg::ExternalObjectList | mobility_path_list_ |
carma_perception_msgs::msg::ExternalObjectList | bsm_list_ |
carma_perception_msgs::msg::ExternalObjectList | psm_list_ |
std::unordered_map< uint32_t, size_t > | mobility_path_obj_id_map_ |
std::unordered_map< uint32_t, size_t > | bsm_obj_id_map_ |
std::unordered_map< uint32_t, size_t > | psm_obj_id_map_ |
std::string | georeference_ {""} |
std::shared_ptr< lanelet::projection::LocalFrameProjector > | map_projector_ |
tf2::Quaternion | ned_in_map_rotation_ |
The class containing the primary business logic for the Motion Computation Package.
Definition at line 46 of file motion_computation_worker.hpp.
using motion_computation::MotionComputationWorker::LookUpTransform = std::function<void()> |
Definition at line 51 of file motion_computation_worker.hpp.
using motion_computation::MotionComputationWorker::PublishObjectCallback = std::function<void(const carma_perception_msgs::msg::ExternalObjectList &)> |
Definition at line 49 of file motion_computation_worker.hpp.
motion_computation::MotionComputationWorker::MotionComputationWorker | ( | const PublishObjectCallback & | obj_pub, |
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr | logger, | ||
rclcpp::node_interfaces::NodeClockInterface::SharedPtr | node_clock | ||
) |
Constructor for MotionComputationWorker.
Definition at line 25 of file motion_computation_worker.cpp.
void motion_computation::MotionComputationWorker::bsmCallback | ( | const carma_v2x_msgs::msg::BSM::UniquePtr | msg | ) |
Definition at line 272 of file motion_computation_worker.cpp.
References bsm_list_, bsm_obj_id_map_, motion_computation::conversion::convert(), enable_bsm_processing_, logger_, map_frame_id_, map_projector_, ned_in_map_rotation_, prediction_period_, and prediction_time_step_.
Referenced by motion_computation::MotionComputationNode::handle_on_configure().
|
private |
|
private |
|
private |
void motion_computation::MotionComputationWorker::georeferenceCallback | ( | const std_msgs::msg::String::UniquePtr | msg | ) |
Callback for map projection string to define lat/lon -> map conversion.
msg The proj string defining the projection.
Definition at line 143 of file motion_computation_worker.cpp.
References georeference_, logger_, map_projector_, and ned_in_map_rotation_.
Referenced by motion_computation::MotionComputationNode::handle_on_configure().
carma_perception_msgs::msg::ExternalObject motion_computation::MotionComputationWorker::matchAndInterpolateTimeStamp | ( | carma_perception_msgs::msg::ExternalObject | path, |
const rclcpp::Time & | time_to_match | ||
) | const |
It cuts ExternalObject's prediction points before the time_to_match. And uses the average velocity in its predictions to match the starting point to the point it would have crossed at time_to_match It uses mobility_path_time_step between prediction points to interpolate.
path | External object with predictions to modify |
time_to_match | time stamp to have the object start at |
Definition at line 326 of file motion_computation_worker.cpp.
Referenced by synchronizeAndAppend().
void motion_computation::MotionComputationWorker::mobilityPathCallback | ( | const carma_v2x_msgs::msg::MobilityPath::UniquePtr | msg | ) |
Definition at line 210 of file motion_computation_worker.cpp.
References motion_computation::conversion::convert(), enable_mobility_path_processing_, logger_, map_projector_, mobility_path_list_, and mobility_path_obj_id_map_.
Referenced by motion_computation::MotionComputationNode::handle_on_configure().
carma_perception_msgs::msg::ExternalObject motion_computation::MotionComputationWorker::mobilityPathToExternalObject | ( | const carma_v2x_msgs::msg::MobilityPath::UniquePtr & | msg | ) | const |
Converts from MobilityPath's predicted points in ECEF to local map and other fields in an ExternalObject object.
msg | MobilityPath message to convert |
void motion_computation::MotionComputationWorker::predictionLogic | ( | carma_perception_msgs::msg::ExternalObjectList::UniquePtr | obj_list | ) |
Function to populate duplicated detected objects along with their velocity, yaw, yaw_rate and static/dynamic class to the provided ExternalObjectList message.
obj_list | ExternalObjectList message |
Definition at line 33 of file motion_computation_worker.cpp.
References bsm_list_, bsm_obj_id_map_, cv_x_accel_noise_, cv_y_accel_noise_, enable_bsm_processing_, enable_ctrv_for_large_vehicle_obj_, enable_ctrv_for_motorcycle_obj_, enable_ctrv_for_pedestrian_obj_, enable_ctrv_for_small_vehicle_obj_, enable_ctrv_for_unknown_obj_, enable_mobility_path_processing_, enable_psm_processing_, enable_sensor_processing_, logger_, mobility_path_list_, mobility_path_obj_id_map_, obj_pub_, prediction_confidence_drop_rate_, prediction_period_, prediction_process_noise_max_, prediction_time_step_, psm_list_, psm_obj_id_map_, and synchronizeAndAppend().
Referenced by motion_computation::MotionComputationNode::handle_on_configure().
void motion_computation::MotionComputationWorker::psmCallback | ( | const carma_v2x_msgs::msg::PSM::UniquePtr | msg | ) |
Definition at line 241 of file motion_computation_worker.cpp.
References motion_computation::conversion::convert(), enable_psm_processing_, logger_, map_frame_id_, map_projector_, ned_in_map_rotation_, node_clock_, prediction_period_, prediction_time_step_, psm_list_, and psm_obj_id_map_.
Referenced by motion_computation::MotionComputationNode::handle_on_configure().
void motion_computation::MotionComputationWorker::setConfidenceDropRate | ( | double | drop_rate | ) |
Definition at line 183 of file motion_computation_worker.cpp.
References prediction_confidence_drop_rate_.
Referenced by motion_computation::MotionComputationNode::handle_on_configure(), and motion_computation::MotionComputationNode::parameter_update_callback().
void motion_computation::MotionComputationWorker::setDetectionInputFlags | ( | bool | enable_sensor_processing, |
bool | enable_bsm_processing, | ||
bool | enable_psm_processing, | ||
bool | enable_mobility_path_processing | ||
) |
Definition at line 188 of file motion_computation_worker.cpp.
References enable_bsm_processing_, enable_mobility_path_processing_, enable_psm_processing_, and enable_sensor_processing_.
Referenced by motion_computation::MotionComputationNode::handle_on_configure(), and motion_computation::MotionComputationNode::parameter_update_callback().
void motion_computation::MotionComputationWorker::setDetectionMotionModelFlags | ( | bool | enable_ctrv_for_unknown_obj, |
bool | enable_ctrv_for_motorcycle_obj, | ||
bool | enable_ctrv_for_small_vehicle_obj, | ||
bool | enable_ctrv_for_large_vehicle_obj, | ||
bool | enable_ctrv_for_pedestrian_obj | ||
) |
Definition at line 198 of file motion_computation_worker.cpp.
References enable_ctrv_for_large_vehicle_obj_, enable_ctrv_for_motorcycle_obj_, enable_ctrv_for_pedestrian_obj_, enable_ctrv_for_small_vehicle_obj_, and enable_ctrv_for_unknown_obj_.
Referenced by motion_computation::MotionComputationNode::parameter_update_callback().
void motion_computation::MotionComputationWorker::setPredictionPeriod | ( | double | period | ) |
Definition at line 172 of file motion_computation_worker.cpp.
References prediction_period_.
Referenced by motion_computation::MotionComputationNode::handle_on_configure(), and motion_computation::MotionComputationNode::parameter_update_callback().
void motion_computation::MotionComputationWorker::setPredictionTimeStep | ( | double | time_step | ) |
Definition at line 167 of file motion_computation_worker.cpp.
References prediction_time_step_.
Referenced by motion_computation::MotionComputationNode::handle_on_configure(), and motion_computation::MotionComputationNode::parameter_update_callback().
void motion_computation::MotionComputationWorker::setProcessNoiseMax | ( | double | noise_max | ) |
Definition at line 178 of file motion_computation_worker.cpp.
References prediction_process_noise_max_.
Referenced by motion_computation::MotionComputationNode::handle_on_configure(), and motion_computation::MotionComputationNode::parameter_update_callback().
void motion_computation::MotionComputationWorker::setXAccelerationNoise | ( | double | noise | ) |
Definition at line 174 of file motion_computation_worker.cpp.
References cv_x_accel_noise_.
Referenced by motion_computation::MotionComputationNode::handle_on_configure(), and motion_computation::MotionComputationNode::parameter_update_callback().
void motion_computation::MotionComputationWorker::setYAccelerationNoise | ( | double | noise | ) |
Definition at line 176 of file motion_computation_worker.cpp.
References cv_y_accel_noise_.
Referenced by motion_computation::MotionComputationNode::handle_on_configure(), and motion_computation::MotionComputationNode::parameter_update_callback().
carma_perception_msgs::msg::ExternalObjectList motion_computation::MotionComputationWorker::synchronizeAndAppend | ( | const carma_perception_msgs::msg::ExternalObjectList & | base_objects, |
carma_perception_msgs::msg::ExternalObjectList | new_objects | ||
) | const |
Appends external objects list behind base_objects. This does not do sensor fusion. When doing so, it drops the predictions points that start before the first prediction is sensor list. And interpolates the remaining predictions points to match the timestep using its average speed between points.
base_objects | object detections to append to and synchronize with |
new_objects | new objects to add and be synchronized |
Definition at line 303 of file motion_computation_worker.cpp.
References matchAndInterpolateTimeStamp().
Referenced by predictionLogic().
|
private |
Definition at line 166 of file motion_computation_worker.hpp.
Referenced by bsmCallback(), and predictionLogic().
|
private |
Definition at line 171 of file motion_computation_worker.hpp.
Referenced by bsmCallback(), and predictionLogic().
|
private |
Definition at line 138 of file motion_computation_worker.hpp.
Referenced by predictionLogic(), and setXAccelerationNoise().
|
private |
Definition at line 139 of file motion_computation_worker.hpp.
Referenced by predictionLogic(), and setYAccelerationNoise().
|
private |
Definition at line 145 of file motion_computation_worker.hpp.
Referenced by bsmCallback(), predictionLogic(), and setDetectionInputFlags().
|
private |
Definition at line 153 of file motion_computation_worker.hpp.
Referenced by predictionLogic(), and setDetectionMotionModelFlags().
|
private |
Definition at line 151 of file motion_computation_worker.hpp.
Referenced by predictionLogic(), and setDetectionMotionModelFlags().
|
private |
Definition at line 154 of file motion_computation_worker.hpp.
Referenced by predictionLogic(), and setDetectionMotionModelFlags().
|
private |
Definition at line 152 of file motion_computation_worker.hpp.
Referenced by predictionLogic(), and setDetectionMotionModelFlags().
|
private |
Definition at line 150 of file motion_computation_worker.hpp.
Referenced by predictionLogic(), and setDetectionMotionModelFlags().
|
private |
Definition at line 147 of file motion_computation_worker.hpp.
Referenced by mobilityPathCallback(), predictionLogic(), and setDetectionInputFlags().
|
private |
Definition at line 146 of file motion_computation_worker.hpp.
Referenced by predictionLogic(), psmCallback(), and setDetectionInputFlags().
|
private |
Definition at line 144 of file motion_computation_worker.hpp.
Referenced by predictionLogic(), and setDetectionInputFlags().
|
private |
Definition at line 174 of file motion_computation_worker.hpp.
Referenced by georeferenceCallback().
|
private |
Definition at line 160 of file motion_computation_worker.hpp.
Referenced by bsmCallback(), georeferenceCallback(), mobilityPathCallback(), predictionLogic(), and psmCallback().
|
private |
Definition at line 157 of file motion_computation_worker.hpp.
Referenced by bsmCallback(), and psmCallback().
|
private |
Definition at line 175 of file motion_computation_worker.hpp.
Referenced by bsmCallback(), georeferenceCallback(), mobilityPathCallback(), and psmCallback().
|
private |
Definition at line 165 of file motion_computation_worker.hpp.
Referenced by mobilityPathCallback(), and predictionLogic().
|
private |
Definition at line 170 of file motion_computation_worker.hpp.
Referenced by mobilityPathCallback(), and predictionLogic().
|
private |
Definition at line 178 of file motion_computation_worker.hpp.
Referenced by bsmCallback(), georeferenceCallback(), and psmCallback().
|
private |
Definition at line 162 of file motion_computation_worker.hpp.
Referenced by psmCallback().
|
private |
Definition at line 132 of file motion_computation_worker.hpp.
Referenced by predictionLogic().
|
private |
Definition at line 141 of file motion_computation_worker.hpp.
Referenced by predictionLogic(), and setConfidenceDropRate().
|
private |
Definition at line 137 of file motion_computation_worker.hpp.
Referenced by bsmCallback(), predictionLogic(), psmCallback(), and setPredictionPeriod().
|
private |
Definition at line 140 of file motion_computation_worker.hpp.
Referenced by predictionLogic(), and setProcessNoiseMax().
|
private |
Definition at line 136 of file motion_computation_worker.hpp.
Referenced by bsmCallback(), predictionLogic(), psmCallback(), and setPredictionTimeStep().
|
private |
Definition at line 167 of file motion_computation_worker.hpp.
Referenced by predictionLogic(), and psmCallback().
|
private |
Definition at line 172 of file motion_computation_worker.hpp.
Referenced by predictionLogic(), and psmCallback().