Motor class abstract Components
Motor represents a physical motor.
For more information, see Motor component.
- Inheritance
- Implementers
Constructors
- Motor()
Properties
Methods
-
doCommand(
Map< String, dynamic> command) → Future<Map< String, dynamic> > -
Send/Receive arbitrary commands to the Resource
inherited
-
goFor(
double rpm, double revolutions, {Map< String, dynamic> ? extra}) → Future<void> -
Spin the Motor the specified number of
revolutions
at specifiedrpm
. Whenrpm
orrevolutions
is a negative value, the rotation will be in the backward direction. Note: if bothrpm
andrevolutions
are negative, the motor will spin in the forward direction. -
goTo(
double rpm, double positionRevolutions, {Map< String, dynamic> ? extra}) → Future<void> -
Spin the Motor to the specified position (provided in revolutions from home/zero),
at the specified speed, in revolutions per minute.
Regardless of the directionality of the
rpm
this function will move the Motor towards the specified position. -
isMoving(
{Map< String, dynamic> ? extra}) → Future<bool> - Get if the Motor is currently moving.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
position(
{Map< String, dynamic> ? extra}) → Future<double> - Report the position of the motor based on its encoder. The value returned is the number of revolutions relative to its zero position. This method will raise an exception if position reporting is not supported by the motor.
-
powerState(
{Map< String, dynamic> ? extra}) → Future<PowerState> -
Returns whether or not the motor is currently powered, and the portion
of max power (between 0 and 1; 0 indicates that power is off). Stepper
motors report
true
if they are being powered while holding a position, as well as when they are turning themselves. -
properties(
{Map< String, dynamic> ? extra}) → Future<MotorProperties> - Report a dictionary mapping each optional property to whether it is supported by this motor.
-
resetZeroPosition(
double offset, {Map< String, dynamic> ? extra}) → Future<void> -
Set the current position (modified by
offset
) to be the new zero (home) position. -
setPower(
double powerPct, {Map< String, dynamic> ? extra}) → Future<void> -
Sets the "percentage" of power the Motor should employ between -1 and 1.
When
powerPct
is negative, the rotation will be in the backward direction. -
setRPM(
double rpm, {Map< String, dynamic> ? extra}) → Future<void> -
Spin the Motor indefinitely at the specified speed, in revolutions per minute.
If
rpm
is positive, the motor will spin forwards, and ifrpm
is negative, the motor will spin backwards. -
stop(
{Map< String, dynamic> ? extra}) → Future<void> - Stop the motor immediately, without any gradual step down.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromRobot(
RobotClient robot, String name) → Motor -
Get the Motor named
name
from the provided robot. -
getResourceName(
String name) → ResourceName -
Get the ResourceName for this Motor with the given
name
.