-
Notifications
You must be signed in to change notification settings - Fork 113
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-2821 Update Frontend SLAM 2D View to XY Plane #2269
Changes from 11 commits
799df92
3744116
f324a15
e301f0e
e082468
743efeb
0578484
d063dfe
245052c
e90d9e0
14eac46
03e85d6
9b1a76b
0ad97cc
d884197
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,8 +32,8 @@ func TestFakeSLAMGetPosition(t *testing.T) { | |
// in floating point values between M1 mac & arm64 linux which | ||
// were causing tests to pass on M1 mac but fail on ci. | ||
expectedPose := spatialmath.NewPose( | ||
r3.Vector{X: -0.005666600181385561, Y: -6.933830159344678e-10, Z: -0.013030459250151614}, | ||
&spatialmath.Quaternion{Real: 0.9999999087728241, Imag: 0, Jmag: 0.0005374749356603168, Kmag: 0}) | ||
r3.Vector{X: -0.005839621552532072747133, Y: 0.012640521020122929413132, Z: 0.000000000000000000}, | ||
&spatialmath.Quaternion{Real: 0.9999998930633826, Imag: 0, Jmag: 0, Kmag: -0.000462464294427742}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this definitely the actual orientation you want? It is sooooo close to (1,0,0,0) in which case you could just use NewPoseFromPoint and leave off the quaternion entirely. My guess is that PoseAlmostEqual will still be true There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer to keep the explicit definitions because the test is loading the first pointcloud and in future datasets this first pointcloud may include some small degree of rotation and this will be easier to update with new datasets if we leave these written out in longhand. @nicksanford @EshaMaharishi I'd like to hear your thoughts on this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO this test should break if we change the test dataset. I think it should reflect the dataset's actual value, i.e. what you already have @jeremyrhyde. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be clear; Totally optional change though. |
||
test.That(t, spatialmath.PoseAlmostEqual(p, expectedPose), test.ShouldBeTrue) | ||
|
||
p2, componentReference, err := slamSvc.GetPosition(context.Background()) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,7 @@ raycaster.on('click', (event) => { | |
|
||
const markerSize = 0.5; | ||
const marker = new THREE.Mesh( | ||
new THREE.PlaneGeometry(markerSize, markerSize).rotateX(-Math.PI / 2), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [note] default plane is XY so a rotation here is no longer necessary |
||
new THREE.PlaneGeometry(markerSize, markerSize), | ||
new THREE.MeshBasicMaterial({ color: 'red' }) | ||
); | ||
marker.name = 'Marker'; | ||
|
@@ -124,9 +124,9 @@ const updateCloud = (pointcloud: Uint8Array) => { | |
const points = loader.parse(pointcloud.buffer); | ||
points.geometry.computeBoundingSphere(); | ||
|
||
const { radius = 1, center = { x: 0, z: 0 } } = points.geometry.boundingSphere ?? {}; | ||
camera.position.set(center.x, 100, center.z); | ||
camera.lookAt(center.x, 0, center.z); | ||
const { radius = 1, center = { x: 0, y: 0 } } = points.geometry.boundingSphere ?? {}; | ||
camera.position.set(center.x, center.y, 100); | ||
camera.lookAt(center.x, center.y, 0); | ||
|
||
const aspect = canvas.clientHeight / canvas.clientWidth; | ||
camera.zoom = aspect > 1 | ||
|
@@ -135,16 +135,16 @@ const updateCloud = (pointcloud: Uint8Array) => { | |
|
||
camera.updateProjectionMatrix(); | ||
|
||
controls.target.set(center.x, 0, center.z); | ||
controls.target.set(center.x, center.y, 0); | ||
controls.maxZoom = radius * 2; | ||
|
||
const intersectionPlane = new THREE.Mesh( | ||
new THREE.PlaneGeometry(radius * 2, radius * 2, 1, 1).rotateX(-Math.PI / 2), | ||
new MeshDiscardMaterial() | ||
); | ||
intersectionPlane.name = 'Intersection Plane'; | ||
intersectionPlane.position.y = -1; | ||
intersectionPlane.position.set(center.x, 0, center.z); | ||
intersectionPlane.position.z = -1; | ||
intersectionPlane.position.set(center.x, center.y, 0); | ||
raycaster.objects = [intersectionPlane]; | ||
|
||
const colors = points.geometry.attributes.color; | ||
|
@@ -168,9 +168,9 @@ const updateCloud = (pointcloud: Uint8Array) => { | |
|
||
const updatePose = (newPose: commonApi.Pose) => { | ||
const x = newPose.getX(); | ||
const z = newPose.getZ(); | ||
const y = newPose.getY(); | ||
marker.position.setX(x); | ||
marker.position.setZ(z); | ||
marker.position.setY(y); | ||
}; | ||
|
||
onMounted(() => { | ||
|
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.
[note] I've left the old artifacts in for the present. I am planning to remove them after we've stabilized the frontend view but can delete them now if desired. Comment here if you'd like me to remove them now.
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'm trusting that this dataset will be regenerated from the final version of viam-modules/viam-cartographer#59 once that viam-cartographer PR is is merged, before this PR is merged.