servo

package
v0.0.0-...-0cd537b Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MoveTimeWrite InstName = iota
	MoveTimeRead
	MoveTimeWaitWrite
	MoveTimeWaitRead
	MoveStart
	MoveStop
	IDWrite
	IDRead
	AngleOffsetAdjust
	AngleOffsetWrite
	AngleOffsetRead
	AngleLimitWrite
	AngleLimitRead
	VoltageLimitWrite
	VoltageLimitRead
	TemperatureMaxLimitWrite
	TemperatureMaxLimitRead
	TemperatureRead
	VoltageRead
	PositionRead
	MotorModeWrite
	MotorModeRead
	LoadOrUnloadWrite
	LoadOrUnloadRead
	LEDControlWrite
	LEDControlRead
	LEDErrorWrite
	LEDErrorRead

	RO Access = false
	RW Access = true
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access bool

type InstByte

type InstByte byte

type InstName

type InstName int

func GetInstName

func GetInstName(text string) InstName

func (InstName) String

func (i InstName) String() string

type Instruction

type Instruction struct {
	//
	InstByte byte

	Length int

	Access Access
}

type InstructionMap

type InstructionMap map[InstName]*Instruction

type Servo

type Servo struct {
	Protocol iface.Protocol
	ID       int
	// contains filtered or unexported fields
}

func New

func New(proto iface.Protocol, instructions InstructionMap, ID int) *Servo

New returns a new Servo.

func (*Servo) AngleLimitRead

func (s *Servo) AngleLimitRead() ([]byte, error)

AngleLimitRead TODO: translate byte to angle and position

func (*Servo) AngleLimitWrite

func (s *Servo) AngleLimitWrite(minAngle uint16, maxAngle uint16) error

AngleLimitWrite: Set angle limit

func (*Servo) AngleOffsetAdjust

func (s *Servo) AngleOffsetAdjust(adjust uint16) error

AngleOffsetAdjust

func (*Servo) AngleOffsetRead

func (s *Servo) AngleOffsetRead() ([]byte, error)

AngleOffsetRead: Read Offset from Servo's EEPROM

func (*Servo) AngleOffsetWrite

func (s *Servo) AngleOffsetWrite() error

AngleOffsetWrite: Save Offset to Servo's EEPROM

func (*Servo) IDRead

func (s *Servo) IDRead() ([]byte, error)

IDRead

func (*Servo) IDWrite

func (s *Servo) IDWrite(newID uint16) error

IDWrite

func (*Servo) LEDControlRead

func (s *Servo) LEDControlRead() ([]byte, error)

LEDControlRead

func (*Servo) LEDControlWrite

func (s *Servo) LEDControlWrite(isAlwayOn uint16) error

LEDControlWrite

func (*Servo) LEDErrorRead

func (s *Servo) LEDErrorRead() ([]byte, error)

LEDErrorRead

func (*Servo) LEDErrorWrite

func (s *Servo) LEDErrorWrite(lightColor uint16) error

LEDErrorWrite lightColor: 1~7

func (*Servo) LoadOrUnloadRead

func (s *Servo) LoadOrUnloadRead() ([]byte, error)

LoadOrUnloadRead

func (*Servo) LoadOrUnloadWrite

func (s *Servo) LoadOrUnloadWrite(isLoad uint16) error

LoadOrUnloadWrite

func (*Servo) MotorModeRead

func (s *Servo) MotorModeRead() ([]byte, error)

MotorModeRead

func (*Servo) MotorModeWrite

func (s *Servo) MotorModeWrite(isMotor uint16, speed uint16) error

MotorModeWrite speed: -1000 to 1000

func (*Servo) MoveStart

func (s *Servo) MoveStart() error

MoveStart

func (*Servo) MoveStop

func (s *Servo) MoveStop() ([]byte, error)

MoveStop

func (*Servo) MoveTimeRead

func (s *Servo) MoveTimeRead() ([]byte, error)

MoveTimeRead

func (*Servo) MoveTimeWaitRead

func (s *Servo) MoveTimeWaitRead() ([]byte, error)

MoveTimeWaitRead

func (*Servo) MoveTimeWaitWrite

func (s *Servo) MoveTimeWaitWrite(position uint16, ms uint16) error

MoveTimeWaitWrite

func (*Servo) MoveTimeWrite

func (s *Servo) MoveTimeWrite(position uint16, ms uint16) error

MoveTimeWrite

func (*Servo) PositionRead

func (s *Servo) PositionRead() ([]byte, error)

PositionRead

func (*Servo) SendInstruction

func (s *Servo) SendInstruction(i InstName, values []uint16) error

func (*Servo) TemperatureMaxLimitRead

func (s *Servo) TemperatureMaxLimitRead() ([]byte, error)

TemperatureMaxLimitRead

func (*Servo) TemperatureMaxLimitWrite

func (s *Servo) TemperatureMaxLimitWrite(maxTemperature uint16) error

TemperatureMaxLimitWrite

func (*Servo) TemperatureRead

func (s *Servo) TemperatureRead() ([]byte, error)

TemperatureRead

func (*Servo) VoltageLimitRead

func (s *Servo) VoltageLimitRead() ([]byte, error)

VoltageLimitRead

func (*Servo) VoltageLimitWrite

func (s *Servo) VoltageLimitWrite(minVoltage uint16, maxVoltage uint16) error

VoltageLimitWrite

func (*Servo) VoltageRead

func (s *Servo) VoltageRead() ([]byte, error)

VoltageRead

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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