From 5af85dd1bb27d72eaf78b6d0a17e9b8175413919 Mon Sep 17 00:00:00 2001 From: Thad House Date: Sun, 10 Jun 2018 20:13:36 -0700 Subject: [PATCH] Explicitly states the gyro direction contract for the Gyro interface (#1151) --- wpilibc/src/main/native/include/interfaces/Gyro.h | 8 ++++++++ .../main/java/edu/wpi/first/wpilibj/interfaces/Gyro.java | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/wpilibc/src/main/native/include/interfaces/Gyro.h b/wpilibc/src/main/native/include/interfaces/Gyro.h index 11ba3f6aee..507b61d0de 100644 --- a/wpilibc/src/main/native/include/interfaces/Gyro.h +++ b/wpilibc/src/main/native/include/interfaces/Gyro.h @@ -42,6 +42,10 @@ class Gyro { * allows algorithms that wouldn't want to see a discontinuity in the gyro * output as it sweeps past from 360 to 0 on the second time around. * + * The angle is expected to increase as the gyro turns clockwise when looked + * at from the top. It needs to follow NED axis conventions in order to work + * properly with dependent control loops. + * * @return the current heading of the robot in degrees. This heading is based * on integration of the returned rate from the gyro. */ @@ -52,6 +56,10 @@ class Gyro { * * The rate is based on the most recent reading of the gyro analog value. * + * The rate is expected to be positive as the gyro turns clockwise when looked + * at from the top. It needs to follow NED axis conventions in order to work + * properly with dependent control loops. + * * @return the current rate in degrees per second */ virtual double GetRate() const = 0; diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/interfaces/Gyro.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/interfaces/Gyro.java index a752d6ed72..a8b2ab63d8 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/interfaces/Gyro.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/interfaces/Gyro.java @@ -34,6 +34,10 @@ public interface Gyro extends AutoCloseable { * from 360 to 361 degrees. This allows algorithms that wouldn't want to see a discontinuity in * the gyro output as it sweeps past from 360 to 0 on the second time around. * + *

The angle is expected to increase as the gyro turns clockwise when looked + * at from the top. It needs to follow NED axis conventions in order to work + * properly with dependent control loops. + * *

This heading is based on integration of the returned rate from the gyro. * * @return the current heading of the robot in degrees. @@ -45,6 +49,10 @@ public interface Gyro extends AutoCloseable { * *

The rate is based on the most recent reading of the gyro analog value * + *

The rate is expected to be positive as the gyro turns clockwise when looked + * at from the top. It needs to follow NED axis conventions in order to work + * properly with dependent control loops. + * * @return the current rate in degrees per second */ double getRate();