@@ -240,46 +240,23 @@ func (ms *builtIn) Move(
240
240
return true , nil
241
241
}
242
242
243
- // MoveOnMap will move the given component to the given destination on the slam map generated from a slam service specified by slamName.
244
- // Bases are the only component that supports this.
245
- func (ms * builtIn ) MoveOnMap (
246
- ctx context.Context ,
247
- componentName resource.Name ,
248
- destination spatialmath.Pose ,
249
- slamName resource.Name ,
250
- extra map [string ]interface {},
251
- ) (bool , error ) {
243
+ func (ms * builtIn ) MoveOnMap (ctx context.Context , req motion.MoveOnMapReq ) (motion.ExecutionID , error ) {
244
+ if err := ctx .Err (); err != nil {
245
+ return uuid .Nil , err
246
+ }
252
247
ms .mu .RLock ()
253
248
defer ms .mu .RUnlock ()
249
+ ms .logger .CDebugf (ctx , "MoveOnMap called with %s" , req )
250
+
251
+ // TODO: Deprecated: remove once no motion apis use the opid system
254
252
operation .CancelOtherWithLabel (ctx , builtinOpLabel )
255
- // make call to motionplan
256
- mr , err := ms .newMoveOnMapRequest (ctx , motion.MoveOnMapReq {
257
- ComponentName : componentName ,
258
- Destination : destination ,
259
- SlamName : slamName ,
260
- Extra : extra ,
261
- }, nil , defaultMaxReplans )
262
- if err != nil {
263
- return false , fmt .Errorf ("error making plan for MoveOnMap: %w" , err )
264
- }
265
253
266
- planResp , err := mr .Plan (ctx )
267
- if err != nil {
268
- return false , err
269
- }
270
- resp , err := mr .Execute (ctx , planResp .Waypoints )
271
- // Error
254
+ id , err := state .StartExecution (ctx , ms .state , req .ComponentName , req , ms .newMoveOnMapRequest )
272
255
if err != nil {
273
- return false , err
256
+ return uuid . Nil , err
274
257
}
275
258
276
- // Didn't reach goal
277
- if resp .Replan {
278
- ms .logger .CWarnf (ctx , "didn't reach the goal. Reason: %s\n " , resp .ReplanReason )
279
- return false , nil
280
- }
281
- // Reached goal
282
- return true , nil
259
+ return id , nil
283
260
}
284
261
285
262
func (ms * builtIn ) MoveOnMapNew (ctx context.Context , req motion.MoveOnMapReq ) (motion.ExecutionID , error ) {
0 commit comments