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-5391 - Create distinct planning and execution frames for PTG KinematicWrapper #3876

Open
wants to merge 96 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
247d4d1
initial add planning and execution frames for bases commit
nfranczak Apr 1, 2024
652ddcc
continue with solverFrame - not the best idea
nfranczak Apr 2, 2024
685d518
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak Apr 5, 2024
de3189d
merge with main:
nfranczak Apr 5, 2024
413cfa3
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak Apr 5, 2024
14fc7fe
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak Apr 9, 2024
2aab600
initial commit - rework move_req to rely on fs for placing obstacles
nfranczak Apr 9, 2024
6a49f8a
have fs place objects into worldframe within getTransientDetections
nfranczak Apr 10, 2024
aa98dea
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak Apr 17, 2024
ff9e945
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak Apr 19, 2024
44b3287
clean up + note about how to interpolate
nfranczak Apr 19, 2024
cde23a6
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak Apr 30, 2024
ba2be7d
remove '&' from orientation printout when doing plan.Path.String()
nfranczak Apr 30, 2024
526b14d
add ExecutionFrame function impl + correct references to transforming…
nfranczak May 1, 2024
656d154
simplify how we create robot collision entities to only use frameInpu…
nfranczak May 1, 2024
09c27a8
fulfill placing obstacles into the world frame using only the newly i…
nfranczak May 1, 2024
662ef08
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak May 1, 2024
a8eca26
clean up remove print statements
nfranczak May 1, 2024
61d8fc1
clean up remove print statements
nfranczak May 1, 2024
5bc3a0a
clean up remove print statements
nfranczak May 1, 2024
7c07b15
remove print stmts
nfranczak May 1, 2024
7185d6e
remove note - clean up
nfranczak May 1, 2024
d454d21
logic complete-ish, sans tests
nfranczak May 1, 2024
5e39ce8
fix segment logic
nfranczak May 1, 2024
db3ca28
correct plannerSetUp inputs
nfranczak May 1, 2024
d8ab4ce
lint + revert tpspace test - not finished yet
nfranczak May 1, 2024
6917eb9
revert test file while updating TestGetTransientDetections
nfranczak May 1, 2024
7e25a8d
motion builtin-tests are passinggit statusgit status lets gooooooooo
nfranczak May 2, 2024
ce18c03
remove un-needed code commented out code
nfranczak May 2, 2024
dfeec43
clean some print statements
nfranczak May 3, 2024
ce5a122
remove un-needed changes
nfranczak May 3, 2024
1d18bb5
clean prints - TestPtgCheckPlan WIP
nfranczak May 3, 2024
2570e15
tpspace rrt test testptgcheckplan passes
nfranczak May 3, 2024
4b42874
tpspace rrt test testptgcheckplan passes
nfranczak May 3, 2024
a4d816f
linted
nfranczak May 3, 2024
0aa7c7f
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak May 3, 2024
fff9cf6
singlar bone of AddFrameBetween + revert messages.go since we are not…
nfranczak May 3, 2024
074cfbb
wip change to pass lint
nfranczak May 3, 2024
c745c4b
fix ptgkinematics no geom tests + add AddFrameBetween
nfranczak May 3, 2024
a21cc99
fix TestMoveOnMapStaticObs
nfranczak May 6, 2024
c064634
linted
nfranczak May 6, 2024
e91f0a9
add debug log to see where this test is failing on CI
nfranczak May 6, 2024
ac7d32a
remove print so we pass linter
nfranczak May 6, 2024
5bb3375
remove need to check for 'ExecutionFrame' in solverFrame code
nfranczak May 8, 2024
716f095
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak May 8, 2024
eb5a38a
fix CheckPlan
nfranczak May 8, 2024
d7e1a6b
sans fmt.Println in frame.go
nfranczak May 8, 2024
9b0405d
remove un-needed changes
nfranczak May 9, 2024
923f362
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak May 9, 2024
c197731
post merge + fixing checkPlanRelative functionality that was lost upo…
nfranczak May 10, 2024
01b7d93
fixed TestPtgCheckPlan and accompanying relative plan checking code
nfranczak May 13, 2024
eaf8ffc
fix test TestMoveOnMapStaticObs + move request set up nits for feedin…
nfranczak May 13, 2024
7f7e4c6
move request nits + feed in proper framesystem for checking of plan
nfranczak May 13, 2024
02fe62f
changes from linter
nfranczak May 13, 2024
c3569dd
nits
nfranczak May 13, 2024
1344a84
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak May 13, 2024
b6aac16
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak May 14, 2024
4f68a9f
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak May 14, 2024
cfa4aea
fix explore err string check
nfranczak May 17, 2024
c6c995c
remove prints
nfranczak May 17, 2024
21cdb8e
add back space
nfranczak May 17, 2024
40d4a77
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak May 17, 2024
43f910d
re-root FS in plan-manager
nfranczak May 20, 2024
dbf6c19
replace ExecutionFrame with LocalizationFrame
nfranczak May 21, 2024
ce50772
introduce Simple6DModel
nfranczak May 21, 2024
ddbde4d
migrate simple6Dmodel to be a 7D model
nfranczak May 21, 2024
d39e5d8
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak May 21, 2024
1d99d0c
change functionaluty of bases to use 7Dof frame - partway through pro…
nfranczak May 21, 2024
29af1f5
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak May 23, 2024
8118206
battle-testing use of 7DoF frame for checking plan - tests still failing
nfranczak May 23, 2024
21c8a4f
tests passing for 7DoF frame
nfranczak May 23, 2024
f149090
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak May 23, 2024
a3e1ee2
over-write inputs to correct first place frame but have original info…
nfranczak May 24, 2024
6a3a794
overwrite inputs for placing detection properly
nfranczak May 24, 2024
668a27a
rays comments sans interpolateInputs requested change
nfranczak May 28, 2024
7648907
hoppefully fixed TestObstacleReplanningGlobe
nfranczak May 28, 2024
5004e4c
fix TestPtgCheckPlan
nfranczak May 28, 2024
3f2df50
move anyNonZero check from solverFrame into planManager, as it was or…
nfranczak Jun 5, 2024
ec18e95
add localizationFrame as argument to CheckPlan + update tests
nfranczak Jun 5, 2024
3e186d9
add missing arguments to test files
nfranczak Jun 5, 2024
34f5269
add comment
nfranczak Jun 6, 2024
9d6dbe7
add back state.Position case in switch stmt for NewCollisionConstraint
nfranczak Jun 6, 2024
24c7349
add comment to fake_kinematics about why we have chosen the given lim…
nfranczak Jun 6, 2024
03ed80a
remove comment
nfranczak Jun 6, 2024
3978b66
update poseFrame interpolate method to use spatial.Interpolate
nfranczak Jun 6, 2024
56636f4
update testptgcheckplan to have correct starting inputs
nfranczak Jun 6, 2024
ba682e7
debugging TestObstacleReplanningGlobe
nfranczak Jun 7, 2024
7afc8ed
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak Jun 7, 2024
ee14bf1
fixed TestObstacleReplanningGlobe
nfranczak Jun 7, 2024
9864457
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak Jun 12, 2024
f43114d
rename absoluteFS to localizingFS
nfranczak Jun 12, 2024
34352cd
update naming
nfranczak Jun 12, 2024
59481af
Merge branch 'main' of github.com:viamrobotics/rdk into RSDK-5391
nfranczak Jun 14, 2024
d4e1c11
generate seed map with all input-enabled components
nfranczak Jun 17, 2024
3fc360b
use zeroth index of plan to construct our zeroCG
nfranczak Jun 17, 2024
3409b40
noramlize the orientation vector limits when set to infinity
nfranczak Jun 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions components/base/kinematicbase/differentialDrive.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ func (ddk *differentialDriveKinematics) Kinematics() referenceframe.Frame {
return ddk.planningFrame
}

func (ddk *differentialDriveKinematics) ExecutionFrame() referenceframe.Frame {
return ddk.executionFrame
}

func (ddk *differentialDriveKinematics) CurrentInputs(ctx context.Context) ([]referenceframe.Input, error) {
// If no localizer is present, CurrentInputs returns the expected position of the robot assuming after
// each part of move command was completed accurately.
Expand Down
2 changes: 1 addition & 1 deletion components/base/kinematicbase/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func (ptgk *ptgBaseKinematics) courseCorrect(
arcSteps[arcIdx].arcSegment.StartConfiguration[startDistanceAlongTrajectoryIndex],
currentInputs[startDistanceAlongTrajectoryIndex],
}
trajPose, err := ptgk.frame.Transform(execInputs)
trajPose, err := ptgk.planningFrame.Transform(execInputs)
if err != nil {
return nil, err
}
Expand Down
70 changes: 45 additions & 25 deletions components/base/kinematicbase/fake_kinematics.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ func (fk *fakeDiffDriveKinematics) Kinematics() referenceframe.Frame {
return fk.planningFrame
}

func (fk *fakeDiffDriveKinematics) ExecutionFrame() referenceframe.Frame {
return fk.executionFrame
}

func (fk *fakeDiffDriveKinematics) CurrentInputs(ctx context.Context) ([]referenceframe.Input, error) {
fk.lock.RLock()
defer fk.lock.RUnlock()
Expand Down Expand Up @@ -118,17 +122,17 @@ func (fk *fakeDiffDriveKinematics) CurrentPosition(ctx context.Context) (*refere

type fakePTGKinematics struct {
*fake.Base
localizer motion.Localizer
frame referenceframe.Frame
options Options
sensorNoise spatialmath.Pose
ptgs []tpspace.PTGSolver
currentInput []referenceframe.Input
origin *referenceframe.PoseInFrame
positionlock sync.RWMutex
inputLock sync.RWMutex
logger logging.Logger
sleepTime int
localizer motion.Localizer
planningFrame, executionFrame referenceframe.Frame
options Options
sensorNoise spatialmath.Pose
ptgs []tpspace.PTGSolver
currentInput []referenceframe.Input
origin *referenceframe.PoseInFrame
positionlock sync.RWMutex
inputLock sync.RWMutex
logger logging.Logger
sleepTime int
}

// WrapWithFakePTGKinematics creates a PTG KinematicBase from the fake Base so that it satisfies the ModelFramer and InputEnabled
Expand Down Expand Up @@ -174,7 +178,8 @@ func WrapWithFakePTGKinematics(

nonzeroBaseTurningRadiusMeters := (baseMillimetersPerSecond / rdkutils.DegToRad(angVelocityDegsPerSecond)) / 1000.

frame, err := tpspace.NewPTGFrameFromKinematicOptions(
// construct planning frame
planningFrame, err := tpspace.NewPTGFrameFromKinematicOptions(
b.Name().ShortName(),
logger,
nonzeroBaseTurningRadiusMeters,
Expand All @@ -187,25 +192,36 @@ func WrapWithFakePTGKinematics(
return nil, err
}

// construct execution frame
executionFrame, err := referenceframe.New2DMobileModelFrame(
b.Name().ShortName()+"ExecutionFrame",
planningFrame.DoF(),
geometries[0],
nfranczak marked this conversation as resolved.
Show resolved Hide resolved
)
if err != nil {
return nil, err
}

if sensorNoise == nil {
sensorNoise = spatialmath.NewZeroPose()
}

ptgProv, ok := frame.(tpspace.PTGProvider)
ptgProv, ok := planningFrame.(tpspace.PTGProvider)
if !ok {
return nil, errors.New("unable to cast ptgk frame to a PTG Provider")
}
ptgs := ptgProv.PTGSolvers()

fk := &fakePTGKinematics{
Base: b,
frame: frame,
origin: origin,
ptgs: ptgs,
currentInput: zeroInput,
sensorNoise: sensorNoise,
logger: logger,
sleepTime: sleepTime,
Base: b,
planningFrame: planningFrame,
executionFrame: executionFrame,
origin: origin,
ptgs: ptgs,
currentInput: zeroInput,
sensorNoise: sensorNoise,
logger: logger,
sleepTime: sleepTime,
}
initLocalizer := &fakePTGKinematicsLocalizer{fk}
fk.localizer = motion.TwoDLocalizer(initLocalizer)
Expand All @@ -215,7 +231,11 @@ func WrapWithFakePTGKinematics(
}

func (fk *fakePTGKinematics) Kinematics() referenceframe.Frame {
return fk.frame
return fk.planningFrame
}

func (fk *fakePTGKinematics) ExecutionFrame() referenceframe.Frame {
return fk.executionFrame
}

func (fk *fakePTGKinematics) CurrentInputs(ctx context.Context) ([]referenceframe.Input, error) {
Expand All @@ -240,7 +260,7 @@ func (fk *fakePTGKinematics) GoToInputs(ctx context.Context, inputSteps ...[]ref
fk.currentInput = []referenceframe.Input{inputs[0], inputs[1], {Value: 0}}
fk.inputLock.Unlock()

finalPose, err := fk.frame.Transform(inputs)
finalPose, err := fk.planningFrame.Transform(inputs)
if err != nil {
return err
}
Expand All @@ -250,7 +270,7 @@ func (fk *fakePTGKinematics) GoToInputs(ctx context.Context, inputSteps ...[]ref
var interpolatedConfigurations [][]referenceframe.Input
for i := 0; i <= steps; i++ {
interp := float64(i) / float64(steps)
interpConfig, err := fk.frame.Interpolate(startCfg, inputs, interp)
interpConfig, err := fk.planningFrame.Interpolate(startCfg, inputs, interp)
if err != nil {
return err
}
Expand All @@ -260,7 +280,7 @@ func (fk *fakePTGKinematics) GoToInputs(ctx context.Context, inputSteps ...[]ref
if ctx.Err() != nil {
return ctx.Err()
}
relativePose, err := fk.frame.Transform(inter)
relativePose, err := fk.planningFrame.Transform(inter)
if err != nil {
return err
}
Expand Down
2 changes: 2 additions & 0 deletions components/base/kinematicbase/kinematics.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ type KinematicBase interface {
referenceframe.InputEnabled

Kinematics() referenceframe.Frame
ExecutionFrame() referenceframe.Frame
Copy link
Member

Choose a reason for hiding this comment

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

IMO there should be a better name for this

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 will think of a better name. Maybe ExecutionKinematics?
@raybjork lmk if you have any opinions on this.

Copy link
Member

Choose a reason for hiding this comment

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

Kinematics is not really correct here the frame has nothing to do with kinematics of the base

Maybe something related to its localization, since thats the transformation the frame is responsible for making? Perhaps LocalizationFrame or something similar? Open to other suggestions.


// ErrorState takes a complete motionplan, as well as the index of the currently-executing set of inputs, and computes the pose
// difference between where the robot in fact is, and where it ought to be.
ErrorState(context.Context) (spatialmath.Pose, error)
Expand Down
29 changes: 22 additions & 7 deletions components/base/kinematicbase/ptgKinematics.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type ptgBaseKinematics struct {
base.Base
motion.Localizer
logger logging.Logger
frame referenceframe.Frame
planningFrame, executionFrame referenceframe.Frame
ptgs []tpspace.PTGSolver
courseCorrectionIdx int
linVelocityMMPerSecond float64
Expand Down Expand Up @@ -100,7 +100,7 @@ func wrapWithPTGKinematics(
}

nonzeroBaseTurningRadiusMeters := (linVelocityMMPerSecond / rdkutils.DegToRad(angVelocityDegsPerSecond)) / 1000.
frame, err := tpspace.NewPTGFrameFromKinematicOptions(
planningFrame, err := tpspace.NewPTGFrameFromKinematicOptions(
b.Name().ShortName(),
logger,
nonzeroBaseTurningRadiusMeters,
Expand All @@ -112,14 +112,14 @@ func wrapWithPTGKinematics(
if err != nil {
return nil, err
}
ptgProv, err := rdkutils.AssertType[tpspace.PTGProvider](frame)
ptgProv, err := rdkutils.AssertType[tpspace.PTGProvider](planningFrame)
if err != nil {
return nil, err
}
ptgs := ptgProv.PTGSolvers()
origin := spatialmath.NewZeroPose()

ptgCourseCorrection, err := rdkutils.AssertType[tpspace.PTGCourseCorrection](frame)
ptgCourseCorrection, err := rdkutils.AssertType[tpspace.PTGCourseCorrection](planningFrame)
if err != nil {
return nil, err
}
Expand All @@ -133,11 +133,22 @@ func wrapWithPTGKinematics(
origin = originPIF.Pose()
}

// construct executionFrame
executionFrame, err := referenceframe.New2DMobileModelFrame(
Copy link
Member

Choose a reason for hiding this comment

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

This should be a full 6dof pose, not a 2d pose.

Copy link
Member

Choose a reason for hiding this comment

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

I think its premature to make this change there is no use case yet where we need more DOF than what exists for (x, y, theta)

Copy link
Member

Choose a reason for hiding this comment

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

Creating such a frame would require construction of a new frame with inputs [x, y, z, roll, pitch, yaw] and since we would only be using 3 of those for now it seems unnecessary to introduce this code at this moment

Copy link
Member

@biotinker biotinker May 9, 2024

Choose a reason for hiding this comment

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

I disagree.

Consider a 2d robot rolling over a bump with a lidar. It may be temporarily looking up or down, and seeing bonus obstacles that are actually the floor or ceiling. If we capture the pose of the robot, we are able to account for this.

As written we are throwing information away and actively weakening our current spatial representation.

A 2d robot can only actuate in those three dof, but that's captured by the planning frame. A 2d robot can exist in a full 6dof pose, and that's what this frame should be able to capture.

b.Name().ShortName()+"ExecutionFrame",
planningFrame.DoF(),
geometries[0],
Copy link
Member

Choose a reason for hiding this comment

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

This is weird. Why just the first geometry? What are you doing with the DoF?

Copy link
Member Author

Choose a reason for hiding this comment

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

you're right that this is weird. We now choose to not take geometry at all for the mobile frame. We also now define our own separate limits, although they might be incorrect in this iteration.

)
if err != nil {
return nil, err
}

return &ptgBaseKinematics{
Base: b,
Localizer: localizer,
logger: logger,
frame: frame,
planningFrame: planningFrame,
executionFrame: executionFrame,
ptgs: ptgs,
courseCorrectionIdx: courseCorrectionIdx,
linVelocityMMPerSecond: linVelocityMMPerSecond,
Expand All @@ -150,7 +161,11 @@ func wrapWithPTGKinematics(
}

func (ptgk *ptgBaseKinematics) Kinematics() referenceframe.Frame {
return ptgk.frame
return ptgk.planningFrame
}

func (ptgk *ptgBaseKinematics) ExecutionFrame() referenceframe.Frame {
return ptgk.executionFrame
}

// For a ptgBaseKinematics, `CurrentInputs` returns inputs which reflect what the base is currently doing.
Expand Down Expand Up @@ -193,7 +208,7 @@ func (ptgk *ptgBaseKinematics) ErrorState(ctx context.Context) (spatialmath.Pose
currentInputs[startDistanceAlongTrajectoryIndex],
}

currPoseInArc, err := ptgk.frame.Transform(executedInputs)
currPoseInArc, err := ptgk.planningFrame.Transform(executedInputs)
if err != nil {
return nil, err
}
Expand Down
48 changes: 25 additions & 23 deletions motionplan/motionPlanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

"go.viam.com/rdk/logging"
"go.viam.com/rdk/motionplan/ik"
"go.viam.com/rdk/referenceframe"
frame "go.viam.com/rdk/referenceframe"
"go.viam.com/rdk/spatialmath"
)
Expand Down Expand Up @@ -477,24 +478,9 @@ func CheckPlan(
return err
}

var startPose spatialmath.Pose
if relative {
// A frame's transformation based on a relative input will position it relative to the
// frame's origin, giving us a relative pose. To put it with respect to the world
// we compose the relative pose with the most recent former pose we have already reached.
if wayPointIdx > 0 {
startPose = poses[wayPointIdx-1]
} else {
// If waypointIdx is 0, we have not begun the plan yet and thus the start pose will be the first pose.
startPose = poses[wayPointIdx]
}
} else {
startPose = currentPose
}

// setup the planOpts
if sfPlanner.planOpts, err = sfPlanner.plannerSetupFromMoveRequest(
startPose,
currentPose,
poses[len(poses)-1],
currentInputs,
worldState,
Expand All @@ -516,7 +502,7 @@ func CheckPlan(

// pre-pend to segments so we can connect to the input we have not finished actuating yet
segments = append(segments, &ik.Segment{
StartPosition: startPose,
StartPosition: currentPose,
EndPosition: poses[wayPointIdx],
StartConfiguration: checkFrameCurrentInputs,
EndConfiguration: checkFrameCurrentInputs,
Expand All @@ -529,6 +515,7 @@ func CheckPlan(
currPose, nextPose spatialmath.Pose,
currInput, nextInput map[string][]frame.Input,
) (*ik.Segment, error) {
// there will be an issue here since currInputs is not of the correct length
currInputSlice, err := sf.mapToSlice(currInput)
if err != nil {
return nil, err
Expand All @@ -553,7 +540,18 @@ func CheckPlan(

// iterate through remaining plan and append remaining segments to check
for i := wayPointIdx; i < len(offsetPlan.Path())-1; i++ {
segment, err := createSegment(poses[i], poses[i+1], offsetPlan.Trajectory()[i], offsetPlan.Trajectory()[i+1])
// do we want to add a relative special case here or in the anon function
currInput := offsetPlan.Trajectory()[i]
nextInput := offsetPlan.Trajectory()[i+1]
if relative {
currInput[checkFrame.Name()+"ExecutionFrame"] = referenceframe.FloatsToInputs(
[]float64{poses[i].Point().X, poses[i].Point().Y, poses[i].Orientation().OrientationVectorRadians().Theta},
)
nextInput[checkFrame.Name()+"ExecutionFrame"] = referenceframe.FloatsToInputs(
[]float64{poses[i+1].Point().X, poses[i+1].Point().Y, poses[i+1].Orientation().OrientationVectorRadians().Theta},
)
}
segment, err := createSegment(poses[i], poses[i+1], currInput, nextInput)
if err != nil {
return err
}
Expand Down Expand Up @@ -581,16 +579,20 @@ func CheckPlan(
return nil
}

// If we are working with a PTG plan the returned value for poseInPath will only
// tell us how far along the arc we have traveled. Since this is only the relative position,
// i.e. relative to where the robot started executing the arc,
// we must compose poseInPath with segment.StartPosition to get the absolute position.
// Add new comment here
interpolatedState := &ik.State{Frame: sf}
if relative {
interpolatedState.Position = spatialmath.Compose(segment.StartPosition, poseInPath)
// I AM PRETTY SURE THAT ORDER MATTERS HERE IN TERMS OF STUFF?
interpolatedState.Configuration = []frame.Input{
{Value: segment.StartPosition.Point().X},
{Value: segment.StartPosition.Point().Y},
{Value: segment.StartPosition.Orientation().OrientationVectorDegrees().Theta},
interpConfig[0], interpConfig[1], interpConfig[2],
}
} else {
interpolatedState.Configuration = interpConfig
}
fmt.Println("interpolatedState: ", interpolatedState)

// Checks for collision along the interpolated route and returns a the first interpolated pose where a collision is detected.
if isValid, err := sfPlanner.planOpts.CheckStateConstraints(interpolatedState); !isValid {
Expand Down
2 changes: 1 addition & 1 deletion motionplan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (path Path) String() string {
for _, step := range path {
str += "\n"
for frame, pose := range step {
str += fmt.Sprintf("%s: %v %v\t", frame, pose.Pose().Point(), pose.Pose().Orientation().OrientationVectorDegrees())
str += fmt.Sprintf("%s: %v %v\t", frame, pose.Pose().Point(), *pose.Pose().Orientation().OrientationVectorDegrees())
}
}
return str
Expand Down
12 changes: 0 additions & 12 deletions motionplan/planManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,18 +504,6 @@ func (pm *planManager) plannerSetupFromMoveRequest(
return nil, err // no geometries defined for frame
}
movingRobotGeometries := movingGeometriesInFrame.Geometries() // solver frame returns geoms in frame World
if pm.useTPspace {
// If we are starting a ptg plan at a different place than the origin, then that translation must be represented in the geometries,
// all of which need to be in the "correct" position when transformed to the world frame.
// At this point in the plan manager, a ptg plan is moving to a goal in the world frame, and the start pose is the base's location
// relative to world. Since nothing providing a geometry knows anything about where the base is relative to world, any geometries
// need to be transformed by the start position to place them correctly in world.
startGeoms := make([]spatialmath.Geometry, 0, len(movingRobotGeometries))
for _, geometry := range movingRobotGeometries {
startGeoms = append(startGeoms, geometry.Transform(from))
}
movingRobotGeometries = startGeoms
}

// find all geometries that are not moving but are in the frame system
staticRobotGeometries := make([]spatialmath.Geometry, 0)
Expand Down