movementsensor

package
v0.2.34 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: AGPL-3.0 Imports: 24 Imported by: 14

Documentation

Overview

Package movementsensor defines the interfaces of a MovementSensor

Index

Constants

View Source
const SubtypeName = resource.SubtypeName("movement_sensor")

SubtypeName is a constant that identifies the component resource subtype string "movement_sensor".

Variables

View Source
var (
	// ErrMethodUnimplementedAccuracy returns error if the Accuracy method is unimplemented.
	ErrMethodUnimplementedAccuracy = errors.New("Accuracy Unimplemented")
	// ErrMethodUnimplementedPosition returns error if the Position method is unimplemented.
	ErrMethodUnimplementedPosition = errors.New("Position Unimplemented")
	// ErrMethodUnimplementedOrientation returns error if the Orientation method is unimplemented.
	ErrMethodUnimplementedOrientation = errors.New("Orientation Unimplemented")
	// ErrMethodUnimplementedLinearVelocity returns error if the LinearVelocity method is unimplemented.
	ErrMethodUnimplementedLinearVelocity = errors.New("LinearVelocity Unimplemented")
	// ErrMethodUnimplementedAngularVelocity returns error if the AngularVelocity method is unimplemented.
	ErrMethodUnimplementedAngularVelocity = errors.New("AngularVelocity Unimplemented")
	// ErrMethodUnimplementedCompassHeading returns error if the CompassHeading method is unimplemented.
	ErrMethodUnimplementedCompassHeading = errors.New("CompassHeading Unimplemented")
	// ErrMethodUnimplementedReadings returns error if the Readings method is unimplemented.
	ErrMethodUnimplementedReadings = errors.New("Readings Unimplemented")
	// ErrMethodUnimplementedProperties returns error if the Properties method is unimplemented.
	ErrMethodUnimplementedProperties = errors.New("Properties Unimplemented")
	// ErrMethodUnimplementedLinearAcceleration returns error if Linear Acceleration is unimplemented.
	ErrMethodUnimplementedLinearAcceleration = errors.New("linear acceleration unimplemented")
)

Subtype is a constant that identifies the component resource subtype.

Functions

func GetHeading

func GetHeading(gps1, gps2 *geo.Point, yawOffset float64) (float64, float64, float64)

GetHeading calculates bearing and absolute heading angles given 2 MovementSensor coordinates 0 degrees indicate North, 90 degrees indicate East and so on.

func Named

func Named(name string) resource.Name

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

func NamesFromRobot

func NamesFromRobot(r robot.Robot) []string

NamesFromRobot is a helper for getting all MovementSensor names from the given Robot.

func NewServer

NewServer constructs an MovementSensor gRPC service subtypeServer.

func NewUnimplementedInterfaceError

func NewUnimplementedInterfaceError(actual interface{}) error

NewUnimplementedInterfaceError is used when there is a failed interface check.

func Readings

func Readings(ctx context.Context, g MovementSensor, extra map[string]interface{}) (map[string]interface{}, error)

Readings is a helper for getting all readings from a MovementSensor.

func WrapWithReconfigurable

func WrapWithReconfigurable(r interface{}, name resource.Name) (resource.Reconfigurable, error)

WrapWithReconfigurable - if MovementSensor is already a reconfigurableMovementSensor, then nothing is done. Otherwise wraps in a Reconfigurable.

Types

type LastError added in v0.2.19

type LastError struct {
	// contains filtered or unexported fields
}

LastError is an object that stores recent errors. If there have been sufficiently many recent errors, you can retrieve the most recent one.

func NewLastError added in v0.2.32

func NewLastError(size, threshold int) LastError

NewLastError creates a LastError object which will let you retrieve the most recent error if at least `threshold` of the most recent `size` items put into it are non-nil.

func (*LastError) Get added in v0.2.19

func (le *LastError) Get() error

Get returns the most-recently-stored non-nil error if we've had enough recent errors. If we're going to return a non-nil error, we also wipe out all other data so we don't return the same error again next time.

func (*LastError) Set added in v0.2.19

func (le *LastError) Set(err error)

Set stores an error to be retrieved later.

type MovementSensor

type MovementSensor interface {
	Position(ctx context.Context, extra map[string]interface{}) (*geo.Point, float64, error)                // (lat, long), altitude (mm)
	LinearVelocity(ctx context.Context, extra map[string]interface{}) (r3.Vector, error)                    // mm / sec
	AngularVelocity(ctx context.Context, extra map[string]interface{}) (spatialmath.AngularVelocity, error) // radians / sec
	LinearAcceleration(ctx context.Context, extra map[string]interface{}) (r3.Vector, error)
	CompassHeading(ctx context.Context, extra map[string]interface{}) (float64, error) // [0->360)
	Orientation(ctx context.Context, extra map[string]interface{}) (spatialmath.Orientation, error)
	Properties(ctx context.Context, extra map[string]interface{}) (*Properties, error)
	Accuracy(ctx context.Context, extra map[string]interface{}) (map[string]float32, error) // in mm
	generic.Generic
	sensor.Sensor
}

A MovementSensor reports information about the robot's direction, position and speed.

func FromDependencies

func FromDependencies(deps registry.Dependencies, name string) (MovementSensor, error)

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

func FromRobot

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

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

func NewClientFromConn

func NewClientFromConn(ctx context.Context, conn rpc.ClientConn, name string, logger golog.Logger) MovementSensor

NewClientFromConn constructs a new Client from connection passed in.

type Properties

type Properties pb.GetPropertiesResponse

Properties tells you what a MovementSensor supports.

Directories

Path Synopsis
Package adxl345 implements the MovementSensor interface for the ADXL345 accelerometer attached to an I2C bus on the robot (the chip supports communicating over SPI as well, but this package does not support that interface).
Package adxl345 implements the MovementSensor interface for the ADXL345 accelerometer attached to an I2C bus on the robot (the chip supports communicating over SPI as well, but this package does not support that interface).
Package cameramono implements a visual odemetry movement sensor based ona single camera stream This is an Experimental package
Package cameramono implements a visual odemetry movement sensor based ona single camera stream This is an Experimental package
Package fake is a fake MovementSensor for testing
Package fake is a fake MovementSensor for testing
Package gpsnmea implements an NMEA serial gps.
Package gpsnmea implements an NMEA serial gps.
Package gpsrtk defines a gps and an rtk correction source which sends rtcm data to a child gps This is an Experimental package
Package gpsrtk defines a gps and an rtk correction source which sends rtcm data to a child gps This is an Experimental package
Package imuvectornav implement vectornav imu
Package imuvectornav implement vectornav imu
Package imuwit implements wit imus.
Package imuwit implements wit imus.
Package mpu6050 implements the movementsensor interface for an MPU-6050 6-axis accelerometer.
Package mpu6050 implements the movementsensor interface for an MPU-6050 6-axis accelerometer.
Package register registers all relevant MovementSensors
Package register registers all relevant MovementSensors

Jump to

Keyboard shortcuts

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