Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-mishra committed Jul 11, 2023
1 parent 05d6255 commit d28e78e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
9 changes: 8 additions & 1 deletion viam-cartographer.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,14 @@ func (cartoSvc *cartographerService) getPositionModularizationV2(ctx context.Con
}

pose := spatialmath.NewPoseFromPoint(r3.Vector{X: pos.X, Y: pos.Y, Z: pos.Z})
returnedExt := map[string]interface{}{"quat": map[string]interface{}{"real": pos.Real, "imag": pos.Imag, "jmag": pos.Jmag, "kmag": pos.Kmag}}
returnedExt := map[string]interface{}{
"quat": map[string]interface{}{
"real": pos.Real,
"imag": pos.Imag,
"jmag": pos.Jmag,
"kmag": pos.Kmag,
},
}
return vcUtils.CheckQuaternionFromClientAlgo(pose, cartoSvc.primarySensorName, returnedExt)
}

Expand Down
24 changes: 21 additions & 3 deletions viam-cartographer_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ func TestGetPositionEndpoint(t *testing.T) {
})
}

//nolint:dupl
func TestGetPositionModularizationV2Endpoint(t *testing.T) {
svc := &cartographerService{Named: resource.NewName(slam.API, "test").AsNamed()}
mockCartoFacade := &cartofacade.Mock{}
Expand All @@ -254,13 +255,21 @@ func TestGetPositionModularizationV2Endpoint(t *testing.T) {
var inputQuat map[string]interface{}

t.Run("successful client", func(t *testing.T) {

t.Run("origin pose success", func(t *testing.T) {
mockCartoFacade.GetPositionFunc = func(
ctx context.Context,
timeout time.Duration,
) (cartofacade.GetPosition, error) {
return cartofacade.GetPosition{X: 0, Y: 0, Z: 0, Real: 1.0, Imag: 0.0, Jmag: 0.0, Kmag: 0.0}, nil
return cartofacade.GetPosition{
X: 0,
Y: 0,
Z: 0,
Real: 1.0,
Imag: 0.0,
Jmag: 0.0,
Kmag: 0.0,
},
nil
}

inputPose = commonv1.Pose{X: 0, Y: 0, Z: 0, OX: 0, OY: 0, OZ: 1, Theta: 0}
Expand All @@ -279,7 +288,16 @@ func TestGetPositionModularizationV2Endpoint(t *testing.T) {
ctx context.Context,
timeout time.Duration,
) (cartofacade.GetPosition, error) {
return cartofacade.GetPosition{X: 5, Y: 5, Z: 5, Real: 1.0, Imag: 1.0, Jmag: 0.0, Kmag: 0.0}, nil
return cartofacade.GetPosition{
X: 5,
Y: 5,
Z: 5,
Real: 1.0,
Imag: 1.0,
Jmag: 0.0,
Kmag: 0.0,
},
nil
}

inputPose = commonv1.Pose{X: 5, Y: 5, Z: 5, OX: 0, OY: 0, OZ: 1, Theta: 0}
Expand Down

0 comments on commit d28e78e

Please sign in to comment.