8 _execution_times_(
std::make_shared<
std::vector<double>>(5, 0.0)),
9 control_solver_(
controller_map.at(params_.control_solver_)(params)),
10 execution_time_pub_(create_publisher<std_msgs::msg::Float64MultiArray>(
11 "/control/execution_time", 10)),
12 control_timer_(create_wall_timer(
std::chrono::milliseconds(this->params_.command_time_interval_),
14 path_point_array_sub_(create_subscription<custom_interfaces::msg::PathPointArray>(
15 params.use_simulated_planning_ ?
"/path_planning/mock_path" :
"/path_planning/path",
18 if (!
params_.using_simulated_slam_) {
20 "/state_estimation/vehicle_pose", 10,
23 if (!
params_.using_simulated_velocities_) {
24 velocity_sub_ = this->create_subscription<custom_interfaces::msg::Velocities>(
25 "/state_estimation/velocities", 10,
33 rclcpp::Time start = this->now();
35 double execution_time = (this->now() - start).seconds() * 1000;
40 std_msgs::msg::Float64MultiArray execution_time_msg;
Class responsible for the ROS2 communication of the control module.
std::shared_ptr< std::vector< double > > _execution_times_
std::shared_ptr< ControlSolver > control_solver_
void vehicle_state_callback(const custom_interfaces::msg::Velocities &msg)
Called when a new velocity is received.
virtual void publish_command(common_lib::structures::ControlCommand cmd)=0
Adapters override this function to publish control commands in their environment.
std::map< std::string, std::shared_ptr< rclcpp::PublisherBase > > publisher_map_
ControlParameters params_
void vehicle_pose_callback(const custom_interfaces::msg::Pose &msg)
Called when a new vehicle pose is received.
rclcpp::Publisher< std_msgs::msg::Float64MultiArray >::SharedPtr execution_time_pub_
void path_callback(const custom_interfaces::msg::PathPointArray &msg)
Called when a new path is received.
ControlNode(const ControlParameters ¶ms)
rclcpp::Subscription< custom_interfaces::msg::Pose >::SharedPtr vehicle_pose_sub_
rclcpp::Subscription< custom_interfaces::msg::Velocities >::SharedPtr velocity_sub_
void control_timer_callback()
Function that publishes control commands on timer ticks.
const std::map< std::string, std::function< std::shared_ptr< ControlSolver >(const ControlParameters &)>, std::less<> > controller_map