Documentation ¶
Overview ¶
Package fake implements a fake encoder.
Index ¶
- type AttrConfig
- type Encoder
- func (e *Encoder) GetPosition(ctx context.Context, positionType *encoder.PositionType, ...) (float64, encoder.PositionType, error)
- func (e *Encoder) GetProperties(ctx context.Context, extra map[string]interface{}) (map[encoder.Feature]bool, error)
- func (e *Encoder) ResetPosition(ctx context.Context, extra map[string]interface{}) error
- func (e *Encoder) SetPosition(ctx context.Context, position int64) error
- func (e *Encoder) SetSpeed(ctx context.Context, speed float64) error
- func (e *Encoder) Start(cancelCtx context.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttrConfig ¶
type AttrConfig struct {
UpdateRate int64 `json:"update_rate_msec,omitempty"`
}
AttrConfig describes the configuration of a fake encoder.
func (*AttrConfig) Validate ¶
func (cfg *AttrConfig) Validate(path string) error
Validate ensures all parts of a config is valid.
type Encoder ¶
type Encoder struct { generic.Unimplemented // contains filtered or unexported fields }
Encoder keeps track of a fake motor position.
func (*Encoder) GetPosition ¶ added in v0.2.34
func (e *Encoder) GetPosition( ctx context.Context, positionType *encoder.PositionType, extra map[string]interface{}, ) (float64, encoder.PositionType, error)
GetPosition returns the current position in terms of ticks or degrees, and whether it is a relative or absolute position.
func (*Encoder) GetProperties ¶ added in v0.2.34
func (e *Encoder) GetProperties(ctx context.Context, extra map[string]interface{}) (map[encoder.Feature]bool, error)
GetProperties returns a list of all the position types that are supported by a given encoder.
func (*Encoder) ResetPosition ¶ added in v0.2.34
ResetPosition sets the current position of the motor (adjusted by a given offset) to be its new zero position.
func (*Encoder) SetPosition ¶
SetPosition sets the position of the encoder.
Click to show internal directories.
Click to hide internal directories.