Documentation ¶
Overview ¶
Package motorutil provides utilities for motor handling.
Index ¶
- func ResetAll() error
- type Errors
- type Steering
- func (s *Steering) Err() error
- func (s *Steering) SetStopAction(action string) *Steering
- func (s *Steering) SteerCounts(speed, turn, counts int) *Steering
- func (s *Steering) SteerDuration(speed, turn int, d time.Duration) *Steering
- func (s *Steering) StopAction() (string, error)
- func (s *Steering) StopActions() ([]string, error)
- func (s *Steering) Wait() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Steering ¶
type Steering struct {
// Left and Right are the left and right motors to be
// used by the steering module.
Left, Right *ev3dev.TachoMotor
// Timeout is the timeout for waiting for motors to
// return to a non-driving state.
//
// See ev3dev.Wait documentation for timeout behaviour.
Timeout time.Duration
// contains filtered or unexported fields
}
Steering implements a paired-motor steering unit similar to an EV3-G steering block.
Errors ocurring during steering operations are sticky. They are returned either by a call to Err or Wait.
func (*Steering) SetStopAction ¶
SetStopAction sets the stop action to be used when a stop command is issued to the TachoMotor. SetStopAction returns on the first error encountered.
func (*Steering) SteerCounts ¶
SteerCounts steers in the given turn for the given tacho counts and at the specified speed. The valid range of turn is -100 (hard left) to +100 (hard right). If the product of counts and speed is negative, the turn will be made in reverse.
See the ev3dev.SetSpeedSetPoint and ev3dev.SetPositionSetPoint documentation for speed and count behaviour.
func (*Steering) SteerDuration ¶
SteerDuration steers in the given turn for the given duration, d, and at the specified speed. The valid range of turn is -100 (hard left) to +100 (hard right). If speed is negative, the turn will be made in reverse.
See the ev3dev.SetSpeedSetpoint and ev3dev.SetTimeSetpoint documentation for speed and duration behaviour.
func (*Steering) StopAction ¶
StopAction returns the stop action used when a stop command is issued to the TachoMotor devices held by the Steering. StopAction returns an error if the two motors do not agree on the stop action.
func (*Steering) StopActions ¶
StopActions returns the available stop actions for the TachoMotor. StopAction returns an error and the intersection of available actions if the two motors do not agree on the available stop actions.