Documentation ¶
Overview ¶
Package movementsensor defines the interfaces of a MovementSensor
Index ¶
- Constants
- Variables
- func AddressReadError(err error, address byte, bus, board string) error
- func GetHeading(gps1, gps2 *geo.Point, yawOffset float64) (float64, float64, float64)
- func Named(name string) resource.Name
- func NamesFromRobot(r robot.Robot) []string
- func NewRPCServiceServer(coll resource.APIResourceCollection[MovementSensor]) interface{}
- func PropertiesToProtoResponse(features *Properties) (*pb.GetPropertiesResponse, error)
- func Readings(ctx context.Context, g MovementSensor, extra map[string]interface{}) (map[string]interface{}, error)
- func UnexpectedDeviceError(address, response byte, deviceName string) error
- type LastError
- type LastPosition
- type MovementSensor
- type Properties
Constants ¶
const SubtypeName = "movement_sensor"
SubtypeName is a constant that identifies the component resource API string "movement_sensor".
Variables ¶
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") )
var API = resource.APINamespaceRDK.WithComponentType(SubtypeName)
API is a variable that identifies the component resource API.
Functions ¶
func AddressReadError ¶ added in v0.2.49
AddressReadError returns a standard error for when we cannot read from an I2C bus.
func GetHeading ¶
GetHeading calculates bearing and absolute heading angles given 2 MovementSensor coordinates 0 degrees indicate North, 90 degrees indicate East and so on.
func NamesFromRobot ¶
NamesFromRobot is a helper for getting all MovementSensor names from the given Robot.
func NewRPCServiceServer ¶ added in v0.2.36
func NewRPCServiceServer(coll resource.APIResourceCollection[MovementSensor]) interface{}
NewRPCServiceServer constructs an MovementSensor gRPC service serviceServer.
func PropertiesToProtoResponse ¶ added in v0.3.0
func PropertiesToProtoResponse( features *Properties, ) (*pb.GetPropertiesResponse, error)
PropertiesToProtoResponse takes a properties struct and converts it to a GetPropertiesResponse.
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 UnexpectedDeviceError ¶ added in v0.2.49
UnexpectedDeviceError returns a standard error for we cannot find the expected device at the given address.
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
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.
type LastPosition ¶ added in v0.3.0
type LastPosition struct {
// contains filtered or unexported fields
}
LastPosition stores the last position seen by the movement sensor.
func NewLastPosition ¶ added in v0.3.0
func NewLastPosition() LastPosition
NewLastPosition creates a new point that's (NaN, NaN) go-staticcheck.
func (*LastPosition) ArePointsEqual ¶ added in v0.3.0
func (lp *LastPosition) ArePointsEqual(p1, p2 *geo.Point) bool
ArePointsEqual checks if two geo.Point instances are equal.
func (*LastPosition) GetLastPosition ¶ added in v0.3.0
func (lp *LastPosition) GetLastPosition() *geo.Point
GetLastPosition returns the last known position.
func (*LastPosition) IsPositionNaN ¶ added in v0.3.0
func (lp *LastPosition) IsPositionNaN(p *geo.Point) bool
IsPositionNaN checks if a geo.Point in math.NaN().
func (*LastPosition) IsZeroPosition ¶ added in v0.3.0
func (lp *LastPosition) IsZeroPosition(p *geo.Point) bool
IsZeroPosition checks if a geo.Point represents the zero position (0, 0).
func (*LastPosition) SetLastPosition ¶ added in v0.3.0
func (lp *LastPosition) SetLastPosition(position *geo.Point)
SetLastPosition updates the last known position.
type MovementSensor ¶
type MovementSensor interface { sensor.Sensor Position(ctx context.Context, extra map[string]interface{}) (*geo.Point, float64, error) // (lat, long), altitude (m) LinearVelocity(ctx context.Context, extra map[string]interface{}) (r3.Vector, error) // m / sec AngularVelocity(ctx context.Context, extra map[string]interface{}) (spatialmath.AngularVelocity, error) // deg / 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) }
A MovementSensor reports information about the robot's direction, position and speed.
func FromDependencies ¶
func FromDependencies(deps resource.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, remoteName string, name resource.Name, logger golog.Logger, ) (MovementSensor, error)
NewClientFromConn constructs a new Client from connection passed in.
type Properties ¶
type Properties struct { LinearVelocitySupported bool AngularVelocitySupported bool OrientationSupported bool PositionSupported bool CompassHeadingSupported bool LinearAccelerationSupported bool }
Properties is a structure representing features of a movementsensor.
func ProtoFeaturesToProperties ¶ added in v0.3.0
func ProtoFeaturesToProperties(resp *pb.GetPropertiesResponse) *Properties
ProtoFeaturesToProperties takes a GetPropertiesResponse and returns an equivalent Properties struct.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package adxl345 implements the MovementSensor interface for the ADXL345 accelerometer.
|
Package adxl345 implements the MovementSensor interface for the ADXL345 accelerometer. |
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 merged implements a movementsensor combining movement data from other sensors
|
Package merged implements a movementsensor combining movement data from other sensors |
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 |
Package rtkstation defines a gps rtk correction source This is an Experimental package
|
Package rtkstation defines a gps rtk correction source This is an Experimental package |