Skip to content

Commit 158c561

Browse files
authored
RSDK-6412 Add default point geometries to PTG kinematic bases (viamrobotics#3462)
1 parent bebbb3e commit 158c561

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

components/base/kinematicbase/ptgKinematics.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ type ptgBaseKinematics struct {
4242
inputLock sync.RWMutex
4343
currentInput []referenceframe.Input
4444
origin spatialmath.Pose
45+
geometries []spatialmath.Geometry
4546
}
4647

4748
// wrapWithPTGKinematics takes a Base component and adds a PTG kinematic model so that it can be controlled.
@@ -75,8 +76,9 @@ func wrapWithPTGKinematics(
7576
}
7677

7778
geometries, err := b.Geometries(ctx, nil)
78-
if err != nil {
79-
return nil, err
79+
if len(geometries) == 0 || err != nil {
80+
logger.CWarn(ctx, "base %s not configured with a geometry, will be considered a point mass for collision detection purposes.")
81+
geometries = []spatialmath.Geometry{spatialmath.NewPoint(r3.Vector{}, b.Name().Name)}
8082
}
8183

8284
frame, err := tpspace.NewPTGFrameFromKinematicOptions(
@@ -115,6 +117,7 @@ func wrapWithPTGKinematics(
115117
ptgs: ptgs,
116118
currentInput: zeroInput,
117119
origin: origin,
120+
geometries: geometries,
118121
}, nil
119122
}
120123

@@ -243,3 +246,7 @@ func (ptgk *ptgBaseKinematics) ErrorState(ctx context.Context, plan [][]referenc
243246

244247
return spatialmath.PoseBetween(nominalPose, actualPIF), nil
245248
}
249+
250+
func (ptgk *ptgBaseKinematics) Geometries(ctx context.Context, extra map[string]interface{}) ([]spatialmath.Geometry, error) {
251+
return ptgk.geometries, nil
252+
}

0 commit comments

Comments
 (0)