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-8852 migrate motionplan to work on framesystems rather than individual frames #4559

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

biotinker
Copy link
Member

@biotinker biotinker commented Nov 15, 2024

This PR migrates motionplan to remove solverFrames, and in general have all algorithms operate on entire framesystems rather than single frames.

This allows new features such as enabling planning for multiple independent frames simultaneously, such as several arms moving near but independently from one another.

Most of the frame-specific motionplan functions and structures, such as constraints, now have a framesystem-specific counterpart.

The entire file for solver frames has been removed, and what little remains are now known as motionChains, of which a planner may have many and which are used to inform which frames may move but do not limit planning. This PR does not change the external public Plan() function, and motion calls should continue to work the same way as they have, with few exceptions. An example of such an exception would be that since all components can now move, one may move out of the way of another if need be, something not possible before now.

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Nov 15, 2024
@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 Nov 15, 2024
Copy link
Member

@raybjork raybjork left a comment

Choose a reason for hiding this comment

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

From a high level this makes sense. I think the biggest question is how we want to talk about Segment vs SegmentFS. I guess I'm leaning to having both now?

@@ -587,11 +566,13 @@ func NewEmptyConstraints() *Constraints {
// NewConstraints initializes a Constraints object with user-defined LinearConstraint, OrientationConstraint, and CollisionSpecification.
func NewConstraints(
linConstraints []LinearConstraint,
pseudoConstraints []PseudolinearConstraint,
Copy link
Member

Choose a reason for hiding this comment

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

Not a fan of adding this here. This should be just for the constraints we expose through proto. You can always append to the Constraints with custom constraints after the fact

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair, I think I did this as a quick one-off to get some tests working. Will update before final review

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, not sure on this.

Since this is the structure we use for our own consumption and passing around of constraints and initialization of actual constraint functions, these structures should I think be the union of what we support in proto, and what we support via things like extra. This allows us to better prototype what will eventually be added into proto. The alternative is creating a parallel data structure that we pass around to do the same thing, but which adds parameters, masks the putative new API, and makes it easier to forget things.

segmentConstraints map[string]SegmentConstraint
segmentFSConstraints map[string]SegmentFSConstraint
stateConstraints map[string]StateConstraint
stateFSConstraints map[string]StateFSConstraint
Copy link
Member

Choose a reason for hiding this comment

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

Could consider making these interfaces to cut down on the need for duplication. But if the vision is we're moving away from the original versions then probably not necessary

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 think they would need to be generics, not just interfaces.
But yes this is a stepping stone towards the eventual removal of the originals


// linearizedFrameSystem wraps a framesystem, allowing conversion in a known order between a map[string][]inputs and a flat array of floats,
// useful for being able to call IK solvers against framesystems.
type linearizedFrameSystem struct {
Copy link
Member

Choose a reason for hiding this comment

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

Is this the solverframe code?

Copy link
Member Author

Choose a reason for hiding this comment

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

No. This simply allows things to call nlopt, which requires a vector of floats.

What little code survives from solverFrame, is now motionChain

@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 Nov 19, 2024
@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 Nov 20, 2024
@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 Nov 20, 2024
@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 Nov 20, 2024
@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 Nov 20, 2024
@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 Nov 21, 2024
@biotinker biotinker marked this pull request as ready for review November 21, 2024 16:34
BoundingRegions []spatialmath.Geometry
Constraints *Constraints
Options map[string]interface{}
allGoals PathStep // TODO: this should replace Goal and Frame
Copy link
Member

Choose a reason for hiding this comment

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

[q]: will this be capitalized in future work?
[q]: why not make this a slice in case there is are specific poses we would like to move through?

Copy link
Member Author

Choose a reason for hiding this comment

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

It will indeed be eventually capitalized.

I don't think there's a need for this to take an array; when pre-planning is fully operational, calling pre-plans iteratively will yield the same result while giving the caller extra control.

motionplan/check.go Outdated Show resolved Hide resolved
motionplan/check.go Outdated Show resolved Hide resolved
motionplan/check.go Outdated Show resolved Hide resolved
motionplan/ik/metrics.go Show resolved Hide resolved
motionplan/ik/metrics.go Show resolved Hide resolved
motionplan/motionPlanner.go Show resolved Hide resolved
motionplan/check.go Outdated Show resolved Hide resolved
motionplan/check.go Outdated 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 Nov 21, 2024
@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 Nov 21, 2024
@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 Nov 21, 2024
@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 Nov 21, 2024
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.

4 participants