@@ -25,128 +25,126 @@ abstract class Motor extends Resource {
25
25
/// Sets the "percentage" of power the [Motor] should employ between -1 and 1.
26
26
/// When [powerPct] is negative, the rotation will be in the backward direction.
27
27
///
28
- /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
29
- ///
30
28
/// ```
31
29
/// // Set the power to 40% forwards.
32
30
/// await myMotor.setPower(0.4);
33
31
/// ```
32
+ ///
33
+ /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
34
34
Future <void > setPower (double powerPct, {Map <String , dynamic >? extra});
35
35
36
36
/// Spin the [Motor] the specified number of [revolutions] at specified [rpm] .
37
37
/// When [rpm] or [revolutions] is a negative value, the rotation will be in the backward direction.
38
38
/// Note: if both [rpm] and [revolutions] are negative, the motor will spin in the forward direction.
39
39
///
40
- /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
41
- ///
42
40
/// ```
43
41
/// // Turn the motor 7.2 revolutions forward at 60 RPM.
44
42
/// await myMotor.goFor(60, 7.2);
45
43
/// ```
44
+ ///
45
+ /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
46
46
Future <void > goFor (double rpm, double revolutions, {Map <String , dynamic >? extra});
47
47
48
48
/// Spin the [Motor] to the specified position (provided in revolutions from home/zero),
49
49
/// at the specified speed, in revolutions per minute.
50
50
/// Regardless of the directionality of the [rpm] this function will move
51
51
/// the [Motor] towards the specified position.
52
52
///
53
- /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
54
- ///
55
53
/// ```
56
54
/// // Turn the motor to 8.3 revolutions from home at 75 RPM.
57
55
/// await myMotor.goTo(75, 8.3);
58
56
/// ```
57
+ ///
58
+ /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
59
59
Future <void > goTo (double rpm, double positionRevolutions, {Map <String , dynamic >? extra});
60
60
61
61
/// Spin the [Motor] indefinitely at the specified speed, in revolutions per minute.
62
62
/// If [rpm] is positive, the motor will spin forwards, and if [rpm] is negative, the motor will spin backwards.
63
63
///
64
- /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
65
- ///
66
64
/// ```
67
65
/// // Set the motor to turn backwards at 120.5 RPM.
68
66
/// await myMotor.setRPM(-120.5);
69
67
/// ```
68
+ ///
69
+ /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
70
70
Future <void > setRPM (double rpm, {Map <String , dynamic >? extra});
71
71
72
72
/// Set the current position (modified by [offset] ) to be the new zero (home) position.
73
73
///
74
- /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
75
- ///
76
74
/// ```
77
75
/// // Set the current position as the new home position with no offset.
78
76
/// await myMotor.resetZeroPosition(0.0);
79
77
/// ```
78
+ ///
79
+ /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
80
80
Future <void > resetZeroPosition (double offset, {Map <String , dynamic >? extra});
81
81
82
82
/// Report the position of the motor based on its encoder.
83
83
/// The value returned is the number of revolutions relative to its zero position.
84
84
/// This method will raise an exception if position reporting is not supported by the motor.
85
85
///
86
- /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
87
- ///
88
86
/// ```
89
87
/// // Get the current position of an encoded motor.
90
88
/// var position = await myMotor.position();
91
89
/// ```
90
+ ///
91
+ /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
92
92
Future <double > position ({Map <String , dynamic >? extra});
93
93
94
94
/// Report a dictionary mapping each optional property to
95
95
/// whether it is supported by this motor.
96
96
///
97
- /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
98
- ///
99
97
/// ```
100
98
/// // Return whether the motor supports certain optional features
101
99
/// var properties = await myMotor.properties();
102
100
/// ```
101
+ ///
102
+ /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
103
103
Future <MotorProperties > properties ({Map <String , dynamic >? extra});
104
104
105
105
/// Stop the motor immediately, without any gradual step down.
106
106
///
107
- /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
108
- Future <void > stop ({Map <String , dynamic >? extra});
109
- ///
110
107
/// ```
111
108
/// // Stop the motor.
112
109
/// await myMotor.stop();
113
110
/// ```
111
+ ///
112
+ /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
114
113
Future <void > stop ({Map <String , dynamic >? extra});
115
114
116
115
/// Returns whether or not the motor is currently powered, and the portion
117
116
/// of max power (between 0 and 1; 0 indicates that power is off). Stepper
118
117
/// motors report `true` if they are being powered while holding a position,
119
118
/// as well as when they are turning themselves.
120
119
///
121
- /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
122
- ///
123
120
/// ```
124
121
/// // Check whether the motor is currently powered and
125
122
/// // check the percentage of max power to the motor.
126
123
/// var powerState = await myMotor.powerState();
127
124
/// var powered = powerState.isOn;
128
125
/// var pct = powerState.powerPct;
129
126
/// ```
127
+ ///
128
+ /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
130
129
Future <PowerState > powerState ({Map <String , dynamic >? extra});
131
130
132
131
/// Get if the [Motor] is currently moving.
133
132
///
134
- /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
135
- ///
136
133
/// ```
137
134
/// // Check whether the motor is moving.
138
135
/// var moving = await myMotor.isMoving();
139
136
/// ```
140
- Future <bool > isMoving ({Map <String , dynamic >? extra});
141
-
142
- /// Get the [ResourceName] for this [Motor] with the given [name]
143
137
///
144
138
/// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
139
+ Future <bool > isMoving ({Map <String , dynamic >? extra});
140
+
141
+ /// Get the [ResourceName] for this [Motor] with the given [name] .
145
142
///
146
143
/// ```
147
144
/// var name = Motor.getResourceName('myMotor');
148
145
/// ```
149
146
///
147
+ /// For more information, see [Motor component] (https://docs.viam.com/components/motor/).
150
148
Future <bool > isMoving ({Map <String , dynamic >? extra});
151
149
static ResourceName getResourceName (String name) {
152
150
return Motor .subtype.getResourceName (name);
0 commit comments