Documentation ¶
Overview ¶
Package gpsnmea implements an NMEA gps.
Package gpsnmea implements an NMEA serial gps.
Package gpsnmea implements a GPS NMEA component.
Package gpsnmea implements an NMEA gps.
Index ¶
- type Config
- type DataReader
- type I2CConfig
- type NMEAMovementSensor
- func (g *NMEAMovementSensor) Accuracy(ctx context.Context, extra map[string]interface{}) (*movementsensor.Accuracy, error)
- func (g *NMEAMovementSensor) AngularVelocity(ctx context.Context, extra map[string]interface{}) (spatialmath.AngularVelocity, error)
- func (g *NMEAMovementSensor) Close(ctx context.Context) error
- func (g *NMEAMovementSensor) CompassHeading(ctx context.Context, extra map[string]interface{}) (float64, error)
- func (g *NMEAMovementSensor) LinearAcceleration(ctx context.Context, extra map[string]interface{}) (r3.Vector, error)
- func (g *NMEAMovementSensor) LinearVelocity(ctx context.Context, extra map[string]interface{}) (r3.Vector, error)
- func (g *NMEAMovementSensor) Orientation(ctx context.Context, extra map[string]interface{}) (spatialmath.Orientation, error)
- func (g *NMEAMovementSensor) Position(ctx context.Context, extra map[string]interface{}) (*geo.Point, float64, error)
- func (g *NMEAMovementSensor) Properties(ctx context.Context, extra map[string]interface{}) (*movementsensor.Properties, error)
- func (g *NMEAMovementSensor) ReadFix(ctx context.Context) (int, error)
- func (g *NMEAMovementSensor) ReadSatsInView(ctx context.Context) (int, error)
- func (g *NMEAMovementSensor) Readings(ctx context.Context, extra map[string]interface{}) (map[string]interface{}, error)
- func (g *NMEAMovementSensor) Start(ctx context.Context) error
- type NmeaMovementSensor
- func MakePmtkI2cGpsNmea(ctx context.Context, deps resource.Dependencies, name resource.Name, ...) (NmeaMovementSensor, error)
- func NewNmeaMovementSensor(ctx context.Context, name resource.Name, dev DataReader, logger logging.Logger) (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 PmtkI2cDataReader
- type SerialConfig
- type SerialDataReader
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 DataReader ¶ added in v0.21.0
DataReader represents a way to get data from a GPS NMEA device. We can read data from it using the channel in Messages, and we can close the device when we're done.
func NewI2cDataReader ¶ added in v0.21.0
func NewI2cDataReader( bus buses.I2C, addr byte, baud int, logger logging.Logger, ) (DataReader, error)
NewI2cDataReader constructs a new DataReader that gets its NMEA messages over an I2C bus.
func NewSerialDataReader ¶ added in v0.21.0
func NewSerialDataReader(options serial.OpenOptions, logger logging.Logger) (DataReader, error)
NewSerialDataReader constructs a new DataReader that gets its NMEA messages over a serial port.
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 ¶ added in v0.21.0
type NMEAMovementSensor struct { resource.Named resource.AlwaysRebuild // contains filtered or unexported fields }
NMEAMovementSensor allows the use of any MovementSensor chip via a DataReader.
func (*NMEAMovementSensor) Accuracy ¶ added in v0.21.0
func (g *NMEAMovementSensor) Accuracy( ctx context.Context, extra map[string]interface{}, ) (*movementsensor.Accuracy, error)
Accuracy returns the accuracy map, hDOP, vDOP, Fixquality and compass heading error.
func (*NMEAMovementSensor) AngularVelocity ¶ added in v0.21.0
func (g *NMEAMovementSensor) AngularVelocity( ctx context.Context, extra map[string]interface{}, ) (spatialmath.AngularVelocity, error)
AngularVelocity returns the sensor's angular velocity.
func (*NMEAMovementSensor) Close ¶ added in v0.21.0
func (g *NMEAMovementSensor) Close(ctx context.Context) error
Close shuts down the NMEAMovementSensor.
func (*NMEAMovementSensor) CompassHeading ¶ added in v0.21.0
func (g *NMEAMovementSensor) CompassHeading( ctx context.Context, extra map[string]interface{}, ) (float64, error)
CompassHeading returns the heading, from the range 0->360.
func (*NMEAMovementSensor) LinearAcceleration ¶ added in v0.21.0
func (g *NMEAMovementSensor) LinearAcceleration( ctx context.Context, extra map[string]interface{}, ) (r3.Vector, error)
LinearAcceleration returns the sensor's linear acceleration.
func (*NMEAMovementSensor) LinearVelocity ¶ added in v0.21.0
func (g *NMEAMovementSensor) 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 (*NMEAMovementSensor) Orientation ¶ added in v0.21.0
func (g *NMEAMovementSensor) Orientation( ctx context.Context, extra map[string]interface{}, ) (spatialmath.Orientation, error)
Orientation returns the sensor's orientation.
func (*NMEAMovementSensor) Position ¶ added in v0.21.0
func (g *NMEAMovementSensor) 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 (*NMEAMovementSensor) Properties ¶ added in v0.21.0
func (g *NMEAMovementSensor) Properties( ctx context.Context, extra map[string]interface{}, ) (*movementsensor.Properties, error)
Properties returns what movement sensor capabilities we have.
func (*NMEAMovementSensor) ReadFix ¶ added in v0.21.0
func (g *NMEAMovementSensor) ReadFix(ctx context.Context) (int, error)
ReadFix returns Fix quality of MovementSensor measurements.
func (*NMEAMovementSensor) ReadSatsInView ¶ added in v0.21.0
func (g *NMEAMovementSensor) ReadSatsInView(ctx context.Context) (int, error)
ReadSatsInView returns the number of satellites in view.
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 NewNmeaMovementSensor ¶ added in v0.21.0
func NewNmeaMovementSensor( ctx context.Context, name resource.Name, dev DataReader, logger logging.Logger, ) (NmeaMovementSensor, error)
NewNmeaMovementSensor creates a new movement sensor.
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 PmtkI2cDataReader ¶ added in v0.21.0
type PmtkI2cDataReader struct {
// contains filtered or unexported fields
}
PmtkI2cDataReader implements the DataReader interface for a PMTK device by communicating with it over an I2C bus.
func (*PmtkI2cDataReader) Close ¶ added in v0.21.0
func (dr *PmtkI2cDataReader) Close() error
Close is part of the DataReader interface. It shuts everything down.
func (*PmtkI2cDataReader) Messages ¶ added in v0.21.0
func (dr *PmtkI2cDataReader) Messages() chan string
Messages returns the channel of complete NMEA sentences we have read off of the device. It's part of the DataReader interface.
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 SerialDataReader ¶ added in v0.21.0
type SerialDataReader struct {
// contains filtered or unexported fields
}
SerialDataReader implements the DataReader interface (defined in component.go) by interacting with the device over a serial port.
func (*SerialDataReader) Close ¶ added in v0.21.0
func (dr *SerialDataReader) Close() error
Close is part of the DataReader interface. It shuts everything down, including our connection to the serial port.
func (*SerialDataReader) Messages ¶ added in v0.21.0
func (dr *SerialDataReader) Messages() chan string
Messages returns the channel of complete NMEA sentences we have read off of the device. It's part of the DataReader interface.