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

Added FromLLArray service #676

Open
wants to merge 3 commits into
base: foxy-devel
Choose a base branch
from

Conversation

MarcinSlomiany
Copy link

Service allows to quickly transform multiple ll points to ros coordinates system.

cartesian_z);
} else {

navsat_conversions::LLtoUTM(
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought I deprecated these functions in favor of geographilib. But I cannot confirm until next week.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, we should be consistent with whatever method we're using.

Copy link
Contributor

Choose a reason for hiding this comment

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

Found it!

Looks like parts didn't make it into ROS2. The reasoning of using geographiclib directly instead of these navsat_transform functions is here: https://github.com/cra-ros-pkg/robot_localization/pull/627/files#r598612280

Copy link
Collaborator

@ayrton04 ayrton04 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

I feel like there's a lot of repeat code between fromLLArrayCallback and fromLLCallback. Can we either make the former call the latter, or pull out the common logic into another method and have both callbacks call that method?

@@ -0,0 +1,3 @@
geographic_msgs/GeoPoint[] ll_points
---
geometry_msgs/Point[] map_points
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing a newline here.

cartesian_z);
} else {

navsat_conversions::LLtoUTM(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, we should be consistent with whatever method we're using.


cartesian_pose.setOrigin(tf2::Vector3(cartesian_x, cartesian_y, altitude));

// nav_msgs::msg::Odometry gps_odom; // it's unused?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove this line.

@MarcinSlomiany
Copy link
Author

Thanks for the PR.

I feel like there's a lot of repeat code between fromLLArrayCallback and fromLLCallback. Can we either make the former call the latter, or pull out the common logic into another method and have both callbacks call that method?

Yes it's repeated fromLLCallback. I think that pulling out logic into another method would be better.

@ayrton04
Copy link
Collaborator

Apologies for the ping, but is there any chance we'll address the PR feedback on this?

@ayrton04
Copy link
Collaborator

Any update here? No worries if there's no interest in addressing the feedback, but I'll close the PR in that case.

@pepisg
Copy link

pepisg commented Feb 16, 2022

Hi! I was not aware of this PR, I had opened #724 requesting exactly the same feature. I may pick this one up and address your comments soon, however I could not give you an specific time frame

@MarcinSlomiany
Copy link
Author

Hi, sorry for the long delay. I think next week I will start making changes based on your comments @ayrton04. Hope to finish it soon :)

@ayrton04
Copy link
Collaborator

Just checking in on this again. As before, no rush.

@ayrton04
Copy link
Collaborator

Ping! :)

@MarcinSlomiany
Copy link
Author

Hi, I think that before this week ends I'll start pushing some commits..

@MarcinSlomiany
Copy link
Author

Finally I've made update to this PR: piappl@dc74221

If this approach is fine I'll do the same for the toLL method. Also I'll get rid of an additional commit of my colleague.

Copy link
Collaborator

@ayrton04 ayrton04 left a comment

Choose a reason for hiding this comment

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

I'm going to approve this, but I'd prefer that we make the change I suggested (though you are free to fix it however you like; you don't have to use the code block I suggested).

const std::shared_ptr<robot_localization::srv::FromLLArray::Request> request,
std::shared_ptr<robot_localization::srv::FromLLArray::Response> response)
{
for (auto it = request->ll_points.begin(); it != request->ll_points.end(); ++it) {
Copy link
Collaborator

@ayrton04 ayrton04 May 24, 2022

Choose a reason for hiding this comment

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

So the behavior here is not ideal, in that if one of the points throws an exception, the response object might be partially filled out. What we'd really want there is an "all or nothing" operation in which we return all points if they all succeed, otherwise we return an empty vector.

In this case, we know that fromLL will only throw an exception if !transform_good_, so if any one point throws an exception, they all will. However, we don't want to assume we know how fromLL works internally here (and someone might change it later on). I might suggest something like this (note that I have not tested this):

#include <algorithm>
...

decltype(response->map_points) converted_points;
converted_points.reserve(request->ll_points.size());

try
{
  std::transform(
    request->ll_points.begin(),
    request->ll_points.end(),
    std::back_inserter(response->map_points),
    [] (const auto& point) { return fromLL(point); });
}
catch(...)
{
  return false;
}

response->map_points = std::move(converted_points);

@YossiO-BWR
Copy link

Is this expected to be merged at some point? I almost came to implement this all over :)
If you want to improve something before merging - I can lend a hand.

@ayrton04
Copy link
Collaborator

ayrton04 commented Sep 4, 2024

See my comment above. If the change I suggested is implemented, then I will happily merge.

@YossiO-BWR
Copy link

@MarcinSlomiany are you up to it? Want to give me write permissions to your fork or should I copy your changes as a base to my fork?

@MarcinSlomiany
Copy link
Author

MarcinSlomiany commented Sep 7, 2024

Hi @YossiO-BWR! I can't give you write permissions becaus it's my company repo but this weekend next week 😅 I'll implement changes suggested by @ayrton04

@YossiO-BWR
Copy link

@MarcinSlomiany Understandable, lookg forward seeing this merged!

@iandresolares
Copy link

iandresolares commented Oct 14, 2024

Hi!
In what branch is this available? Thanks!

@ayrton04
Copy link
Collaborator

Not available anywhere in this repo yet. The PR has yet to be merged.

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.

7 participants