Documentation ¶
Overview ¶
Package dimensionengineering contains implementations of the dimensionengineering motor controls
Index ¶
- func NewMotor(ctx context.Context, c *Config, name resource.Name, logger golog.Logger) (motor.LocalMotor, error)
- type Config
- type Motor
- func (m *Motor) Close(ctx context.Context) error
- func (m *Motor) DoCommand(ctx context.Context, cmd map[string]interface{}) (map[string]interface{}, error)
- func (m *Motor) GoFor(ctx context.Context, rpm, revolutions float64, extra map[string]interface{}) error
- func (m *Motor) GoTillStop(ctx context.Context, rpm float64, stopFunc func(ctx context.Context) bool) error
- func (m *Motor) GoTo(ctx context.Context, rpm, position float64, extra map[string]interface{}) error
- func (m *Motor) IsMoving(ctx context.Context) (bool, error)
- func (m *Motor) IsPowered(ctx context.Context, extra map[string]interface{}) (bool, float64, error)
- func (m *Motor) Position(ctx context.Context, extra map[string]interface{}) (float64, error)
- func (m *Motor) Properties(ctx context.Context, extra map[string]interface{}) (map[motor.Feature]bool, error)
- func (m *Motor) ResetZeroPosition(ctx context.Context, offset float64, extra map[string]interface{}) error
- func (m *Motor) SetPower(ctx context.Context, powerPct float64, extra map[string]interface{}) error
- func (m *Motor) Stop(ctx context.Context, extra map[string]interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // path to /dev/ttyXXXX file SerialPath string `json:"serial_path"` // The baud rate of the controller BaudRate int `json:"serial_baud_rate,omitempty"` // Valid values are 128-135 SerialAddress int `json:"serial_address"` // Valid values are 1/2 MotorChannel int `json:"motor_channel"` // Flip the direction of the signal sent to the controller. // Due to wiring/motor orientation, "forward" on the controller may not represent "forward" on the robot DirectionFlip bool `json:"dir_flip,omitempty"` // A value to control how quickly the controller ramps to a particular setpoint RampValue int `json:"controller_ramp_value,omitempty"` // The maximum freewheel rotational velocity of the motor after the final drive (maximum effective wheel speed) MaxRPM float64 `json:"max_rpm,omitempty"` // The name of the encoder used for this motor Encoder string `json:"encoder,omitempty"` // The lowest power percentage to allow for this motor. This is used to prevent motor stalls and overheating. Default is 0.0 MinPowerPct float64 `json:"min_power_pct,omitempty"` // The max power percentage to allow for this motor. Default is 0.0 MaxPowerPct float64 `json:"max_power_pct,omitempty"` // The number of ticks per rotation of this motor from the encoder TicksPerRotation int `json:"ticks_per_rotation,omitempty"` // TestChan is a fake "serial" path for test use only TestChan chan []byte `json:"-,omitempty"` }
Config adds DimensionEngineering-specific config options.
type Motor ¶
type Motor struct { resource.Named resource.AlwaysRebuild // which channel the motor is connected to on the controller Channel int // contains filtered or unexported fields }
Motor is a single axis/motor/component instance.
func (*Motor) DoCommand ¶
func (m *Motor) DoCommand(ctx context.Context, cmd map[string]interface{}) (map[string]interface{}, error)
DoCommand executes additional commands beyond the Motor{} interface.
func (*Motor) GoFor ¶
func (m *Motor) GoFor(ctx context.Context, rpm, revolutions float64, extra map[string]interface{}) error
GoFor moves an inputted number of revolutions at the given rpm, no encoder is present for this so power is determined via a linear relationship with the maxRPM and the distance traveled is a time based estimation based on desired RPM.
func (*Motor) GoTillStop ¶
func (m *Motor) GoTillStop(ctx context.Context, rpm float64, stopFunc func(ctx context.Context) bool) error
GoTillStop moves a motor until stopped by the controller (due to switch or function) or stopFunc.
func (*Motor) GoTo ¶
func (m *Motor) GoTo(ctx context.Context, rpm, position float64, extra map[string]interface{}) error
GoTo instructs the motor to go to a specific position (provided in revolutions from home/zero), at a specific speed. Regardless of the directionality of the RPM this function will move the motor towards the specified target/position.
func (*Motor) Properties ¶
func (m *Motor) Properties(ctx context.Context, extra map[string]interface{}) (map[motor.Feature]bool, error)
Properties returns the additional features supported by this motor.
func (*Motor) ResetZeroPosition ¶
func (m *Motor) ResetZeroPosition(ctx context.Context, offset float64, extra map[string]interface{}) error
ResetZeroPosition defines the current position to be zero (+/- offset).