Interface IPositionalMotor
Represents an interface for controlling a positional motor.
Assembly: Meadow.Contracts.dll
View Source
public interface IPositionalMotor : IVariableSpeedMotor, IMotor
Properties
Position
Gets the current position of the motor.
View Source
Angle Position { get; }
MaxVelocity
Gets the maximum run velocity for the motor
View Source
AngularVelocity MaxVelocity { get; }
Methods
GoTo(Angle, AngularVelocity, CancellationToken)
Moves the motor to the specified position with the given velocity.
View Source
Task GoTo(Angle position, AngularVelocity velocity, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
Meadow.Units.Angle | position | The target position to move to. |
Meadow.Units.AngularVelocity | velocity | The angular velocity of the motor during the movement. |
System.Threading.CancellationToken | cancellationToken | A token to cancel the operation. |
GoTo(Angle, RotationDirection, AngularVelocity, CancellationToken)
Moves the motor to the specified position and direction with the given velocity.
View Source
Task GoTo(Angle position, RotationDirection direction, AngularVelocity velocity, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
Meadow.Units.Angle | position | The target position to move to. |
Meadow.Peripherals.RotationDirection | direction | The direction in which to move the motor. |
Meadow.Units.AngularVelocity | velocity | The angular velocity of the motor during the movement. |
System.Threading.CancellationToken | cancellationToken | A token to cancel the operation. |
Run(RotationDirection, AngularVelocity, CancellationToken)
Runs the motor in the specified direction with the given velocity.
View Source
Task Run(RotationDirection direction, AngularVelocity velocity, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
Meadow.Peripherals.RotationDirection | direction | The direction in which to run the motor. |
Meadow.Units.AngularVelocity | velocity | The angular velocity of the motor during the run. |
System.Threading.CancellationToken | cancellationToken | A token to cancel the operation. |
RunFor(TimeSpan, RotationDirection, AngularVelocity, CancellationToken)
Runs the motor for a specified duration in the specified direction with the given velocity.
View Source
Task RunFor(TimeSpan runTime, RotationDirection direction, AngularVelocity velocity, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | runTime | The duration for which to run the motor. |
Meadow.Peripherals.RotationDirection | direction | The direction in which to run the motor. |
Meadow.Units.AngularVelocity | velocity | The angular velocity of the motor during the run. |
System.Threading.CancellationToken | cancellationToken | A token to cancel the operation. |
ResetPosition(CancellationToken)
Resets the position of the motor.
View Source
Task ResetPosition(CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | A token to cancel the operation. |
Rotate(Angle, RotationDirection, AngularVelocity, CancellationToken)
Rotates the motor by the specified angle and direction with the given velocity.
View Source
Task Rotate(Angle amountToRotate, RotationDirection direction, AngularVelocity velocity, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
Meadow.Units.Angle | amountToRotate | The angle by which to rotate the motor. |
Meadow.Peripherals.RotationDirection | direction | The direction in which to rotate the motor. |
Meadow.Units.AngularVelocity | velocity | The angular velocity of the motor during the rotation. |
System.Threading.CancellationToken | cancellationToken | A token to cancel the operation. |