Skip to content

Commit f53ce45

Browse files
committed
using name instead of shortname
1 parent 63ea431 commit f53ce45

File tree

7 files changed

+45
-45
lines changed

7 files changed

+45
-45
lines changed

cli/motion.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ func motionPrintStatusAction(c *cli.Context, args motionPrintArgs) error {
109109
continue
110110
}
111111

112-
pif, err := myMotion.GetPose(ctx, theComponent.Name().ShortName(), "world", nil, nil)
112+
pif, err := myMotion.GetPose(ctx, theComponent.Name().Name, "world", nil, nil)
113113
if err != nil {
114114
return err
115115
}
116116

117-
printf(c.App.Writer, "%20s : %v", theComponent.Name().ShortName(), prettyString(pif.Pose()))
117+
printf(c.App.Writer, "%20s : %v", theComponent.Name().Name, prettyString(pif.Pose()))
118118
}
119119

120120
return nil
@@ -165,7 +165,7 @@ func motionGetPoseAction(c *cli.Context, args motionGetPoseArgs) error {
165165
return fmt.Errorf("no motion: %w", err)
166166
}
167167

168-
pif, err := myMotion.GetPose(ctx, theComponent.Name().ShortName(), "world", nil, nil)
168+
pif, err := myMotion.GetPose(ctx, theComponent.Name().Name, "world", nil, nil)
169169
if err != nil {
170170
return err
171171
}
@@ -222,7 +222,7 @@ func motionSetPoseAction(c *cli.Context, args motionSetPoseArgs) error {
222222
return fmt.Errorf("no motion: %w", err)
223223
}
224224

225-
pose, err := myMotion.GetPose(ctx, theComponent.Name().ShortName(), "world", nil, nil)
225+
pose, err := myMotion.GetPose(ctx, theComponent.Name().Name, "world", nil, nil)
226226
if err != nil {
227227
return err
228228
}
@@ -260,7 +260,7 @@ func motionSetPoseAction(c *cli.Context, args motionSetPoseArgs) error {
260260
printf(c.App.Writer, "going to pose %v", pose)
261261

262262
req := motion.MoveReq{
263-
ComponentName: theComponent.Name().ShortName(),
263+
ComponentName: theComponent.Name().Name,
264264
Destination: pose,
265265
}
266266
_, err = myMotion.Move(ctx, req)

services/motion/builtin/builtin.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,13 @@ func (ms *builtIn) Reconfigure(
194194
case framesystem.Service:
195195
ms.fsService = dep
196196
case movementsensor.MovementSensor:
197-
movementSensors[name.ShortName()] = dep
197+
movementSensors[name.Name] = dep
198198
case slam.Service:
199-
slamServices[name.ShortName()] = dep
199+
slamServices[name.Name] = dep
200200
case vision.Service:
201-
visionServices[name.ShortName()] = dep
201+
visionServices[name.Name] = dep
202202
default:
203-
componentMap[name.ShortName()] = dep
203+
componentMap[name.Name] = dep
204204
}
205205
}
206206
ms.movementSensors = movementSensors

services/motion/builtin/builtin_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -661,9 +661,9 @@ func TestStoppableMoveFunctions(t *testing.T) {
661661
}
662662

663663
req := motion.MoveOnGlobeReq{
664-
ComponentName: injectBase.Name().ShortName(),
664+
ComponentName: injectBase.Name().Name,
665665
Destination: goal,
666-
MovementSensorName: injectMovementSensor.Name().ShortName(),
666+
MovementSensorName: injectMovementSensor.Name().Name,
667667
MotionCfg: &motionCfg,
668668
Extra: extra,
669669
}
@@ -713,9 +713,9 @@ func TestStoppableMoveFunctions(t *testing.T) {
713713

714714
goal := spatialmath.NewPoseFromPoint(r3.Vector{X: 0, Y: 500})
715715
req := motion.MoveOnMapReq{
716-
ComponentName: injectBase.Name().ShortName(),
716+
ComponentName: injectBase.Name().Name,
717717
Destination: goal,
718-
SlamName: injectSlam.Name().ShortName(),
718+
SlamName: injectSlam.Name().Name,
719719
MotionCfg: &motion.MotionConfiguration{
720720
PlanDeviationMM: 0.2,
721721
},
@@ -767,9 +767,9 @@ func TestStoppableMoveFunctions(t *testing.T) {
767767
ms.(*builtIn).fsService = fsSvc
768768

769769
req := motion.MoveOnMapReq{
770-
ComponentName: injectBase.Name().ShortName(),
770+
ComponentName: injectBase.Name().Name,
771771
Destination: spatialmath.NewPoseFromPoint(r3.Vector{X: 0, Y: 500}),
772-
SlamName: injectSlam.Name().ShortName(),
772+
SlamName: injectSlam.Name().Name,
773773
MotionCfg: &motion.MotionConfiguration{
774774
PlanDeviationMM: 1,
775775
},
@@ -885,7 +885,7 @@ func TestGetTransientDetectionsMath(t *testing.T) {
885885
moveReq := motion.MoveOnGlobeReq{
886886
ComponentName: "test-base",
887887
Destination: destinationGeoPose.Location(),
888-
MovementSensorName: moveSensor.Name().ShortName(),
888+
MovementSensorName: moveSensor.Name().Name,
889889
MotionCfg: &motion.MotionConfiguration{
890890
PlanDeviationMM: 1,
891891
ObstacleDetectors: []motion.ObstacleDetectorName{
@@ -1057,9 +1057,9 @@ func TestCheckPlan(t *testing.T) {
10571057
test.That(t, ok, test.ShouldBeTrue)
10581058

10591059
req := motion.MoveOnGlobeReq{
1060-
ComponentName: fakeBase.Name().ShortName(),
1060+
ComponentName: fakeBase.Name().Name,
10611061
Destination: dst,
1062-
MovementSensorName: movementSensor.Name().ShortName(),
1062+
MovementSensorName: movementSensor.Name().Name,
10631063
}
10641064

10651065
// construct move request

services/motion/builtin/move_on_map_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ func TestMoveOnMapStaticObs(t *testing.T) {
200200
goal := spatialmath.NewPoseFromPoint(r3.Vector{X: 0.6556e3, Y: 0.64152e3})
201201

202202
req := motion.MoveOnMapReq{
203-
ComponentName: injectBase.Name().ShortName(),
203+
ComponentName: injectBase.Name().Name,
204204
Destination: goal,
205-
SlamName: injectSlam.Name().ShortName(),
205+
SlamName: injectSlam.Name().Name,
206206
MotionCfg: &motion.MotionConfiguration{PlanDeviationMM: 0.01},
207207
Extra: extra,
208208
}

services/motion/server_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,10 @@ func TestServerMoveOnGlobe(t *testing.T) {
259259
test.That(t, *req.MotionCfg.ObstaclePollingFreqHz, test.ShouldAlmostEqual, obstaclePollingFrequencyHz)
260260
test.That(t, *req.MotionCfg.PositionPollingFreqHz, test.ShouldAlmostEqual, positionPollingFrequencyHz)
261261
test.That(t, len(req.MotionCfg.ObstacleDetectors), test.ShouldAlmostEqual, 2)
262-
test.That(t, req.MotionCfg.ObstacleDetectors[0].VisionServiceName, test.ShouldResemble, vision.Named("vision service 1").ShortName())
263-
test.That(t, req.MotionCfg.ObstacleDetectors[0].CameraName, test.ShouldResemble, camera.Named("camera 1").ShortName())
264-
test.That(t, req.MotionCfg.ObstacleDetectors[1].VisionServiceName, test.ShouldResemble, vision.Named("vision service 2").ShortName())
265-
test.That(t, req.MotionCfg.ObstacleDetectors[1].CameraName, test.ShouldResemble, camera.Named("camera 2").ShortName())
262+
test.That(t, req.MotionCfg.ObstacleDetectors[0].VisionServiceName, test.ShouldResemble, vision.Named("vision service 1").Name)
263+
test.That(t, req.MotionCfg.ObstacleDetectors[0].CameraName, test.ShouldResemble, camera.Named("camera 1").Name)
264+
test.That(t, req.MotionCfg.ObstacleDetectors[1].VisionServiceName, test.ShouldResemble, vision.Named("vision service 2").Name)
265+
test.That(t, req.MotionCfg.ObstacleDetectors[1].CameraName, test.ShouldResemble, camera.Named("camera 2").Name)
266266
test.That(t, len(req.BoundingRegions), test.ShouldEqual, 1)
267267
test.That(t, req.BoundingRegions[0], test.ShouldResemble, geoGeometry3)
268268
return firstExecutionID, nil
@@ -389,10 +389,10 @@ func TestServerMoveOnMap(t *testing.T) {
389389
test.That(t, *req.MotionCfg.ObstaclePollingFreqHz, test.ShouldAlmostEqual, obstaclePollingFrequencyHz)
390390
test.That(t, *req.MotionCfg.PositionPollingFreqHz, test.ShouldAlmostEqual, positionPollingFrequencyHz)
391391
test.That(t, len(req.MotionCfg.ObstacleDetectors), test.ShouldAlmostEqual, 2)
392-
test.That(t, req.MotionCfg.ObstacleDetectors[0].VisionServiceName, test.ShouldResemble, vision.Named("vision service 1").ShortName())
393-
test.That(t, req.MotionCfg.ObstacleDetectors[0].CameraName, test.ShouldResemble, camera.Named("camera 1").ShortName())
394-
test.That(t, req.MotionCfg.ObstacleDetectors[1].VisionServiceName, test.ShouldResemble, vision.Named("vision service 2").ShortName())
395-
test.That(t, req.MotionCfg.ObstacleDetectors[1].CameraName, test.ShouldResemble, camera.Named("camera 2").ShortName())
392+
test.That(t, req.MotionCfg.ObstacleDetectors[0].VisionServiceName, test.ShouldResemble, vision.Named("vision service 1").Name)
393+
test.That(t, req.MotionCfg.ObstacleDetectors[0].CameraName, test.ShouldResemble, camera.Named("camera 1").Name)
394+
test.That(t, req.MotionCfg.ObstacleDetectors[1].VisionServiceName, test.ShouldResemble, vision.Named("vision service 2").Name)
395+
test.That(t, req.MotionCfg.ObstacleDetectors[1].CameraName, test.ShouldResemble, camera.Named("camera 2").Name)
396396
return firstExecutionID, nil
397397
}
398398
moveOnMapResponse, err := server.MoveOnMap(context.Background(), moveOnMapRequest)

services/navigation/builtin/builtin.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,9 @@ func (svc *builtIn) Reconfigure(ctx context.Context, deps resource.Dependencies,
351351
return err
352352
}
353353
obstacleDetectorNamePairs = append(obstacleDetectorNamePairs, motion.ObstacleDetectorName{
354-
VisionServiceName: visionSvc.Name().ShortName(), CameraName: camera.Name().ShortName(),
354+
VisionServiceName: visionSvc.Name().Name, CameraName: camera.Name().Name,
355355
})
356-
visionServicesByName[visionSvc.Name().ShortName()] = visionSvc
356+
visionServicesByName[visionSvc.Name().Name] = visionSvc
357357
}
358358

359359
// Parse movement sensor from the configuration if map type is GPS
@@ -544,10 +544,10 @@ func (svc *builtIn) Close(ctx context.Context) error {
544544

545545
func (svc *builtIn) moveToWaypoint(ctx context.Context, wp navigation.Waypoint, extra map[string]interface{}) error {
546546
req := motion.MoveOnGlobeReq{
547-
ComponentName: svc.base.Name().ShortName(),
547+
ComponentName: svc.base.Name().Name,
548548
Destination: wp.ToPoint(),
549549
Heading: math.NaN(),
550-
MovementSensorName: svc.movementSensor.Name().ShortName(),
550+
MovementSensorName: svc.movementSensor.Name().Name,
551551
Obstacles: svc.obstacles,
552552
MotionCfg: svc.motionCfg,
553553
BoundingRegions: svc.boundingRegions,
@@ -687,7 +687,7 @@ func (svc *builtIn) Obstacles(ctx context.Context, extra map[string]interface{})
687687
svc.logger.CDebugf(
688688
ctx,
689689
"we assume the movementsensor named: %s is coincident with the camera named: %s due to err: %v",
690-
svc.movementSensor.Name().ShortName(), detector.CameraName, err.Error(),
690+
svc.movementSensor.Name().Name, detector.CameraName, err.Error(),
691691
)
692692
cameraToMovementsensor = movementsensorOrigin
693693
}
@@ -822,7 +822,7 @@ func (svc *builtIn) Paths(ctx context.Context, extra map[string]interface{}) ([]
822822
}
823823

824824
ph, err := svc.motionService.PlanHistory(ctx, motion.PlanHistoryReq{
825-
ComponentName: svc.base.Name().ShortName(),
825+
ComponentName: svc.base.Name().Name,
826826
ExecutionID: ewp.executionID,
827827
LastPlanOnly: true,
828828
})

services/navigation/builtin/builtin_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,9 @@ func TestStartWaypoint(t *testing.T) {
981981
if len(s.sprs) == 2 {
982982
// MoveOnGlobe was called twice, once for each waypoint
983983
test.That(t, len(s.mogrs), test.ShouldEqual, 2)
984-
test.That(t, s.mogrs[0].ComponentName, test.ShouldResemble, s.base.Name().ShortName())
984+
test.That(t, s.mogrs[0].ComponentName, test.ShouldResemble, s.base.Name().Name)
985985
test.That(t, math.IsNaN(s.mogrs[0].Heading), test.ShouldBeTrue)
986-
test.That(t, s.mogrs[0].MovementSensorName, test.ShouldResemble, s.movementSensor.Name().ShortName())
986+
test.That(t, s.mogrs[0].MovementSensorName, test.ShouldResemble, s.movementSensor.Name().Name)
987987

988988
test.That(t, s.mogrs[0].Extra, test.ShouldResemble, map[string]interface{}{
989989
"motion_profile": "position_only",
@@ -993,9 +993,9 @@ func TestStartWaypoint(t *testing.T) {
993993
// waypoint 1
994994
test.That(t, s.mogrs[0].Destination, test.ShouldResemble, pt1)
995995

996-
test.That(t, s.mogrs[1].ComponentName, test.ShouldResemble, s.base.Name().ShortName())
996+
test.That(t, s.mogrs[1].ComponentName, test.ShouldResemble, s.base.Name().Name)
997997
test.That(t, math.IsNaN(s.mogrs[1].Heading), test.ShouldBeTrue)
998-
test.That(t, s.mogrs[1].MovementSensorName, test.ShouldResemble, s.movementSensor.Name().ShortName())
998+
test.That(t, s.mogrs[1].MovementSensorName, test.ShouldResemble, s.movementSensor.Name().Name)
999999
test.That(t, s.mogrs[1].Extra, test.ShouldResemble, map[string]interface{}{
10001000
"motion_profile": "position_only",
10011001
})
@@ -1005,11 +1005,11 @@ func TestStartWaypoint(t *testing.T) {
10051005
test.That(t, s.mogrs[1].Destination, test.ShouldResemble, pt2)
10061006

10071007
// PlanStop called twice, once for each waypoint
1008-
test.That(t, s.sprs[0].ComponentName, test.ShouldResemble, s.base.Name().ShortName())
1009-
test.That(t, s.sprs[1].ComponentName, test.ShouldResemble, s.base.Name().ShortName())
1008+
test.That(t, s.sprs[0].ComponentName, test.ShouldResemble, s.base.Name().Name)
1009+
test.That(t, s.sprs[1].ComponentName, test.ShouldResemble, s.base.Name().Name)
10101010

10111011
// Motion reports that the last execution succeeded
1012-
ph, err := s.injectMS.PlanHistory(ctx, motion.PlanHistoryReq{ComponentName: s.base.Name().ShortName()})
1012+
ph, err := s.injectMS.PlanHistory(ctx, motion.PlanHistoryReq{ComponentName: s.base.Name().Name})
10131013
test.That(t, err, test.ShouldBeNil)
10141014
test.That(t, len(ph), test.ShouldEqual, 1)
10151015
test.That(t, ph[0].Plan.ExecutionID, test.ShouldResemble, executionIDs[1])
@@ -1256,7 +1256,7 @@ func TestStartWaypoint(t *testing.T) {
12561256
test.That(t, s.mogrs[4].Destination, test.ShouldResemble, pt1)
12571257

12581258
// Motion reports that the last execution succeeded
1259-
ph, err := s.injectMS.PlanHistory(ctx, motion.PlanHistoryReq{ComponentName: s.base.Name().ShortName()})
1259+
ph, err := s.injectMS.PlanHistory(ctx, motion.PlanHistoryReq{ComponentName: s.base.Name().Name})
12601260
test.That(t, err, test.ShouldBeNil)
12611261
test.That(t, len(ph), test.ShouldEqual, 1)
12621262
test.That(t, ph[0].Plan.ExecutionID, test.ShouldResemble, executionIDs[2])
@@ -1389,7 +1389,7 @@ func TestStartWaypoint(t *testing.T) {
13891389
test.That(t, wpAfter, test.ShouldResemble, wpBefore)
13901390

13911391
// check the last state of the execution
1392-
ph, err := s.injectMS.PlanHistory(ctx, motion.PlanHistoryReq{ComponentName: s.base.Name().ShortName()})
1392+
ph, err := s.injectMS.PlanHistory(ctx, motion.PlanHistoryReq{ComponentName: s.base.Name().Name})
13931393
test.That(t, err, test.ShouldBeNil)
13941394
test.That(t, len(ph), test.ShouldEqual, 1)
13951395
test.That(t, len(ph[0].StatusHistory), test.ShouldEqual, 2)
@@ -1521,7 +1521,7 @@ func TestStartWaypoint(t *testing.T) {
15211521
// Motion reports that the last execution succeeded
15221522
s.RUnlock()
15231523

1524-
ph, err := s.injectMS.PlanHistory(ctx, motion.PlanHistoryReq{ComponentName: s.base.Name().ShortName()})
1524+
ph, err := s.injectMS.PlanHistory(ctx, motion.PlanHistoryReq{ComponentName: s.base.Name().Name})
15251525
test.That(t, err, test.ShouldBeNil)
15261526
test.That(t, len(ph), test.ShouldEqual, 1)
15271527
test.That(t, ph[0].Plan.ExecutionID, test.ShouldResemble, executionIDs[1])
@@ -1650,7 +1650,7 @@ func TestStartWaypoint(t *testing.T) {
16501650
// Motion reports that the last execution succeeded
16511651
s.RUnlock()
16521652

1653-
ph, err := s.injectMS.PlanHistory(ctx, motion.PlanHistoryReq{ComponentName: s.base.Name().ShortName()})
1653+
ph, err := s.injectMS.PlanHistory(ctx, motion.PlanHistoryReq{ComponentName: s.base.Name().Name})
16541654
test.That(t, err, test.ShouldBeNil)
16551655
test.That(t, len(ph), test.ShouldEqual, 1)
16561656
test.That(t, ph[0].Plan.ExecutionID, test.ShouldResemble, executionIDs[0])

0 commit comments

Comments
 (0)