Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(planning, control): reuse stamp of subscribed topic to measure co… #1894

Merged
merged 1 commit into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ boost::optional<trajectory_follower::InputData> Controller::createInputData(rclc

void Controller::callbackTimerControl()
{
autoware_control_msgs::msg::Control out;
out.stamp = this->now();

// 1. create input data
const auto input_data = createInputData(*get_clock());
if (!input_data) {
Expand Down Expand Up @@ -239,8 +242,6 @@ void Controller::callbackTimerControl()
if (isTimeOut(lon_out, lat_out)) return;

// 5. publish control command
autoware_control_msgs::msg::Control out;
out.stamp = this->now();
out.lateral = lat_out.control_cmd;
out.longitudinal = lon_out.control_cmd;
control_cmd_pub_->publish(out);
Expand Down
2 changes: 2 additions & 0 deletions control/autoware_vehicle_cmd_gate/src/vehicle_cmd_gate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,13 +569,15 @@ void VehicleCmdGate::publishControlCommands(const Commands & commands)
filtered_control.longitudinal = createLongitudinalStopControlCmd();
} else {
filtered_control = createStopControlCmd();
filtered_control.stamp = commands.control.stamp;
}
}

// Check if command filtering option is enable
if (enable_cmd_limit_filter_) {
// Apply limit filtering
filtered_control = filterControlCommand(filtered_control);
filtered_control.stamp = commands.control.stamp;
}
// tmp: Publish vehicle emergency status
VehicleEmergencyStamped vehicle_cmd_emergency;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ bool BehaviorPathPlannerNode::isDataReady()

void BehaviorPathPlannerNode::run()
{
const auto stamp = this->now();

takeData();

if (!isDataReady()) {
Expand Down Expand Up @@ -372,6 +374,7 @@ void BehaviorPathPlannerNode::run()

// path handling
const auto path = getPath(output, planner_data_, planner_manager_);
path->header.stamp = stamp;
// update planner data
planner_data_->prev_output_path = path;

Expand Down Expand Up @@ -714,7 +717,6 @@ PathWithLaneId::SharedPtr BehaviorPathPlannerNode::getPath(
auto path = !output.path.points.empty() ? std::make_shared<PathWithLaneId>(output.path)
: planner_data->prev_output_path;
path->header = planner_data->route_handler->getRouteHeader();
path->header.stamp = this->now();

PathWithLaneId connected_path;
const auto module_status_ptr_vec = planner_manager->getSceneModuleStatus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ autoware_planning_msgs::msg::Path BehaviorVelocityPlannerNode::generatePath(
"Backward path is NOT supported. just converting path_with_lane_id to path");
output_path_msg = to_path(*input_path_msg);
output_path_msg.header.frame_id = "map";
output_path_msg.header.stamp = this->now();
output_path_msg.header.stamp = input_path_msg->header.stamp;
output_path_msg.left_bound = input_path_msg->left_bound;
output_path_msg.right_bound = input_path_msg->right_bound;
return output_path_msg;
Expand All @@ -366,7 +366,7 @@ autoware_planning_msgs::msg::Path BehaviorVelocityPlannerNode::generatePath(
output_path_msg = autoware::behavior_velocity_planner::filterStopPathPoint(interpolated_path_msg);

output_path_msg.header.frame_id = "map";
output_path_msg.header.stamp = this->now();
output_path_msg.header.stamp = input_path_msg->header.stamp;

// TODO(someone): This must be updated in each scene module, but copy from input message for now.
output_path_msg.left_bound = input_path_msg->left_bound;
Expand Down
Loading