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


C++ GetWatchdog函数代码示例

本文整理汇总了C++中GetWatchdog函数的典型用法代码示例。如果您正苦于以下问题:C++ GetWatchdog函数的具体用法?C++ GetWatchdog怎么用?C++ GetWatchdog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: OperatorControl

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		
		GetWatchdog().SetEnabled(true);
		compressor->Start();
		
		GetWatchdog().SetExpiration(0.5);
		
		bool valve_state = false;
		
		while (IsOperatorControl())
		{
			motor->Set(stick->GetY());
			
			if (stick->GetRawButton(1) && !valve_state)
			{
				valve->Set(true);
				valve_state = true;
			}
			
			if (!stick->GetRawButton(1) && valve_state)
			{
				valve->Set(false);
				valve_state = false;
			}
			// Update driver station
			//dds->sendIOPortData(valve);

			GetWatchdog().Feed();
		}
	}
开发者ID:FRC2994,项目名称:FRC2994,代码行数:34,代码来源:MyRobot.cpp

示例2: OperatorControl

	/**
	 * 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
		}
	}
开发者ID:frc2423,项目名称:2008-2012,代码行数:33,代码来源:MyRobot.cpp

示例3: GyroTurn

	//robot turns to desired position with a deadband of 2 degrees in each direction
	bool GyroTurn (float desiredTurnAngle, float turnSpeed)
	{
		bool turning = true;
		float myAngle = gyro->GetAngle();
		//normalizes angle from gyro to [-180,180) with zero as straight ahead
		while(myAngle >= 180)
		{
			GetWatchdog().Feed();
			myAngle = myAngle - 360;
		}
		while(myAngle < -180)
		{
			GetWatchdog().Feed();
			myAngle = myAngle + 360;
		}
		if(myAngle < (desiredTurnAngle - 2))// if robot is too far left, turn right a bit
		{
			myRobot->Drive(turnSpeed, -turnSpeed); //(right,left)
		}
		if(myAngle > (desiredTurnAngle + 2))// if robot is too far right, turn left a bit
		{
			myRobot->Drive(-turnSpeed, turnSpeed); //(right,left)
		}
		else
		{
			myRobot->Drive(0, 0);
			turning = false;
		}

		return turning;
	}
开发者ID:robotics1714,项目名称:2014-Code,代码行数:32,代码来源:MyRobot.cpp

示例4: OperatorControl

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		GetWatchdog().SetEnabled(true);
		while (IsOperatorControl())
		{
			GetWatchdog().Feed();
			myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
		}
	}
开发者ID:Team694,项目名称:frc,代码行数:12,代码来源:Michael1.cpp

示例5: GetWatchdog

	Spike::Spike(void)
	{ 
		GetWatchdog().SetExpiration(10.0);//set up watchdog
		GetWatchdog().SetEnabled(true);
		
		Drive = new RobotDrive(LEFT_DRV_PWM,RIGHT_DRV_PWM);
		rightjoy = new Joystick(1);
		leftjoy = new Joystick(2);

	}
开发者ID:Team293,项目名称:RewrittenCode,代码行数:10,代码来源:Spike.cpp

示例6: DashBoardInput

	void DashBoardInput() {
		int i = 0;
		GetWatchdog().SetEnabled(true);
		while (IsAutonomous() && IsEnabled()) {
			i++;
			GetWatchdog().Feed();
			dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "%f, %i",
					driverStation->GetAnalogIn(1), i);
			dsLCD->UpdateLCD();
		}
	}
开发者ID:2202Programming,项目名称:OldCode,代码行数:11,代码来源:Hohenheim.cpp

示例7: Autonomous

	/**
	 * Drive left & right motors for 2 seconds, enabled by a jumper (jumper
	 * must be in for autonomous to operate).
	 */
	void Autonomous(void)
	{
		GetWatchdog().SetEnabled(false);
		if (ds->GetDigitalIn(ENABLE_AUTONOMOUS) == 1)	// only run the autonomous program if jumper is in place
		{
			myRobot->Drive(0.5, 0.0);			// drive forwards half speed
			Wait(2000);							//    for 2 seconds
			myRobot->Drive(0.0, 0.0);			// stop robot
		}
		GetWatchdog().SetEnabled(true);
	}
开发者ID:Alexander-Brown,项目名称:frc2876,代码行数:15,代码来源:PrototypeRobot.cpp

示例8: TwoColorDemo

        /**
     * Constructor for this robot subclass.
     * Create an instance of a RobotDrive with left and right motors plugged into PWM
     * ports 1 and 2 on the first digital module. The two servos are PWM ports 3 and 4.
     * Tested with camera settings White Balance: Flurorescent1, Brightness 40, Exposure Auto
     */
    TwoColorDemo(void)
    {
        ds = DriverStation::GetInstance();
        myRobot = new RobotDrive(1, 2, 0.5);    // robot will use PWM 1-2 for drive motors
        rightStick = new Joystick(1);   // create the joysticks
        leftStick = new Joystick(2);
        // remember to use jumpers on the sidecar for the Servo PWMs
        horizontalServo = new Servo(9); // create horizontal servo on PWM 9
        verticalServo = new Servo(10);  // create vertical servo on PWM 10
        servoDeadband = 0.01;   // move if > this amount 
        framesPerSecond = 15;   // number of camera frames to get per second
        sinStart = 0.0;         // control where to start the sine wave for pan
        memset(&par, 0, sizeof(par));   // initialize particle analysis report

        /* image data for tracking - override default parameters if needed */
        /* recommend making PINK the first color because GREEN is more 
         * subsceptible to hue variations due to lighting type so may
         * result in false positives */
        // PINK
        sprintf(td1.name, "PINK");
        td1.hue.minValue = 220;
        td1.hue.maxValue = 255;
        td1.saturation.minValue = 75;
        td1.saturation.maxValue = 255;
        td1.luminance.minValue = 85;
        td1.luminance.maxValue = 255;
        // GREEN
        sprintf(td2.name, "GREEN");
        td2.hue.minValue = 55;
        td2.hue.maxValue = 125;
        td2.saturation.minValue = 58;
        td2.saturation.maxValue = 255;
        td2.luminance.minValue = 92;
        td2.luminance.maxValue = 255;

        /* set up debug output: 
         * DEBUG_OFF, DEBUG_MOSTLY_OFF, DEBUG_SCREEN_ONLY, DEBUG_FILE_ONLY, DEBUG_SCREEN_AND_FILE 
         */
        SetDebugFlag(DEBUG_SCREEN_ONLY);

        /* start the CameraTask  */
        if (StartCameraTask(framesPerSecond, 0, k320x240, ROT_0) == -1)
        {
            DPRINTF(LOG_ERROR,
                    "Failed to spawn camera task; exiting. Error code %s",
                    GetVisionErrorText(GetLastVisionError()));
        }
        /* allow writing to vxWorks target */
        Priv_SetWriteFileAllowed(1);

        /* stop the watchdog if debugging  */
        GetWatchdog().SetExpiration(0.5);
        GetWatchdog().SetEnabled(false);
    }
开发者ID:FRC980,项目名称:FRC-Team-980,代码行数:60,代码来源:TwoColorDemo.cpp

示例9: RobotMain

	/**
	 * Runs the motors with arcade steering. 
	 */
	void RobotMain(void)
	{
		GetWatchdog().SetEnabled(false);
		
		while (true)
		{
			GetWatchdog().Feed();
			sendIOPortData();
			sendVisionData();
			Wait(1.0);
		}
	}
开发者ID:Skunk-ProLaptop,项目名称:Skunkworks1983,代码行数:15,代码来源:DashboardDataExample.cpp

示例10: MainRobot

	/****************************************
	 * MainRobot: (The constructor)
	 * Mandatory method.
	 * TODO:
	 * - Tweak anything related to the scissor lift - verify values.
	 * - Find out how to configure Victor.
	 */
	MainRobot(void):
		// Below: The constructor needs to know which port connects to which
		// motor so it can control the Jaguars correctly.
		// See constants at top.
		robotDrive(LEFT_FRONT_MOTOR_PORT, LEFT_REAR_MOTOR_PORT, 
		RIGHT_FRONT_MOTOR_PORT, RIGHT_REAR_MOTOR_PORT)
		{
			SmartDashboard::init();
			GetWatchdog().SetExpiration(0.1);  				// In seconds.
			stick1 = new Joystick(MOVE_JOYSTICK_USB); 		// Joystick 1
			stick2 = new Joystick(LIFT_JOYSTICK_USB);		// Joystick 2
			
			minibot = new MinibotDeployment (
					MINIBOT_DEPLOY_PORT,
					MINIBOT_DEPLOYED_DIO,
					MINIBOT_RETRACTED_DIO);

			lineSensors = new LineSensors (
					LEFT_CAMERA_PORT,
					MIDDLE_CAMERA_PORT,
					RIGHT_CAMERA_PORT);
			
			lift = new LiftController (
					LIFT_MOTOR_PORT,
					HIGH_LIFT_DIO,
					LOW_LIFT_DIO);
			lift->initButtons(
					kJSButton_2,	// Botton top button
					kJSButton_4,	// Left top button
					kJSButton_3, 	// Center top button
					kJSButton_5); 	// Right top button

			
			// The wiring was inverted on the left motors, so the below
			// is necessary.
			robotDrive.SetInvertedMotor(RobotDrive::kFrontLeftMotor, true);
			robotDrive.SetInvertedMotor(RobotDrive::kRearLeftMotor, true);
			
			isFastSpeedOn = false;
			isSafetyModeOn = true;
			isLiftHigh = false;
			// isSafetyModeOn:  Controlled by the driver -- should only have to
			// 					choose once.
			// isLiftHigh: 		Controlled by the program -- turns true only 
			//					when height is too high, otherwise turns false.
			
			isDoingPreset = false;
			
			GetWatchdog().SetEnabled(true);
			UpdateDashboard("TestingTestingTestingTesting"
							"TestingTestingTestingTestingTesting");
			UpdateDashboard("Finished initializing.");
		}
开发者ID:MrWilson1,项目名称:skyline-robotics,代码行数:60,代码来源:MyRobot.cpp

示例11: OperatorControl

	void OperatorControl(void)
	{		
		GetWatchdog().SetExpiration(.1);
		GetWatchdog().SetEnabled(true);
		GetWatchdog().Feed();

		while (IsOperatorControl())
		{
			GetWatchdog().Feed();	   				
			UpdateDash();
			Wait(.001f);
		}
	}
开发者ID:HighRollersCode,项目名称:HR12,代码行数:13,代码来源:MyRobot.cpp

示例12: DBG

void RobotBeta1::resetGyro(void) {
	DBG("Enter\n");
	float angle;
	do {
		gyro->Reset();
		angle = gyro->GetAngle();
		DBG("calibrate angle %f\r", angle);
		GetWatchdog().Feed();
		Wait(0.1);
		GetWatchdog().Feed();
	} while (((int)angle) != 0);
	DBG("\nExit\n");
}
开发者ID:Alexander-Brown,项目名称:frc2876,代码行数:13,代码来源:RobotBeta1DrivePatterns.cpp

示例13: OperatorControl

	/**
	 * Run the closed loop position controller on the Jag.
	 */
	void OperatorControl()
	{
		printf("In OperatorControl\n");
		GetWatchdog().SetEnabled(true);
		while (IsOperatorControl() && !IsDisabled())
		{
			GetWatchdog().Feed();
			// Set the desired setpoint
			speedJag.Set(stick.GetAxis(axis) * 150.0);
			UpdateDashboardStatus();
			Wait(0.05);
		}
	}
开发者ID:FRC980,项目名称:FRC-Team-980,代码行数:16,代码来源:MyRobot.cpp

示例14: Test

	void Test(void)
	{
		compressor->Start();
		myRobot.SetSafetyEnabled(true);
		GetWatchdog().SetEnabled(true);
		GetWatchdog().SetExpiration(1);
		GetWatchdog().Feed();

		while(IsTest())
		{
			GetWatchdog().Feed();
			Wait(0.1);
		}
	}
开发者ID:highlandprogramming,项目名称:WIP-2014-Code-FRC,代码行数:14,代码来源:MyRobot.cpp

示例15: Robot2014

	Robot2014(void){
		GetWatchdog().SetExpiration(1);
		GetWatchdog().SetEnabled(false);
		
		drivePad = new Joystick(DRIVEPAD);
		gamePad = new Joystick(GAMEPAD);
		
		driveTrain = new MecanumDrive();
		ballShooter = new Shooter();
		pickupBall = new BallPickup();
		//vision = new VisionSystem();
		
		autonTimer = new Timer();
	}
开发者ID:FRC-263,项目名称:Gimli,代码行数:14,代码来源:Robot2014.cpp


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