Documentation ¶
Overview ¶
Package navigation contains a navigation service, along with a gRPC server and client
Package navigation implements the navigation service.
Index ¶
- Constants
- Variables
- func Named(name string) resource.Name
- func NewServer(s subtype.Service) pb.NavigationServiceServer
- func NewUnimplementedInterfaceError(actual interface{}) error
- func WrapWithReconfigurable(s interface{}, name resource.Name) (resource.Reconfigurable, error)
- type Config
- type MemoryNavigationStore
- func (store *MemoryNavigationStore) AddWaypoint(ctx context.Context, point *geo.Point) (Waypoint, error)
- func (store *MemoryNavigationStore) NextWaypoint(ctx context.Context) (Waypoint, error)
- func (store *MemoryNavigationStore) RemoveWaypoint(ctx context.Context, id primitive.ObjectID) error
- func (store *MemoryNavigationStore) WaypointVisited(ctx context.Context, id primitive.ObjectID) error
- func (store *MemoryNavigationStore) Waypoints(ctx context.Context) ([]Waypoint, error)
- type Mode
- type MongoDBNavigationStore
- func (store *MongoDBNavigationStore) AddWaypoint(ctx context.Context, point *geo.Point) (Waypoint, error)
- func (store *MongoDBNavigationStore) Close(ctx context.Context) error
- func (store *MongoDBNavigationStore) NextWaypoint(ctx context.Context) (Waypoint, error)
- func (store *MongoDBNavigationStore) RemoveWaypoint(ctx context.Context, id primitive.ObjectID) error
- func (store *MongoDBNavigationStore) WaypointVisited(ctx context.Context, id primitive.ObjectID) error
- func (store *MongoDBNavigationStore) Waypoints(ctx context.Context) ([]Waypoint, error)
- type NavStore
- type Service
- type StoreConfig
- type Waypoint
Constants ¶
const ( ModeManual = Mode(iota) ModeWaypoint )
The set of known modes.
const ( // StoreTypeMemory is the constant for the memory store type. StoreTypeMemory = "memory" // StoreTypeMongoDB is the constant for the mongodb store type. StoreTypeMongoDB = "mongodb" )
const SubtypeName = resource.SubtypeName("navigation")
SubtypeName is the name of the type of service.
Variables ¶
var ()
Database and collection names used by the MongoDBNavigationStore.
var Subtype = resource.NewSubtype( resource.ResourceNamespaceRDK, resource.ResourceTypeService, SubtypeName, )
Subtype is a constant that identifies the navigation service resource subtype.
Functions ¶
func Named ¶ added in v0.0.8
Named is a helper for getting the named navigation service's typed resource name.
func NewServer ¶
func NewServer(s subtype.Service) pb.NavigationServiceServer
NewServer constructs a navigation gRPC service server.
func NewUnimplementedInterfaceError ¶ added in v0.1.0
func NewUnimplementedInterfaceError(actual interface{}) error
NewUnimplementedInterfaceError is used when there is a failed interface check.
func WrapWithReconfigurable ¶
func WrapWithReconfigurable(s interface{}, name resource.Name) (resource.Reconfigurable, error)
WrapWithReconfigurable wraps a navigation service as a Reconfigurable.
Types ¶
type Config ¶
type Config struct { Store StoreConfig `json:"store"` BaseName string `json:"base"` MovementSensorName string `json:"movement_sensor"` DegPerSecDefault float64 `json:"degs_per_sec"` MMPerSecDefault float64 `json:"mm_per_sec"` }
Config describes how to configure the service.
type MemoryNavigationStore ¶ added in v0.1.0
type MemoryNavigationStore struct {
// contains filtered or unexported fields
}
MemoryNavigationStore holds the waypoints for the navigation service.
func NewMemoryNavigationStore ¶ added in v0.1.0
func NewMemoryNavigationStore() *MemoryNavigationStore
NewMemoryNavigationStore returns and empty MemoryNavigationStore.
func (*MemoryNavigationStore) AddWaypoint ¶ added in v0.1.0
func (store *MemoryNavigationStore) AddWaypoint(ctx context.Context, point *geo.Point) (Waypoint, error)
AddWaypoint adds a waypoint to the MemoryNavigationStore.
func (*MemoryNavigationStore) NextWaypoint ¶ added in v0.1.0
func (store *MemoryNavigationStore) NextWaypoint(ctx context.Context) (Waypoint, error)
NextWaypoint gets the next waypoint that has not been visited.
func (*MemoryNavigationStore) RemoveWaypoint ¶ added in v0.1.0
func (store *MemoryNavigationStore) RemoveWaypoint(ctx context.Context, id primitive.ObjectID) error
RemoveWaypoint removes a waypoint from the MemoryNavigationStore.
func (*MemoryNavigationStore) WaypointVisited ¶ added in v0.1.0
func (store *MemoryNavigationStore) WaypointVisited(ctx context.Context, id primitive.ObjectID) error
WaypointVisited sets that a waypoint has been visited.
type MongoDBNavigationStore ¶ added in v0.1.0
type MongoDBNavigationStore struct {
// contains filtered or unexported fields
}
MongoDBNavigationStore holds the mongodb client and waypoints collection.
func NewMongoDBNavigationStore ¶ added in v0.1.0
func NewMongoDBNavigationStore(ctx context.Context, config map[string]interface{}) (*MongoDBNavigationStore, error)
NewMongoDBNavigationStore creates a new navigation store using MongoDB.
func (*MongoDBNavigationStore) AddWaypoint ¶ added in v0.1.0
func (store *MongoDBNavigationStore) AddWaypoint(ctx context.Context, point *geo.Point) (Waypoint, error)
AddWaypoint adds a waypoint to the MongoDBNavigationStore.
func (*MongoDBNavigationStore) Close ¶ added in v0.1.0
func (store *MongoDBNavigationStore) Close(ctx context.Context) error
Close closes the connection with the mongodb client.
func (*MongoDBNavigationStore) NextWaypoint ¶ added in v0.1.0
func (store *MongoDBNavigationStore) NextWaypoint(ctx context.Context) (Waypoint, error)
NextWaypoint gets the next waypoint that has not been visited.
func (*MongoDBNavigationStore) RemoveWaypoint ¶ added in v0.1.0
func (store *MongoDBNavigationStore) RemoveWaypoint(ctx context.Context, id primitive.ObjectID) error
RemoveWaypoint removes a waypoint from the MongoDBNavigationStore.
func (*MongoDBNavigationStore) WaypointVisited ¶ added in v0.1.0
func (store *MongoDBNavigationStore) WaypointVisited(ctx context.Context, id primitive.ObjectID) error
WaypointVisited sets that a waypoint has been visited.
type NavStore ¶ added in v0.1.0
type NavStore interface {}
NavStore handles the waypoints for a navigation service.
type Service ¶
type Service interface { Mode(ctx context.Context, extra map[string]interface{}) (Mode, error) SetMode(ctx context.Context, mode Mode, extra map[string]interface{}) error Location(ctx context.Context, extra map[string]interface{}) (*geo.Point, error) // Waypoint Waypoints(ctx context.Context, extra map[string]interface{}) ([]Waypoint, error) AddWaypoint(ctx context.Context, point *geo.Point, extra map[string]interface{}) error RemoveWaypoint(ctx context.Context, id primitive.ObjectID, extra map[string]interface{}) error resource.Generic }
A Service controls the navigation for a robot.
func FromRobot ¶ added in v0.2.8
FromRobot is a helper for getting the named navigation service from the given Robot.
func NewClientFromConn ¶
func NewClientFromConn(ctx context.Context, conn rpc.ClientConn, name string, logger golog.Logger) Service
NewClientFromConn constructs a new Client from connection passed in.
type StoreConfig ¶
type StoreConfig struct { Type storeType `json:"type"` Config map[string]interface{} `json:"config"` }
StoreConfig describes how to configure data storage.
func (*StoreConfig) Validate ¶
func (config *StoreConfig) Validate(path string) error
Validate ensures all parts of the config are valid.
Directories ¶
Path | Synopsis |
---|---|
Package builtin contains the default navigation service, along with a gRPC server and client
|
Package builtin contains the default navigation service, along with a gRPC server and client |
Package register registers all relevant navigation models and also subtype specific functions
|
Package register registers all relevant navigation models and also subtype specific functions |