@@ -63,15 +63,15 @@ ControlValidator::ControlValidator(const rclcpp::NodeOptions & options)
63
63
64
64
sub_control_cmd_ = create_subscription<Control>(
65
65
" ~/input/control_cmd" , 1 , std::bind (&ControlValidator::on_control_cmd, this , _1));
66
- sub_predicted_traj_ = create_subscription<Trajectory>(
67
- " ~/input/predicted_trajectory" , 1 ,
68
- std::bind (&ControlValidator::on_predicted_trajectory, this , _1));
69
66
sub_kinematics_ =
70
67
autoware_utils::InterProcessPollingSubscriber<nav_msgs::msg::Odometry>::create_subscription (
71
68
this , " ~/input/kinematics" , 1 );
72
69
sub_reference_traj_ =
73
70
autoware_utils::InterProcessPollingSubscriber<Trajectory>::create_subscription (
74
71
this , " ~/input/reference_trajectory" , 1 );
72
+ sub_predicted_traj_ =
73
+ autoware_utils::InterProcessPollingSubscriber<Trajectory>::create_subscription (
74
+ this , " ~/input/predicted_trajectory" , 1 );
75
75
sub_measured_acc_ =
76
76
autoware_utils::InterProcessPollingSubscriber<AccelWithCovarianceStamped>::create_subscription (
77
77
this , " ~/input/measured_acceleration" , 1 );
@@ -191,7 +191,7 @@ bool ControlValidator::is_data_ready()
191
191
return waiting (sub_reference_traj_->subscriber ()->get_topic_name ());
192
192
}
193
193
if (!current_predicted_trajectory_) {
194
- return waiting (sub_predicted_traj_ ->get_topic_name ());
194
+ return waiting (sub_reference_traj_-> subscriber () ->get_topic_name ());
195
195
}
196
196
if (!acceleration_msg_) {
197
197
return waiting (sub_measured_acc_->subscriber ()->get_topic_name ());
@@ -203,22 +203,11 @@ bool ControlValidator::is_data_ready()
203
203
}
204
204
205
205
void ControlValidator::on_control_cmd (const Control::ConstSharedPtr msg)
206
- {
207
- control_cmd_msg_ = msg;
208
-
209
- validation_status_.latency = (this ->now () - msg->stamp ).seconds ();
210
- validation_status_.is_valid_latency =
211
- validation_status_.latency < validation_params_.nominal_latency_threshold ;
212
-
213
- validation_status_.invalid_count =
214
- is_all_valid (validation_status_) ? 0 : validation_status_.invalid_count + 1 ;
215
- }
216
-
217
- void ControlValidator::on_predicted_trajectory (const Trajectory::ConstSharedPtr msg)
218
206
{
219
207
stop_watch.tic ();
220
208
221
- current_predicted_trajectory_ = msg;
209
+ control_cmd_msg_ = msg;
210
+ current_predicted_trajectory_ = sub_predicted_traj_->take_data ();
222
211
current_reference_trajectory_ = sub_reference_traj_->take_data ();
223
212
current_kinematics_ = sub_kinematics_->take_data ();
224
213
acceleration_msg_ = sub_measured_acc_->take_data ();
@@ -227,6 +216,10 @@ void ControlValidator::on_predicted_trajectory(const Trajectory::ConstSharedPtr
227
216
228
217
debug_pose_publisher_->clear_markers ();
229
218
219
+ validation_status_.latency = (this ->now () - msg->stamp ).seconds ();
220
+ validation_status_.is_valid_latency =
221
+ validation_status_.latency < validation_params_.nominal_latency_threshold ;
222
+
230
223
validate (
231
224
*current_predicted_trajectory_, *current_reference_trajectory_, *current_kinematics_,
232
225
*control_cmd_msg_, *acceleration_msg_);
0 commit comments