-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RSDK-3950 - call into cgo for getPosition #188
RSDK-3950 - call into cgo for getPosition #188
Conversation
viam-cartographer_internal_test.go
Outdated
var inputPose commonv1.Pose | ||
var inputQuat map[string]interface{} | ||
|
||
t.Run("successful client", func(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the client? Can we just remove this t.Run so the rest of them are at the top level?
viam-cartographer_internal_test.go
Outdated
test.That(t, pose, test.ShouldResemble, expectedPose) | ||
}) | ||
|
||
t.Run("non origin pose success", func(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we test the error case please?
viam-cartographer_internal_test.go
Outdated
@@ -243,6 +244,75 @@ func TestGetPositionEndpoint(t *testing.T) { | |||
}) | |||
} | |||
|
|||
//nolint:dupl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this still necessary if we remove 257?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With 257 removed, I still get: 284-310 lines are duplicate of viam-cartographer_internal_test.go:256-282
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please refactor it to not hit this lint rule by making a helper function?
func (cartoSvc *cartographerService) getPositionModularizationV2(ctx context.Context) (spatialmath.Pose, string, error) { | ||
pos, err := cartoSvc.cartofacade.GetPosition(ctx, cartoSvc.cartoFacadeTimeout) | ||
if err != nil { | ||
return nil, "", err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we please test this error case?
viam-cartographer_internal_test.go
Outdated
|
||
inputPose = commonv1.Pose{X: 0, Y: 0, Z: 0, OX: 0, OY: 0, OZ: 1, Theta: 0} | ||
inputQuat = map[string]interface{}{"real": 1.0, "imag": 0.0, "jmag": 0.0, "kmag": 0.0} | ||
pose, _, err := svc.GetPosition(context.Background()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we not testing the component reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add that back in, I got confused about using this after some of the changes from component reference to sensors[0], but this will still be needed after full mod in the case of multiple sensors, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes correct
viam-cartographer_internal_test.go
Outdated
|
||
inputPose = commonv1.Pose{X: 5, Y: 5, Z: 5, OX: 0, OY: 0, OZ: 1, Theta: 0} | ||
inputQuat = map[string]interface{}{"real": 1.0, "imag": 1.0, "jmag": 0.0, "kmag": 0.0} | ||
pose, _, err := svc.GetPosition(context.Background()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we not testing the component reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -243,6 +244,73 @@ func TestGetPositionEndpoint(t *testing.T) { | |||
}) | |||
} | |||
|
|||
//nolint:dupl | |||
func TestGetPositionModularizationV2Endpoint(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a test for "empty component reference success"
viam-cartographer_internal_test.go
Outdated
|
||
inputPose = commonv1.Pose{X: 0, Y: 0, Z: 0, OX: 0, OY: 0, OZ: 1, Theta: 0} | ||
inputQuat = map[string]interface{}{"real": 1.0, "imag": 0.0, "jmag": 0.0, "kmag": 0.0} | ||
pose, _, err := svc.GetPosition(context.Background()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we not testing the component reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
RSDK-3950