servo

package
v0.0.0-...-b56da86 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PiServo

type PiServo struct {
	Servo
	// contains filtered or unexported fields
}

PiServo is an integral servo

func NewPiServo

func NewPiServo(s Servo, cfg *PiServoCfg, freq float64) *PiServo

NewPiServo to create servo structure

func (*PiServo) GetState

func (s *PiServo) GetState() State

GetState returns current state of PiServo

func (*PiServo) InitLastFreq

func (s *PiServo) InitLastFreq(freq float64)

InitLastFreq function to reset last freq and drift

func (*PiServo) IsSpike

func (s *PiServo) IsSpike(offset int64) bool

IsSpike function to check if offset is considered as spike

func (*PiServo) MeanFreq

func (s *PiServo) MeanFreq() float64

MeanFreq to return best calculated frequency from filter

func (*PiServo) Sample

func (s *PiServo) Sample(offset int64, localTs uint64) (float64, State)

Sample function to calculate frequency based on the offset

func (*PiServo) SetLastFreq

func (s *PiServo) SetLastFreq(freq float64)

SetLastFreq function to set last freq

func (*PiServo) SetMaxFreq

func (s *PiServo) SetMaxFreq(freq float64)

SetMaxFreq is to adjust frequency range supported by PHC

func (*PiServo) SyncInterval

func (s *PiServo) SyncInterval(interval float64)

SyncInterval inform a clock servo about the master's sync interval in seconds

type PiServoCfg

type PiServoCfg struct {
	PiKp         float64
	PiKi         float64
	PiKpScale    float64
	PiKpExponent float64
	PiKpNormMax  float64
	PiKiScale    float64
	PiKiExponent float64
	PiKiNormMax  float64
}

PiServoCfg is an integral servo config

func DefaultPiServoCfg

func DefaultPiServoCfg() *PiServoCfg

DefaultPiServoCfg to create default pi servo config

type PiServoFilter

type PiServoFilter struct {
	// contains filtered or unexported fields
}

PiServoFilter is a filter state structure

func NewPiServoFilter

func NewPiServoFilter(s *PiServo, cfg *PiServoFilterCfg) *PiServoFilter

NewPiServoFilter to create new filter instance

func (*PiServoFilter) MeanFreq

func (f *PiServoFilter) MeanFreq() float64

MeanFreq to return best calculated frequency

func (*PiServoFilter) Reset

func (f *PiServoFilter) Reset()

Reset - cleanup and restart filter

func (*PiServoFilter) Sample

func (f *PiServoFilter) Sample(s *PiServoFilterSample)

Sample to add a sample to filter and recalculate value

type PiServoFilterCfg

type PiServoFilterCfg struct {
	// contains filtered or unexported fields
}

PiServoFilterCfg is a filter configuration

func DefaultPiServoFilterCfg

func DefaultPiServoFilterCfg() *PiServoFilterCfg

DefaultPiServoFilterCfg to create a default pi servo filter config

type PiServoFilterSample

type PiServoFilterSample struct {
	// contains filtered or unexported fields
}

PiServoFilterSample is a structure of offset and frequency

type Servo

type Servo struct {
	StepThreshold      int64
	FirstStepThreshold int64
	FirstUpdate        bool
	OffsetThreshold    int64
	// contains filtered or unexported fields
}

Servo structure has values common for any type of servo

func DefaultServoConfig

func DefaultServoConfig() Servo

DefaultServoConfig generates default servo struct

type State

type State uint8

State provides the result of servo calculation

const (
	StateInit     State = 0
	StateJump     State = 1
	StateLocked   State = 2
	StateFilter   State = 3
	StateHoldover State = 4
)

All the states of servo

func (State) String

func (s State) String() string

Jump to

Keyboard shortcuts

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