Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel committed Jul 11, 2024
1 parent 6091789 commit 58dd502
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 50 deletions.
4 changes: 3 additions & 1 deletion lib/src/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class AppClient {
/// Create a new [Organization]
///
/// For more information, see [Fleet Management API](https://docs.viam.com/appendix/apis/fleet/). Future<Organization> createOrganization(String name) async {
Future<Organization> createOrganization(String name) async {
final request = CreateOrganizationRequest()..name = name;
final CreateOrganizationResponse response = await _client.createOrganization(request);
return response.organization;
Expand Down Expand Up @@ -74,7 +75,8 @@ class AppClient {

/// Checks for namespace availablity throughout all [Organization]s.
///
/// For more information, see [Fleet Management API](https://docs.viam.com/appendix/apis/fleet/). Future<bool> getOrganizationNamespaceAvailability(String publicNamespace) async {
/// For more information, see [Fleet Management API](https://docs.viam.com/appendix/apis/fleet/).
Future<bool> getOrganizationNamespaceAvailability(String publicNamespace) async {
final request = GetOrganizationNamespaceAvailabilityRequest()..publicNamespace = publicNamespace;
final GetOrganizationNamespaceAvailabilityResponse response = await _client.getOrganizationNamespaceAvailability(request);
return response.available;
Expand Down
1 change: 0 additions & 1 deletion lib/src/components/arm/arm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ abstract class Arm extends Resource {
/// Get the current [Pose] of the end of the arm.
///
/// ```
/// // Get the pose of an arm named "myArm2"
/// final currentPose = await myArm.endPosition();
/// ```
///
Expand Down
3 changes: 0 additions & 3 deletions lib/src/components/camera/camera.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ abstract class Camera extends Resource {
/// ```
///
/// For more information, see [Camera component](https://docs.viam.com/components/camera/).
Future<ViamImage> image({MimeType? mimeType, Map<String, dynamic>? extra});

/// Get the next point cloud from the camera.
Expand All @@ -30,8 +29,6 @@ abstract class Camera extends Resource {
/// ```
///
/// For more information, see [Camera component](https://docs.viam.com/components/camera/).
///
/// For more information, see [Camera component](https://docs.viam.com/components/camera/).
Future<ViamImage> pointCloud({Map<String, dynamic>? extra});

/// Get the camera's intrinsic parameters and the camera's distortion parameters.
Expand Down
47 changes: 22 additions & 25 deletions lib/src/components/motor/motor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,129 +25,126 @@ abstract class Motor extends Resource {
/// 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.
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
///
/// ```
/// // Set the power to 40% forwards.
/// await myMotor.setPower(0.4);
/// ```
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
Future<void> setPower(double powerPct, {Map<String, dynamic>? extra});

/// Spin the [Motor] the specified number of [revolutions] at specified [rpm].
/// When [rpm] or [revolutions] is a negative value, the rotation will be in the backward direction.
/// Note: if both [rpm] and [revolutions] are negative, the motor will spin in the forward direction.
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
///
/// ```
/// // Turn the motor 7.2 revolutions forward at 60 RPM.
/// await myMotor.goFor(60, 7.2);
/// ```
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
Future<void> goFor(double rpm, double revolutions, {Map<String, dynamic>? extra});

/// 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.
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
///
/// ```
/// // Turn the motor to 8.3 revolutions from home at 75 RPM.
/// await myMotor.goTo(75, 8.3);
/// ```
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
Future<void> goTo(double rpm, double positionRevolutions, {Map<String, dynamic>? extra});

/// Spin the [Motor] indefinitely at the specified speed, in revolutions per minute.
/// If [rpm] is positive, the motor will spin forwards, and if [rpm] is negative, the motor will spin backwards.
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
///
/// ```
/// // Set the motor to turn backwards at 120.5 RPM.
/// await myMotor.setRPM(-120.5);
/// ```
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
Future<void> setRPM(double rpm, {Map<String, dynamic>? extra});

/// Set the current position (modified by [offset]) to be the new zero (home) position.
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
///
/// ```
/// // Set the current position as the new home position with no offset.
/// await myMotor.resetZeroPosition(0.0);
/// ```
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
Future<void> resetZeroPosition(double offset, {Map<String, dynamic>? extra});

/// 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.
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
///
/// ```
/// // Get the current position of an encoded motor.
/// var position = await myMotor.position();
/// ```
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
Future<double> position({Map<String, dynamic>? extra});

/// Report a dictionary mapping each optional property to
/// whether it is supported by this motor.
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
///
/// ```
/// // Return whether the motor supports certain optional features
/// var properties = await myMotor.properties();
/// ```
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
Future<MotorProperties> properties({Map<String, dynamic>? extra});

/// Stop the motor immediately, without any gradual step down.
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
Future<void> stop({Map<String, dynamic>? extra});
///
/// ```
/// // Stop the motor.
/// await myMotor.stop();
/// ```
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
Future<void> stop({Map<String, dynamic>? extra});

/// 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.
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
///
/// ```
/// // Check whether the motor is currently powered and
/// // check the percentage of max power to the motor.
/// var powerState = await myMotor.powerState();
/// var powered = powerState.isOn;
/// var pct = powerState.powerPct;
/// ```
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
Future<PowerState> powerState({Map<String, dynamic>? extra});

/// Get if the [Motor] is currently moving.
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
///
/// ```
/// // Check whether the motor is moving.
/// var moving = await myMotor.isMoving();
/// ```
Future<bool> isMoving({Map<String, dynamic>? extra});

/// Get the [ResourceName] for this [Motor] with the given [name]
///
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
Future<bool> isMoving({Map<String, dynamic>? extra});

/// Get the [ResourceName] for this [Motor] with the given [name].
///
/// ```
/// var name = Motor.getResourceName('myMotor');
/// ```
///
Future<bool> isMoving({Map<String, dynamic>? extra});
/// For more information, see [Motor component](https://docs.viam.com/components/motor/).
static ResourceName getResourceName(String name) {
return Motor.subtype.getResourceName(name);
}
Expand Down
29 changes: 9 additions & 20 deletions lib/src/components/servo/servo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,39 @@ abstract class Servo extends Resource {

/// Get the current angle (degrees) of the [Servo].
///
/// For more information, see [Servo component](https://docs.viam.com/components/servo/).
///
/// ```
/// var angle = await myServo.position();
/// ```
Future<int> position({Map<String, dynamic>? extra});

/// Stop the [Servo]. It is assumed that the servo stops immediately.
///
/// For more information, see [Servo component](https://docs.viam.com/components/servo/).
///
Future<void> stop({Map<String, dynamic>? extra});

/// Get if the [Servo] is currently moving.
///
/// For more information, see [Servo component](https://docs.viam.com/components/servo/).
Future<bool> isMoving();
Future<int> position({Map<String, dynamic>? extra});

/// Get the [ResourceName] for this [Servo] with the given [name]
///
/// For more information, see [Servo component](https://docs.viam.com/components/servo/).
/// Stop the [Servo]. It is assumed that the servo stops immediately.
///
/// ```
/// await myServo.stop();
/// ```
Future<void> stop({Map<String, dynamic>? extra});

/// Whether the [Servo] is currently moving.
///
/// For more information, see [Servo component](https://docs.viam.com/components/servo/).
Future<void> stop({Map<String, dynamic>? extra});

/// Get if the [Servo] is currently moving.
///
/// ```
/// var isItMoving = await myServo.isMoving();
/// ```
///
/// For more information, see [Servo component](https://docs.viam.com/components/servo/).
Future<bool> isMoving();

/// Get the [ResourceName] for this [Servo] with the given [name].
///
/// For more information, see [Servo component](https://docs.viam.com/components/servo/).
///
/// ```
/// // Example:
/// var name = Servo.getResourceName('myServo');
/// ```
///
/// For more information, see [Servo component](https://docs.viam.com/components/servo/).
static ResourceName getResourceName(String name) {
return Servo.subtype.getResourceName(name);
}
Expand Down

0 comments on commit 58dd502

Please sign in to comment.