Пример #1
0
void MainWindow::createActions()
{
    m_autonamtonMode = new QActionGroup(this);
    m_autonamtonMode->setExclusive(true);
    m_autonamtonMode->addAction(ui->actEditAutomaton);
    m_autonamtonMode->addAction(ui->actRunSimulation);
    m_autonamtonMode->addAction(ui->actRunwithHardware);
    ui->actEditAutomaton->setChecked(true);
    ui->menuAutomata->setEnabled(false);
    ui->actDeleteAutomaton->setEnabled(false);
    ui->actImportAutomaton->setEnabled(false);
    ui->actEditHWConnection->setEnabled(false);

    m_controllerState= new QActionGroup(this);
    m_controllerState->setExclusive(true);
    m_controllerState->addAction(ui->actStartController);
    m_controllerState->addAction(ui->actStopController);
    m_controllerState->addAction(ui->actPauseController);
    ui->actStopController->setChecked(true);


    ui->menuToggleToolBars->addAction(ui->mainToolBar->toggleViewAction());
    ui->menuToggleToolBars->addAction(ui->controllerToolBar->toggleViewAction());

    connect(ui->actAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

    connect(ui->actStartController, SIGNAL(triggered()), m_controller, SLOT(startController()));
    connect(ui->actStopController, SIGNAL(triggered()), m_controller, SLOT(stopController()));
    connect(ui->actPauseController, SIGNAL(triggered(bool)), m_controller, SLOT(pauseController(bool)));
}
Пример #2
0
void taskReceive(void *p){
	
	for(;;){
		if (isRXReady()){
			uint8_t header = readByte();
			
			switch(header){
				case HEADER_READY:
				{
					setControllerReady();
					setSendReady();
					break;
				}
				break;
				case HEADER_STOP:
				{
					stopController();
					stopSending();
					break;
				}
				case HEADER_SET_PARAMETERS:
				{
					uint8_t newSetpoint;
					uint8_t newSampleTime;
					double newKp;
					double newKi;
					double newKd;
					waitRXReady();
					newSetpoint = readByte();
					waitRXReady();
					newSampleTime = readByte();
					waitRXReady();
					newKp = readDouble();
					waitRXReady();
					newKi =  readDouble();
					waitRXReady();
					newKd = readDouble();
					
					setParameters(newSetpoint, newSampleTime, newKp, newKi, newKd);
					break;
				}
				case HEADER_CHANGE_DUTY:
				{
					uint8_t duty;
					waitRXReady();
					duty = readByte();
					
					changeDutyCycle(34, duty);
					break;
				}
				
			}
		}

		
	}
}
void JointControllerManager::stopHook()
{
  // Stop running controllers
  stopController(getControllerNames(getRunningControllers()), BEST_EFFORT);

  // Stop joint interface
  if (!joint_iface_->stop())
  {
    PAL_ERROR("Failed to successfully stop component: Could not stop low level joint access.");
  }
}