Implements StateMachineAsio< T >.
Definition at line 2545 of file drivectrl.cc.
References Encoder::Abs(), Local::az, data, RaDec::dec, Error(), Time::GetNextSunRise(), Drive::State::kArmed, MessageImp::kError, Drive::State::kInitialized, BIAS::State::kLocked, Drive::State::kMoving, Drive::State::kOnTrack, Drive::State::kParking, Drive::State::kPositioningFailed, Drive::State::kStopping, Drive::State::kTracking, Time::Mjd(), PointingData::pointing, RaDec::ra, PointingSetup::start, t, time, StateMachineDrive< T, S >::TrackingLoop(), and Local::zd.
2553 msg <<
"Next sun-rise will be at " <<
fSunRise;
2571 static time_t lastTime = 0;
2572 const time_t tm =
time(NULL);
2573 if (lastTime!=tm &&
fDrive.IsInitialized())
2598 fTrackingLoop.expires_from_now(boost::posix_time::milliseconds(1));
2600 this, ba::placeholders::error));
2607 out <<
"Start tracking at Ra=" << data.
pointing.
ra*12/M_PI <<
"h Dec=" << data.
pointing.
dec*180/M_PI <<
"deg";
2618 const Encoder dist = dest - sepos;
2626 const bool cdzd = cd.
zd>1;
2627 const bool cdaz = cd.
az>1;
2634 T::Info(
"Target position reached in "+to_string(
fStep)+
" steps.");
2640 T::Error(
"Target position not reached in "+to_string(
fStep)+
" steps.");
2652 if (
fDrive.GetVerbosity())
2654 T::Out() <<
"Moving step " <<
fStep << endl;
2655 T::Out() <<
"Encoder [deg] " << sepos.zd*360 <<
" " << sepos.az*360 << endl;
2656 T::Out() <<
"Destination [deg] " << dest.
zd *360 <<
" " << dest.
az *360 << endl;
2657 T::Out() <<
"Residual [deg] " << dist.
zd *360 <<
" " << dist.
az *360 << endl;
2658 T::Out() <<
"Residual/max [1] " << cd.
zd <<
" " << cd.
az << endl;
2659 T::Out() <<
"Rel. time [1] " << t.
zd <<
" " << t.
az << endl;
2660 T::Out() <<
"Rel. velocity [1] " << vel.
zd <<
" " << vel.
az << endl;
2664 fDrive.StartAbsolutePositioning(dest, cdzd, cdaz);
2668 out <<
"Moving to encoder Zd=" << dest.
zd*360 <<
"deg Az=" << dest.
az*360 <<
"deg";
2670 out <<
"Moving residual of dZd=" << dist.
zd*360*60 <<
"' dAz=" << dist.
az*360*60 <<
"'";
double fMaxPointingResidual
void UpdatePointingPosition()
uint64_t fTrackingCounter
ba::deadline_timer fTrackingLoop
PointingSetup fPointingSetup
Adds some functionality to boost::posix_time::ptime for our needs.
Time GetNextSunRise(double horizon) const
PointingData CalcPointingPos(double mjd)
int UpdateTrackingPosition()
Warning because the service this data corrsponds to might have been last updated longer ago than Local time
void TrackingLoop(const boost::system::error_code &error=boost::system::error_code())
Error, something unexpected happened, but can still be handled by the program.
Acceleration fAccTracking