/** * Compare Interrupt */ void TIM4_IRQHandler(void){ if(TIM_GetITStatus(TIM4, TIM_IT_CC1) == SET){ // clear IRQ Status TIM_ClearITPendingBit(TIM4, TIM_IT_CC1); NVIC_ClearPendingIRQ(TIM2_IRQn); // now increment local loop counter and modify local // time on second increment ++loops; if(loops == RATE_MIN){ // reset timing information for next 1 second round loops = 0; totalDuration = newTotalDuration; lastOverflow = 0; currentCycleDuration = 0; immediateCorrection = 0; // only applied till next cycle/second starts, then // newTotalDuration contains corrected value } if(loops % UPDATE_RATE_SEC == 0){ DCF77_incrementTime(&clockTime); UART_SendString("S\n\0"); } // update timer compare register and update duration of current cycle /second in ticks currentCycleDuration += lastCompareDuration; lastCompareDuration = Clock_calcMacrotickDuration(); previousCompareRegisterValue = TIM4->CCR1; TIM4->CCR1 += lastCompareDuration; // update visualization of clock updateVisualization(&clockTime, (loops % UPDATE_RATE_SEC), UPDATE_RATE_SEC); } }
void RamachandranPlot::resetSelectedResidueAngles() { ProteinState *state = curProtein(); if ( !state ) return; #ifdef COIL if ( state->selectedResidue != 0 && state->selectedResidue->getType() != MD::Protein::Residue::UNK && state->selectedResidue->getSecondaryStructure()->getStructureType() == MD::Protein::SecondaryStructure::COIL ) #endif if ( state->selectedResidue != 0 && state->selectedResidue->getType() != MD::Protein::Residue::UNK ) { /* reset dihedral angles of selected residue: */ MD::Scalar newPhi = MD::Scalar( phiAngle ); MD::Scalar newPsi = MD::Scalar( psiAngle ); /* Apply the change: */ undoBuffer.startInteraction ( state->protein, state->selectedResidue, state->interactor->getUpdateDirection() ); state->protein->setDihedralAngles ( state->protein->getResidueIndex(state->selectedResidue), 1,&newPhi,&newPsi,state->interactor->getUpdateDirection() ); undoBuffer.finishInteraction(); /* Update visualization state: */ updateVisualization(); } }
int main(int argc, char* argv[]) { ros::init(argc, argv, "rvo_example"); ros::NodeHandle nh("rvo_example"); /* Create a new simulator instance. */ RVO::RVOSimulator* sim = new RVO::RVOSimulator(); /* Set up the scenario. */ setupScenario(sim); /* Perform (and manipulate) the simulation. */ ROS_INFO("Iteration"); do { #if RVO_OUTPUT_TIME_AND_POSITIONS updateVisualization(sim); #endif setPreferredVelocities(sim); sim->doStep(); } while (!reachedGoal(sim)); ROS_INFO("End"); delete sim; return 0; }
void PhysicsLib::enableFeature(PhysicsLib::Feature feature, bool enable) { if(!data->sdk || !data->scene) return; if(!data->scene->isWritable()) { ::Logger::getInstance()->warning("PhysicsLib::enableFeature - Attempt to set physics features while physics running (pause game/physics update first)."); return; } data->featureMap[feature] = enable; data->applyOptions(); // not necessarily a good idea? will cause a huge hit for this frame until proper settings get updated.. updateVisualization(VC3(0,0,0), 999999.0f, true); }
int main(int argc, const char* argv[]) { /* Create a new simulator instance. */ RVO::RVOSimulator* sim = new RVO::RVOSimulator(); /* Set up the scenario. */ setupScenario(sim); /* Perform (and manipulate) the simulation. */ do { updateVisualization(sim); setPreferredVelocities(sim); sim->doStep(); } while (!reachedGoal(sim)); delete sim; return 0; }
/** * Compare Interrupt - dummy handler demo for local counter */ void TIM4_IRQHandler(void){ if(TIM_GetITStatus(TIM4, TIM_IT_CC1) == SET){ // clear IRQ Status TIM_ClearITPendingBit(TIM4, TIM_IT_CC1); NVIC_ClearPendingIRQ(TIM4_IRQn); // now increment local loop counter and modify local // time on second increment ++loops; if(loops % UPDATE_RATE_SEC == 0){ // primitve watch seconds++; if(seconds == 60){ seconds = 0; ++minutes; if(minutes == 60){ ++hours; minutes = 0; if(hours == 24){ hours = 0; } } } seconds = seconds % 60; loops = 0; //UART_SendString("S\n\0"); } // update timer compare register and update duration of current cycle /second in ticks TIM4->CCR1 += COUNTERVALUE40MS; // update visualization of clock updateVisualization(hours, minutes, seconds, (loops % UPDATE_RATE_SEC)); } }