Gyro deadband defaults to 0

The gyro class no longer attempts to set a default deadband, but it still
has an optional SetDeadband() method.

The gyro integration tests were modified and still pass consistently.

Change-Id: I08a97b00b98b49b0a3c63306fcc809857523af2b
This commit is contained in:
Thomas Clark
2014-08-05 09:46:02 -04:00
parent 60a3fd0698
commit 43c566bd86
7 changed files with 50 additions and 86 deletions

View File

@@ -33,7 +33,7 @@ protected:
// The gyro object blocks for 5 seconds in the constructor, so only
// construct it once for the whole test case
m_gyro = new Gyro(TestBench::kCameraGyroChannel);
m_gyro->SetSensitivity(0.0134897058674);
m_gyro->SetSensitivity(0.013);
}
static void TearDownTestCase() {
@@ -66,22 +66,22 @@ Gyro *TiltPanCameraTest::m_gyro = 0;
* Test if the gyro angle defaults to 0 immediately after being reset.
*/
TEST_F(TiltPanCameraTest, DefaultGyroAngle) {
EXPECT_NEAR(0.0f, m_gyro->GetAngle(), 0.01f);
EXPECT_NEAR(0.0f, m_gyro->GetAngle(), 1.0f);
}
/**
* Test if the servo turns 180 degrees and the gyroscope measures this angle
*/
TEST_F(TiltPanCameraTest, GyroAngle) {
for(int i = 0; i < 180; i++) {
m_pan->SetAngle(i);
for(int i = 0; i < 1800; i++) {
m_pan->SetAngle(i / 10.0);
Wait(0.05);
Wait(0.001);
}
double gyroAngle = m_gyro->GetAngle();
EXPECT_NEAR(gyroAngle, kTestAngle, 20.0) << "Gyro measured " << gyroAngle
EXPECT_NEAR(gyroAngle, kTestAngle, 10.0) << "Gyro measured " << gyroAngle
<< " degrees, servo should have turned " << kTestAngle << " degrees";
}