Repository navigation
Fix swath end points in coverage path message when generate_path is true - #161
ohauterville wants to merge 4 commits into
Conversation
A raw F2C path stores one state per swath (point, heading, length), so the end point was taken from the state's point and start == end when generate_path is true. Signed-off-by: ohauterville <[email protected]>
94710a4 to
b4c6c67
Compare
SteveMacenski
left a comment
There was a problem hiding this comment.
Replace revert the reformatting. I can hardly tell what you changed to give this a review 😉
Signed-off-by: ohauterville <[email protected]>
Signed-off-by: ohauterville <[email protected]>
|
Yes ! My bad, now it should be ok ! |
e24bdc1 to
9652600
Compare
SteveMacenski
left a comment
There was a problem hiding this comment.
Via Claude:
It re-implements PathState::atEnd() and drops dir. F2C v2’s version is point.getPointFromAngle(angle, len * static_cast(dir)). Today this doesn’t cause wrong output, because appendSwath and PathGenerator::appendConnection only emit FORWARD swath-like states. Switching to s.atEnd() is still cleaner. One catch: F2C’s transformPathWithFieldRef recomputes angle as “towards the next point” but keeps dir. So a BACKWARD state in the GPS branch would land on the wrong side with atEnd(), while the PR’s version would happen to be right. Either choice is fine for now; just leave a comment about the BACKWARD case.
|
@SteveMacenski It now passes all the tests. Are you okay with the changes ? |
|
Can you respond to this last point above? Otherwise, it does look good to me but also needs to be in |
Signed-off-by: ohauterville <[email protected]>
9652600 to
6d3d1cc
Compare
|
Claude was right, the atEnd function does the same job, so now it works and it is simpler this way |
SteveMacenski
left a comment
There was a problem hiding this comment.
Can you put on ros2 as well (and lyrical) so that current distros also have this fix if/when you upgrade?
|
Hi, apologies, I hadn't seen this PR. While preparing #162 I ran into the same swath end point issue and fixed it on |
|
So should this be closed in lieu of your backports? PS Can you open for |
|
It can be closed, though the fix isn't in a backport yet: I'd carry it in the next jazzy one (the Fields2Cover v2.1.1 backport). Or you can simply merge this, and I'll skip that part in my backport, so ohauterville's work lands as well. And yes, I'm preparing the same backport for |
|
Can we merge this one and keep your backports @u33549 on the other branches? |
|
Yes, we can. I was going to include this fix in the next backport pr as well, so it's not currently in the repository. It is mergeable. |
|
I've backported Humble and Lyrical; I'm waiting for a decision on jazzy. |
|
I believe #165 has already been merged. I would like to have the branches consistent, so if we have fixes already that have landed in all the other branches, then using the same in Jazzy for consistency I think is wise, unfortunately :( |
|
Thanks again for finding this and for iterating on it. To keep jazzy consistent with the other branches, the same swath end point fix lands on jazzy with #174, the jazzy counterpart of the humble Fields2Cover v2.1.1 backports (#166, #173). Once #174 is merged, this PR can be closed. I appreciate your work on it, and sorry again that it ended up overlapping. |
Summary
toCoveragePathMsg(const Path &, ...)fillsswaths[i].endwith the start point ofthe last swath state, so every swath in the message has
start == endwhengenerate_pathis true.Cause
A raw Fields2Cover path stores one state per swath (start point, heading, length).
path[i - 1].point/path.back().pointis therefore the swath START. The end mustbe
point + len * (cos(angle), sin(angle)).Fix
Compute the end point from the state's point, angle and length (cartesian case).
Test
Added
TesttoCoveragePathMsgSwathEndPoints. It fails before the fix and passes after.Reproduction (before the fix)
ros2 action send_goaloncompute_coverage_pathwith the same field:generate_route: true, generate_path: false-> swaths have distinct start/end.generate_route: true, generate_path: true->end == startfor every swath.Limitation
The formula is valid in cartesian coordinates. For GPS input the path is converted
back to the previous CRS before the loop, so lengths (meters) and points (degrees)
cannot be mixed. Suggestions welcome for the GPS case.