@@ -77,6 +77,8 @@ VehicleCmdGate::VehicleCmdGate(const rclcpp::NodeOptions & node_options)
77
77
engage_pub_ = create_publisher<EngageMsg>(" output/engage" , durable_qos);
78
78
pub_external_emergency_ = create_publisher<Emergency>(" output/external_emergency" , durable_qos);
79
79
operation_mode_pub_ = create_publisher<OperationModeState>(" output/operation_mode" , durable_qos);
80
+ processing_time_pub_ =
81
+ this ->create_publisher <tier4_debug_msgs::msg::Float64Stamped>(" ~/debug/processing_time_ms" , 1 );
80
82
81
83
is_filter_activated_pub_ =
82
84
create_publisher<IsFilterActivated>(" ~/is_filter_activated" , durable_qos);
@@ -375,6 +377,8 @@ T VehicleCmdGate::getContinuousTopic(
375
377
376
378
void VehicleCmdGate::onTimer ()
377
379
{
380
+ stop_watch.tic ();
381
+
378
382
// Subscriber for auto
379
383
const auto msg_auto_command_turn_indicator = auto_turn_indicator_cmd_sub_.takeData ();
380
384
if (msg_auto_command_turn_indicator)
@@ -573,12 +577,18 @@ void VehicleCmdGate::publishControlCommands(const Commands & commands)
573
577
vehicle_cmd_emergency.emergency = (use_emergency_handling_ && is_system_emergency_);
574
578
vehicle_cmd_emergency.stamp = filtered_control.stamp ;
575
579
580
+ // ProcessingTime
581
+ tier4_debug_msgs::msg::Float64Stamped processing_time_msg;
582
+ processing_time_msg.stamp = get_clock ()->now ();
583
+ processing_time_msg.data = stop_watch.toc ();
584
+
576
585
// Publish commands
577
586
vehicle_cmd_emergency_pub_->publish (vehicle_cmd_emergency);
578
587
control_cmd_pub_->publish (filtered_control);
579
588
published_time_publisher_->publish_if_subscribed (control_cmd_pub_, filtered_control.stamp );
580
589
adapi_pause_->publish ();
581
590
moderate_stop_interface_->publish ();
591
+ processing_time_pub_->publish (processing_time_msg);
582
592
583
593
// Save ControlCmd to steering angle when disengaged
584
594
prev_control_cmd_ = filtered_control;
@@ -616,12 +626,18 @@ void VehicleCmdGate::publishEmergencyStopControlCommands()
616
626
vehicle_cmd_emergency.stamp = stamp;
617
627
vehicle_cmd_emergency.emergency = true ;
618
628
629
+ // ProcessingTime
630
+ tier4_debug_msgs::msg::Float64Stamped processing_time_msg;
631
+ processing_time_msg.stamp = get_clock ()->now ();
632
+ processing_time_msg.data = stop_watch.toc ();
633
+
619
634
// Publish topics
620
635
vehicle_cmd_emergency_pub_->publish (vehicle_cmd_emergency);
621
636
control_cmd_pub_->publish (control_cmd);
622
637
turn_indicator_cmd_pub_->publish (turn_indicator);
623
638
hazard_light_cmd_pub_->publish (hazard_light);
624
639
gear_cmd_pub_->publish (gear);
640
+ processing_time_pub_->publish (processing_time_msg);
625
641
}
626
642
627
643
void VehicleCmdGate::publishStatus ()
@@ -638,12 +654,18 @@ void VehicleCmdGate::publishStatus()
638
654
external_emergency.stamp = stamp;
639
655
external_emergency.emergency = is_external_emergency_stop_;
640
656
657
+ // ProcessingTime
658
+ tier4_debug_msgs::msg::Float64Stamped processing_time_msg;
659
+ processing_time_msg.stamp = get_clock ()->now ();
660
+ processing_time_msg.data = stop_watch.toc ();
661
+
641
662
gate_mode_pub_->publish (current_gate_mode_);
642
663
engage_pub_->publish (autoware_engage);
643
664
pub_external_emergency_->publish (external_emergency);
644
665
operation_mode_pub_->publish (current_operation_mode_);
645
666
adapi_pause_->publish ();
646
667
moderate_stop_interface_->publish ();
668
+ processing_time_pub_->publish (processing_time_msg);
647
669
}
648
670
649
671
Control VehicleCmdGate::filterControlCommand (const Control & in)
0 commit comments