Skip to content

DOCS-3552: Add SLAM examples #528

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

Merged
merged 2 commits into from
Apr 8, 2025
Merged
Changes from all 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
49 changes: 47 additions & 2 deletions src/services/slam/slam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,63 @@ export interface Slam extends Resource {
/**
* Get the current position of the specified source component in the point
* cloud SLAM map.
*
* @example
*
* ```ts
* const slam = new VIAM.SlamClient(machine, 'my_slam');
*
* // Get the current position of the robot in the SLAM map
* const position = await slam.getPosition();
* console.log('Current position:', position);
* ```
*/
getPosition: () => Promise<SlamPosition>;

/** Get the point cloud SLAM map. */
/**
* Get the point cloud SLAM map.
*
* @example
*
* ```ts
* const slam = new VIAM.SlamClient(machine, 'my_slam');
*
* // Get the point cloud map
* const pointCloudMap = await slam.getPointCloudMap();
*
* // Get the edited point cloud map
* const editedMap = await slam.getPointCloudMap(true);
* ```
*/
getPointCloudMap: (returnEditedMap?: boolean) => Promise<Uint8Array>;

/**
* Get the internal state of the SLAM algorithm required to continue
* mapping/localization.
*
* @example
*
* ```ts
* const slam = new VIAM.SlamClient(machine, 'my_slam');
*
* // Get the internal state of the SLAM algorithm
* const internalState = await slam.getInternalState();
* ```
*/
getInternalState: () => Promise<Uint8Array>;

/** Gets information on the properties of the current SLAM service. */
/**
* Get information on the properties of the current SLAM service.
*
* @example
*
* ```ts
* const slam = new VIAM.SlamClient(machine, 'my_slam');
*
* // Get the properties of the SLAM service
* const properties = await slam.getProperties();
* console.log('SLAM properties:', properties);
* ```
*/
getProperties: () => Promise<SlamProperties>;
}