My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
gcp::antenna::control::Tracker Class Reference

#include <Tracker.h>

Inheritance diagram for gcp::antenna::control::Tracker:
gcp::antenna::control::SpecificTask gcp::util::GenericTask< TrackerMsg >

Protected Types

enum  NextDriveState {
  IGNORE, HALT, SLEW, WAIT,
  TARGET, SYNC, SLAVE, REBOOT
}
 

Protected Member Functions

 Tracker (AntennaDrive *parent)
 
virtual ~Tracker ()
 
virtual void processMsg (TrackerMsg *msg)
 
void resetMembers ()
 
void reset ()
 
virtual void initialize ()
 
void archiveStatus ()
 
void updatePmac (TimeVal &mjd, AxisPositions *current)
 
void updateMountLimits ()
 
void sourcePosition (gcp::util::TimeVal &mjd)
 
void sourcePosition (gcp::util::TimeVal &mjd, Pointing &thisTargetVal)
 
void sourcePositionTrack (gcp::util::TimeVal &mjd, double utc)
 
void sourcePositionTrack (gcp::util::TimeVal &mjd, double utc, Pointing &thisTargetVal)
 
void sourcePositionCenter (gcp::util::TimeVal &mjd)
 
void sourcePositionCenter (gcp::util::TimeVal &mjd, Pointing &thisTargetVal)
 
virtual void pmacNewPosition (gcp::util::PmacMode::Mode mode, AxisPositions *current, gcp::util::TimeVal &mjd)
 
void finalizePointing (double pmra, double pmdec, PointingCorrections *f, Pointing *p, gcp::util::TimeVal &mjd)
 
void finalizePointing (double pmra, double pmdec, PointingCorrections *f, Pointing *p, gcp::util::TimeVal &mjd, Pointing &thisTargetVal)
 
void finalizePointing (gcp::util::TimeVal &mjd)
 
void finalizePointing (gcp::util::TimeVal &mjd, Pointing &thisTargetVal)
 
void registerRequest (unsigned seq)
 
virtual void addTick (TrackerMsg *msg)
 
virtual void addTickOvro (TrackerMsg *msg)
 
void calCollimation (TrackerMsg *msg)
 
void calEncoders (TrackerMsg *msg)
 
void calFlexure (TrackerMsg *msg)
 
void calTilts (TrackerMsg *msg)
 
void changeYear (TrackerMsg *msg)
 
void extendEqnEqx (TrackerMsg *msg)
 
void extendTrack (TrackerMsg *msg)
 
void extendScan (TrackerMsg *msg)
 
void extendUt1Utc (TrackerMsg *msg)
 
void haltTelescope (TrackerMsg *msg=0)
 
void locateSite (TrackerMsg *msg)
 
void locateAntenna (TrackerMsg *msg)
 
void rebootDrive (TrackerMsg *msg)
 
void recordEncoderLimits (TrackerMsg *msg)
 
void selectModel (TrackerMsg *msg)
 
void setEncoderZero (TrackerMsg *msg)
 
void setOffset (TrackerMsg *msg)
 
void setSlewRate (TrackerMsg *msg)
 
void slewTelescope (TrackerMsg *msg)
 
void updateRefraction (TrackerMsg *msg)
 
void updateRefraction ()
 
virtual void connectPmac ()
 
virtual void disconnectPmac ()
 
bool okToPoint ()
 
void setNextState (NextDriveState state)
 
void strobeServo (TrackerMsg *msg)
 
bool acknowledgeCompletion ()
 
void executeServoCmd (TrackerMsg *msg)
 
- Protected Member Functions inherited from gcp::util::GenericTask< TrackerMsg >
 GenericTask ()
 
 GenericTask (Thread *thread)
 
virtual ~GenericTask ()
 
void sendTaskMsg (TrackerMsg *msg)
 
void startThreads (void *arg)
 
void startThread (void *arg, unsigned order)
 
unsigned getMinStartOrder ()
 
bool threadsNeedStarting ()
 
void cancelThreads ()
 
void cancelThread (unsigned order)
 
unsigned getMinCancelOrder ()
 
bool threadsNeedCancelling ()
 
void pingThreads (void *arg)
 
void raise (std::string name, int sigNo)
 
ThreadgetThread (std::string name)
 
bool threadsAreRunning ()
 
void shutdownConnection (int fd)
 
virtual void serviceMsgQ (void)
 
virtual void restart (void)
 
virtual void run (void)
 
virtual void processTaskMsg (bool *stop)
 
virtual void processMsg (TrackerMsg *msg)
 
virtual void respondToHeartBeat ()
 
virtual void installTimer (TrackerMsg *msg)
 
virtual void installSignal (TrackerMsg *msg)
 
virtual void enableTimer (TrackerMsg *msg)
 
virtual void addHandler (TrackerMsg *msg)
 
void stepCommands ()
 

Protected Attributes

bool simPmac_
 
bool simGps_
 
AntennaDriveparent_
 
bool shutdownPending_
 
int year_
 
NextDriveState whatNext_
 
unsigned archived_
 
unsigned lacking_
 
bool encoderCalPending_
 
volatile long lastReq_
 
volatile long lastAck_
 
gcp::util::TrackingStatus::Status oldStatus_
 
gcp::util::TrackingStatus::Status newStatus_
 
bool paramsUpdated_
 
int pmacTracking_
 
Atmosphere atmos_
 
Model model_
 
ServoCommsSaservo_
 
Pointing nextTarget_
 
Pointing nextTarget1_
 
Pointing nextTarget2_
 
Position lastCommanded_
 
Position prevCommanded_
 
Position tertCommanded_
 
Site site_
 
gcp::util::Atmosphere refracCalculator_
 
gcp::util::Source src_
 
Scan scan_
 
gcp::util::TimeVal currentTick_
 
gcp::util::TimeVal lastTick_
 
TrackerBoardtracker_
 
TrackerOffset offset_
 
- Protected Attributes inherited from gcp::util::GenericTask< TrackerMsg >
Threadthread_
 
std::vector< Thread * > threads_
 
PipeQ< TrackerMsg > msgq_
 
gcp::util::FdSet fdSet_
 
std::vector< Command * > commands_
 
struct timeval * timeOut_
 
TimeVal commandTimeOut_
 

Friends

class AntennaDrive
 

Additional Inherited Members

- Public Member Functions inherited from gcp::antenna::control::SpecificTask
 SpecificTask ()
 
virtual ~SpecificTask ()
 
SpecificSharegetShare ()
 
- Public Member Functions inherited from gcp::util::GenericTask< TrackerMsg >
void sendRestartMsg ()
 
void sendStopMsg ()
 
void sendHeartBeatMsg ()
 
virtual void fwdTaskMsg (TrackerMsg *msg)
 
- Public Attributes inherited from gcp::antenna::control::SpecificTask
SpecificShareshare_
 

Detailed Description

Define a class that will handle pointing and tracking for this antenna.

Member Enumeration Documentation

The following identifiers define stages in the state machine that controls the drive.

Constructor & Destructor Documentation

Tracker::Tracker ( AntennaDrive parent)
protected

Constructor function requires the shared resource object which will maintain pertinent registers of this antenna's state.

Exceptions
Exception....................................................................... Allocate all of the resources needed by the tracker task. Note that no further resource allocation or re-allocation should be peformed while the task is running. This means that the instrument can be left unattended after start-up without the fear of resource depletion causing unexpected failures.

Input:

parent AntennaDrive * Resources of the parent object.

Tracker::~Tracker ( )
protectedvirtual

Destructor.

....................................................................... Delete the resources of a tracker-task.

Member Function Documentation

void Tracker::addTick ( TrackerMsg msg)
protectedvirtual

Respond to a tick from the time-code reader ISR by recording the new clock offset. If a resynchronization of the clock has been requested, also check the time against the time-code reader and correct it if necessary.

Parameters
msgTrackerMsg* The message received on the AntennaDrive message queue.

....................................................................... Respond to a 1-second tick from the time-code reader ISR by recording the new clock offset. If a resynchronization of the clock has been requested, also check the time against the time-code reader and correct it if necessary.

Modification for South African Telescope – need to calculate three positions to send to the telescope

Input:

msg TrackerMsg* The message received on the Tracker message queue.

void Tracker::addTickOvro ( TrackerMsg msg)
protectedvirtual

OLD ADDTICK....................................................................... Respond to a 1-second tick from the time-code reader ISR by recording the new clock offset. If a resynchronization of the clock has been requested, also check the time against the time-code reader and correct it if necessary.

Input:

msg TrackerMsg* The message received on the Tracker message queue.

void Tracker::archiveStatus ( )
protected

Record the current tracking status (newStatus_) in the archive database and in oldStatus_.

....................................................................... Record the current tracking status (trk->new_status) in the archive database and in trk->old_status.

void Tracker::calCollimation ( TrackerMsg msg)
protected

Calibrate the collimation of the telescope.

....................................................................... Calibrate the collimation of the telescope.

void Tracker::calEncoders ( TrackerMsg msg)
protected

Record new encoder offsets and multipliers.

....................................................................... Record new encoder offsets and multipliers.

Input: msg TrackerMsg* The message received on the Tracker message queue.

void Tracker::calFlexure ( TrackerMsg msg)
protected

Calibrate the gravitational flexure of the telescope.

....................................................................... Calibrate the gravitational flexure of the telescope.

void Tracker::calTilts ( TrackerMsg msg)
protected

Calibrate the axis tilts of the telescope.

....................................................................... Calibrate the axis tilts of the telescope.

void Tracker::changeYear ( TrackerMsg msg)
protected

Update the year. Note that the time code reader doesn't supply the year, so the year has to be provided by the control program.

Parameters
msgTrackerMsg* The message received on the AntennaDrive message queue.

....................................................................... Update the year. Note that the time code reader doesn't supply the year, so the year has to be provided by the control program.

Input:

msg TrackerMsg* The message received on the Tracker message queue.

void Tracker::connectPmac ( )
protectedvirtual

Attempt to connect to the pmac.

....................................................................... Attempt to connect to the pmac.

void Tracker::disconnectPmac ( )
protectedvirtual

A function called when an error occurs talking to the pmac.

....................................................................... This function will be called if an error occurs talking to the pmac.

void Tracker::executeServoCmd ( TrackerMsg msg)
protected

............................................................ Execute a Servo specific command

void Tracker::extendEqnEqx ( TrackerMsg msg)
protected

Update the equation-of-the-equinoxes interpolator.

Parameters
msgTrackerMsg* The message received on the AntennaDrive message queue.
Exceptions
Exception....................................................................... Update the equation-of-the-equinoxes interpolator.
void Tracker::extendScan ( TrackerMsg msg)
protected

Extend the ephemeris of the current scan

....................................................................... Extend the ephemeris of the current scan

Input: msg TrackerMsg* The message received on the Tracker message queue.

Initialize the scan cache fixed members if this is the start of a new scan.

Let the pointing routines know that the current scan is active.

void Tracker::extendTrack ( TrackerMsg msg)
protected

Extend the ephemeris of the current source.

Parameters
msgTrackerMsg* The message received on the AntennaDrive message queue.

....................................................................... Extend the ephemeris of the current source.

Input: msg TrackerMsg* The message received on the Tracker message queue.

void Tracker::extendUt1Utc ( TrackerMsg msg)
protected

Update the UT1-UTC interpolator.

Parameters
msgTrackerMsg* The message received on the AntennaDrive message queue.
Exceptions
Exception....................................................................... Update the UT1-UTC interpolator.

Input: msg TrackerMsg* The message received on the Tracker message queue.

void Tracker::finalizePointing ( double  pmra,
double  pmdec,
PointingCorrections f,
Pointing p,
gcp::util::TimeVal mjd 
)
protected

Prototype the functions that implement the various stages of pointing calculations

....................................................................... Compute the final az,el,pa and associated drive rates.

Input:

pmra double The proper motion in Right Ascension (radians/sec). pmdec double The proper motion in Declination (radians/sec). f PointingCorrections * The corrected az,el and latitude.

void Tracker::finalizePointing ( gcp::util::TimeVal mjd)
protected

....................................................................... Compute the final az,el,pa and associated drive rates.

Input:

pmra double The proper motion in Right Ascension (radians/sec). pmdec double The proper motion in Declination (radians/sec). f PointingCorrections * The corrected az,el and latitude.

void Tracker::haltTelescope ( TrackerMsg msg = 0)
protected

Arrange to halt the telescope. If the pmac new_position flag is set this will be done immediately, otherwise it will be postponed to the next 1-second tick.

Parameters
msgTrackerMsg * If the halt command was received from the control program then this must contain a transaction sequence number. Otherwise send NULL.

....................................................................... Arrange to halt the telescope. If the pmac new_position flag is set this will be done immediately, otherwise it will be postponed to the next 1-second tick.

Input: msg TrackerMsg * If the halt command was received from the control program then this must contain a transaction sequence number. Otherwise send NULL.

void Tracker::initialize ( )
protectedvirtual

Reset non-pointer members of the Tracker object

Exceptions
Exception....................................................................... Reset non-pointer members of the Tracker object
void Tracker::locateAntenna ( TrackerMsg msg)
protected

Update the antenna-specific offset

Parameters
msgTrackerMsg* The message received on the AntennaDrive message queue.

....................................................................... Update the local and system-wide site-location parameters.

Input:

msg TrackerMsg* The message received on the Tracker message queue.

void Tracker::locateSite ( TrackerMsg msg)
protected

Update the local and system-wide site-location parameters.

Parameters
msgTrackerMsg* The message received on the AntennaDrive message queue.

....................................................................... Update the local and system-wide site-location parameters.

Input:

msg TrackerMsg* The message received on the Tracker message queue.

bool Tracker::okToPoint ( )
protected

Return true if we have enough information to roughly point the telescope.

....................................................................... Return true if we have enough information to roughly point the telescope.

void Tracker::pmacNewPosition ( gcp::util::PmacMode::Mode  mode,
AxisPositions current,
gcp::util::TimeVal mjd 
)
protectedvirtual
Parameters
currentAxisPositions * The current position of the telescope, as readPosition().
Exceptions
Exception....................................................................... Write a given drive command into the drive dual-port-ram. Before invoking this function, the caller must call DriveBoard::isBusy() to see whether the drive is ready for a new command.

Input:

mode PmacMode The command-type to send. current AxisPositions * The current position of the telescope, as

void Tracker::processMsg ( TrackerMsg msg)
protectedvirtual

Public method to initate a response to a message received on the AntennaDrive message queue

Exceptions
Exception....................................................................... Process a message received on the Tracker message queue

Input:

msg TrackerMsg* The message received on the Tracker message queue.

void Tracker::rebootDrive ( TrackerMsg msg)
protected

Arrange to reboot the pmac. If the pmac new_position flag is set this will be done immediately, otherwise it will be postponed to the next 1-second tick.

Parameters
msgTrackerMsg * If the halt command was received from the control program then this must contain a transaction sequence number. Otherwise send NULL.

....................................................................... Arrange to reboot the drive.

Input: msg TrackerMsg * If the halt command was received from the control program then this must contain a transaction sequence number. Otherwise send NULL.

void Tracker::recordEncoderLimits ( TrackerMsg msg)
protected

Record new encoder limits.

Parameters
msgTrackerMsg* The message received on the AntennaDrive message queue.

....................................................................... Record new encoder limits.

Input:

msg TrackerMsg* The message received on the Tracker message queue.

void Tracker::registerRequest ( unsigned  seq)
protected

Register the receipt of a control-program command that needs to be acknowledged when has taken effect. Also mark the tracking parameters as modified.

Input: seq unsigned The sequence number assigned to the command by the control program.

....................................................................... Register the receipt of a control-program command that needs to be acknowledged when has taken effect. Also mark the tracking parameters as modified.

Input: seq unsigned The sequence number assigned to the command by the control program.

void Tracker::reset ( )
protected

This function is called by new_Tracker() and ini_Tracker() to clear legacy pointing model terms before the thread is next run. It assumes that all pointers either point at something valid or have been set to NULL.

....................................................................... This function is called by new_Tracker() and ini_Tracker() to clear legacy pointing model terms before the thread is next run. It assumes that all pointers either point at something valid or have been set to NULL.

void Tracker::resetMembers ( )
protected

....................................................................... Reset non-pointer members of the Tracker object

void Tracker::selectModel ( TrackerMsg msg)
protected

Select between the optical and radio pointing models.

....................................................................... Select between the optical and radio pointing models.

void Tracker::setEncoderZero ( TrackerMsg msg)
protected

Install new encoder offsets.

Parameters
msgTrackerMsg* The message received on the AntennaDrive message queue.

....................................................................... Install new encoder offsets.

Input: msg TrackerMsg* The message received on the Tracker message queue.

void Tracker::setOffset ( TrackerMsg msg)
protected

Adjust the tracking offsets of specified drive axes, and round them into the range -pi..pi.

Parameters
msgTrackerMsg* The message received on the AntennaDrive message queue.

....................................................................... Adjust the tracking offsets of specified drive axes, and round them into the range -pi..pi.

Input: msg TrackerMsg* The message received on the Tracker message queue.

void Tracker::setSlewRate ( TrackerMsg msg)
protected

Install new slew rates.

Parameters
msgTrackerMsg* The message received on the AntennaDrive message queue.

....................................................................... Install new slew rates.

Input: msg TrackerMsg* The message received on the Tracker message queue.

void Tracker::slewTelescope ( TrackerMsg msg)
protected

Arrange to slew the telescope to a given az,el,dk coordinate.

Parameters
msgTrackerMsg* The message received on the AntennaDrive message queue.

....................................................................... Arrange to slew the telescope to a given az,el,dk coordinate.

Input: msg TrackerMsg* The message received on the Tracker message queue.

void Tracker::sourcePosition ( gcp::util::TimeVal mjd)
protected

Compute the encoder positions and rates needed to track a given source at a given utc.

Parameters
mjdint The day component of the MJD utc at which coordinates are required.
secint The MJD utc time of day, in seconds.

....................................................................... Compute the encoder positions and rates needed to track a given source at a given utc.

Input: mjd int The day component of the MJD utc at which coordinates are required. sec int The MJD utc time of day, in seconds.

void Tracker::sourcePosition ( gcp::util::TimeVal mjd,
Pointing thisTargetVal 
)
protected

....................................................................... Compute the encoder positions and rates needed to track a given source at a given utc.

Input: mjd int The day component of the MJD utc at which coordinates are required. target to modify sec int The MJD utc time of day, in seconds.

void Tracker::updateMountLimits ( )
protected

Update the mount-angle limits that correspond to revised values of model.{az,el,dk}.{per_turn,per_radian,zero,min,max}, and mark them as unarchived.

....................................................................... Update the mount-angle limits that correspond to revised values of model.{az,el,dk}.{per_turn,per_radian,zero,min,max}, and mark them as unarchived.

void Tracker::updatePmac ( TimeVal mjd,
AxisPositions current 
)
protected

....................................................................... This is a private function of Tracker::addTick() used to update the pmac on each one second tick when PmacBoard::isBusy() returns false.

Input:

mjd TimeVal& The Julian Date (utc). current AxisPositions* The current position of the telescope.

void Tracker::updateRefraction ( TrackerMsg msg)
protected

Record new refraction coefficients received from the weather station task.

Parameters
msgTrackerMsg* The message received on the AntennaDrive message queue.

....................................................................... Record new refraction coefficients received from the weather station task.

Input:

msg TrackerMsg* The message received on the Tracker message queue.

void Tracker::updateRefraction ( )
protected

....................................................................... Update the refraction

Member Data Documentation

gcp::util::TimeVal gcp::antenna::control::Tracker::currentTick_
protected

The time of the last time-code-reader interrupt

TrackerOffset gcp::antenna::control::Tracker::offset_
protected

The current mount tracking offsets

AntennaDrive* gcp::antenna::control::Tracker::parent_
protected

Pointer to the resources of the parent task.

bool gcp::antenna::control::Tracker::shutdownPending_
protected

True when a shutdown request has been received.

TrackerBoard* gcp::antenna::control::Tracker::tracker_
protected

A virtual board of tracker registers


The documentation for this class was generated from the following files: