feat(app): add autoware module (lib.rs) - #690
Draft
nokosaaan wants to merge 26 commits into
Draft
Conversation
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>
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
nokosaaan
marked this pull request as ready for review
May 11, 2026 00:59
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>
Contributor
|
This PR will be reviewed after #689 is merged. |
kobayu858
marked this pull request as draft
May 15, 2026 07:44
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
…o test_autoware
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
Signed-off-by: nokosaaan <nishimura.r.019@ms.saitama-u.ac.jp>
…o test_autoware
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Summary
The
test_autowareapp (applications/autoware/src/lib.rs) was still callingekf_localizer's old API (initialize(Pose),predict(dt),update_velocity(vx, wz),get_current_pose(bool), etc.), which no longer matches the currentekf_localizercrate (TF-awareinitialize,measurement_update_pose/measurement_update_twist, the delay-compensation buffer). This PR reconnects the DAG wiring to the current API.While doing so, this PR also fixes two bugs found along the way:
gyro_odometerwas labeling its output twist message with the pre-transform input frame name instead of the transformed-to frame.ekf_sinkreactor to the UDP sender task used an unsynchronizedstatic mut, which is a genuine data race across tasks/cores.This is still the "provisionally complete" stage using a dummy pose source (
pose_dummy_generator; no real NDT-style localization is wired in yet). Swapping in a real pose source is planned for a separate branch (derived fromtrajectory_follower).Background
The
ekf_localizercrate itself has already been through a separate round of work addressing 5 review findings (missingmeasurement_update_pose, a simplifiedmeasurement_update_twist, a missing low-speed gate, a non-functional delay-compensation buffer, and a non-TF-awareinitialize()), followed by a full-file fidelity review. However, thetest_autowareDAG wiring that actually calls intoEKFModulehad been left behind, still calling the pre-review API. This PR updates that wiring to match the current API.Changes
1. Update the
ekf_localizerreactor to the current API (applications/autoware/src/lib.rs)The DAG reactor registered under the name
"ekf_localizer"was rewritten as follows.ekf.initialize(pose)(barePose, first tick only)ekf.initialize(&pose_stamped, &Transform::identity())(PoseWithCovarianceStamped+ TF, first tick only)ekf.predict(dt)ekf.accumulate_delay_time(dt)+ekf.predict_with_delay(dt)(both are required -- calling only one leaves the delay buffer non-functional per its own contract)ekf.update_velocity(vx, wz)apply_twist_observability_gate(&mut twist, threshold)+ekf.measurement_update_twist(&twist, current_time)ekf.measurement_update_pose(&pose_stamped, current_time)(every tick after the first)ekf.get_current_pose(false)->Poseekf.get_current_pose(false, current_time)->PoseStamped(take.pose)ekf.get_current_twist()->Twistekf.get_current_twist(current_time)->TwistStamped(take.twist)measurement_update_poseis the function the earlier review flagged as present upstream but never called at all; this is the first time it is actually invoked from the DAG.pose_dummy_generatorstill emits a fixed(0, 0, 0, identity)placeholder (no real sensor behind it), and the covariance fed intomeasurement_update_poseis likewise a small fixed placeholder value. Swapping in a real pose-estimation source is out of scope here and planned for a separate branch.graph LR dummy_pose["pose_dummy_generator (fixed 0,0,0,identity)"] --> ekf["ekf_localizer reactor"] gyro["gyro_odometer"] --> ekf ekf -- "measurement_update_pose + measurement_update_twist" --> ekf ekf --> sink["ekf_sink (JSON formatting)"] sink -- "try_send" --> chan["bounded channel (queue_size=1, overwrite-oldest)"] chan -- "try_recv" --> udp["periodic_udp_sender_task"] udp -- "socket.send" --> ext["external (UDP recv -> topic publish)"]2. Fix
gyro_odometer'sframe_idbug (applications/autoware/gyro_odometer/src/lib.rs)GyroOdometerCore::process_and_get_resultbuilt its outputTwistWithCovarianceStampedwithheader.frame_idset to the pre-transform input frame (the gyro sensor's ownframe_id,imu_linkin practice) instead of the TF target frame (output_frame,"base_link"by default). The angular velocity values themselves were correctly transformed intooutput_frame, but the label on the message still said the pre-transform frame -- a mismatch that trippedekf_localizer::measurement_update_twist'sframe_id != "base_link"check on every single tick, loggingtwist frame_id must be base_link, got imu_linkcontinuously.Changed
output_frame's field type fromStringto&'static str(matching the same-purposeimu_corrector::ImuCorrectorConfig::output_frame, which was already&'static str), which let the output message'sframe_idbe set directly toself.output_frameinstead of the pre-transform frame name.3. Replace the racy
ekf_sink-> UDP sender handoff with a channel (applications/autoware/src/lib.rs)Before: the
ekf_sinkreactor (a synchronous callback scheduled by the DAG) wrote intostatic mut LATEST_JSON_DATA: Option<String>, which an independently-scheduledperiodic_udp_sender_taskread viaunsafe. Since the two tasks can run concurrently on different cores, this unsynchronizedStringhandoff was a genuine data race (undefined behavior), only partially masked by two separateAtomics (JSON_DATA_READY/JSON_DATA_LENGTH) that never protected the actual data.After: a single channel is created via
awkernel_async_lib::channel::bounded::new::<String>(Attribute { queue_size: 1, flow_control: false, lifespan: Permanent }).ekf_sinkcallstry_send(a non-blocking, synchronous call -- required, since reactor callbacks are synchronous and cannot.await); the UDP sender task polls withtry_recv().queue_size: 1+flow_control: falsereproduces the original "only the newest odometry matters, dropping intermediate ticks is fine" behavior (overwrite the oldest entry when full) while removing the race.The now-dead
LATEST_JSON_DATA/JSON_DATA_READY/JSON_DATA_LENGTHstatics, the startup "waiting for JSON data to become ready" diagnostic loop that depended on them, and the now-unusedcore::sync::atomicimport were removed.Validation
cargo test -p gyro_odometer-- 5 passedmake x86_64 RELEASE=1-- succeedscargo clippy_x86-- no new warnings inapplications/autoware/src/lib.rs(pre-existing, unrelated clippy findings remain ingyro_odometer/ekf_localizer, in code this PR did not touch)twist frame_id must be base_link, got imu_linkwarning is goneawkernel_script/sensor_inputs/(kept outside this repo by policy) via theMakefile'sIMU_CSV_PATH/VELOCITY_CSV_PATH(?=-defaulted to the sibling directory, overridable); confirmed 5708/5699 real rows load successfullyRelated links
https://github.com/autowarefoundation/autoware_core/blob/1.8.0/localization/autoware_ekf_localizer/src/ekf_localizer.cpp
How was this PR tested?
lib.txt
Notes for reviewers