コード例 #1
0
  void RobotInit ()
  {
  lw = LiveWindow::GetInstance();
  CameraServer::GetInstance()->SetQuality(50);
   //the camera name (ex "cam0") can be found through the roborio web interface
  CameraServer::GetInstance()->StartAutomaticCapture("cam1");
  AutonState = 0;
  ballarm.Reset();
  ballarm.SetMaxPeriod(.01);
  ballarm.SetMinRate(.02);
  ballarm.SetDistancePerPulse(.9);
  gyroOne.Calibrate();
  UpdateActuatorCmnds(0,0,false,false,false,false,false,false,false,0,0,0,0,0);

  UpdateSmartDashboad(false,
                      false,
                      false,
                      false,
                      false,
                      0,
                      0,
                      0,
                      0,
                      0,
                      0,
                      0,
                      0,
                      0);
  }
コード例 #2
0
ファイル: Robot.cpp プロジェクト: prajwal1121/2015
	void TeleopInit()
	{
// Initialize the encoder
		sampleEncoder = new Encoder(0, 1, false, Encoder::EncodingType::k4X);
		sampleEncoder->SetMaxPeriod(.1);
		sampleEncoder->SetMinRate(10);
		sampleEncoder->SetDistancePerPulse(5);
		sampleEncoder->SetReverseDirection(true);
		sampleEncoder->SetSamplesToAverage(7);

// Initialize the joystick
		joystick = new Joystick(0);

// Initialize the motor
		motor = new Victor(9);

// Initialize the gear tooth counter
		toothTrigger = new AnalogTrigger(3);
		toothTrigger->SetLimitsRaw(250, 3600);
		gearToothCounter = new Counter(toothTrigger);
//		gearToothCounter->SetUpDownCounterMode();
	}
コード例 #3
0
/**
 * Set the minimum rate of the device before the hardware reports it stopped.
 * 
 * @param minRate The minimum rate.  The units are in distance per second as scaled by the value from SetEncoderDistancePerPulse().
 *
 * @param aSlot The digital module slot for the A Channel on the encoder
 * @param aChannel The channel on the digital module for the A Channel of the encoder
 * @param bSlot The digital module slot for the B Channel on the encoder
 * @param bChannel The channel on the digital module for the B Channel of the encoder
 */
void SetMinEncoderRate(UINT32 aSlot, UINT32 aChannel, UINT32 bSlot, UINT32 bChannel, double minRate)
{
	Encoder *encoder = AllocateEncoder(aSlot, aChannel, bSlot, bChannel);
	if (encoder != NULL)
		encoder->SetMinRate(minRate);
}