Documentation
¶
Index ¶
- Constants
- Variables
- func RunLua(script string, ctrl *Controller) error
- type Battery
- type Color
- type ColorAmbient
- type ColorData
- type ColorReflect
- type ColorValue
- type Controller
- func (ctrl *Controller) Battery() (*Battery, error)
- func (ctrl *Controller) NewColor(inAddr string) (*Color, error)
- func (ctrl *Controller) NewColorAmbient(inAddr string) (*ColorAmbient, error)
- func (ctrl *Controller) NewColorReflect(inAddr string) (*ColorReflect, error)
- func (ctrl *Controller) NewIRProxy(inAddr string) (*IRProxy, error)
- func (ctrl *Controller) NewIRRemote(inAddr string) (*IRRemote, error)
- func (ctrl *Controller) NewIRSeek(inAddr string) (*IRSeek, error)
- func (ctrl *Controller) NewMotor(outAddr string) (*Motor, error)
- func (ctrl *Controller) NewTouch(inAddr string) (*Touch, error)
- type ControllerOption
- type IRProxy
- type IRRemote
- type IRRemoteCode
- type IRRemoteData
- type IRSeek
- type IRSeekChannel
- type IRSeekData
- type Motor
- func (tm *Motor) ChangePolarity(p string) error
- func (tm *Motor) ChangePositionSP(val int) error
- func (tm *Motor) ChangeRampDownSP(d time.Duration) error
- func (tm *Motor) ChangeRampUpSP(d time.Duration) error
- func (tm *Motor) ChangeSpeedSP(val int) error
- func (tm *Motor) ChangeStopAction(sa string) error
- func (tm *Motor) ChangeTimeSP(d time.Duration) error
- func (m *Motor) Move() *Move
- func (tm *Motor) Polarity() (string, error)
- func (tm *Motor) Position() (int, error)
- func (tm *Motor) PositionSP() (int, error)
- func (tm *Motor) RampDownSP() (time.Duration, error)
- func (tm *Motor) RampUpSP() (time.Duration, error)
- func (tm *Motor) Reset() error
- func (tm *Motor) RunDirect() error
- func (tm *Motor) RunForever() error
- func (tm *Motor) RunTimed() error
- func (tm *Motor) RunToAbsPos() error
- func (tm *Motor) RunToRelPos() error
- func (tm *Motor) Speed() (int, error)
- func (tm *Motor) SpeedSP() (int, error)
- func (tm *Motor) State() (States, error)
- func (tm *Motor) Stop() error
- func (tm *Motor) StopAction() (string, error)
- func (tm *Motor) TimeSP() (time.Duration, error)
- type MotorDescriptor
- type Move
- type SensorDescriptor
- type Server
- type State
- type States
- type Touch
Constants ¶
const ( OutA = "outA" OutB = "outB" OutC = "outC" OutD = "outD" )
All out Addresses
const ( In1 = "in1" In2 = "in2" In3 = "in3" In4 = "in4" )
All in Addresses
const ( NoColor ColorValue = 0 Black = 1 Blue = 2 Green = 3 Yellow = 4 Red = 5 White = 6 Brown = 7 )
const ( IRRCNone IRRemoteCode = 0 IRRCRedUp = 1 IRRCRedDown = 2 IRRCBlueUp = 3 IRRCBlueDown = 4 IRRCRedUpBlueUp = 5 IRRCRedUpBlueDown = 6 IRRCRedDownBlueUp = 7 IRRCRedDownBlueDown = 8 IRRCBeaconOn = 9 IRRCRedUpRedDown = 10 IRRCBlueUpBlueDown = 11 )
possible values for remote code
const ( StopActionCoast = "coast" StopActionBrake = "brake" StopActionHold = "hold" )
List of all stop actions
const ( PolarityNormal = "normal" PolarityInversed = "inversed" )
List of all polarities actions
Variables ¶
var StatesMoving = States{StateRunning, StateRamping}
StatesMoving contains all moving states
var StatesNotMoving = States{StateIdle, StateHolding, StateOverloaded, StateStalled}
StatesNotMoving contains all non-moving states
Functions ¶
func RunLua ¶
func RunLua(script string, ctrl *Controller) error
Types ¶
type ColorAmbient ¶
type ColorAmbient struct {
// contains filtered or unexported fields
}
func (*ColorAmbient) Read ¶
func (cr *ColorAmbient) Read() int
type ColorData ¶
type ColorData struct {
Value ColorValue
}
type ColorReflect ¶
type ColorReflect struct {
// contains filtered or unexported fields
}
func (*ColorReflect) Read ¶
func (cr *ColorReflect) Read() int
type ColorValue ¶
type ColorValue int
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(options ...ControllerOption) (*Controller, error)
func (*Controller) Battery ¶
func (ctrl *Controller) Battery() (*Battery, error)
func (*Controller) NewColorAmbient ¶
func (ctrl *Controller) NewColorAmbient(inAddr string) (*ColorAmbient, error)
func (*Controller) NewColorReflect ¶
func (ctrl *Controller) NewColorReflect(inAddr string) (*ColorReflect, error)
color sensors
func (*Controller) NewIRProxy ¶
func (ctrl *Controller) NewIRProxy(inAddr string) (*IRProxy, error)
func (*Controller) NewIRRemote ¶
func (ctrl *Controller) NewIRRemote(inAddr string) (*IRRemote, error)
type ControllerOption ¶
type ControllerOption func(ctrl *Controller) error
func WithBatteryFS ¶
func WithBatteryFS(fs string) ControllerOption
func WithMotorFS ¶
func WithMotorFS(fs string) ControllerOption
func WithSensorFS ¶
func WithSensorFS(fs string) ControllerOption
type IRRemote ¶
type IRRemote struct {
// contains filtered or unexported fields
}
func (*IRRemote) Read ¶
func (irr *IRRemote) Read() IRRemoteData
type IRRemoteCode ¶
type IRRemoteCode int
IRRemoteCode is the returning chanel mode for ir remote mode
func (IRRemoteCode) String ¶
func (irrc IRRemoteCode) String() string
type IRRemoteData ¶
type IRRemoteData struct {
Channels [4]IRRemoteCode
}
IRRemoteData is the returning data structure for ir remote mode
func (IRRemoteData) String ¶
func (irrd IRRemoteData) String() string
type IRSeek ¶
type IRSeek struct {
// contains filtered or unexported fields
}
func (*IRSeek) Seek ¶
func (irs *IRSeek) Seek() IRSeekData
ReadData reads the channel data from the seek; for distance 100% is approximately 200cm, heading is -25 far left, 25 far right
type IRSeekChannel ¶
type IRSeekData ¶
type IRSeekData struct {
Channels [4]IRSeekChannel
}
func (IRSeekData) String ¶
func (irsd IRSeekData) String() string
type Motor ¶
type Motor struct {
Descriptor MotorDescriptor
}
Motor is the base struct to control motors
func (*Motor) ChangePolarity ¶
ChangePolarity changes the polarity to the specified value
func (*Motor) ChangePositionSP ¶
ChangePositionSP changes the position_sp to the specified value
func (*Motor) ChangeRampDownSP ¶
ChangeRampDownSP changes the ramp_down_sp to the specified value
func (*Motor) ChangeRampUpSP ¶
ChangeRampUpSP changes the ramp_up_sp to the specified value
func (*Motor) ChangeSpeedSP ¶
ChangeSpeedSP changes the speed_sp to the specified value
func (*Motor) ChangeStopAction ¶
ChangeStopAction changes the stop action to the specified value
func (*Motor) ChangeTimeSP ¶
ChangeTimeSP changes the time_sp to the specified value
func (*Motor) PositionSP ¶
PositionSP returns position_sp
func (*Motor) RampDownSP ¶
RampDownSP returns ramp_down_sp
func (*Motor) RunForever ¶
RunForever executes the run-forever command
func (*Motor) RunToAbsPos ¶
RunToAbsPos executes the run-to-abs-pos command
func (*Motor) RunToRelPos ¶
RunToRelPos executes the run-to-rel-pos command
func (*Motor) StopAction ¶
StopAction returns stop_action
type MotorDescriptor ¶
type Move ¶
type Move struct {
// contains filtered or unexported fields
}
Move collects several moves and actions of one motor
func (*Move) WithStopAction ¶
WithStopAction sets the stop-action
type SensorDescriptor ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) ListenAndServe ¶
type State ¶
type State string
State wraps the state
type States ¶
type States []State
States wraps the state list
func (States) ContainsOneOf ¶
ContainsOneOf return if states contains one of the specified ones