// ****************************************************************************************** // Call when joints edit sceen is done and needs to be saved // ****************************************************************************************** void ROSControllersWidget::saveJointsGroupsScreen() { // Find the controller we are editing based on the controller name string moveit_setup_assistant::ROSControlConfig* searched_controller = config_data_->findROSControllerByName(current_edit_controller_); // Clear the old data searched_controller->joints_.clear(); // Copy the data for (int i = 0; i < joint_groups_widget_->selected_data_table_->rowCount(); ++i) { // Get list of associated joints const robot_model::JointModelGroup* joint_model_group = config_data_->getRobotModel()->getJointModelGroup( joint_groups_widget_->selected_data_table_->item(i, 0)->text().toStdString()); const std::vector<const robot_model::JointModel*>& joint_models = joint_model_group->getActiveJointModels(); // Iterate through the joints for (const robot_model::JointModel* joint : joint_models) { if (joint->isPassive() || joint->getMimic() != nullptr || joint->getType() == robot_model::JointModel::FIXED) continue; searched_controller->joints_.push_back(joint->getName()); } } // Switch to main screen showMainScreen(); // Reload main screen table loadControllersTree(); }
// ****************************************************************************************** // Call when joints edit sceen is done and needs to be saved // ****************************************************************************************** void ROSControllersWidget::saveControllerScreenEdit() { // Save the controller if (!saveControllerScreen()) return; // Switch to main screen showMainScreen(); }
void toggleScreen() { if(currentScreen == 0) { DISPLAY_ON; showMainScreen(); } else { currentScreen = 0; DISPLAY_OFF; } }
bool BackGroundLayer::init() { if ( !Layer::init() ) { return false; } Log::getInstance()->debug("BackGroundLayer"); showMainScreen(); return true; }
// ****************************************************************************************** // Delete a controller // ****************************************************************************************** void ROSControllersWidget::deleteController() { std::string controller_name = current_edit_controller_; if (controller_name.empty()) { QTreeWidgetItem* item = controllers_tree_->currentItem(); // Check that something was actually selected if (item == nullptr) return; // Get the user custom properties of the currently selected row int type = item->data(0, Qt::UserRole).value<int>(); if (type == 0) controller_name = item->text(0).toUtf8().constData(); } // Confirm user wants to delete controller if (QMessageBox::question( this, "Confirm Controller Deletion", QString("Are you sure you want to delete the controller '").append(controller_name.c_str()).append(" ?"), QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel) { return; } // Delete actual controller if (config_data_->deleteROSController(controller_name)) { ROS_INFO_STREAM_NAMED("Setup Assistant", "Controller " << controller_name << " deleted succefully"); } else { ROS_WARN_STREAM_NAMED("Setup Assistant", "Couldn't delete Controller " << controller_name); } current_edit_controller_.clear(); // Switch to main screen showMainScreen(); // Reload main screen table loadControllersTree(); }
// ****************************************************************************************** // Call when joints edit sceen is done and needs to be saved // ****************************************************************************************** void ROSControllersWidget::saveJointsScreen() { // Find the controller we are editing based on the controller name string moveit_setup_assistant::ROSControlConfig* searched_controller = config_data_->findROSControllerByName(current_edit_controller_); // Clear the old data searched_controller->joints_.clear(); // Copy the data for (int i = 0; i < joints_widget_->selected_data_table_->rowCount(); ++i) { searched_controller->joints_.push_back(joints_widget_->selected_data_table_->item(i, 0)->text().toStdString()); } // Switch to main screen showMainScreen(); // Reload main screen table loadControllersTree(); }
// ****************************************************************************************** // Call when edit screen is canceled // ****************************************************************************************** void ROSControllersWidget::cancelEditing() { if (!current_edit_controller_.empty() && adding_new_controller_) { moveit_setup_assistant::ROSControlConfig* editing = config_data_->findROSControllerByName(current_edit_controller_); if (editing && editing->joints_.empty()) { config_data_->deleteROSController(current_edit_controller_); current_edit_controller_.clear(); // Load the data to the tree loadControllersTree(); } } else { current_edit_controller_.clear(); } // Switch to main screen showMainScreen(); }
int main(void) { uint8_t cmd; uint8_t dispMode = MODE_MAIN; static int8_t direction = PARAM_UP; hwInit(); showTimeMasked(); ds18x20Process(); sensTimer = TEMP_MEASURE_TIME; while(1) { // Update sensors with SENSOR_POLL_INTERVAL period if (!sensTimer == 0) { sensTimer = SENSOR_POLL_INTERVAL; ds18x20Process(); if (bmp180HaveSensor()) bmp180Convert(); dht22Read(); } // Check alarm checkAlarm(); // Update brightness only when not in brightness setup if (dispMode != MODE_BRIGHTNESS) calcBrightness(); // Get command from buttons cmd = getBtnCmd(); // Beep on button pressed if (cmd != BTN_STATE_0) { if (cmd < BTN_0_LONG) startBeeper(BEEP_SHORT); else startBeeper(BEEP_LONG); } // Stop scrolling on any button pressed if (cmd != BTN_STATE_0) matrixHwScroll(MATRIX_SCROLL_STOP); // Handle command switch (cmd) { case BTN_0: direction = PARAM_UP; switch (dispMode) { case MODE_EDIT_TIME: rtcNextEditParam(); break; case MODE_EDIT_ALARM: alarmNextEditParam(); break; } break; case BTN_1: direction = PARAM_UP; case BTN_2: if (cmd == BTN_2) direction = PARAM_DOWN; switch (dispMode) { case MODE_MAIN: startScroll(cmd - BTN_1); break; case MODE_EDIT_TIME: rtcChangeTime(direction); break; case MODE_EDIT_ALARM: alarmChange(direction); break; case MODE_BRIGHTNESS: changeBrightness(direction); break; case MODE_TEST: displayChangeRotate(direction); break; } break; case BTN_0_LONG: if (dispMode == MODE_MAIN) { dispMode = MODE_EDIT_TIME; rtcNextEditParam(); } else { rtc.etm = RTC_NOEDIT; alarmSave(); alarm.eam = ALARM_NOEDIT; dispMode = MODE_MAIN; showTimeMasked(); } break; case BTN_1_LONG: if (dispMode == MODE_MAIN) { dispMode = MODE_EDIT_ALARM; alarmNextEditParam(); } break; case BTN_2_LONG: if (dispMode == MODE_MAIN) { dispMode = MODE_BRIGHTNESS; showBrightness(direction, MASK_ALL); } break; case BTN_0_LONG | BTN_1_LONG: displaySwitchHourZero(); dispMode = MODE_MAIN; showTimeMasked(); break; case BTN_1_LONG | BTN_2_LONG: displaySwitchBigNum(); dispMode = MODE_MAIN; showTimeMasked(); break; case BTN_0_LONG | BTN_2_LONG: displaySwitchHourSignal(); dispMode = MODE_MAIN; showTimeMasked(); break; case BTN_0_LONG | BTN_1_LONG | BTN_2_LONG: dispMode = MODE_TEST; break; } // Show things switch (dispMode) { case MODE_MAIN: showMainScreen(); break; case MODE_EDIT_TIME: showTimeEdit(direction); break; case MODE_EDIT_ALARM: showAlarmEdit(direction); break; case MODE_BRIGHTNESS: showBrightness(direction, MASK_NONE); break; case MODE_TEST: showTest(); break; } } return 0; }