FACT++  1.0
template<class T , class S >
int StateMachineDrive< T, S >::CheckState ( )
inlineprivate

Definition at line 2502 of file drivectrl.cc.

References Drive::State::kArmed, Drive::State::kAvailable, Drive::State::kBlocked, State::kDisconnected, Drive::State::kMoving, Drive::State::kOnTrack, Drive::State::kParking, StateMachineImp::kSM_Error, Drive::State::kStopping, Drive::State::kTracking, and Drive::State::kUnavailable.

2503  {
2504  if (!fDrive.IsConnected())
2505  return State::kDisconnected;
2506 
2507  if (!fDrive.IsOnline())
2508  return State::kUnavailable;
2509 
2510  // FIXME: This can prevent parking in case e.g.
2511  // of e8029 Position limit exceeded
2512  if (fDrive.HasError())
2513  {
2514  if (T::GetCurrentState()==State::kOnTrack ||
2515  T::GetCurrentState()==State::kTracking ||
2516  T::GetCurrentState()==State::kMoving ||
2517  T::GetCurrentState()==State::kParking)
2518  return StopMovement();
2519 
2520  if (T::GetCurrentState()==State::kStopping && fDrive.IsMoving())
2521  return State::kStopping;
2522 
2524  }
2525 
2526  // This can happen if one of the drives is not in RF.
2527  // Usually this only happens when the drive is not yet in RF
2528  // or an error was just cleared. Usually there is no way that
2529  // a drive goes below the RF state during operation without
2530  // a warning or error message.
2531  if (fDrive.IsOnline() && fDrive.IsBlocked())
2532  return State::kBlocked;
2533 
2534  if (fDrive.IsOnline() && !fDrive.IsReady())
2535  return State::kAvailable;
2536 
2537  // This is the case as soon as the init commands were send
2538  // after a connection to the SPS was established
2539  if (fDrive.IsOnline() && fDrive.IsReady() && !fDrive.IsInitialized())
2540  return State::kArmed;
2541 
2542  return -1;
2543  }
Error states should be between 0x100 and 0xffff.