Documentation ¶
Overview ¶
Package gpsnmea implements an NMEA serial gps.
Package gpsnmea implements a GPS NMEA component.
Package gpsnmea implements an NMEA serial gps.
Index ¶
- type Config
- type GPSData
- type I2CConfig
- type NmeaMovementSensor
- func MakePmtkI2cGpsNmea(ctx context.Context, deps resource.Dependencies, name resource.Name, ...) (NmeaMovementSensor, error)
- func NewPmtkI2CGPSNMEA(ctx context.Context, deps resource.Dependencies, name resource.Name, ...) (NmeaMovementSensor, error)
- func NewSerialGPSNMEA(ctx context.Context, name resource.Name, conf *Config, logger logging.Logger) (NmeaMovementSensor, error)
- type PmtkI2CNMEAMovementSensor
- func (g *PmtkI2CNMEAMovementSensor) Accuracy(ctx context.Context, extra map[string]interface{}) (*movementsensor.Accuracy, error)
- func (g *PmtkI2CNMEAMovementSensor) AngularVelocity(ctx context.Context, extra map[string]interface{}) (spatialmath.AngularVelocity, error)
- func (g *PmtkI2CNMEAMovementSensor) Close(ctx context.Context) error
- func (g *PmtkI2CNMEAMovementSensor) CompassHeading(ctx context.Context, extra map[string]interface{}) (float64, error)
- func (g *PmtkI2CNMEAMovementSensor) GetBusAddr() (buses.I2C, byte)
- func (g *PmtkI2CNMEAMovementSensor) LinearAcceleration(ctx context.Context, extra map[string]interface{}) (r3.Vector, error)
- func (g *PmtkI2CNMEAMovementSensor) LinearVelocity(ctx context.Context, extra map[string]interface{}) (r3.Vector, error)
- func (g *PmtkI2CNMEAMovementSensor) Orientation(ctx context.Context, extra map[string]interface{}) (spatialmath.Orientation, error)
- func (g *PmtkI2CNMEAMovementSensor) Position(ctx context.Context, extra map[string]interface{}) (*geo.Point, float64, error)
- func (g *PmtkI2CNMEAMovementSensor) Properties(ctx context.Context, extra map[string]interface{}) (*movementsensor.Properties, error)
- func (g *PmtkI2CNMEAMovementSensor) ReadFix(ctx context.Context) (int, error)
- func (g *PmtkI2CNMEAMovementSensor) ReadSatsInView(ctx context.Context) (int, error)
- func (g *PmtkI2CNMEAMovementSensor) Readings(ctx context.Context, extra map[string]interface{}) (map[string]interface{}, error)
- func (g *PmtkI2CNMEAMovementSensor) Start(ctx context.Context) error
- type SerialConfig
- type SerialNMEAMovementSensor
- func (g *SerialNMEAMovementSensor) Accuracy(ctx context.Context, extra map[string]interface{}) (*movementsensor.Accuracy, error)
- func (g *SerialNMEAMovementSensor) AngularVelocity(ctx context.Context, extra map[string]interface{}) (spatialmath.AngularVelocity, error)
- func (g *SerialNMEAMovementSensor) Close(ctx context.Context) error
- func (g *SerialNMEAMovementSensor) CompassHeading(ctx context.Context, extra map[string]interface{}) (float64, error)
- func (g *SerialNMEAMovementSensor) LinearAcceleration(ctx context.Context, extra map[string]interface{}) (r3.Vector, error)
- func (g *SerialNMEAMovementSensor) LinearVelocity(ctx context.Context, extra map[string]interface{}) (r3.Vector, error)
- func (g *SerialNMEAMovementSensor) Orientation(ctx context.Context, extra map[string]interface{}) (spatialmath.Orientation, error)
- func (g *SerialNMEAMovementSensor) Position(ctx context.Context, extra map[string]interface{}) (*geo.Point, float64, error)
- func (g *SerialNMEAMovementSensor) Properties(ctx context.Context, extra map[string]interface{}) (*movementsensor.Properties, error)
- func (g *SerialNMEAMovementSensor) ReadFix(ctx context.Context) (int, error)
- func (g *SerialNMEAMovementSensor) ReadSatsInView(ctx context.Context) (int, error)
- func (g *SerialNMEAMovementSensor) Readings(ctx context.Context, extra map[string]interface{}) (map[string]interface{}, error)
- func (g *SerialNMEAMovementSensor) Start(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.2.36
type Config struct { ConnectionType string `json:"connection_type"` *SerialConfig `json:"serial_attributes,omitempty"` *I2CConfig `json:"i2c_attributes,omitempty"` }
Config is used for converting NMEA Movement Sensor attibutes.
type GPSData ¶ added in v0.5.0
type GPSData struct { Location *geo.Point Alt float64 Speed float64 // ground speed in m per sec VDOP float64 // vertical accuracy HDOP float64 // horizontal accuracy SatsInView int // quantity satellites in view SatsInUse int // quantity satellites in view FixQuality int CompassHeading float64 // true compass heading in degree // contains filtered or unexported fields }
GPSData struct combines various attributes related to GPS.
func (*GPSData) ParseAndUpdate ¶ added in v0.5.0
ParseAndUpdate will attempt to parse a line to an NMEA sentence, and if valid, will try to update the given struct with the values for that line. Nothing will be updated if there is not a valid gps fix.
type I2CConfig ¶ added in v0.2.36
type I2CConfig struct { I2CBus string `json:"i2c_bus"` I2CAddr int `json:"i2c_addr"` I2CBaudRate int `json:"i2c_baud_rate,omitempty"` }
I2CConfig is used for converting Serial NMEA MovementSensor config attributes.
type NmeaMovementSensor ¶
type NmeaMovementSensor interface { movementsensor.MovementSensor Start(ctx context.Context) error // Initialize and run MovementSensor Close(ctx context.Context) error // Close MovementSensor ReadFix(ctx context.Context) (int, error) // Returns the fix quality of the current MovementSensor measurements ReadSatsInView(ctx context.Context) (int, error) // Returns the number of satellites in view }
NmeaMovementSensor implements a gps that sends nmea messages for movement data.
func MakePmtkI2cGpsNmea ¶ added in v0.15.0
func MakePmtkI2cGpsNmea( ctx context.Context, deps resource.Dependencies, name resource.Name, conf *Config, logger logging.Logger, i2cBus buses.I2C, ) (NmeaMovementSensor, error)
MakePmtkI2cGpsNmea is only split out for ease of testing: you can pass in your own mock I2C bus, or pass in nil to have it create a real one. It is public so it can also be called from within the gpsrtkpmtk package.
func NewPmtkI2CGPSNMEA ¶
func NewPmtkI2CGPSNMEA( ctx context.Context, deps resource.Dependencies, name resource.Name, conf *Config, logger logging.Logger, ) (NmeaMovementSensor, error)
NewPmtkI2CGPSNMEA implements a gps that communicates over i2c.
type PmtkI2CNMEAMovementSensor ¶
type PmtkI2CNMEAMovementSensor struct { resource.Named resource.AlwaysRebuild // contains filtered or unexported fields }
PmtkI2CNMEAMovementSensor allows the use of any MovementSensor chip that communicates over I2C using the PMTK protocol.
func (*PmtkI2CNMEAMovementSensor) Accuracy ¶
func (g *PmtkI2CNMEAMovementSensor) Accuracy(ctx context.Context, extra map[string]interface{}) (*movementsensor.Accuracy, error)
Accuracy returns the accuracy, hDOP and vDOP.
func (*PmtkI2CNMEAMovementSensor) AngularVelocity ¶
func (g *PmtkI2CNMEAMovementSensor) AngularVelocity( ctx context.Context, extra map[string]interface{}, ) (spatialmath.AngularVelocity, error)
AngularVelocity not supported.
func (*PmtkI2CNMEAMovementSensor) Close ¶
func (g *PmtkI2CNMEAMovementSensor) Close(ctx context.Context) error
Close shuts down the SerialNMEAMOVEMENTSENSOR.
func (*PmtkI2CNMEAMovementSensor) CompassHeading ¶
func (g *PmtkI2CNMEAMovementSensor) CompassHeading(ctx context.Context, extra map[string]interface{}) (float64, error)
CompassHeading returns the compass heading in degree (0->360).
func (*PmtkI2CNMEAMovementSensor) GetBusAddr ¶
func (g *PmtkI2CNMEAMovementSensor) GetBusAddr() (buses.I2C, byte)
GetBusAddr returns the bus and address that takes in rtcm corrections.
func (*PmtkI2CNMEAMovementSensor) LinearAcceleration ¶ added in v0.2.11
func (g *PmtkI2CNMEAMovementSensor) LinearAcceleration(ctx context.Context, extra map[string]interface{}) (r3.Vector, error)
LinearAcceleration returns the current linear acceleration of the MovementSensor.
func (*PmtkI2CNMEAMovementSensor) LinearVelocity ¶
func (g *PmtkI2CNMEAMovementSensor) LinearVelocity(ctx context.Context, extra map[string]interface{}) (r3.Vector, error)
LinearVelocity returns the current speed of the MovementSensor.
func (*PmtkI2CNMEAMovementSensor) Orientation ¶
func (g *PmtkI2CNMEAMovementSensor) Orientation(ctx context.Context, extra map[string]interface{}) (spatialmath.Orientation, error)
Orientation not supporter.
func (*PmtkI2CNMEAMovementSensor) Position ¶
func (g *PmtkI2CNMEAMovementSensor) Position(ctx context.Context, extra map[string]interface{}) (*geo.Point, float64, error)
Position returns the current geographic location of the MovementSensor.
func (*PmtkI2CNMEAMovementSensor) Properties ¶
func (g *PmtkI2CNMEAMovementSensor) Properties(ctx context.Context, extra map[string]interface{}) (*movementsensor.Properties, error)
Properties what can I do!
func (*PmtkI2CNMEAMovementSensor) ReadFix ¶
func (g *PmtkI2CNMEAMovementSensor) ReadFix(ctx context.Context) (int, error)
ReadFix returns quality.
func (*PmtkI2CNMEAMovementSensor) ReadSatsInView ¶ added in v0.12.0
func (g *PmtkI2CNMEAMovementSensor) ReadSatsInView(ctx context.Context) (int, error)
ReadSatsInView return number of satellites in view.
type SerialConfig ¶ added in v0.2.36
type SerialConfig struct { SerialPath string `json:"serial_path"` SerialBaudRate int `json:"serial_baud_rate,omitempty"` // TestChan is a fake "serial" path for test use only TestChan chan []uint8 `json:"-"` }
SerialConfig is used for converting Serial NMEA MovementSensor config attributes.
type SerialNMEAMovementSensor ¶
type SerialNMEAMovementSensor struct { resource.Named resource.AlwaysRebuild // contains filtered or unexported fields }
SerialNMEAMovementSensor allows the use of any MovementSensor chip that communicates over serial.
func (*SerialNMEAMovementSensor) Accuracy ¶
func (g *SerialNMEAMovementSensor) Accuracy(ctx context.Context, extra map[string]interface{}) (*movementsensor.Accuracy, error, )
Accuracy returns the accuracy map, hDOP, vDOP, Fixquality and compass heading error.
func (*SerialNMEAMovementSensor) AngularVelocity ¶
func (g *SerialNMEAMovementSensor) AngularVelocity(ctx context.Context, extra map[string]interface{}) (spatialmath.AngularVelocity, error)
AngularVelocity returns the sensor's angular velocity.
func (*SerialNMEAMovementSensor) Close ¶
func (g *SerialNMEAMovementSensor) Close(ctx context.Context) error
Close shuts down the SerialNMEAMovementSensor.
func (*SerialNMEAMovementSensor) CompassHeading ¶
func (g *SerialNMEAMovementSensor) CompassHeading(ctx context.Context, extra map[string]interface{}) (float64, error)
CompassHeading returns the heading, from the range 0->360.
func (*SerialNMEAMovementSensor) LinearAcceleration ¶ added in v0.2.11
func (g *SerialNMEAMovementSensor) LinearAcceleration(ctx context.Context, extra map[string]interface{}) (r3.Vector, error)
LinearAcceleration returns the sensor's linear acceleration.
func (*SerialNMEAMovementSensor) LinearVelocity ¶
func (g *SerialNMEAMovementSensor) LinearVelocity(ctx context.Context, extra map[string]interface{}) (r3.Vector, error)
LinearVelocity returns the sensor's linear velocity. It requires having a compass heading, so we know which direction our speed is in. We assume all of this speed is horizontal, and not in gaining/losing altitude.
func (*SerialNMEAMovementSensor) Orientation ¶
func (g *SerialNMEAMovementSensor) Orientation(ctx context.Context, extra map[string]interface{}) (spatialmath.Orientation, error)
Orientation returns the sensor's orientation.
func (*SerialNMEAMovementSensor) Position ¶
func (g *SerialNMEAMovementSensor) Position(ctx context.Context, extra map[string]interface{}) (*geo.Point, float64, error)
Position returns the position and altitide of the sensor, or an error.
func (*SerialNMEAMovementSensor) Properties ¶
func (g *SerialNMEAMovementSensor) Properties(ctx context.Context, extra map[string]interface{}) (*movementsensor.Properties, error)
Properties returns what movement sensor capabilities we have.
func (*SerialNMEAMovementSensor) ReadFix ¶
func (g *SerialNMEAMovementSensor) ReadFix(ctx context.Context) (int, error)
ReadFix returns Fix quality of MovementSensor measurements.
func (*SerialNMEAMovementSensor) ReadSatsInView ¶ added in v0.12.0
func (g *SerialNMEAMovementSensor) ReadSatsInView(ctx context.Context) (int, error)
ReadSatsInView returns the number of satellites in view.