Documentation ¶
Overview ¶
Package dmc4000 implements stepper motors behind a Galil DMC4000 series motor controller
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) Home(ctx context.Context) 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) Jog(ctx context.Context, rpm 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 { resource.TriviallyValidateConfig DirectionFlip bool `json:"dir_flip,omitempty"` // Flip the direction of the signal sent if there is a Dir pin MaxRPM float64 `json:"max_rpm,omitempty"` MaxAcceleration float64 `json:"max_acceleration_rpm_per_sec,omitempty"` TicksPerRotation int `json:"ticks_per_rotation"` SerialDevice string `json:"serial_path"` // path to /dev/ttyXXXX file Axis string `json:"controller_axis"` // A-H HomeRPM float64 `json:"home_rpm"` // Speed for Home() // Set the per phase current (when using stepper amp) // https://www.galil.com/download/comref/com4103/index.html#amplifier_gain.html AmplifierGain int `json:"amplifier_gain"` // Can reduce current when holding // https://www.galil.com/download/comref/com4103/index.html#low_current_stepper_mode.html LowCurrent int `json:"low_current"` // TestChan is a fake "serial" path for test use only TestChan chan string `json:"-"` }
Config adds DMC-specific config options.
type Motor ¶
type Motor struct { resource.Named resource.AlwaysRebuild Axis string TicksPerRotation int MaxAcceleration float64 HomeRPM float64 // 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 instructs the motor to go in a specific direction for a specific amount of revolutions at a given speed in revolutions per minute. Both the RPM and the revolutions can be assigned negative values to move in a backwards direction. Note: if both are negative the motor will spin in the forward direction.
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).