bool MainObject::StartAudioDevice() { // // Create Ringbuffers // if(sir_config->audioBitrateQuantity()==0) { // For VBR modes sir_ringbuffers. push_back(new Ringbuffer(RINGBUFFER_SIZE,sir_config->audioChannels())); } else { for(unsigned i=0;i<sir_config->audioBitrateQuantity();i++) { sir_ringbuffers. push_back(new Ringbuffer(RINGBUFFER_SIZE,sir_config->audioChannels())); } } // // Start Audio Device // QString err; if((sir_audio_device= AudioDeviceFactory(sir_config->audioDevice(),sir_config->audioChannels(), sir_config->audioSamplerate(), &sir_ringbuffers,this))==NULL) { Log(LOG_ERR, QString().sprintf("%s devices not supported", (const char *)AudioDevice::deviceTypeText(sir_config->audioDevice()).toUtf8())); exit(256); } connect(sir_audio_device,SIGNAL(hasStopped()), this,SLOT(audioDeviceStoppedData())); if(!sir_audio_device->processOptions(&err,sir_config->deviceKeys(), sir_config->deviceValues())) { Log(LOG_ERR,err); exit(256); } if(!sir_audio_device->start(&err)) { Log(LOG_ERR,err); exit(256); } sir_meter_timer=new QTimer(this); connect(sir_meter_timer,SIGNAL(timeout()),this,SLOT(meterData())); if(sir_config->meterData()) { sir_meter_timer->start(AUDIO_METER_INTERVAL); } return true; }
void stopTurn(ros::Publisher vel_pub) { if (hasStopped()) { ROS_INFO("Reached goal"); g_state = FORWARD; g_goal.x = cos(g_pose->theta) * 2 + g_pose->x; g_goal.y = sin(g_pose->theta) * 2 + g_pose->y; g_goal.theta = g_pose->theta; printGoal(); } else { commandFly(vel_pub, 0, 0); } }
void stopForward(ros::Publisher vel_pub) { if (hasStopped()) { ROS_INFO("Reached goal"); g_state = TURN; g_goal.x = g_pose->x; g_goal.y = g_pose->y; g_goal.theta = fmod(g_pose->theta + PI/2.0, 2*PI); printGoal(); } else { commandFly(vel_pub, 0, 0); } }
// detiene el movimiento de giro void stopTurn(ros::Publisher twist_pub) { if (hasStopped()) // si el giro se ha detenido: { ROS_INFO("Reached goal"); g_state = FORWARD; g_goal.x = distance[d]* cos(g_pose->theta) + g_pose->x; g_goal.y = distance[d]* sin(g_pose->theta) + g_pose->y; g_goal.theta = g_pose->theta; d++; printGoal(); } else // sino, da la orden de detener el giro: { commandTurtle(twist_pub, 0, 0); } }
// detiene el movimiento forward void stopForward(ros::Publisher twist_pub) { double temp; if (hasStopped()) // si la tortuga se ha detenido: { ROS_INFO("Reached goal"); g_state = TURN; g_goal.x = g_pose->x; // mantiene los valores de x e y g_goal.y = g_pose->y; if((g_pose->theta + angle[a]) >= 2*PI) { g_goal.theta =g_pose->theta + angle[a] - 2*PI; // mantiene el valor de theta menor a 2*PI } else g_goal.theta =g_pose->theta + angle[a]; a++; printGoal(); } else // sino, da la orden de detenerla { commandTurtle(twist_pub, 0, 0); } }