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

feat(evaluator): Add Trajectory Evaluator #9265

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

mraditya01
Copy link
Contributor

Description

Add trajectory evaluator to evaluate the accuracy of predicted or planned vehicle trajectories by comparing the expected versus actual arrival times at specific trajectory points.

Related links

Parent Issue:

  • Link

How was this PR tested?

Unit and random test.

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

@github-actions github-actions bot added the component:evaluator Evaluation tools for planning, localization etc. (auto-assigned) label Nov 8, 2024
Copy link

github-actions bot commented Nov 8, 2024

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

Copy link

stale bot commented Jan 9, 2025

This pull request has been automatically marked as stale because it has not had recent activity.

@stale stale bot added the status:stale Inactive or outdated issues. (auto-assigned) label Jan 9, 2025
@stale stale bot removed the status:stale Inactive or outdated issues. (auto-assigned) label Jan 17, 2025
Comment on lines 131 to 133
const double velocity = std::sqrt(
std::pow(odom_msg->twist.twist.linear.x, 2) + std::pow(odom_msg->twist.twist.linear.y, 2) +
std::pow(odom_msg->twist.twist.linear.z, 2));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is enough to directly use odom_msg->twist.twist.linear.x

void TrajectoryEvaluatorNode::on_kinematic_state(
const nav_msgs::msg::Odometry::ConstSharedPtr odom_msg)
{
if (odom_msg != nullptr) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having the whole function in the if block, you should do an early return.

Suggested change
if (odom_msg != nullptr) {
if (odom_msg == nullptr) {
return;
}

}
}

if (min_distance < 1e-6) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if ego deviates from the trajectory by more than 1e-6m then the error is not measured ?

Comment on lines 142 to 153
double min_distance = std::numeric_limits<double>::max();
size_t closest_index = trajectory.trajectory_points.size();
const geometry_msgs::msg::Pose & pose = odom_msg->pose.pose;
for (size_t i = 0; i < trajectory.trajectory_points.size(); ++i) {
const auto & trajectory_point_pose = trajectory.trajectory_points[i].trajectory_point.pose;
double distance = autoware::universe_utils::calcDistance2d(trajectory_point_pose, pose);

if (distance < min_distance) {
min_distance = distance;
closest_index = i;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a function autoware::motion_utils::findNearestIndex() to find the nearest index.
BUT you should calculate the expected time more accurately. Please calculate the arc length of the odom pose and interpolate the corresponding expected time.
You can use autoware::motion_utils::findNearestSegmentIndex().

Comment on lines 216 to 218
metrics_pub_->publish(metrics_msg_);

metrics_pub_->publish(metrics_msg_);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are publishing twice, and for each stored trajectory.
This is too much so please only publish the metrics message once per iteration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:evaluator Evaluation tools for planning, localization etc. (auto-assigned)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants