setPower method

  1. @override
Future<void> setPower(
  1. Vector3 linear,
  2. Vector3 angular, {
  3. Map<String, dynamic>? extra,
})
override

Set the linear and angular velocity of the Base.

When linear is a zero-vector, the base will spin. When angular is a zero-vector, the base will move in a straight line. When both linear and angular are zero-vectors, the base will stop. When linear and angular are both non-zero-vectors, the base will move in an arc, with a tighter radius if angular power is greater than linear power. The positive y axis points forwards and the positive z axis points up.

// Move the base straight forward at 75% power:
await myBase.setPower(Vector3(0, 0.75, 0), Vector3());

// Move the base straight backward at 100% power:
await myBase.setPower(Vector3(0, -1, 0), Vector3());

// Turn the base to the left at 50% power:
await myBase.setPower(Vector3(), Vector3(0, 0, 0.5));

// Turn the base to the right at 60% power:
await myBase.setPower(Vector3(), Vector3(0, 0, -0.6));

For more information, see Base component.

Implementation

@override
Future<void> setPower(Vector3 linear, Vector3 angular, {Map<String, dynamic>? extra}) async {
  final request = SetPowerRequest()
    ..name = name
    ..linear = linear
    ..angular = angular
    ..extra = extra?.toStruct() ?? Struct();
  await client.setPower(request);
}