slam

package
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2024 License: AGPL-3.0 Imports: 17 Imported by: 11

Documentation

Overview

Package slam implements simultaneous localization and mapping. This is an Experimental package.

Index

Constants

View Source
const (
	SubtypeName       = "slam"
	MappingModeNewMap = MappingMode(iota)
	MappingModeLocalizationOnly
	MappingModeUpdateExistingMap
)

SubtypeName is the name of the type of service.

View Source
const (
	SensorTypeCamera = SensorType(iota)
	SensorTypeMovementSensor
)

SensorTypeCamera is a camera sensor.

Variables

View Source
var API = resource.APINamespaceRDK.WithServiceType(SubtypeName)

API is a variable that identifies the slam resource API.

Functions

func HelperConcatenateChunksToFull added in v0.2.35

func HelperConcatenateChunksToFull(f func() ([]byte, error)) ([]byte, error)

HelperConcatenateChunksToFull concatenates the chunks from a streamed grpc endpoint.

func InternalStateCallback added in v0.24.0

func InternalStateCallback(ctx context.Context, name string, slamClient pb.SLAMServiceClient) (func() ([]byte, error), error)

InternalStateCallback helps a client request the internal state stream from a SLAM server, returning a callback function for accessing the stream data.

func InternalStateFull added in v0.8.0

func InternalStateFull(ctx context.Context, slamSvc Service) ([]byte, error)

InternalStateFull concatenates the streaming responses from InternalState into the internal serialized state of the slam algorithm.

func Limits added in v0.8.0

func Limits(ctx context.Context, svc Service, useEditedMap bool) ([]referenceframe.Limit, error)

Limits returns the bounds of the slam map as a list of referenceframe.Limits.

func Named added in v0.0.8

func Named(name string) resource.Name

Named is a helper for getting the named service's typed resource name.

func NewRPCServiceServer added in v0.2.36

func NewRPCServiceServer(coll resource.APIResourceCollection[Service]) interface{}

NewRPCServiceServer constructs a the slam gRPC service server. It is intentionally untyped to prevent use outside of tests.

func PointCloudMapCallback added in v0.24.0

func PointCloudMapCallback(ctx context.Context, name string, slamClient pb.SLAMServiceClient, returnEditedMap bool) (
	func() ([]byte, error), error,
)

PointCloudMapCallback helps a client request the point cloud stream from a SLAM server, returning a callback function for accessing the stream data.

func PointCloudMapFull added in v0.8.0

func PointCloudMapFull(ctx context.Context, slamSvc Service, returnEditedMap bool) ([]byte, error)

PointCloudMapFull concatenates the streaming responses from PointCloudMap into a full point cloud.

Types

type MappingMode added in v0.18.0

type MappingMode uint8

MappingMode describes what mapping mode the slam service is in, including creating a new map, localizing on an existing map or updating an existing map.

func (MappingMode) String added in v0.30.0

func (t MappingMode) String() string

type Properties added in v0.18.0

type Properties struct {
	CloudSlam             bool
	MappingMode           MappingMode
	InternalStateFileType string
	SensorInfo            []SensorInfo
}

Properties returns various information regarding the current slam service, including whether the slam process is running in the cloud and its mapping mode.

type SensorInfo added in v0.24.0

type SensorInfo struct {
	Name string
	Type SensorType
}

SensorInfo holds information about the sensor name and sensor type.

type SensorType added in v0.24.0

type SensorType uint8

SensorType describes what sensor type the sensor is, including camera or movement sensor.

func (SensorType) String added in v0.30.0

func (t SensorType) String() string

type Service

type Service interface {
	resource.Resource
	Position(ctx context.Context) (spatialmath.Pose, error)
	PointCloudMap(ctx context.Context, returnEditedMap bool) (func() ([]byte, error), error)
	InternalState(ctx context.Context) (func() ([]byte, error), error)
	Properties(ctx context.Context) (Properties, error)
}

Service describes the functions that are available to the service.

The Go SDK implements helper functions that concatenate streaming responses. Some of the following examples use corresponding helper methods instead of interface methods.

Position example:

// Get the current position of the specified source component
// in the SLAM map as a Pose.
pos, name, err := mySLAMService.Position(context.Background())

PointCloudMap example (using PointCloudMapFull helper method):

// Get the point cloud map in standard PCD format.
pcdMapBytes, err := PointCloudMapFull(
    context.Background(), mySLAMService, true)

InternalState example (using InternalStateFull helper method):

// Get the internal state of the SLAM algorithm required
// to continue mapping/localization.
internalStateBytes, err := InternalStateFull(
    context.Background(), mySLAMService)

Properties example:

// Get the properties of your current SLAM session
properties, err := mySLAMService.Properties(context.Background())

func FromDependencies added in v0.18.0

func FromDependencies(deps resource.Dependencies, name string) (Service, error)

FromDependencies is a helper for getting the named SLAM service from a collection of dependencies.

func FromRobot added in v0.2.32

func FromRobot(r robot.Robot, name string) (Service, error)

FromRobot is a helper for getting the named SLAM service from the given Robot.

func NewClientFromConn

func NewClientFromConn(
	ctx context.Context,
	conn rpc.ClientConn,
	remoteName string,
	name resource.Name,
	logger logging.Logger,
) (Service, error)

NewClientFromConn constructs a new Client from the connection passed in.

Directories

Path Synopsis
Package fake implements a fake slam service
Package fake implements a fake slam service
internal
testhelper
Package testhelper implements a slam service definition with additional exported functions for the purpose of testing
Package testhelper implements a slam service definition with additional exported functions for the purpose of testing
Package register registers all relevant slam models and also API specific functions
Package register registers all relevant slam models and also API specific functions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL