예제 #1
0
	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		AnalogTrigger trig1(2);
		trig1.SetLimitsVoltage(1.5, 2.5);
			
		AnalogTrigger trig2(3);
		trig2.SetLimitsVoltage(1.5, 2.5);

		Encoder encoder(
			trig1.CreateOutput(AnalogTriggerOutput::kRisingPulse),
			trig2.CreateOutput(AnalogTriggerOutput::kRisingPulse),
			false, Encoder::k2X); 
		
		double tm = GetTime();
		
		GetWatchdog().SetEnabled(true);
		while (IsOperatorControl())
		{
			GetWatchdog().Feed();
			myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
			
			if (GetTime() - tm > 0.25)
			{
				printf("Encoder: %d\r", encoder.Get());
				tm = GetTime();
			}
			
			Wait(0.005);				// wait for a motor update time
		}
	}
예제 #2
0
void static fireTriggers(void) {
  if (trigger_guard_trig1(queue_0, ptr_0))
    trig1(trigger_trig1_arg_0(queue_1, ptr_1),
          trigger_trig1_arg_1(ext_e1, ext_e2, ext_e3_0, ext_ff_1, queue_1, ptr_1),
          trigger_trig1_arg_2(queue_2, ptr_2));
}