servo

package
v0.0.0-...-be9965c Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2016 License: MIT Imports: 5 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Servo

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

func New

func New(proto iface.Protocol, registers reg.Map, ID int) *Servo

New returns a new Servo.

func NewWithReturnLevel

func NewWithReturnLevel(proto iface.Protocol, registers reg.Map, ID int, returnLevel int) *Servo

NewWithReturnLevel returns a servo with its Return Level preconfigured. It's better to use New and SetReturnLevel to be sure, but this can be useful when we're absolutely sure what the return level currently is.

func (*Servo) AlarmLED

func (s *Servo) AlarmLED() (int, error)

func (*Servo) AlarmShutdown

func (s *Servo) AlarmShutdown() (int, error)

func (*Servo) Angle

func (s *Servo) Angle() (float64, error)

Returns the current position of the servo, relative to the zero angle.

func (*Servo) BaudRate

func (s *Servo) BaudRate() (int, error)

func (*Servo) CCWAngleLimit

func (s *Servo) CCWAngleLimit() (int, error)

func (*Servo) CCWComplianceMargin

func (s *Servo) CCWComplianceMargin() (int, error)

func (*Servo) CCWComplianceSlope

func (s *Servo) CCWComplianceSlope() (int, error)

func (*Servo) CWAngleLimit

func (s *Servo) CWAngleLimit() (int, error)

func (*Servo) CWComplianceMargin

func (s *Servo) CWComplianceMargin() (int, error)

func (*Servo) CWComplianceSlope

func (s *Servo) CWComplianceSlope() (int, error)

func (*Servo) FetchReturnLevel

func (s *Servo) FetchReturnLevel() error

func (*Servo) FirmwareVersion

func (s *Servo) FirmwareVersion() (int, error)

func (*Servo) GoalPosition

func (s *Servo) GoalPosition() (int, error)

func (*Servo) HighestLimitTemperature

func (s *Servo) HighestLimitTemperature() (int, error)

func (*Servo) HighestLimitVoltage

func (s *Servo) HighestLimitVoltage() (int, error)

func (*Servo) LED

func (s *Servo) LED() (bool, error)

LED returns the current state of the servo's LED. TODO: Should we continue to return bool here, or expose the int?

func (*Servo) LimitTemperature

func (s *Servo) LimitTemperature() (int, error)

LimitTemperature is an alias for HighestLimitTemperature, since the XL-320 calls it that.

func (*Servo) Lock

func (s *Servo) Lock() (int, error)

TODO: Rename this to avoid confusion?

func (*Servo) LowestLimitVoltage

func (s *Servo) LowestLimitVoltage() (int, error)

func (*Servo) MaxTorque

func (s *Servo) MaxTorque() (int, error)

func (*Servo) ModelNumber

func (s *Servo) ModelNumber() (int, error)

func (*Servo) MoveTo

func (s *Servo) MoveTo(angle float64) error

MoveTo sets the goal position of the servo by angle (in degrees), where zero is the midpoint, 150 deg is max left (clockwise), and -150 deg is max right (counter-clockwise). This is generally preferable to calling SetGoalPosition, which uses the internal uint16 representation.

func (*Servo) Moving

func (s *Servo) Moving() (int, error)

func (*Servo) MovingSpeed

func (s *Servo) MovingSpeed() (int, error)

MovingSpeed returns the current moving speed. This is not the speed at which the motor is moving, it's the speed at which the servo wants to move.

func (*Servo) Ping

func (s *Servo) Ping() error

Ping sends the PING instruction to servo, and waits for the response. Returns nil if the ping succeeds, otherwise an error. It's optional, but a very good idea, to call this before sending any other instructions to the servo.

func (*Servo) Position

func (s *Servo) Position() (int, error)

Position is a legacy alias for PresentPosition.

func (*Servo) PresentLoad

func (s *Servo) PresentLoad() (int, error)

func (*Servo) PresentPosition

func (s *Servo) PresentPosition() (int, error)

func (*Servo) PresentSpeed

func (s *Servo) PresentSpeed() (int, error)

func (*Servo) PresentTemperature

func (s *Servo) PresentTemperature() (int, error)

func (*Servo) PresentVoltage

func (s *Servo) PresentVoltage() (int, error)

func (*Servo) Registered

func (s *Servo) Registered() (int, error)

Registered is a legacy alias for RegisteredInstruction. The XL docs use the longer name, which seems clearer to me.

func (*Servo) RegisteredInstruction

func (s *Servo) RegisteredInstruction() (int, error)

func (*Servo) ReturnDelayTime

func (s *Servo) ReturnDelayTime() (int, error)

func (*Servo) ReturnLevel

func (s *Servo) ReturnLevel() (int, error)

ReturnLevel returns the current return level of the servo, or an error if we don't know. This method will never actually read from the control table, because it's expected to be called by getters are setters.

func (*Servo) ServoID

func (s *Servo) ServoID() (int, error)

func (*Servo) SetAlarmLED

func (s *Servo) SetAlarmLED(v int) error

func (*Servo) SetAlarmShutdown

func (s *Servo) SetAlarmShutdown(v int) error

func (*Servo) SetBaudRate

func (s *Servo) SetBaudRate(v int) error

func (*Servo) SetBuffered

func (s *Servo) SetBuffered(buf bool)

Enable instruction buffering, which causes register accessors to send the REG_WRITE instruction instead of WRITE_DATA. This causes writes to be buffered until the ACTION instruction is received (via Protocol.Action).

func (*Servo) SetCCWAngleLimit

func (s *Servo) SetCCWAngleLimit(v int) error

func (*Servo) SetCCWComplianceMarginval

func (s *Servo) SetCCWComplianceMarginval(v int) error

func (*Servo) SetCCWComplianceSlope

func (s *Servo) SetCCWComplianceSlope(v int) error

func (*Servo) SetCWAngleLimit

func (s *Servo) SetCWAngleLimit(v int) error

func (*Servo) SetCWComplianceMargin

func (s *Servo) SetCWComplianceMargin(v int) error

func (*Servo) SetCWComplianceSlope

func (s *Servo) SetCWComplianceSlope(v int) error

func (*Servo) SetGoalPosition

func (s *Servo) SetGoalPosition(pos int) error

SetGoalPosition sets the goal position.

TODO: Reject if the servo is in wheel mode (where CW and CCW angle limit

is zero).

func (*Servo) SetHighestLimitTemperature

func (s *Servo) SetHighestLimitTemperature(v int) error

func (*Servo) SetHighestLimitVoltage

func (s *Servo) SetHighestLimitVoltage(v int) error

func (*Servo) SetIdent

func (s *Servo) SetIdent(ident int) error

SetIdent is a legacy alias for SetServoID.

func (*Servo) SetLED

func (s *Servo) SetLED(state bool) error

Enables or disables the servo's LED.

func (*Servo) SetLimitTemperature

func (s *Servo) SetLimitTemperature(v int) error

SetLimitTemperature is an alias for SetHighestLimitTemperature, since the XL-320 calls it that.

func (*Servo) SetLock

func (s *Servo) SetLock(isLocked int) error

func (*Servo) SetLowestLimitVoltage

func (s *Servo) SetLowestLimitVoltage(v int) error

func (*Servo) SetMaxTorque

func (s *Servo) SetMaxTorque(v int) error

func (*Servo) SetMovingSpeed

func (s *Servo) SetMovingSpeed(speed int) error

SetMovingSpeed the moving speed.

Note: Setting the moving speed appears to reset the TorqueEnabled register to

true, at least on my AX12s.

func (*Servo) SetReturnDelayTime

func (s *Servo) SetReturnDelayTime(v int) error

func (*Servo) SetReturnLevel

func (s *Servo) SetReturnLevel(value int) error

SetReturnLevel sets the return level. Possible values are:

0 = Only respond to PING commands
1 = Only respond to PING and READ commands
2 = Respond to all commands

The factory default setting is 2, but this register is persisted in EEPROM, so does not reset when power-cycled. To avoid waiting for a response from a servo which will never respond, or (worse) receiving unexpected responses, use this method to set the value explicitly immediately after connecting.

See: dxl_ax_actuator.htm#Actuator_Address_10

func (*Servo) SetServoID

func (s *Servo) SetServoID(ident int) error

SetServoID changes the identity of the servo. This is stored in EEPROM, so will persist between reboots.

func (*Servo) SetTorqueEnable

func (s *Servo) SetTorqueEnable(state bool) error

SetTorqueEnable enables or disables torque.

func (*Servo) SetTorqueLimit

func (s *Servo) SetTorqueLimit(val int) error

func (*Servo) SetZero

func (s *Servo) SetZero(offset float64)

Sets the origin angle (in degrees).

func (*Servo) TorqueEnable

func (s *Servo) TorqueEnable() (bool, error)

func (*Servo) TorqueLimit

func (s *Servo) TorqueLimit() (int, error)

func (*Servo) Voltage

func (s *Servo) Voltage() (float64, error)

Voltage returns the current voltage supplied. Unlike the underlying register, this is the actual voltage, not multiplied by ten.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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