framesystem

package
v0.55.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: AGPL-3.0 Imports: 12 Imported by: 1

Documentation

Overview

Package framesystem defines the frame system service which is responsible for managing a stateful frame system

Index

Constants

View Source
const LocalFrameSystemName = "robot"

LocalFrameSystemName is the default name of the frame system created by the service.

View Source
const SubtypeName = "frame_system"

SubtypeName is a constant that identifies the internal frame system resource subtype string.

Variables

API is the fully qualified API for the internal frame system service.

View Source
var InternalServiceName = resource.NewName(API, "builtin")

InternalServiceName is used to refer to/depend on this service internally.

Functions

func DependencyNotFoundError added in v0.2.47

func DependencyNotFoundError(name string) error

DependencyNotFoundError returns an error if the given dependency name could not be found when building the framesystem.

func DuplicateResourceShortNameError added in v0.2.47

func DuplicateResourceShortNameError(name string) error

DuplicateResourceShortNameError returns an error if mutiple components are attempted to be registered in the frame system which share a short name.

func NotInputEnabledError added in v0.2.47

func NotInputEnabledError(component resource.Resource) error

NotInputEnabledError is returned when the given component is not InputEnabled but should be.

func PrefixRemoteParts added in v0.2.47

func PrefixRemoteParts(parts []*referenceframe.FrameSystemPart, remoteName, remoteParent string)

PrefixRemoteParts applies prefixes to a list of FrameSystemParts appropriate to the remote they originate from.

Types

type Config added in v0.2.47

type Config struct {
	resource.TriviallyValidateConfig
	Parts                []*referenceframe.FrameSystemPart
	AdditionalTransforms []*referenceframe.LinkInFrame
}

Config is a slice of *config.FrameSystemPart.

func (Config) String added in v0.2.47

func (cfg Config) String() string

String prints out a table of each frame in the system, with columns of name, parent, translation and orientation.

type InputEnabled added in v0.43.0

type InputEnabled interface {
	CurrentInputs(ctx context.Context) ([]referenceframe.Input, error)
	GoToInputs(context.Context, ...[]referenceframe.Input) error
}

InputEnabled is a standard interface for all things that interact with the frame system This allows us to figure out where they currently are, and then move them. Input units are always in meters or radians.

type Service

type Service interface {
	resource.Resource

	// TransformPose returns a transformed pose in the destination reference frame.
	// This method converts a given source pose from one reference frame to a specified destination frame.
	TransformPose(
		ctx context.Context,
		pose *referenceframe.PoseInFrame,
		dst string,
		additionalTransforms []*referenceframe.LinkInFrame,
	) (*referenceframe.PoseInFrame, error)

	// TransformPointCloud returns a new point cloud with points adjusted from one reference frame to a specified destination frame.
	TransformPointCloud(ctx context.Context, srcpc pointcloud.PointCloud, srcName, dstName string) (pointcloud.PointCloud, error)

	// CurrentInputs returns a map of the current inputs for each component of a machine's frame system
	// and a map of statuses indicating which of the machine's components may be actuated through input values.
	CurrentInputs(ctx context.Context) (map[string][]referenceframe.Input, map[string]InputEnabled, error)

	// FrameSystem returns the frame system of the machine and incorporates any specified additional transformations.
	FrameSystem(ctx context.Context, additionalTransforms []*referenceframe.LinkInFrame) (referenceframe.FrameSystem, error)
}

A Service that returns the frame system for a robot.

TransformPose example:

// Define a Pose coincident with the world reference frame
firstPose := spatialmath.NewZeroPose

// Establish the world as the reference for firstPose
firstPoseInFrame := referenceframe.NewPoseInFrame(referenceframe.World, firstPose)

// Calculate firstPoseInFrame from the perspective of the origin frame of myArm
transformedPoseInFrame, err := machine.TransformPose(context.Background(), firstPoseInFrame, "myArm", nil)

TransformPointCloud example:

// Create an empty slice to store point cloud data.
pointClouds := make([]pointcloud.PointCloud, 0)

// Transform the first point cloud in the list from its reference frame to the frame of 'myArm'.
transformed, err := fsService.TransformPointCloud(context.Background(), pointClouds[0], referenceframe.World, "myArm")

CurrentInputs example:

myCurrentInputs, err := fsService.CurrentInputs(context.Background())

frameSystem, err := fsService.FrameSystem(context.Background(), nil)

func FromDependencies added in v0.2.47

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

FromDependencies is a helper for getting the framesystem from a collection of dependencies.

func New

func New(ctx context.Context, deps resource.Dependencies, logger logging.Logger) (Service, error)

New returns a new frame system service for the given robot.

Jump to

Keyboard shortcuts

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