void initPositions(void) { waitMS(100); if( getPosition(choice) == 0 || getPosition(choice) == 0xFFFF ) { unsigned char i; for( i = 1; i <= MAX_TRACKS; i++ ) { // not initialized before savePosition(i, initpos); } // default power off step motor saveByte(ADDR_KEEPPOWER, KEEPPOWER_OFF); } // always set the calibration position savePosition(choice, initpos); }
bool QPositionNode::eventFilter(QObject* obj, QEvent* event) { if( event->type() == QEvent::DynamicPropertyChange ) { QDynamicPropertyChangeEvent* ev = static_cast<QDynamicPropertyChangeEvent*>(event); if( ev->propertyName() == "Position" ) { QVec3f pos = obj->property("Position").value<QVec3f>(); savePosition( pos.X, pos.Y, pos.Z ); obj->setProperty("__AbsoluteTransformation", QVariant::fromValue(QMatrix4f::TransMat( pos.X, pos.Y, pos.Z) ) ); } if( ev->propertyName() == "Scale" ) { // No scale allowed obj->setProperty("Scale", QVariant::fromValue(QVec3f(1, 1, 1)) ); } // Set absolute transformation to the relative one but don't apply it to the xml data if( ev->propertyName() == "__RelativeTransformation" ) { QMatrix4f mat = obj->property("__RelativeTransformation").value<QMatrix4f>(); obj->setProperty("__AbsoluteTransformation", QVariant::fromValue(mat) ); } } return QXmlTreeNode::eventFilter(obj, event); }
//------------------------------------------------------------------------------------ ToolOperation* CameraPositionTool::activate(const Any& _toolParameter) { const ToolParam& tp = any_cast<ToolParam>(_toolParameter); if(tp.store) { World* world = WorldManager::getSingleton().getActiveWorld(); if(world) { Camera* camera = world->getCamera(); savePosition( tp.index, camera->getPosition(), camera->getOrientation()); updateMenuItems(); } } else { Vector3 position; Quaternion rotation; readPosition(tp.index, position, rotation); World* world = WorldManager::getSingleton().getActiveWorld(); Camera* camera = world->getCamera(); camera->setPosition(position); camera->setOrientation(rotation); } return nullptr; }
void ERModel::saveERDiagram( string fileName ) { ofstream outputERDiagramFile; outputERDiagramFile.open(fileName); if (!outputERDiagramFile.is_open()) { creatFilePath(fileName); outputERDiagramFile.open(fileName); } _isModify = false; SaveComponentVisitor* saveComponentVisitor = new SaveComponentVisitor(); for(int i = 0; i < _components.size(); i++) _components[i]->accept(saveComponentVisitor); outputERDiagramFile << saveComponentVisitor->getERDiagramComponent(); outputERDiagramFile.close(); savePosition(fileName, saveComponentVisitor->getPositionInfo()); }
void MainWindow::handleStateChanged(Qt::WindowState state) { stateChangedHook(state); updateIsActive((state == Qt::WindowMinimized) ? Global::OfflineBlurTimeout() : Global::OnlineFocusTimeout()); psUserActionDone(); if (state == Qt::WindowMinimized && Global::WorkMode().value() == dbiwmTrayOnly) { minimizeToTray(); } savePosition(state); }
void CDummyRepeaterFrame::onClose(wxCloseEvent& event) { if (!event.CanVeto()) { saveCalls(); Destroy(); return; } int reply = ::wxMessageBox(_("Do you want to exit Dummy Repeater"), _("Exit Dummy Repeater"), wxOK | wxCANCEL | wxICON_QUESTION); switch (reply) { case wxOK: saveCalls(); savePosition(); Destroy(); break; case wxCANCEL: event.Veto(); break; } }
bool CheckerboardDetection::detect(const sensor_msgs::ImageConstPtr& in_msg, vector<double>& out) { CheckerboardData cb; out.resize(4); if (detect(in_msg, cb)) { savePosition(out); saveImage(in_msg); out[idx_x] = cb.x; out[idx_y] = cb.y; out[idx_rows] = this->patternSize.height; out[idx_cols] = this->patternSize.width; for (int i = 0; i < corners.size(); i++) { out.push_back(corners[i].x); out.push_back(corners[i].y); } out.push_back(this->squareLength); // square length return true; } return false; }
/*! This is the main testing function. It is called whenever the user is idle, and it tests the next grasp in the graspList. It follows the testing process defined above. When the last grasp is reached, the hand is returned to its position before the testing began, the graspList is sorted in quality order, and the testingComplete signal is emitted. */ void grasp_tester::testIt() { bool do_iteration; bool do_save; /* Show status bar */ #ifdef GRASPITDBG std::cout << "PL_OUT: Testing grasp no " << actualGraspNr++ << " out of " << nrOfGrasps << std::endl; #endif /* Loop over all planned grasps to test them */ if (it_gr != (*graspList).end()) { do_iteration = false; do_save = false; /* Update visualization */ #ifdef GRASPITDBG std::cout << "PL_OUT: vor change color" << std::endl; #endif (*it_gr)->get_graspRepresentation()->changeColor(1., 0., 0.); if (render) { myViewer->render(); projectionViewer->render(); // this doesn't work!!!!!! } #ifdef GRASPITDBG std::cout << "PL_OUT: Put hand in position" << std::endl; #endif /* First, put hand to starting point outside the object */ if (putIt(*it_gr, render) == SUCCESS) { #ifdef GRASPITDBG std::cout << "PL_OUT: set preshape" << std::endl; #endif /* Use given preshape */ preshapeIt((*it_gr)->get_preshape(), render); #ifdef GRASPITDBG std::cout << "PL_OUT: test for collisions" << std::endl; #endif /* check if hand collides already with any obstacle (like the table) */ if (!handCollision()) { #ifdef GRASPITDBG std::cout << "PL_OUT: move hand towards object" << std::endl; #endif /* Now, move the hand in the specified direction */ if (moveIt((*it_gr)->get_graspDirection(), render)) { #ifdef GRASPITDBG std::cout << "PL_OUT: check contacts" << std::endl; #endif /* Check if contact exists between hand and the right object */ if (checkContactToHand((*it_gr)->get_graspableBody())) { /* Then close the fingers */ my_hand->autoGrasp(render, 1); // my_world->findAllContacts(); my_world->updateGrasps(); // if (render) myViewer->render(); /* Evaluate grasp */ (*it_gr)->set_quality(my_grasp->getQM(whichQM)->evaluate()); #ifdef GRASPITDBG std::cout << "PL_OUT: !!!! whichQM: " << whichQM << " quality: " << (*it_gr)->get_quality() << std::endl; #endif if (saveToFile) { saveGrasp((*it_gr)->get_quality()); } /* save final position to grasp class */ if ((*it_gr)->get_quality() > QUALITY_MIN_THRESHOLD && (*it_gr)->get_quality() <= 1.0) { do_save = true; } } else { do_iteration = true; } /* iteration if: - grasp not stable - wrong contacts */ if (do_iteration || ((*it_gr)->get_quality() <= QUALITY_MIN_THRESHOLD)) { if (iteration(**it_gr)) { /* save final position to grasp class */ do_save = true; } } } #ifdef GRASPITDBG else { std::cout << "PL_OUT: MoveIt failed." << std::endl; } #endif } } #ifdef GRASPITDBG else { std::cout << "PL_OUT: putIt failed. Stepping to next grasp." << std::endl; } #endif if (do_save) { /* change radius in vis window according to quality */ (*it_gr)->get_graspRepresentation()->changeRadius((*it_gr)->get_quality()); /* save final position to grasp class */ savePosition(**it_gr); } else { (*it_gr)->remove_graspRepresentation(); } /* reset color */ //(*it_gr)->get_graspRepresentation()->resetColor(); /* increment iterator for next step */ if (it_gr != (*graspList).end()) { it_gr++; } } /* last grasp reached */ else { #ifdef GRASPITDBG std::cout << "PL_OUT: Last grasp reached" << std::endl; #endif /* Order List and remove bad grasps */ orderGraspListByQuality(*graspList); if (saveToFile) {graspFile.close(); saveToFile = false;} /* we are ready; kill idleSensor */ if (idleSensor != NULL) { delete idleSensor; } idleSensor = NULL; if (render) { /* put the hand back to starting position */ my_hand->setTran(origTran); my_hand->forceDOFVals(dofs); } PROF_STOP_TIMER(TOTAL_PLANNER); PROF_PRINT_ALL; Q_EMIT testingComplete(); } if (idleSensor != NULL) { idleSensor->schedule(); } if (!render) { /* put the hand back to starting position */ my_hand->setTran(origTran); my_hand->forceDOFVals(dofs); } }
void ParametersPage::on_spinAngle_valueChanged() { savePosition(); }
void ParametersPage::on_editPositionY_valueChanged() { savePosition(); }
/* * setup service to define the track positions * control remains in this function as long as the setup button is active */ void setup(void) { confirm(5); // start with position mid stepnr = initpos; choice = MAX_TRACKS / 2 + 1; updateDisplay(); pulswidth = MAX_PULSWIDTH; power = POWER_ON; waitMS(100); curtrack = choice; while( buttonSetup == BUTTON_ON ) { waitMS(10); if( buttonRight == BUTTON_ON && buttonLeft == BUTTON_ON ) { saveByte( ADDR_KEEPPOWER, readByte(ADDR_KEEPPOWER) ? KEEPPOWER_OFF:KEEPPOWER_ON ); confirm(3); while( buttonRight == BUTTON_ON && buttonLeft == BUTTON_ON ); } while( stepnr < MAX_STEPS && buttonLeft == BUTTON_OFF && buttonRight == BUTTON_ON ) { // turn right; end position is not reached stepnr++; oneStep(STEP_RIGHT); }; while( stepnr > 0 && buttonLeft == BUTTON_ON && buttonRight == BUTTON_OFF ) { // turn left; start position is not reached stepnr--; oneStep(STEP_LEFT); }; // check if the buttonSave is pressed if( buttonSave == BUTTON_ON ) { // save the new position in eeprom savePosition( choice, stepnr); confirm(1); choice++; if( choice > MAX_TRACKS ) choice = 1; curtrack = choice; updateDisplay(); while( buttonSave == BUTTON_ON ) waitMS(10); } // check if the buttonNext is pressed if( buttonNext == BUTTON_ON ) { confirm(1); choice++; if( choice > MAX_TRACKS ) choice = 1; curtrack = choice; updateDisplay(); while( buttonNext == BUTTON_ON ) waitMS(10); } } // end while if( !readByte(ADDR_KEEPPOWER) ) power = POWER_OFF; /* power off step motor */ }