Repository navigation
feat(autoware): use nalgebra for common types #775
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
Open
romancardenas
wants to merge
4
commits into
tier4:main
Choose a base branch
from
romancardenas:dev-748-crop-box
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+495
−180
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
41c25a7
feat(autoware): use nalgebra for common types
romancardenas 5d8bdd1
feat: move Transform to common_types
romancardenas a883769
feat(autoware): improve Transform error checking; add try_from_ros co…
romancardenas 5b4cf47
feat(autoware): add nalgebra criteria documentation and tests for Tra…
romancardenas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,27 @@ | ||
| //! This crate defines data types that are common to the Autoware project. | ||
| //! | ||
| //! For algebraic operations and transformations, this crate relies on nalgebra. | ||
| //! This implies some differences from the conventions used in ROS. | ||
| //! | ||
| //! For example, quaternions are represented using nalgebra's convention rather than ROS's. | ||
| //! `nalgebra`'s quaternion convention is `Quaternion::new(w, i, j, k)`. | ||
| //! On the other hand, ROS uses the `(x, y, z, w)` convention for quaternions. | ||
| //! | ||
| //! We will use nalgebra's convention throughout this crate, | ||
| //! and only convert to/from ROS's convention at I/O boundaries. | ||
| //! ROS compatibility functions are marked as deprecated, and should only be used for interfacing with ROS | ||
| //! or for maintaining compatibility with existing ROS-based code. | ||
|
|
||
| #![no_std] | ||
|
|
||
| extern crate alloc; | ||
|
|
||
| pub mod transform; | ||
|
|
||
| #[derive(Debug, Clone)] | ||
| pub struct Header { | ||
| pub frame_id: &'static str, | ||
| pub timestamp: u64, | ||
| } | ||
|
|
||
| #[derive(Debug, Clone)] | ||
| pub struct Vector3 { | ||
| pub x: f64, | ||
| pub y: f64, | ||
| pub z: f64, | ||
| } | ||
|
|
||
| impl Vector3 { | ||
| pub fn new(x: f64, y: f64, z: f64) -> Self { | ||
| Self { x, y, z } | ||
| } | ||
| } | ||
| pub use nalgebra::{Quaternion, UnitQuaternion, Vector3}; | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-exporting nalgebra's
Quaternionchanges the constructor order from the old field-named{x, y, z, w}(ROS order) toQuaternion::new(w, i, j, k). The TODO inimu_corrector/src/lib.rsL147-148 plans to hardcode a fixed TF next, and copying ROS values intonew()would silently give a wrong rotation. Could we add a ROS-order constructor (e.g.Transform::from_ros_xyzw(t: [f64; 3], q: [f64; 4]), viaQuaternion::from_vector(Vector4::new(x, y, z, w))) or at least document the order?