FACT++  1.0
template<class T , class S >
int StateMachineDrive< T, S >::StartWobble ( const double &  srcra,
const double &  srcdec,
const double &  woboff,
const double &  wobang,
const string  name = "" 
)
inlineprivate

Definition at line 929 of file cosyctrl.cc.

References Error(), and Dim::SendCommand().

932  {
933  const double ra = srcra *M_PI/12;
934  const double dec = srcdec*M_PI/180;
935  const double off = woboff*M_PI/180;
936  const double dir = wobang*M_PI/180;
937 
938  const double cosdir = cos(dir);
939  const double sindir = sin(dir);
940  const double cosoff = cos(off);
941  const double sinoff = sin(off);
942  const double cosdec = cos(dec);
943  const double sindec = sin(dec);
944 
945  if (off==0)
946  {
947  const array<double, 6> dim = {{ srcra, srcdec, srcra, srcdec, 0, 0 }};
948  fDrive.UpdateSource(dim, name);
949 
950  string command = "RADEC ";
951  command += AngleToStr(srcra) + ' ' + AngleToStr(srcdec);
952  return SendCommand(command);
953  }
954 
955  const double sintheta = sindec*cosoff + cosdec*sinoff*cosdir;
956  if (sintheta >= 1)
957  {
958  T::Error("cos(Zd) > 1");
959  return T::GetCurrentState();
960  }
961 
962  const double costheta = sqrt(1 - sintheta*sintheta);
963 
964  const double cosdeltara = (cosoff - sindec*sintheta)/(cosdec*costheta);
965  const double sindeltara = sindir*sinoff/costheta;
966 
967  const double ndec = asin(sintheta)*180/M_PI;
968  const double nra = (atan2(sindeltara, cosdeltara) + ra)*12/M_PI;
969 
970  const array<double, 6> dim = {{ srcra, srcdec, nra, ndec, woboff, wobang }};
971  fDrive.UpdateSource(dim, name);
972 
973  string command = "RADEC ";
974  command += AngleToStr(nra) + ' ' + AngleToStr(ndec);
975  return SendCommand(command);
976  }
string AngleToStr(double angle)
Definition: cosyctrl.cc:822
int SendCommand(const string &str)
Definition: cosyctrl.cc:843
Error()
Definition: HeadersFTM.h:197

+ Here is the call graph for this function: