15#ifndef MOTION_COMPUTATION__MOTION_COMPUTATION_WORKER_HPP_
16#define MOTION_COMPUTATION__MOTION_COMPUTATION_WORKER_HPP_
18#include <gtest/gtest_prod.h>
19#include <lanelet2_extension/projection/local_frame_projector.h>
20#include <tf2/LinearMath/Transform.h>
21#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
27#include <unordered_map>
29#include <motion_predict/motion_predict.hpp>
30#include <motion_predict/predict_ctrv.hpp>
31#include <rclcpp/rclcpp.hpp>
33#include <carma_perception_msgs/msg/external_object.hpp>
34#include <carma_perception_msgs/msg/external_object_list.hpp>
35#include <carma_v2x_msgs/msg/bsm.hpp>
36#include <carma_v2x_msgs/msg/mobility_path.hpp>
37#include <carma_v2x_msgs/msg/psm.hpp>
38#include <std_msgs/msg/string.hpp>
50 std::function<void(
const carma_perception_msgs::msg::ExternalObjectList &)>;
58 rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger,
59 rclcpp::node_interfaces::NodeClockInterface::SharedPtr node_clock);
65 void predictionLogic(carma_perception_msgs::msg::ExternalObjectList::UniquePtr obj_list);
75 bool enable_sensor_processing,
bool enable_bsm_processing,
bool enable_psm_processing,
76 bool enable_mobility_path_processing);
78 bool enable_ctrv_for_unknown_obj,
bool enable_ctrv_for_motorcycle_obj,
79 bool enable_ctrv_for_small_vehicle_obj,
bool enable_ctrv_for_large_vehicle_obj,
80 bool enable_ctrv_for_pedestrian_obj);
85 void bsmCallback(
const carma_v2x_msgs::msg::BSM::UniquePtr msg);
87 void psmCallback(
const carma_v2x_msgs::msg::PSM::UniquePtr msg);
102 const carma_v2x_msgs::msg::MobilityPath::UniquePtr & msg)
const;
114 const carma_perception_msgs::msg::ExternalObjectList & base_objects,
115 carma_perception_msgs::msg::ExternalObjectList new_objects)
const;
128 carma_perception_msgs::msg::ExternalObject path,
const rclcpp::Time & time_to_match)
const;
160 rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr
logger_;
162 rclcpp::node_interfaces::NodeClockInterface::SharedPtr
node_clock_;
166 carma_perception_msgs::msg::ExternalObjectList
bsm_list_;
167 carma_perception_msgs::msg::ExternalObjectList
psm_list_;
The class containing the primary business logic for the Motion Computation Package.
bool enable_ctrv_for_motorcycle_obj_
carma_perception_msgs::msg::ExternalObjectList bsm_list_
void setConfidenceDropRate(double drop_rate)
void georeferenceCallback(const std_msgs::msg::String::UniquePtr msg)
Callback for map projection string to define lat/lon -> map conversion.
double prediction_period_
bool enable_ctrv_for_pedestrian_obj_
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/...
double prediction_confidence_drop_rate_
double prediction_process_noise_max_
carma_perception_msgs::msg::ExternalObjectList psm_list_
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)
carma_perception_msgs::msg::ExternalObjectList mobility_path_list_
tf2::Quaternion ned_in_map_rotation_
std::string georeference_
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....
bool enable_ctrv_for_small_vehicle_obj_
void psmCallback(const carma_v2x_msgs::msg::PSM::UniquePtr msg)
std::unordered_map< uint32_t, size_t > bsm_obj_id_map_
void bsmCallback(const carma_v2x_msgs::msg::BSM::UniquePtr msg)
std::shared_ptr< lanelet::projection::LocalFrameProjector > map_projector_
bool enable_sensor_processing_
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger_
bool enable_ctrv_for_unknown_obj_
std::unordered_map< uint32_t, size_t > psm_obj_id_map_
double prediction_time_step_
std::function< void()> LookUpTransform
void setYAccelerationNoise(double noise)
std::function< void(const carma_perception_msgs::msg::ExternalObjectList &)> PublishObjectCallback
void setDetectionInputFlags(bool enable_sensor_processing, bool enable_bsm_processing, bool enable_psm_processing, bool enable_mobility_path_processing)
bool enable_mobility_path_processing_
FRIEND_TEST(MotionComputationWorker, PsmToExternalObject)
FRIEND_TEST(MotionComputationWorker, MobilityPathToExternalObject)
void setXAccelerationNoise(double noise)
bool enable_psm_processing_
FRIEND_TEST(MotionComputationWorker, BSMtoExternalObject)
void setPredictionPeriod(double period)
rclcpp::node_interfaces::NodeClockInterface::SharedPtr node_clock_
void mobilityPathCallback(const carma_v2x_msgs::msg::MobilityPath::UniquePtr msg)
MotionComputationWorker(const PublishObjectCallback &obj_pub, rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger, rclcpp::node_interfaces::NodeClockInterface::SharedPtr node_clock)
Constructor for MotionComputationWorker.
std::string map_frame_id_
bool enable_bsm_processing_
void setProcessNoiseMax(double noise_max)
PublishObjectCallback obj_pub_
std::unordered_map< uint32_t, size_t > mobility_path_obj_id_map_
bool enable_ctrv_for_large_vehicle_obj_
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 ExternalObj...
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...
void setPredictionTimeStep(double time_step)