001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package edu.wpi.first.hal;
006
007/**
008 * IMU Functions.
009 *
010 * @see "hal/IMU.h"
011 */
012public class IMUJNI extends JNIWrapper {
013  /**
014   * Get the acceleration along the axes of the IMU in meters per second squared.
015   *
016   * @param accel array of size >= 3 to place the acceleration data in. The data will be in the form
017   *     [x, y, z].
018   */
019  public static native void getIMUAcceleration(double[] accel);
020
021  /**
022   * Get the angular rate about the axes of the IMU in radians per second.
023   *
024   * @param rates array of size >= 3 to place the angular rate data in. The data will be in the form
025   *     [x, y, z].
026   */
027  public static native void getIMUGyroRates(double[] rates);
028
029  /**
030   * Get the angle, in radians, about the axes of the IMU in the "flat" orientation.
031   *
032   * @param angles array of size >= 3 to place the angle data in. The data will be in the form [x,
033   *     y, z].
034   */
035  public static native void getIMUEulerAnglesFlat(double[] angles);
036
037  /**
038   * Get the angle, in radians, about the axes of the IMU in the "landscape" orientation.
039   *
040   * @param angles array of size >= 3 to place the angle data in. The data will be in the form [x,
041   *     y, z].
042   */
043  public static native void getIMUEulerAnglesLandscape(double[] angles);
044
045  /**
046   * Get the angle, in radians, about the axes of the IMU in the "portrait" orientation.
047   *
048   * @param angles array of size >= 3 to place the angle data in. The data will be in the form [x,
049   *     y, z].
050   */
051  public static native void getIMUEulerAnglesPortrait(double[] angles);
052
053  /**
054   * Get the orientation of the IMU as a quaternion.
055   *
056   * @param quat array of size >= 4 to place the quaternion data in. The data will be in the form
057   *     [w, x, y, z].
058   */
059  public static native void getIMUQuaternion(double[] quat);
060
061  /**
062   * Get the yaw value, in radians, of the IMU in the "flat" orientation.
063   *
064   * @return flat orientation yaw
065   */
066  public static native double getIMUYawFlat();
067
068  /**
069   * Get the yaw value, in radians, of the IMU in the "landscape" orientation.
070   *
071   * @return landscape orientation yaw
072   */
073  public static native double getIMUYawLandscape();
074
075  /**
076   * Get the yaw value, in radians, of the IMU in the "portrait" orientation.
077   *
078   * @return portrait orientation yaw
079   */
080  public static native double getIMUYawPortrait();
081}