RageFileBasic *ThreadedFileWorker::Copy( RageFileBasic *&pFile, CString &sError ) { ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ /* If we're currently in a timed-out state, fail. */ if( IsTimedOut() ) { this->Close( pFile ); pFile = NULL; } if( pFile == NULL ) { sError = "Operation timed out"; return NULL; } m_pRequestFile = pFile; if( !DoRequest(REQ_COPY) ) { /* If we time out, we can no longer access pFile. */ sError = "Operation timed out"; pFile = NULL; return NULL; } RageFileBasic *pRet = m_pResultFile; m_pRequestFile = NULL; m_pResultFile = NULL; return pRet; }
bool SetShooterAngle::IsFinished() { if(IsTimedOut()) return true; else return Robot::shooterrotation->OnTarget(); }
bool AngelChange::IsFinished() { #if ASYNC_BRAKE return brakeEngagedTime> 0 && brakeEngagedTime + 100 < getCurrentMillis(); #else return stability>13 || IsTimedOut(); #endif }
void AngelChange::Execute() { pterodactyl->setOutputRange(); // Let the PID run. if (pterodactyl->isPIDFinished(true) || (target <= 0 && pterodactyl->getAngle() <= 0.25)) { stability++; } else { stability = 0; } if (tmpTarget == 45 && target < 45 && shooter->isReallyDrawnBack()) { tmpTarget = target; pterodactyl->setTarget(tmpTarget+(tmpTarget>0 ? 0.5 : 0)); } #if ASYNC_BRAKE if ((stability> 13 && (tmpTarget != 45)) || IsTimedOut()) { if (brakeEngagedTime <= 0) { brakeEngagedTime = getCurrentMillis(); } if (target> 0) { pterodactyl->setBrakeState(Pterodactyl::kActive); } } #endif }
bool ExecHolder::CheckTimeout() { if(IsTimedOut()){ timing=false; return true; } return false; }
bool Shoot::IsFinished() { if(IsTimedOut()) return true; else return solenoid->Get() == (push ? DoubleSolenoid::kForward : DoubleSolenoid::kReverse); }
bool FindPosition::IsFinished() { double range = beaglebone->goalRange; return IsTimedOut() || range == 99.0 || (range > MIN_FIRE_RANGE && range < MAX_FIRE_RANGE); }
bool ThreadedFileWorker::FlushDirCache( const CString &sPath ) { /* FlushDirCache() is often called globally, on all drivers, which means it's called with * no timeout. Temporarily enable a timeout if needed. */ bool bTimeoutEnabled = TimeoutEnabled(); if( !bTimeoutEnabled ) SetTimeout(1); if( m_pChildDriver == NULL ) return false; /* If we're currently in a timed-out state, fail. */ if( IsTimedOut() ) return false; m_sRequestPath = sPath; /* Kick off the worker thread, and wait for it to finish. */ if( !DoRequest(REQ_FLUSH_DIR_CACHE) ) { if( !bTimeoutEnabled ) SetTimeout(-1); LOG->Trace( "FlushDirCache(%s) timed out", sPath.c_str() ); return false; } if( !bTimeoutEnabled ) SetTimeout(-1); return true; }
int ThreadedFileWorker::GetFileSize( RageFileBasic *&pFile ) { ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ /* If we're currently in a timed-out state, fail. */ if( IsTimedOut() ) { this->Close( pFile ); pFile = NULL; } if( pFile == NULL ) return -1; m_pRequestFile = pFile; if( !DoRequest(REQ_GET_FILE_SIZE) ) { /* If we time out, we can no longer access pFile. */ pFile = NULL; return -1; } m_pRequestFile = NULL; return m_iResultRequest; }
int ThreadedFileWorker::Flush( RageFileBasic *&pFile, CString &sError ) { ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ /* If we're currently in a timed-out state, fail. */ if( IsTimedOut() ) { this->Close( pFile ); pFile = NULL; } if( pFile == NULL ) { sError = "Operation timed out"; return -1; } m_pRequestFile = pFile; if( !DoRequest(REQ_FLUSH) ) { /* If we time out, we can no longer access pFile. */ sError = "Operation timed out"; pFile = NULL; return -1; } if( m_iResultRequest == -1 ) sError = m_sResultError; m_pRequestFile = NULL; return m_iResultRequest; }
bool CollectPreset::IsFinished() { if(!IsTimedOut()) { return false; } //If the arm gets within 0.2 volts of the target call it done return abs(Ford::mainArm->GetSetpoint()-Ford::mainArm->GetPosition()) < 0.2; }
RageFileBasic *ThreadedFileWorker::Open( const CString &sPath, int iMode, int &iErr ) { if( m_pChildDriver == NULL ) { iErr = ENODEV; return NULL; } /* If we're currently in a timed-out state, fail. */ if( IsTimedOut() ) { iErr = EFAULT; /* Win32 has no ETIMEDOUT */ return NULL; } m_sRequestPath = sPath; m_iRequestMode = iMode; if( !DoRequest(REQ_OPEN) ) { LOG->Trace( "Open(%s) timed out", sPath.c_str() ); iErr = EFAULT; /* Win32 has no ETIMEDOUT */ return NULL; } iErr = m_iResultRequest; RageFileBasic *pRet = m_pResultFile; m_pResultFile = NULL; return pRet; }
bool SetShooter::IsFinished() { if(IsTimedOut()) return true; else return false; }
bool Turn::IsFinished() { if(IsTimedOut()){ std::cout << "Turn Error: Timeout expired"<<std::endl; return true; } return pid.OnTarget(); }
bool CompressorEnabled::IsFinished() { if(IsTimedOut()) { return true; } else { return false; } }
bool ActuateCanStabilizer::IsFinished() { if (timeout == -1) { return true; } else { return IsTimedOut(); } }
// Make this return true when this Command no longer needs to run execute() bool AutonomousDriveCommand::IsFinished() { bool isInRange = ( useRangeFinder ? Robot::robotRangeFinder->IdealAutonomousRange() : false); bool isTimeout = IsTimedOut(); printf("isInRange = %s, isTimeout = %s, range: %d, matchTime: %f\n", isInRange ? "true" : "false", isTimeout ? "true" : "false", Robot::robotRangeFinder->GetDistance(), Timer::GetFPGATimestamp()); return isInRange || isTimeout; //return isTimeout; use if robot has no rangefinder }
// Make this return true when this Command no longer needs to run execute() bool ExtendSFM::IsFinished() { if(IsTimedOut()){ //time out return true; }else{ return false; } }
bool DriveStraight::IsFinished() { if(IsTimedOut()){ std::cout << "DriveStraight Error: Timeout expired"<<std::endl; return true; } at_heading=Acntrl.AtTarget(); at_position=Dcntrl.AtTarget(); return(at_position && at_heading); }
bool TensionToGivenValueCommand::IsFinished() { if (IsTimedOut()) return true; float deltaTension = fabs(currentTension - tensionValue); if(deltaTension < 2 && deltaTension > -2) return true; return false; }
bool DriveUntilRange::IsFinished() { if (IsTimedOut()){ return true; } if (direction > 0){ return rangefinder->rangefinder_bottom->GetRangeInches() < range; } return rangefinder->rangefinder_bottom->GetRangeInches() > range; }
bool Turn::IsFinished() { if(drive_ == nullptr) return true; if(type_ == FOREVER) return false; return IsTimedOut() || (fabs(drive_->GetLeftRevs()) > fabs(length_)); }
// Make this return true when this Command no longer needs to run execute() bool TimedDriveStraight::IsFinished() { if (m_timeout > 0.0) { return IsTimedOut(); } else { return false; } }
// Make this return true when this Command no longer needs to run execute() bool shootShoot::IsFinished() { // Encoder shot if (IsTimedOut()) { return true; } else { return Robot::shooter->CompareValues(); } // Throttle shot //return true; }
// Make this return true when this Command no longer needs to run execute() bool AutonomousMove::IsFinished() { printf("AutonomousMove:m_distance=%f encoder=%f\n", m_distance, RobotMap::driveTrainDriveencoder->GetDistance()); if (isDistanceMove && m_distance > 0){ printf("Distance move is true, IsFinished was encountered\n"); return (RobotMap::driveTrainDriveencoder->GetDistance() >= m_distance); } else if (isDistanceMove && m_distance < 0){ return (RobotMap::driveTrainDriveencoder->GetDistance() <= m_distance); } else return IsTimedOut(); }
// Make this return true when this Command no longer needs to run execute() bool ShootLowGoal::IsFinished() { if(IsTimedOut()){ //time out return true; } if(CommandBase::pBIOS->GetCurrentTime() >= 2.0){ return true; }else{ return false; } }
// Make this return true when this Command no longer needs to run execute() bool Intake::IsFinished() { if(IsTimedOut()){ //time out return true; } if(CommandBase::pBIOS->IsSwitchSet()){ return false; }else{ return true; } }
bool MoveToAndDropBridgeCmd::IsFinished() { if ( (_isFinished == true) && (IsTimedOut() == true)) { SmartDashboard::GetInstance()->PutString("Status", "MoveToAndDropBridgeCmd::Finished"); return false; } else { return false; } }
bool FireLauncher::IsFinished() { double newReading = LauncherPotentiometer().Get(); if(lastPotReading == newReading) { return true; } else { lastPotReading = newReading; return IsTimedOut(); } }
// Make this return true when this Command no longer needs to run execute() bool TurnToTarget::IsFinished() { if(fabs(pixels_off) <= ACCEPTED_ERROR) { return true; } else if(IsTimedOut()) { log->write(Log::WARNING_LEVEL, "TurnToTarget timed out (Time: %f Pixels Off: %f)", TIMEOUT, pixels_off); return true; } return false; }