コード例 #1
0
void manualControl(void){ //For manual control

	if (abs(vexRT(Ch2)) > 15 || abs(vexRT(Ch3)) > 15){ //Only move if we pop over 15 units on the controls
		//Run the motors at the joystick input
		setLeftMotors(vexRT(Ch2));
		setRightMotors(vexRT(Ch3));
		}	else {
		//Kill the motors
		stopLeftMotors();
		stopRightMotors();
	}



	if (vexRT(Btn8U)){
		setMotor(vertBelt,- 0);
	}


	// Starts and stops verticle belt
	if (vexRT(Btn5D)||vexRT(Btn6D)){
		if (vexRT(Btn5D)){setMotor(vertBelt,-100);} else {setMotor(vertBelt,100);}
	}

	// Starts and stops verticle belt
	if (vexRT(Btn5U)||vexRT(Btn6U)){
		if (vexRT(Btn5U)){setMotor(hozBelt,-100);} else {setMotor(hozBelt,100);}
	}

	//Kill the belts
	if (vexRT(Btn8D)){stopMotor(hozBelt);stopMotor(vertBelt);}

	//Start Auto
	if (vexRT(Btn8L) && vexRT(Btn8R)){roboControl();}

	//Quick start, all on
	if (vexRT(Btn7L)){
		setMotor(hozBelt,100);
		setMotor(vertBelt,100);
		launcherSpeed_new = 127;
	}

	/*			Launcher speeds			*/
	if (vexRT(Btn7D)){ stopLauncher();} //Emergency launcher Stop
	//if (vexRT(Btn7D)){ safeLauncherStop();} //Safe launcher Stop
	if (vexRT(Btn7R)){launcherSpeed_new = 75;}//Low speed mode
	if (vexRT(Btn7U)){ launcherSpeed_new = 127;} //Sets launcher speed to 127 (max)
	updateLauncherSpeed();
}
コード例 #2
0
ファイル: GravensteinMain.c プロジェクト: WesR/Vex-BotCode
void manualControl(void){ //For manual control

	if (abs(vexRT(Ch2)) > 15 || abs(vexRT(Ch3)) > 15){ //Only move if we pop over 15 units on the controls
		//Run the motors at the joystick input
		setLeftMotors(vexRT(Ch2));
		setRightMotors(vexRT(Ch3));
		}	else {
		//Kill the motors
		stopLeftMotors();
		stopRightMotors();
	}

	// Starts and stops verticle belt
	if (vexRT(Btn5D)||vexRT(Btn6D)){
		if (vexRT(Btn5D)){setMotor(vertBelt,-100);} else {setMotor(vertBelt,100);}
	}

	// Starts and stops verticle belt
	if (vexRT(Btn5U)||vexRT(Btn6U)){
		if (vexRT(Btn5U)){setMotor(hozBelt,-100);} else {setMotor(hozBelt,100);}
	}

	//Kill the belts
	if (vexRT(Btn8D)){stopMotor(hozBelt);stopMotor(vertBelt);}

	// Starts and stops the horizontal belt
	/*
	if (vexRT(Btn8L)){hozBeltBtn_beenPressed = true;} //We have pressed it
	if (!vexRT(Btn8L) && hozBeltBtn_beenPressed){ //When we let go lets flip
	if (!hozBelt_on){hozBelt_on = true; setMotor(hozBelt,100);}else{hozBelt_on = false;stopMotor(hozBelt);}
	hozBeltBtn_beenPressed = false;
	}
	*/

	//Quick start, all on
	if (vexRT(Btn7L)){
		setMotor(hozBelt,100);
		setMotor(vertBelt,100);
		launcherSpeed_new = 127;
	}

	/*			Launcher speeds			*/
	if (vexRT(Btn7D)){ stopLauncher();} //Emergency launcher Stop
	//if (vexRT(Btn7D)){ safeLauncherStop();} //Safe launcher Stop
	if (vexRT(Btn7R)){launcherSpeedHop();}//Pop up 15
	if (vexRT(Btn7U)){ launcherSpeed_new = 127;} //Sets launcher speed to 127 (max)
	updateLauncherSpeed();
}
コード例 #3
0
ファイル: w_main.cpp プロジェクト: dbkblk/rand_launcher
w_main::w_main(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::w_main)
{
    ui->setupUi(this);

    /* Language routine : Get language parameter, else if OS language, then wait to fully initialize the GUI.
     * See f_lang.cpp for details */
    // Get OS language
    QString loc = QLocale::system().name().section('_', 0, 0);

    translator = new QTranslator(this);

    if(readCheckerParam("Main/Lang") == "error")
    {
        if(isLanguageSupported(loc)){
            setCheckerParam("Main/Lang",loc);
        }
        else {
            setCheckerParam("Main/Lang","en");
            loc = "en";
        }
        checkGameFont();
    }
    else
    {
        loc = readCheckerParam("Main/Lang");
        checkGameFont();
    }
    qDebug() << "Language used: " << getLanguageNameFromCode(loc);

    // Setup translator
    translator->load(QString("launcher_" + loc + ".qm"),"checker/lang/");
    qApp->installTranslator(translator);

    // Initialize sub-windows
    modules = new w_modules(this);
    modules->UpdateWindow();
    connect(modules, SIGNAL(exit()), this, SLOT(stopLauncher()));
    ui->bt_mcpupdate->setVisible(false);

    // GUI : Set menu icons
    ui->actionOpen_mod_folder->setIcon(QIcon("checker/icons/open.png"));
    ui->actionExit->setIcon(QIcon("checker/icons/exit.png"));
    ui->actionForum->setIcon(QIcon("checker/icons/forum.png"));
    ui->actionBugreport->setIcon(QIcon("checker/icons/bugs.png"));
    ui->actionAbout_AND_Resurrection_team_forum->setIcon(QIcon("checker/icons/about.png"));
    ui->actionHelp_translate_the_mod->setIcon(QIcon("checker/icons/translate.png"));
    ui->actionTranslate_the_civilopedia->setIcon(QIcon("checker/icons/translate.png"));
    ui->actionTranslate_the_module_Mega_Civ_pack->setIcon(QIcon("checker/icons/translate.png"));
    ui->actionTranslate_the_website->setIcon(QIcon("checker/icons/translate.png"));
    ui->actionTranslate_the_mod_help->setIcon(QIcon("checker/icons/help.png"));
    ui->menuTranslation->setIcon(QIcon("checker/icons/transl.png"));
    ui->actionGive_us_feedback_forum->setIcon(QIcon("checker/icons/feed.png"));
    ui->actionWebsite->setIcon(QIcon("checker/icons/blue_marble.png"));
    ui->menuFix_installation->setIcon(QIcon("checker/icons/fix.png"));
    ui->actionClear_cache->setIcon(QIcon("checker/icons/clear.png"));
    ui->actionReset->setIcon(QIcon("checker/icons/reset.png"));
    ui->actionDevelopment_platform->setIcon(QIcon("checker/icons/dev.png"));
    ui->actionApply_Asian_language_patch_again->setIcon(QIcon("checker/icons/asian.png"));
    ui->actionFrequently_asked_questions->setIcon(QIcon("checker/icons/faq.png"));
    ui->actionCheck_the_files_again->setIcon(QIcon("checker/icons/cust.png"));
    ui->actionWrite_a_review_on_Moddb->setIcon(QIcon("checker/icons/moddb.png"));

    // GUI : Set title and special options if the mod is known
    QString optName = readCheckerParam("Mod/mod_name");
    if(optName != "error"){
        // Set title
        this->setWindowTitle(optName);

        // Disable specific menus
        ui->menuCommunity->deleteLater();
        ui->menuTools->deleteLater();
    }
    else {
        this->setWindowTitle("Civilization IV: A New Dawn");
    }

    // GUI : Set background
    this->setStyleSheet("w_main { background-image: url(checker/and2_background.jpg); background-position: bottom }");

    // Update : Prepare a background task to check for update without slowing down the GUI
    /*  Thread code, imported from https://github.com/fabienpn/simple-qt-thread-example */
    thread = new QThread();
    worker = new f_check();

    worker->moveToThread(thread);
    connect(worker, SIGNAL(workRequested()), thread, SLOT(start()));
    connect(thread, SIGNAL(started()), worker, SLOT(CheckForUpdate()));
    connect(worker, SIGNAL(finished(bool, bool)), thread, SLOT(quit()), Qt::DirectConnection);
    connect(worker, SIGNAL(finished(bool, bool)), this, SLOT(UpdateWindowInfos()), Qt::DirectConnection);
    connect(worker, SIGNAL(finished(bool, bool)), this, SLOT(UpdateAvailable(bool, bool)));
    connect(worker, SIGNAL(finished(bool, bool)), modules, SLOT(UpdateWindow()));

    // Update : Kill the previous background task if any, then start the task
    worker->abort();
    thread->wait(); // If the thread is not running, this will immediately return.
    worker->requestWork();

    // Map signals for dynamic mod menu
    populate_mod_list();

    // GUI : Update the local version and font color
    UpdateWindowInfos();

    // Translations : Reload the GUI with the correct translation
    ui->retranslateUi(this);
    clear_language_state();
    populate_language_menu(loc);

    // Inject audio xml silently in background in non-default modules have been detected
    inj_thread = new QThread();
    inj_worker = new f_injection();
    inj_worker->moveToThread(inj_thread);
    connect(inj_worker, SIGNAL(workRequested()), inj_thread, SLOT(start()));
    connect(inj_thread, SIGNAL(started()), inj_worker, SLOT(start()));
    inj_worker->abort();
    inj_thread->wait(); // If the thread is not running, this will immediately return.
    inj_worker->requestWork();

    // Invite the user to select the right executable if the file doesn't exists
    QString executable = readCheckerParam("Main/ExecutablePath");
    if(!QFile::exists(executable))
    {
        QMessageBox::information(0, "Information", tr("The executable saved in your settings doesn't exist. You will be now invited to select the game executable location"));
        QString exeloc = QFileDialog::getOpenFileName(0, tr("Find Civ IV executable"), QString(), "(Civ4BeyondSword.exe)");
        setCheckerParam("Main/ExecutablePath",exeloc);
    }
}