当前位置: 首页>>代码示例>>C++>>正文


C++ AnalogGyro::SetSensitivity方法代码示例

本文整理汇总了C++中AnalogGyro::SetSensitivity方法的典型用法代码示例。如果您正苦于以下问题:C++ AnalogGyro::SetSensitivity方法的具体用法?C++ AnalogGyro::SetSensitivity怎么用?C++ AnalogGyro::SetSensitivity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AnalogGyro的用法示例。


在下文中一共展示了AnalogGyro::SetSensitivity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GyroCalibratedParameters

/**
  * Gets calibrated parameters from previously calibrated gyro, allocates a new
  * gyro with the given parameters for center and offset, and re-runs tests on
  * the new gyro.
  */
void TiltPanCameraTest::GyroCalibratedParameters() {
  uint32_t cCenter = m_gyro->GetCenter();
  float cOffset = m_gyro->GetOffset();
  delete m_gyro;
  m_gyro = new AnalogGyro(TestBench::kCameraGyroChannel, cCenter, cOffset);
  m_gyro->SetSensitivity(kSensitivity);

  // Default gyro angle test
  // Accumulator needs a small amount of time to reset before being tested
  m_gyro->Reset();
  Wait(.001);
  EXPECT_NEAR(0.0f, m_gyro->GetAngle(), 1.0f);

  // Gyro angle test
  // Make sure that the gyro doesn't get jerked when the servo goes to zero.
  m_pan->SetAngle(0.0);
  Wait(0.5);
  m_gyro->Reset();

  for (int i = 0; i < 600; i++) {
    m_pan->Set(i / 1000.0);
    Wait(0.001);
  }

  double gyroAngle = m_gyro->GetAngle();

  EXPECT_NEAR(gyroAngle, kTestAngle, 10.0)
      << "Gyro measured " << gyroAngle << " degrees, servo should have turned "
      << kTestAngle << " degrees";
}
开发者ID:FRC3238,项目名称:allwpilib,代码行数:35,代码来源:TiltPanCameraTest.cpp

示例2: SetUpTestCase

 static void SetUpTestCase() {
   // The gyro object blocks for 5 seconds in the constructor, so only
   // construct it once for the whole test case
   m_gyro = new AnalogGyro(TestBench::kCameraGyroChannel);
   m_gyro->SetSensitivity(kSensitivity);
 }
开发者ID:FRC3238,项目名称:allwpilib,代码行数:6,代码来源:TiltPanCameraTest.cpp


注:本文中的AnalogGyro::SetSensitivity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。