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(autoware_multi_object_tracker): new function to add odometry uncertainty #9139

Merged
merged 11 commits into from
Nov 19, 2024

Conversation

technolojin
Copy link
Contributor

@technolojin technolojin commented Oct 23, 2024

Description

Add a new method that adds the odometry uncertainty to the object covariance.

  1. Add an option to enable/disable the odometry uncertainty consideration
  2. Implement the covariance converter from the odometry uncertainty to the object covariance
  3. Refactor the covariance processing

The odometry message is a dummy, and will be replaced by system message.
Software architecture need to be determined to subscribe the odometry message.

Related links

This PR will be merged after PR autowarefoundation/autoware_launch#1196

  • Link

How was this PR tested?

  • disabled

Screenshot from 2024-10-23 13-23-50

  • enabled - the object covariance is enlarged

Screenshot from 2024-10-23 13-25-37

  • experiments
    Exaggerate parameters of odometry covariance to check the effect. The following results will not shown in the current PR parameters.
  1. large x-x covariance - the covariance is extended to x direction (map coordinate)

Screenshot from 2024-10-23 13-33-10

  1. large yaw-yaw covariance

Screenshot from 2024-10-23 13-35-25

  1. large x-velocity covariance

Screenshot from 2024-10-23 13-39-53

Notes for reviewers

This function will not be implemented by default.

Interface changes

None.

Effects on system behavior

None.

@technolojin technolojin self-assigned this Oct 23, 2024
@github-actions github-actions bot added component:perception Advanced sensor data processing and environment understanding. (auto-assigned) tag:require-cuda-build-and-test labels Oct 23, 2024
Copy link

github-actions bot commented Oct 23, 2024

Thank you for contributing to the Autoware project!

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

Please ensure:

@technolojin technolojin changed the title feat(autoware_multi_object_tracker): new method to add the odometry uncertainty feat(autoware_multi_object_tracker): new method to add odometry uncertainty Oct 23, 2024
@technolojin technolojin changed the title feat(autoware_multi_object_tracker): new method to add odometry uncertainty feat(autoware_multi_object_tracker): new function to add odometry uncertainty Oct 23, 2024
@technolojin technolojin added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Oct 24, 2024
Copy link

codecov bot commented Oct 24, 2024

Codecov Report

Attention: Patch coverage is 0% with 69 lines in your changes missing coverage. Please review.

Project coverage is 28.43%. Comparing base (802f906) to head (03130da).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
..._tracker/lib/uncertainty/uncertainty_processor.cpp 0.00% 47 Missing ⚠️
...i_object_tracker/src/multi_object_tracker_node.cpp 0.00% 20 Missing ⚠️
...lti_object_tracker/src/processor/input_manager.cpp 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9139      +/-   ##
==========================================
- Coverage   29.81%   28.43%   -1.38%     
==========================================
  Files        1338     1306      -32     
  Lines      103301   101123    -2178     
  Branches    40233    39213    -1020     
==========================================
- Hits        30797    28757    -2040     
- Misses      69518    69622     +104     
+ Partials     2986     2744     -242     
Flag Coverage Δ *Carryforward flag
differential 0.00% <0.00%> (?)
total 28.46% <ø> (-1.35%) ⬇️ Carriedforward from 4c79e10

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
feat: Rotate object pose covariance matrix to account for yaw uncertainty

Rotate the object pose covariance matrix in the uncertainty_processor.cpp file to account for the yaw uncertainty. This ensures that the covariance matrix accurately represents the position uncertainty of the object.

Refactor the code to rotate the covariance matrix using Eigen's Rotation2D class. The yaw uncertainty is added to the y-y element of the rotated covariance matrix. Finally, update the object_pose_cov array with the updated covariance values.

Closes autowarefoundation#123

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

refactoring

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
…ertainty

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

style(pre-commit): autofix

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
@technolojin technolojin marked this pull request as ready for review October 24, 2024 02:51
Comment on lines +298 to +313
// set odometry twist
auto & odom_twist = odometry.twist.twist;
odom_twist.linear.x = 10.0; // m/s
odom_twist.linear.y = 0.1; // m/s
odom_twist.angular.z = 0.1; // rad/s

// model the uncertainty
auto & odom_pose_cov = odometry.pose.covariance;
odom_pose_cov[0] = 0.1; // x-x
odom_pose_cov[7] = 0.1; // y-y
odom_pose_cov[35] = 0.0001; // yaw-yaw

auto & odom_twist_cov = odometry.twist.covariance;
odom_twist_cov[0] = 2.0; // x-x [m^2/s^2]
odom_twist_cov[7] = 0.2; // y-y [m^2/s^2]
odom_twist_cov[35] = 0.001; // yaw-yaw [rad^2/s^2]
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have any explanation about these dummy parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At this PR, the imput will be a dummy fixed value.
After subscribing a new message is decided, it will be replaced by real one.

@YoshiRi
Copy link
Contributor

YoshiRi commented Nov 12, 2024

memorize mathematical equations by chat ai.

Mathematical Formulations

Ego Motion Covariance

The motion covariance due to the ego vehicle's velocities over time dt:

$$ Q_{motion} = \begin{bmatrix} (x_{ego} \cdot dt)^2 & 0 \\ 0 & (y_{ego} \cdot dt)^2 \end{bmatrix} $$

Updated Ego Position Covariance

Including motion uncertainty:

$$ P_{ego pose} = P_{odom pose} + R_{ego} Q_{motion} R_{ego}^T $$

Updated Ego Yaw Covariance

Including angular motion uncertainty:

$$ COV_{yaw} = COV_{ego yaw} + (\theta_{ego} \cdot dt)^2 $$

Object Position Covariance Update

  1. Add Ego Position Uncertainty:

$$ P_{object pose} = P_{object pose} + P_{ego_pose} $$

  1. Add Effect of Ego Yaw Uncertainty:

$$ COV_{by yaw} = COV_{ego yaw} \times r^2 $$

$$ P' = R^T_b P_{object pose} R_b $$

$$
P'{yy} = P' + COV{by yaw}
$$

$$ P_{object pose} = R_b P' R^T_b $$

Object Velocity Covariance Update

  1. Add Ego Velocity Uncertainty:

$$ \Delta \theta = \theta_{object} - \theta_{ego} $$

$$ P_{object twist} = P_{object twist} + R_{\Delta \theta} P_{ego twist} R^T_{\Delta \theta} $$

  1. Add Effect of Ego Yaw Rate Uncertainty:

$$ COV_{by yaw rate} = COV_{yaw rate} \times r^2 $$

$$ P' = R^T_b P_{object twist} R_b $$

$$
P'{yy} = P' + COV{by yaw rate}
$$

$$ P_{object\_twist} = R_b P' R^T_b $$

Copy link
Contributor

@YoshiRi YoshiRi left a comment

Choose a reason for hiding this comment

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

LGTM

@technolojin technolojin enabled auto-merge (squash) November 19, 2024 04:57
@technolojin technolojin merged commit bcd7830 into autowarefoundation:main Nov 19, 2024
30 of 31 checks passed
@technolojin technolojin deleted the feat/mot/odom-noise branch November 19, 2024 05:30
zulfaqar-azmi-t4 pushed a commit to tier4/autoware.universe that referenced this pull request Nov 21, 2024
…ertainty (autowarefoundation#9139)

* feat: add Odometry uncertainty to object tracking

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

* feat: Add odometry heading uncertainty to object pose covariance

feat: Rotate object pose covariance matrix to account for yaw uncertainty

Rotate the object pose covariance matrix in the uncertainty_processor.cpp file to account for the yaw uncertainty. This ensures that the covariance matrix accurately represents the position uncertainty of the object.

Refactor the code to rotate the covariance matrix using Eigen's Rotation2D class. The yaw uncertainty is added to the y-y element of the rotated covariance matrix. Finally, update the object_pose_cov array with the updated covariance values.

Closes #123

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

* feat: Add odometry motion uncertainty to object pose covariance

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

refactoring

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

* feat: Update ego twist uncertainty to the object velocity uncertainty

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

* feat: update object twist covariance by odometry yaw rate uncertainty

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

* feat: move uncertainty modeling to input side

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

* feat: add option to select odometry uncertainty

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

* refactor: rename consider_odometry_uncertainty to enable_odometry_uncertainty

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

* fix: transform to world first, add odometry covariance later

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

style(pre-commit): autofix

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

* feat: Add odometry heading uncertainty to object pose covariance

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>

---------

Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:perception Advanced sensor data processing and environment understanding. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) tag:require-cuda-build-and-test
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

2 participants