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

Adds LaneEnd. #61

Merged
merged 1 commit into from
Apr 16, 2024
Merged

Adds LaneEnd. #61

merged 1 commit into from
Apr 16, 2024

Conversation

francocipollone
Copy link
Contributor

@francocipollone francocipollone commented Apr 16, 2024

🎉 New feature

#28 #17

Summary

  • maliput: Adds LaneEnd implementation in Rust.
  • maliput_sys: LaneEnd type and LaneEnd_new method is added to be used later on in methods that return LaneEnds.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if it affects the public API)

Signed-off-by: Franco Cipollone <[email protected]>
@@ -973,6 +973,15 @@ impl LaneSRange {
}
}

/// A specific endpoint of a specific Lane.
/// This is analogous to the C++ maliput::api::LaneEnd implementation.
pub enum LaneEnd<'a> {
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this very much.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to constraint the creation such that no nullptr is used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No nullptr will be used.

Lane is a class whose underlying value is a reference.
The methods returning lanes from the underlying cpp implementation will evaluate whether that pointer is valid or not before creating the reference.

We can meet and discuss if needed.

Btw, In a follow up PR (where I add LaneEndSet) I am changing the &Lane by Lane. You will notice why.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#62

Copy link
Contributor

@agalbachicar agalbachicar left a comment

Choose a reason for hiding this comment

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

Just a nit.

let lane = road_geometry.get_lane(&lane_id);
let lane_end_start = maliput::api::LaneEnd::Start(&lane);
match lane_end_start {
maliput::api::LaneEnd::Start(lane) => assert_eq!(lane.id(), lane_id),
Copy link
Contributor

Choose a reason for hiding this comment

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

Should use another name for lane to avoid alising. Same below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah makes sense. I am changing a bit this test in a follow-up PR. Let me address it in the next PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#62

@francocipollone francocipollone merged commit f122b7e into main Apr 16, 2024
3 checks passed
@francocipollone francocipollone deleted the francocipollone/lane_end branch April 16, 2024 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants