Skip to content

Commit e104461

Browse files
committed
fix bugs in old Move() sample
1 parent 16dc011 commit e104461

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

services/motion/motion.go

+17-17
Original file line numberDiff line numberDiff line change
@@ -195,26 +195,26 @@ type PlanWithStatus struct {
195195
// // Assumes a gripper configured with name "my_gripper" on the machine
196196
// gripperName := gripper.Named("my_gripper")
197197
//
198-
// // Add a table obstacle to a WorldState
199-
// obstacles := []spatialmath.Geometry{
200-
// spatialmath.NewBox(
201-
// spatialmath.NewPose(r3.Vector{X: 0.0, Y: 0.0, Z: -19.0}, &spatialmath.OrientationVectorDegrees{0X: 0.0, 0Y: 0.0, 0Z: 1.0, Theta: 0.0}),
202-
// r3.Vector{X: 2000.0, Y: 2000.0, Z: 38.0},
203-
// "table",
204-
// ),
205-
// }
198+
// // Define destination
199+
// destination := referenceframe.NewPoseInFrame("world", spatialmath.NewPoseFromPoint(r3.Vector{X: 0.1, Y: 0.0, Z: 0.0})) // 10 cm in X direction
206200
//
207-
// // Create a WorldState that has geometries included
208-
// worldState := &referenceframe.WorldState{
209-
// Obstacles: []*referenceframe.GeometriesInFrame{
210-
// referenceframe.NewGeometriesInFrame(referenceframe.World, obstacles),
211-
// },
212-
// }
201+
// // Create obstacles
202+
// boxPose := spatialmath.NewPoseFromPoint(r3.Vector{X: 0.0, Y: 0.0, Z: 0.0})
203+
// boxDims := r3.Vector{X: 0.2, Y: 0.2, Z: 0.2} // 20cm x 20cm x 20cm box
204+
// obstacle, _ := spatialmath.NewBox(boxPose, boxDims, "obstacle_1")
213205
//
214-
// goalPose := referenceframe.NewPoseInFrame("my_gripper", spatialmath.NewPoseFromPoint(r3.Vector{X:-3, Y:0.5}))
206+
// geometryInFrame := referenceframe.NewGeometriesInFrame("base", []spatialmath.Geometry{obstacle})
207+
// obstacles := []*referenceframe.GeometriesInFrame{geometryInFrame}
215208
//
216-
// // Move the gripper
217-
// moved, err := motionService.Move(context.Background(), gripperName, goalPose, worldState, nil, nil)
209+
// // Create transforms
210+
// transform := referenceframe.NewLinkInFrame("gripper", spatialmath.NewPoseFromPoint(r3.Vector{X: 0.1, Y: 0.0, Z: 0.1}), "transform_1", nil)
211+
// transforms := []*referenceframe.LinkInFrame{transform}
212+
//
213+
// // Create a WorldState
214+
// worldState, err := referenceframe.NewWorldState(obstacles, transforms)
215+
//
216+
// // Move gripper component
217+
// moved, err := motionService.Move(context.Background(), gripperName, destination, worldState, nil, nil)
218218
//
219219
// MoveOnMap example:
220220
//

0 commit comments

Comments
 (0)