fix(app): add autoware module (imu_corrector)#687
Conversation
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
There was a problem hiding this comment.
Pull request overview
Adds a new optional test_autoware test application to the userland runtime and introduces Autoware-related test crates (including an imu_corrector implementation and unit tests) under applications/tests/test_autoware.
Changes:
- Wire a new
test_autowarefeature intouserlandand calltest_autoware::run()when enabled. - Add a new
applications/tests/test_autowarecrate plus subcrates forimu_driver,imu_corrector, andvehicle_velocity_converter. - Implement unit-test-style validation for message conversions / corrections in the new subcrates.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| userland/src/lib.rs | Adds feature-gated call to test_autoware::run() from the main runtime entrypoint. |
| userland/Cargo.toml | Adds optional dependency + feature flag for test_autoware. |
| applications/tests/test_autoware/src/lib.rs | Introduces test_autoware crate entrypoint (run()), currently empty. |
| applications/tests/test_autoware/Cargo.toml | Defines the test_autoware crate dependencies (currently missing imu_corrector). |
| applications/tests/test_autoware/imu_driver/src/lib.rs | Adds imu_driver parsing/generation logic plus unit tests. |
| applications/tests/test_autoware/imu_driver/Cargo.toml | Declares the imu_driver crate. |
| applications/tests/test_autoware/imu_corrector/src/lib.rs | Adds imu_corrector logic (bias/covariance/TF handling) plus unit tests. |
| applications/tests/test_autoware/imu_corrector/Cargo.toml | Declares the imu_corrector crate and its dependencies. |
| applications/tests/test_autoware/vehicle_velocity_converter/src/lib.rs | Adds vehicle_velocity_converter conversion + covariance logic plus unit tests. |
| applications/tests/test_autoware/vehicle_velocity_converter/Cargo.toml | Declares the vehicle_velocity_converter crate. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
|
This PR will be reviewed after #681 is merged. |
…rector Co-authored-by: Copilot <copilot@github.com>
| @@ -0,0 +1,488 @@ | |||
| // Ported from the following versions of the original C++ code: | |||
There was a problem hiding this comment.
correct_for_dynamic_bias and correct_for_scale are not implemented in this port.
Since these are present in the original C++ implementation, could you add a comment in ImuCorrectorConfig explaining why they are omitted and marking them as TODO for future support?
There was a problem hiding this comment.
I fixed it and added TODO comment.
| pub fn to_imu_msg(&self) -> ImuMsg { | ||
| ImuMsg { | ||
| header: self.header.clone(), | ||
| orientation: self.orientation.clone(), |
There was a problem hiding this comment.
In ImuWithCovariance::from_imu_msg, the orientation from the original IMU message is copied as-is:
orientation: imu_msg.orientation.clone(),However, the original C++ implementation intentionally does not copy orientation into the output message after the frame transform:
sensor_msgs::msg::Imu imu_msg_base_link;
imu_msg_base_link.linear_acceleration = transform_vector3(...);
imu_msg_base_link.angular_velocity = transform_vector3(...);
// ← no assignment to orientationPlease add a comment explaining why you chose this setting.
There was a problem hiding this comment.
I added a comment.
There was a problem hiding this comment.
If orientation isn't being used in the first place, wouldn't it make sense to just remove it? Is there a clear reason to keep it around? Either way, I don't think the current code will ever actually be used as-is in the future. What do you think?
There was a problem hiding this comment.
I included the orientation field in the ros_bag used for evaluation because it contained that data, and I assumed that if there was an input, that value would naturally be included in the output. However, as you pointed out, orientation is not actually included in the actual processing, so I plan to remove it as a member of the struct.
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
| } | ||
| } | ||
|
|
||
| fn to_nalgebra_vector3(&self, vec: &Vector3) -> NVector3<f64> { |
There was a problem hiding this comment.
to_nalgebra_vector3, to_imu_vector3, and to_nalgebra_quaternion all perform pure type conversions without using any fields of self, so there is no need for them to be &self instance methods.
Additionally, identical implementations exist in ImuCorrector, creating a risk of the two diverging if only one is updated in the future.
Please consider refactoring — for example, by extracting these as free functions or implementing the standard From/Into traits.
| } | ||
|
|
||
| impl MockTransformListener { | ||
| pub fn new() -> Self { |
There was a problem hiding this comment.
Please add an implementation for the Default trait.
| } | ||
|
|
||
| impl ImuCorrector<MockTransformListener> { | ||
| pub fn new() -> Self { |
There was a problem hiding this comment.
Please add an implementation for the Default trait.
Description
I added the
imu_correctormodule.Basically, I added it in the same format as
imu_driverandvehicle_velocity_converter, but since I could only find test code forgyro_bias_estimatorand not forimu_corrector_core, I added tests to verify the correctness of the input and output as a substitute, similar toimu_driver.Related links
https://github.com/autowarefoundation/autoware_universe/tree/main/sensing/autoware_imu_corrector/src
How was this PR tested?
You should add the path to the Cargo.toml file you want to unit test to the
memberssection of theworkspacein the root directory's Cargo.toml (at/awkernel/Cargo.toml)imu_corrector.log
Notes for reviewers