Skip to content
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-6631 - Change RC card to use MoveOnMap typescript SDK wrapper #3574

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 0 additions & 73 deletions web/frontend/src/api/motion.ts

This file was deleted.

19 changes: 13 additions & 6 deletions web/frontend/src/components/slam/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
import { SlamMap2D } from '@viamrobotics/prime-blocks';
import { copyToClipboard } from '@/lib/copy-to-clipboard';
import { filterSubtype } from '@/lib/resource';
import { moveOnMap } from '@/api/motion';
import { notify } from '@viamrobotics/prime';
import { setAsyncInterval } from '@/lib/schedule';
import { components, services } from '@/stores/resources';
Expand Down Expand Up @@ -298,13 +297,21 @@ const toggleAxes = () => {

const handleMoveClick = async () => {
try {
// set pose in frame
const lastPose = await slamClient.getPosition();
nicksanford marked this conversation as resolved.
Show resolved Hide resolved
const destinationMM = lastPose.pose!;
destinationMM.x = destination!.x * 1000;
destinationMM.y = destination!.y * 1000;
const base = bases[0]!;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[minor stuff] Could we change this to be a little more defensive? In general, we should avoid using the assertion operator ! (in App we have linters against this) because it's unsafe. Maybe we could use the nullish coalescing operator ?? to provide a reasonable default? Or return and display an error?

await moveOnMap(
$robotClient,
slamResourceName,
await motionClient.moveOnMap(
destinationMM,
base,
destination!.x,
destination!.y
slamResourceName,
// obstacleDetectorsList is specified to work around this bug: RSDK-6632
// when that ticket is resolved we should delete the empty obstacleDetectorsList
// parameter
{ planDeviationM: 0.5, obstacleDetectorsList: [] },
{ motion_profile: 'position_only' }
);
await refreshPaths();
} catch (error) {
Expand Down
Loading