SLAM Service

Simultaneous Localization And Mapping (SLAM) allows your machine to create a map of its surroundings and find its location within that map. SLAM is an important area of ongoing research in robotics, particularly for mobile applications such as drones, boats, and rovers.

The Viam SLAM service supports the integration of SLAM as a service on your machine. You can conduct SLAM with data collected live by a RPlidar or with LIDAR data you provide in configuration, and easily view the map you build by clicking on View SLAM library on your location’s page in the Viam app:

Completed SLAM maps in the SLAM library tab

Used with

* Required for use

Configuration

Integrated SLAM libraries include the following. Click the model name for configuration instructions.

ModelDescription
viam:slam:cartographerThe Cartographer Project performs dense SLAM using LIDAR data.
viam:cloudslam-wrapper:cloudslamcloudslam-wrapper Allows you to run supported SLAM algorithms in the cloud.

API

The SLAM service API supports the following methods:

Method NameDescription
GetPositionGet the current position of the component the SLAM service is configured to source point cloud data from in the SLAM map as a Pose.
GetPointCloudMapGet the point cloud map.
GetInternalStateGet the internal state of the SLAM algorithm required to continue mapping/localization.
GetPropertiesGet information about the current SLAM session.
InternalStateFullInternalStateFull concatenates the streaming responses from InternalState into the internal serialized state of the SLAM algorithm.
PointCloudMapFullPointCloudMapFull concatenates the streaming responses from PointCloudMap into a full point cloud.
ReconfigureReconfigure this resource.
DoCommandExecute model-specific commands that are not otherwise defined by the service API.
GetResourceNameGet the ResourceName for this instance of the SLAM service with the given name.
CloseSafely shut down the resource and prevent further use.

SLAM mapping best practices

The best way to improve map quality is by taking extra care when creating the initial map. While in a slam session, you should:

  • turn gently and gradually, completely avoiding sudden quick turns
  • make frequent loop closures, arriving back at a previously mapped area so the machine can correct for errors in the map layout
  • stay relatively (but not extremely) close to walls
  • use a machine that can go smoothly over bumps and transitions between flooring areas
  • drive at a moderate speed
  • when using a wheeled base, try to include an odometry movement sensor. This helps the SLAM algorithm keep track of where the machine is moving.
  • it is important to note that the adxl345 accelerometer on the Viam Rover 1 will not satisfy the movement sensor requirement.

You can find additional assistance in the Troubleshooting section.