This is the latest WPILib src, VisionSample2013, cRIO image, ... pulled down from firstforge.wpi.edu.
There might be risks in using the top of tree rather than an official release, but the commit messages do mention fixes for some deadlocks and race conditions.
git-svn-id: https://robotics.mvla.net/svn/frc971/2013/trunk/src@4066 f308d9b7-e957-4cde-b6ac-9a88185e7312
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Gyro.h b/azaleasource/WPILibCProgramming/trunk/WPILib/Gyro.h
new file mode 100644
index 0000000..a106a98
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Gyro.h
@@ -0,0 +1,65 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008. All Rights Reserved. */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
+/*----------------------------------------------------------------------------*/
+
+#ifndef GYRO_H_
+#define GYRO_H_
+
+#include "SensorBase.h"
+#include "PIDSource.h"
+#include "LiveWindow/LiveWindowSendable.h"
+
+class AnalogChannel;
+class AnalogModule;
+
+/**
+ * Use a rate gyro to return the robots heading relative to a starting position.
+ * The Gyro class tracks the robots heading based on the starting position. As the robot
+ * rotates the new heading is computed by integrating the rate of rotation returned
+ * by the sensor. When the class is instantiated, it does a short calibration routine
+ * where it samples the gyro while at rest to determine the default offset. This is
+ * subtracted from each sample to determine the heading. This gyro class must be used
+ * with a channel that is assigned one of the Analog accumulators from the FPGA. See
+ * AnalogChannel for the current accumulator assignments.
+ */
+class Gyro : public SensorBase, public PIDSource, public LiveWindowSendable
+{
+public:
+ static const UINT32 kOversampleBits = 10;
+ static const UINT32 kAverageBits = 0;
+ static const float kSamplesPerSecond = 50.0;
+ static const float kCalibrationSampleTime = 5.0;
+ static const float kDefaultVoltsPerDegreePerSecond = 0.007;
+
+ Gyro(UINT8 moduleNumber, UINT32 channel);
+ explicit Gyro(UINT32 channel);
+ explicit Gyro(AnalogChannel *channel);
+ explicit Gyro(AnalogChannel &channel);
+ virtual ~Gyro();
+ virtual float GetAngle();
+ void SetSensitivity(float voltsPerDegreePerSecond);
+ virtual void Reset();
+
+ // PIDSource interface
+ double PIDGet();
+
+ void UpdateTable();
+ void StartLiveWindowMode();
+ void StopLiveWindowMode();
+ std::string GetSmartDashboardType();
+ void InitTable(ITable *subTable);
+ ITable * GetTable();
+
+private:
+ void InitGyro();
+
+ AnalogChannel *m_analog;
+ float m_voltsPerDegreePerSecond;
+ float m_offset;
+ bool m_channelAllocated;
+
+ ITable *m_table;
+};
+#endif