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

chore: move position correction code to lib #8

Merged
merged 20 commits into from
Feb 13, 2025

Conversation

eduardacoppo
Copy link
Contributor

@eduardacoppo eduardacoppo commented Jan 23, 2025

Depends on:

What is this PR for

[sc-67374]
This PR moves the position correction code here

How I did it

Moved the code that was previously in drivers/orogen/nmea0183 and made some improvements in the code.

Results, How I tested

Unit tests

Checklist

  • Assign yourself in the PR
  • Write unit tests (when relevant)
  • Run rubocop and rake tests locally

and make some improvements in the code.
use std::string instead of constexpr char and fix tests
and log the message directly instead of saving it to a variable
and fix wrong documentation about it
and avoid using null values in converter
Copy link
Member

@doudou doudou left a comment

Choose a reason for hiding this comment

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

floating point types are already implicitly converted into double, if necessary
pass utm_converter as const& and write const& instead of const <TYPE>&, for consistency.
Pass position as std::optional
because they're expected behaviors, we shouldn't treat them as errors
@eduardacoppo eduardacoppo requested a review from jhonasiv January 30, 2025 18:43
@seixasxbr seixasxbr self-requested a review January 31, 2025 12:44
@doudou
Copy link
Member

doudou commented Feb 4, 2025

Documentation is necessary when the code is not sufficiently expressive, and rewriting function signature in plain english is not documentation for me and I think it is just noisy. It is not a complaint about you specifically, I see this practice in other team members too. Just using this opportunity to raise this discussion

@wvmcastro agreed. I'm complaining about this regularly on reviews too.

Copy link
Member

@doudou doudou left a comment

Choose a reason for hiding this comment

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

All agreed with Wellington. I think you're good after that and that having both me, jhonas and wellington is a bit too much. I'm accepting the PR to get myself out of the loop.

Copy link

@wvmcastro wvmcastro left a comment

Choose a reason for hiding this comment

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

Also, write a test that assures the applyPositionCorrection output time field is equal to the one of position parameter

Having "_gps" as a suffix for the sensor and vessel positions in GPS coordinates was intended to distinguish GPS coordinates from UTM ones.
That was a confusing nomenclature, but as I had no better idea, I just went on with it.
After discussing the matter, I agreed naming these variables simply "sensor_pos" and "vessel_pos" were a satisfactory way to make this distinction, as the type "ais_base::Position" is known to have coordinates in the GPS system. So this solved the nomenclature problem.

Part of the transformation to get the vessel position in the world frame was left inside the "convertUTMToGPS" function. This was fixed by moving it to the now called "computeVesselPositionInWorldFrame".
and rename vessel2world_gps to vessel_pos, as is done in the code
@wvmcastro
Copy link

Approving it since it does not have nothing actually wrong, just some minor enhancements

@eduardacoppo eduardacoppo merged commit 41c6fdc into master Feb 13, 2025
1 check passed
@eduardacoppo eduardacoppo deleted the position_correction branch February 13, 2025 10:31
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.

5 participants