long RangeFinder::getDistance() { long pingSamples[PING_SAMPLES]; long microseconds; for (int x = 0; x < PING_SAMPLES; x++) { pingSamples[x] = ping(); } microseconds = filterRange(pingSamples); #if __RANGEFINDER_H__DEBUG Serial.print("Filtered microseconds = "); Serial.println(microseconds); #endif long distance_cm = calcDistance(microseconds, 1); // Calculating the distance #if __RANGEFINDER_H__DEBUG Serial.print("distance CM = "); Serial.println(distance_cm); // printf the distance about CM #endif return distance_cm; }
void AGain::SetFilterFreq(const double& freq) { axRange<double> filterRange(30.0, 5000.0); double hzValue = filterRange.GetValueFromZeroToOne(freq); for(int i = 0; i < 10; i++) { _polyChannels[i]->SetFilterFreq(hzValue); } }
double TupleTester::testFilterCreation( std::ostream& os ) { try { os << "Creating a filter factory" << std::endl; std::auto_ptr< AIDA::Dev::IDevFilterFactory > factory( new iAIDA::AIDA_Tuple_native::AIDA_DevFilterFactory ); if ( ! factory.get() ) throw std::runtime_error( "Could not create a filter factory" ); os << "Creating a scripted filter" << std::endl; std::auto_ptr< AIDA::IFilter > filter( factory->createScripted( "a*x + b > 0" ) ); if ( ! filter.get() ) throw std::runtime_error( "Could not create a scripted filter" ); os << "Creating a scripted filter with range" << std::endl; std::auto_ptr< AIDA::IFilter > filterRange( factory->createScripted( "a*y + b > 0", 100, 1 ) ); if ( ! filterRange.get() ) throw std::runtime_error( "Could not create a scripted filter" ); return 1; } catch ( std::exception& e ){ os << e.what() << std::endl; return 0; } }