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

RSDK-8576 spline constraints for motion #4379

Conversation

biotinker
Copy link
Member

This PR adds complex constraints for motion, allowing a series of poses to be passed such that splines, complex curves, or any other surface describable by the user can be followed at arbitrary precision.

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Sep 20, 2024
motionplan/motionPlanner.go Show resolved Hide resolved
@@ -54,6 +54,95 @@ func newPlanManager(
return &planManager{planner: p, frame: frame, useTPspace: len(frame.PTGSolvers()) > 0}, nil
}

// PlanMultiWaypoint plans a motion through multiple waypoints, using identical constraints for each
// Unlike PlanSingleWaypoint, this does not break up individual.
func (pm *planManager) PlanMultiWaypoint(ctx context.Context, request *PlanRequest, goals []spatialmath.Pose) (Plan, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Why not just change the PlanRequest destination to accept a slice? Its confusing to me how the list of goals would interact with the request destination

Copy link
Member Author

Choose a reason for hiding this comment

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

Since the features we are adding via DoCommand and extra are quick shortest-path fixes rather than fully fleshed-out updates, I'd prefer not to make major structural changes to public data structures until the feature is more formalized.

I may update this as part of RSDK-8835 but prefer not to do so now.

Copy link
Member

Choose a reason for hiding this comment

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

Ok I'm good with this then, but just want to flag this as something that's suboptimal that we should go back and fix later on once we figure out more sustainable data structures.

Maybe you could make a ticket for removing this function?

Copy link
Member Author

Choose a reason for hiding this comment

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

Made RSDK-8850 as an umbrella for all of this.

spatialmath/capsule_test.go Outdated Show resolved Hide resolved
// It returns an error if the geometry type is unsupported or if points cannot be computed.
// The points returned are in order, in frame of the capsule's parent, and follow the right hand rule around the plane normal.
func CapsuleIntersectionWithPlane(g Geometry, planeNormal, planePoint r3.Vector, numPoints int) ([]r3.Vector, error) {
c, ok := g.(*capsule)
Copy link
Member

Choose a reason for hiding this comment

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

[nit] can use utils.AssertType

Copy link
Member Author

Choose a reason for hiding this comment

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

Is there really a benefit to this? It's the same number of LoC, but now with a function call abstraction.

Copy link
Member

Choose a reason for hiding this comment

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

I like it personally since it cuts down on needing to write similar errors in a ton of places. I've been trying to promote it where applicable for better uniformity.

The only knock on it I see is the overhead of an additional function call?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm less worried about the computational overhead of the function call, and more worried about the overhead from a code readability standpoint. Instead of doing the thing in one line right there, we abstract it away in a function call to another package which, if there is unexpected behavior going on, requires way more effort to track down and check. It's a higher mental load to ensure code correctness, without a line count reduction to make up for it.

spatialmath/capsule.go Show resolved Hide resolved
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Sep 23, 2024
Copy link
Contributor

Availability

Scene # viamrobotics:main biotinker:20240816_RSDK-8576-spline-constraints-for-motion Percent Improvement Health
1 100% 100% 0%
2 100% 100% 0%
3 100% 100% 0%
4 100% 100% 0%
5 80% 90% 12%
6 60% 70% 17%
7 30% 20% -33%
8 100% 100% 0%
9 90% 100% 11%
10 100% 100% 0%
11 100% 100% 0%
12 100% 100% 0%
13 100% 100% 0%
14 100% 100% 0%
15 100% 100% 0%
16 90% 90% 0%
17 100% 100% 0%
18 70% 70% 0%

Quality

Scene # viamrobotics:main biotinker:20240816_RSDK-8576-spline-constraints-for-motion Percent Improvement Probability of Improvement Health
1 1.31±0.00 1.31±0.00 -0% 50%
2 0.91±0.00 0.90±0.00 1% 100%
3 2.48±0.13 2.48±0.13 -0% 50%
4 4.49±1.30 4.86±0.92 -8% 41%
5 15.35±11.90 11.88±2.67 23% 61%
6 14.46±6.19 15.76±5.17 -9% 44%
7 4.35±1.86 5.28±1.61 -21% 35%
8 5.58±1.39 4.99±1.08 10% 63%
9 4.52±0.14 5.45±2.95 -21% 38%
10 4.13±0.34 4.13±0.34 -0% 50%
11 3.13±0.00 3.13±0.00 -0% 50%
12 3.91±0.85 3.91±0.85 0% 50%
13 904.77±13.78 904.77±13.78 -0% 50%
14 2035.66±601.28 2035.67±601.28 -0% 50%
15 50790.10±9415.58 50790.10±9415.58 -0% 50%
16 59103.42±7272.96 59103.42±7272.96 -0% 50%
17 15936.40±3302.53 15936.40±3302.53 -0% 50%
18 119838.44±14937.25 119672.78±14831.97 0% 50%

Performance

Scene # viamrobotics:main biotinker:20240816_RSDK-8576-spline-constraints-for-motion Percent Improvement Probability of Improvement Health
1 0.09±0.01 0.09±0.00 4% 61%
2 0.11±0.01 0.11±0.01 4% 66%
3 1.02±0.62 1.01±0.61 1% 51%
4 2.04±0.13 2.04±0.14 -0% 49%
5 2.51±0.61 2.71±0.86 -8% 43%
6 2.38±0.34 3.20±0.80 -35% 17%
7 2.71±0.59 2.91±0.58 -7% 41%
8 0.30±0.11 0.40±0.15 -31% 31%
9 5.00±0.15 4.99±0.16 0% 51%
10 0.14±0.03 0.14±0.03 -1% 49%
11 0.10±0.00 0.10±0.01 -0% 50%
12 0.13±0.01 0.13±0.01 2% 59%
13 0.07±0.01 0.07±0.01 -0% 49%
14 0.81±0.28 0.81±0.28 -0% 50%
15 1.11±0.18 1.11±0.17 0% 50%
16 2.54±0.81 2.51±0.82 1% 51%
17 1.30±0.15 1.30±0.15 -0% 49%
18 4.67±0.78 4.67±0.78 -0% 50%

The above data was generated by running scenes defined in the motion-testing repository
The SHA1 for viamrobotics:main is: 900738751a11aa6be03dd90a3932f38e1c35f187
The SHA1 for biotinker:20240816_RSDK-8576-spline-constraints-for-motion is: 900738751a11aa6be03dd90a3932f38e1c35f187

  • 10 samples were taken for each scene
  • A timeout of 5.0 seconds was imposed for each trial

@biotinker biotinker merged commit fb5e3cf into viamrobotics:main Sep 24, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants