Documentation ¶
Index ¶
- func GoalAndTrack(goal int, block bool, servos ...*Servo) error
- func TorqueOffVar(servos ...*Servo) error
- func TorqueOnVar(servos ...*Servo) error
- func WaitForMovementVar(servos ...*Servo) error
- type Servo
- func (s *Servo) AlarmLED() (int, error)
- func (s *Servo) AlarmShutdown() (int, error)
- func (s *Servo) Angle() (float64, error)
- func (s *Servo) BaudRate() (int, error)
- func (s *Servo) CCWAngleLimit() (int, error)
- func (s *Servo) CCWComplianceMargin() (int, error)
- func (s *Servo) CCWComplianceSlope() (int, error)
- func (s *Servo) CWAngleLimit() (int, error)
- func (s *Servo) CWComplianceMargin() (int, error)
- func (s *Servo) CWComplianceSlope() (int, error)
- func (s *Servo) DGain() (int, error)
- func (s *Servo) DriveMode() (int, error)
- func (s *Servo) FetchReturnLevel() error
- func (s *Servo) FirmwareVersion() (int, error)
- func (s *Servo) GoalPosition() (int, error)
- func (s *Servo) HighestLimitTemperature() (int, error)
- func (s *Servo) HighestLimitVoltage() (int, error)
- func (s *Servo) IGain() (int, error)
- func (s *Servo) LED() (bool, error)
- func (s *Servo) LimitTemperature() (int, error)
- func (s *Servo) Lock() (int, error)
- func (s *Servo) LowestLimitVoltage() (int, error)
- func (s *Servo) MaxPositionLimit() (int, error)
- func (s *Servo) MaxTorque() (int, error)
- func (s *Servo) MinPositionLimit() (int, error)
- func (s *Servo) ModelNumber() (int, error)
- func (s *Servo) MoveTo(angle float64) error
- func (s *Servo) Moving() (int, error)
- func (s *Servo) MovingSpeed() (int, error)
- func (s *Servo) MovingThreshold() (int, error)
- func (s *Servo) PGain() (int, error)
- func (s *Servo) Ping() error
- func (s *Servo) Position() (int, error)
- func (s *Servo) PresentLoad() (int, error)
- func (s *Servo) PresentPosition() (int, error)
- func (s *Servo) PresentSpeed() (int, error)
- func (s *Servo) PresentTemperature() (int, error)
- func (s *Servo) PresentVoltage() (int, error)
- func (s *Servo) PrintRegisters()
- func (s *Servo) Reboot() error
- func (s *Servo) Registered() (int, error)
- func (s *Servo) RegisteredInstruction() (int, error)
- func (s *Servo) ReturnDelayTime() (int, error)
- func (s *Servo) ReturnLevel() (int, error)
- func (s *Servo) ServoID() (int, error)
- func (s *Servo) SetAlarmLED(v int) error
- func (s *Servo) SetAlarmShutdown(v int) error
- func (s *Servo) SetBaudRate(v int) error
- func (s *Servo) SetBuffered(buf bool)
- func (s *Servo) SetCCWAngleLimit(v int) error
- func (s *Servo) SetCCWComplianceMarginval(v int) error
- func (s *Servo) SetCCWComplianceSlope(v int) error
- func (s *Servo) SetCWAngleLimit(v int) error
- func (s *Servo) SetCWComplianceMargin(v int) error
- func (s *Servo) SetCWComplianceSlope(v int) error
- func (s *Servo) SetDGain(v int) error
- func (s *Servo) SetDriveMode(v int) error
- func (s *Servo) SetGoalPWM(val int) error
- func (s *Servo) SetGoalPosition(pos int) error
- func (s *Servo) SetHighestLimitTemperature(v int) error
- func (s *Servo) SetHighestLimitVoltage(v int) error
- func (s *Servo) SetIGain(v int) error
- func (s *Servo) SetIdent(ident int) error
- func (s *Servo) SetLED(state bool) error
- func (s *Servo) SetLimitTemperature(v int) error
- func (s *Servo) SetLock(isLocked int) error
- func (s *Servo) SetLowestLimitVoltage(v int) error
- func (s *Servo) SetMaxPositionLimit(v int) error
- func (s *Servo) SetMaxTorque(v int) error
- func (s *Servo) SetMinPositionLimit(v int) error
- func (s *Servo) SetMovingSpeed(speed int) error
- func (s *Servo) SetMovingThreshold(v int) error
- func (s *Servo) SetOperatingMode(v int) error
- func (s *Servo) SetPGain(v int) error
- func (s *Servo) SetProfileAcceleration(val int) error
- func (s *Servo) SetProfileVelocity(val int) error
- func (s *Servo) SetReturnDelayTime(v int) error
- func (s *Servo) SetReturnLevel(value int) error
- func (s *Servo) SetServoID(ident int) error
- func (s *Servo) SetTorqueEnable(state bool) error
- func (s *Servo) SetTorqueLimit(val int) error
- func (s *Servo) SetZero(offset float64)
- func (s *Servo) TorqueEnable() (bool, error)
- func (s *Servo) TorqueLimit() (int, error)
- func (s *Servo) Voltage() (float64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GoalAndTrack ¶
GoalAndTrack takes a goal position and some servos, and moves all servos to that position It will optionally track the joint positions and block until the servos are done moving
func TorqueOffVar ¶
Turn on torque for a select few servos
func WaitForMovementVar ¶
WaitForMovement takes some servos, and will block until the servos are done moving
Types ¶
type Servo ¶
func NewWithReturnLevel ¶
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) AlarmShutdown ¶
func (*Servo) CCWAngleLimit ¶
func (*Servo) CCWComplianceMargin ¶
func (*Servo) CCWComplianceSlope ¶
func (*Servo) CWAngleLimit ¶
func (*Servo) CWComplianceMargin ¶
func (*Servo) CWComplianceSlope ¶
func (*Servo) FetchReturnLevel ¶
func (*Servo) FirmwareVersion ¶
func (*Servo) GoalPosition ¶
func (*Servo) HighestLimitTemperature ¶
func (*Servo) HighestLimitVoltage ¶
func (*Servo) LED ¶
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 ¶
LimitTemperature is an alias for HighestLimitTemperature, since the XL-320 calls it that.
func (*Servo) LowestLimitVoltage ¶
func (*Servo) MaxPositionLimit ¶
func (*Servo) MinPositionLimit ¶
func (*Servo) ModelNumber ¶
func (*Servo) MoveTo ¶
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) MovingSpeed ¶
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) MovingThreshold ¶
func (*Servo) Ping ¶
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) PresentLoad ¶
func (*Servo) PresentPosition ¶
func (*Servo) PresentSpeed ¶
func (*Servo) PresentTemperature ¶
func (*Servo) PresentVoltage ¶
func (*Servo) PrintRegisters ¶
func (s *Servo) PrintRegisters()
PrintRegisters prints out the contents of all registers
func (*Servo) Registered ¶
Registered is a legacy alias for RegisteredInstruction. The XL docs use the longer name, which seems clearer to me.
func (*Servo) RegisteredInstruction ¶
func (*Servo) ReturnDelayTime ¶
func (*Servo) ReturnLevel ¶
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) SetAlarmLED ¶
func (*Servo) SetAlarmShutdown ¶
func (*Servo) SetBaudRate ¶
func (*Servo) SetBuffered ¶
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 (*Servo) SetCCWComplianceMarginval ¶
func (*Servo) SetCCWComplianceSlope ¶
func (*Servo) SetCWAngleLimit ¶
func (*Servo) SetCWComplianceMargin ¶
func (*Servo) SetCWComplianceSlope ¶
func (*Servo) SetDriveMode ¶
func (*Servo) SetGoalPWM ¶
func (*Servo) SetGoalPosition ¶
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 (*Servo) SetHighestLimitVoltage ¶
func (*Servo) SetLimitTemperature ¶
SetLimitTemperature is an alias for SetHighestLimitTemperature, since the XL-320 calls it that.
func (*Servo) SetLowestLimitVoltage ¶
func (*Servo) SetMaxPositionLimit ¶
func (*Servo) SetMaxTorque ¶
func (*Servo) SetMinPositionLimit ¶
func (*Servo) SetMovingSpeed ¶
SetMovingSpeed the moving speed.
Note: Setting the moving speed appears to reset the TorqueEnabled register to
true, at least on my AX12s.
func (*Servo) SetMovingThreshold ¶
func (*Servo) SetOperatingMode ¶
func (*Servo) SetProfileAcceleration ¶
func (*Servo) SetProfileVelocity ¶
func (*Servo) SetReturnDelayTime ¶
func (*Servo) SetReturnLevel ¶
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 ¶
SetServoID changes the identity of the servo. This is stored in EEPROM, so will persist between reboots.
func (*Servo) SetTorqueEnable ¶
SetTorqueEnable enables or disables torque.