Beispiel #1
0
void OmniRobot::gamepadButton(int button, int pressed)
{
    if (pressed == 0) return;

    switch (omniState)
    {
    case INIT_MODE:
        switch (button)
        {
        case 1: movementMode = ROTATE_MAX_MODE; break;
        case 2: movementMode = ROTATE_POINT_MODE; break;
        case 3: movementMode = ROTATE_MODE; break;
        case 5: movementMode = ANDROID_MODE; period = 10; break;
        }
        omniState = CONTROL_MODE;
        startControl();
        break;
    case CONTROL_MODE:
        qDebug() << "INIT_MODE";
        init();
        omniState = INIT_MODE;
        brick.stop();
        timer.stop();
        disconnect(&timer, SIGNAL(timeout()), this, SLOT(omniControl()));
        break;
    default:
        brick.stop();
        timer.stop();
        disconnect(&timer, SIGNAL(timeout()), this, SLOT(omniControl()));
    }

}
Beispiel #2
0
task main()
{
	while(true)
	{
		omniControl(vexRT[Ch3], vexRT[Ch4], vexRT[Ch1]);
	}
}
Beispiel #3
0
void OmniRobot::startControl()
{
    brick.stop();
    timer.stop();
    qDebug() << "CONTROL_MODE";
    connect(&timer, SIGNAL(timeout()), this, SLOT(omniControl()));
    timer.start(period);
}
Beispiel #4
0
void OmniRobot::getButton(int code, int value)
{
    if (value != 1)
        return;

    qDebug() << "INIT_MODE";
    omniState = INIT_MODE;
    init();
    brick.stop();
    timer.stop();
    disconnect(&timer, SIGNAL(timeout()), this, SLOT(omniControl()));
}