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(imu_corrector): remove non-periodic publish to /diagnostics topic #9951

Conversation

interimadd
Copy link
Contributor

Description

Background

Publishing rate to /diagnostics from gyro_bias_estimator is set by diagnostics_updater_interval_sec and setPeriod()
However when gyro bias is updated, gyro_bias_estimator publish with force_update() and setPeriod() is executed again.

Changes

Removed force_update() and setPeriod() in gyro_bias_estimator timer callback.

Related links

Private Links:

How was this PR tested?

/diagnostics contents and publishing rate was checked by following procedure.

# terminal 1
~/autoware$ ros2 run autoware_imu_corrector gyro_bias_estimator_node --ros-args -r /gyro_bias_validator/input/imu_raw:=/sensing/imu/tamagawa/imu_raw -r /gyro_bias_validator/input/odom:=/localization/kinematic_state --params-file sensing/autoware_imu_corrector/config/gyro_bias_estimator.param.yaml --params-file sensing/autoware_imu_corrector/config/imu_corrector.param.yaml  -p  timer_callback_interval_sec:=0.5 -p diagnostics_updater_interval_sec:=2.0

# terminal 2
~/autoware$ ros2 run tf2_ros static_transform_publisher --x 0 --y 0 --z 0 --qx 0 --qy 0 --qz 0 --qw 1 --frame-id base_link --child-frame-id top_front_left/imu_link

# terminal 3
~/autoware$ ros2 bag play ~/tmp/1a96ba52-5739-4d03-9bcf-4c4ee00e138f/cfa23601-97c4-4d47-a37e-edfc7e080d8c_2024-12-20-15-44-56_p0900_38.db3 --topics /sensing/imu/tamagawa/imu_raw /localization/kinematic_state /tf

before change

~$ ros2 topic hz /diagnostics
average rate: 0.500
	min: 2.000s max: 2.000s std dev: 0.00003s window: 2
average rate: 0.615
	min: 0.500s max: 2.000s std dev: 0.64964s window: 4
average rate: 0.588
	min: 0.500s max: 2.000s std dev: 0.60012s window: 5
average rate: 0.571
	min: 0.500s max: 2.000s std dev: 0.55913s window: 6

after change

~$ ros2 topic hz /diagnostics
average rate: 0.500
	min: 2.000s max: 2.000s std dev: 0.00001s window: 2
average rate: 0.500
	min: 2.000s max: 2.000s std dev: 0.00007s window: 3
average rate: 0.500
	min: 2.000s max: 2.000s std dev: 0.00007s window: 4
average rate: 0.500
	min: 2.000s max: 2.000s std dev: 0.00008s window: 5
average rate: 0.500
	min: 2.000s max: 2.000s std dev: 0.00008s window: 6

~$ ros2 topic echo /diagnostics
header:
  stamp:
    sec: 1737080573
    nanosec: 532117472
  frame_id: ''
status:
- level: "\x01"
  name: 'gyro_bias_validator: gyro_bias_validator'
  message: Gyro bias may be incorrect. Please calibrate IMU and reflect the result in imu_corrector. You may also use the output of gyro_bi...
  hardware_id: gyro_bias_validator
  values:
  - key: gyro_bias_x_for_imu_corrector
    value: '-0.00391047'
  - key: gyro_bias_y_for_imu_corrector
    value: '-0.00466050'
  - key: gyro_bias_z_for_imu_corrector
    value: '0.00142520'
  - key: estimated_gyro_bias_x
    value: '-0.00391047'
  - key: estimated_gyro_bias_y
    value: '-0.00466050'
  - key: estimated_gyro_bias_z
    value: '0.00142520'
  - key: gyro_bias_threshold
    value: '0.00300000'
---

Notes for reviewers

The original implementation aimed to publish to /diagnostics immediately when the gyro bias was updated.
However, this behavior can be achieved by setting a shorter diagnostics_updater_interval_sec.

Interface changes

None.

Effects on system behavior

  • publishing rate to /diagnostics from gyro_bias_estimator will now be fixed.
  • creation of a timer callback by calling setPeriod() in the gyro_bias_estimator timer callback will be suppressed.

@github-actions github-actions bot added the component:sensing Data acquisition from sensors, drivers, preprocessing. (auto-assigned) label Jan 17, 2025
Copy link

Thank you for contributing to the Autoware project!

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

Please ensure:

@TaikiYamada4 TaikiYamada4 added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Jan 17, 2025
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.21%. Comparing base (415e1ec) to head (438b9de).
Report is 19 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9951      +/-   ##
==========================================
- Coverage   29.21%   29.21%   -0.01%     
==========================================
  Files        1425     1425              
  Lines      107740   107739       -1     
  Branches    42197    42193       -4     
==========================================
- Hits        31479    31474       -5     
- Misses      73215    73219       +4     
  Partials     3046     3046              
Flag Coverage Δ *Carryforward flag
differential 2.75% <ø> (?)
differential-cuda 2.75% <ø> (?)
total 29.21% <ø> (-0.01%) ⬇️ Carriedforward from 415e1ec

*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.

Copy link
Contributor

@TaikiYamada4 TaikiYamada4 left a comment

Choose a reason for hiding this comment

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

Checked that /diagnostics seems to output certain values with certain frequency as set in the gyro_bias_estimator.param.yaml. The values I tried are

timer_period diagnostics_period
0.5 (default) 0.5 (default)
0.1 0.3
0.3 0.1

Looks good to me 👍

@interimadd interimadd merged commit f9c0aa6 into autowarefoundation:main Jan 17, 2025
45 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:sensing Data acquisition from sensors, drivers, preprocessing. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants