Beispiel #1
0
	/****************************************
	 * 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.");
		}
Beispiel #2
0
	/****************************************
	 * UpdateDashboard:
	 * Overloading: Updates the dashboard, but with text also.
	 * Input = string to be displayed.
	 * Output = See UpdateDashboard(void)
	 * 			String from program.
	 * TODO:
	 * - Test
	 */
	void UpdateDashboard(const char *outputText)
	{
		// Call to base dashboard updater.
		UpdateDashboard();

		SmartDashboard::Log(outputText, "Message:");
	}
Beispiel #3
0
	void TabWidget::updateTorrentStats ()
	{
		if (Core::Instance ()->GetCurrentTorrent () == -1)
			return;

		UpdateTorrentControl ();
		UpdateDashboard ();
		UpdateOverallStats ();
		TorrentSelectionChanged_ = false;
	}
Beispiel #4
0
	/****************************************
	 * OperatorControl:
	 * Input = Data from driver station or field
	 * Output = Robot movements
	 * Mandatory method. 
	 * TODO:
	 * None
	 */
	void OperatorControl(void)
	{
		//GetWatchdog().SetEnabled(true);
		timer.Reset();
		timer.Start();
		GetWatchdog().Feed();
		isFastSpeedOn = false;
		isSafetyModeOn = false;
		bool isLiftGood;
		UpdateDashboard("Starting Operator Control");
		while(IsOperatorControl()) {
			FatalityChecks(stick1, stick2);
			DriveHost(stick1);
			isLiftGood = ManualLift(stick2);
			MinibotDeploy(stick1);
			
			GetWatchdog().Feed();
			UpdateDashboard(isLiftGood ? " " : "Scissor Error");
			Wait(DELAY_VALUE);
		}
	}
Beispiel #5
0
	/****************************************
	 * FatalityChecks:
	 * Input = Both joysticks, error codes from ManualLift
	 * Output = None
	 * Handles 
	 * - Joystick disconnects
	 * - Toggling safety mode
	 * TODO:
	 * - Find out how 'wpi_fatal' works
	 * - Replace NULL with '0'? (zero)
	 */
	void FatalityChecks(GenericHID *moveStick, GenericHID *liftStick)
	{
		// Terminate if a joystick is disconnected.
		bool badMove = (NULL == moveStick);
		bool badLift = (NULL == liftStick);
		if (badMove || badLift) {
			if (badMove && !badLift) {
				UpdateDashboard("ERROR: Stick 1 disconnected");
			} else if (!badMove && badLift) {
				UpdateDashboard("ERROR: Stick 2 disconnected");
			} else if (badMove && badLift) {
				UpdateDashboard("ERROR: Stick 1 and stick 2 disconnected");
			}
			wpi_fatal(NullParameter);
			return;
		}

		if (false == GetWatchdog().IsAlive()) {
			UpdateDashboard("ERROR: The watchdog died");
			GetWatchdog().Kill();
			wpi_fatal(NullParameter);
			return;
		}
		
		if (moveStick->GetRawButton(ENABLE_SAFETY_BUTTON) ||
			liftStick->GetRawButton(ENABLE_SAFETY_BUTTON)) {
			isSafetyModeOn = true;
		}
		if (moveStick->GetRawButton(DISABLE_SAFETY_BUTTON) ||
			liftStick->GetRawButton(DISABLE_SAFETY_BUTTON)) {
			isSafetyModeOn = false;
		}
		
		// If the scissor-lift is too high, it might topple at higher speeds.
		isLiftHigh = lift->isAtTop();
	}
Beispiel #6
0
	TabWidget::TabWidget (QWidget *parent)
	: QWidget { parent }
	{
		Ui_.setupUi (this);

		TagsChangeCompleter_ = new Util::TagsCompleter { Ui_.TorrentTags_ };
		Ui_.TorrentTags_->AddSelector ();

		connect (Core::Instance (),
				SIGNAL (dataChanged (QModelIndex, QModelIndex)),
				this,
				SLOT (updateTorrentStats (QModelIndex, QModelIndex)));

		UpdateDashboard ();
	}
Beispiel #7
0
	void TorrentTabWidget::updateTorrentStats ()
	{
		UpdateDashboard ();
		UpdateOverallStats ();
		UpdateTorrentControl ();
	}