fake

package
v0.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package fake implements a fake encoder.

Index

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"`
}

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) Reset

func (e *Encoder) Reset(ctx context.Context, offset int64, extra map[string]interface{}) error

Reset sets the current position of the motor (adjusted by a given offset) to be its new zero position.

func (*Encoder) SetPosition

func (e *Encoder) SetPosition(ctx context.Context, position int64) error

SetPosition sets the position of the encoder.

func (*Encoder) SetSpeed

func (e *Encoder) SetSpeed(ctx context.Context, speed float64) error

SetSpeed sets the speed of the fake motor the encoder is measuring.

func (*Encoder) Start

func (e *Encoder) Start(cancelCtx context.Context)

Start starts a background thread to run the encoder.

func (*Encoder) TicksCount

func (e *Encoder) TicksCount(ctx context.Context, extra map[string]interface{}) (int64, error)

TicksCount returns the current position in terms of ticks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL