getDirection method

Future<Direction> getDirection()

Gets the orientation of the Frame. Note that the heading is not yet implemented on Frame and will always return 0.

Returns: Future

Implementation

Future<Direction> getDirection() async {
  final result = await frame.runLua(
    "local dir = frame.imu.direction();print(dir['roll']..','..dir['pitch']..','..dir['heading'])",
    awaitPrint: true,
  );
  final values = result!.split(',').map(double.parse).toList();
  return Direction(roll: values[0], pitch: values[1], heading: values[2]);
}