1 #ifndef ACTIVITIES_H_LOADED
2 #define ACTIVITIES_H_LOADED 1
28 ScheduleFollowingActivity,
30 TrackSiderealActivity,
31 TrackAzimuthActivity, };
55 #define ACTIVITY_STATUS_COMPLETE 1
56 #define ACTIVITY_STATUS_INVALID 1<<1
67 activity_status |= (ACTIVITY_STATUS_COMPLETE | ACTIVITY_STATUS_INVALID);
80 virtual void az_click(ms_t t,
double azimuth);
89 virtual void alt_click(ms_t t,
double altitude);
98 virtual void at_endstop(ms_t t,
int az_click_count,
int alt_click_count) = 0;
101 bool is_complete(
void)
const {
return activity_status & ACTIVITY_STATUS_COMPLETE; }
104 bool is_valid(
void)
const {
return ! (activity_status & ACTIVITY_STATUS_INVALID); }
107 virtual void cancel(
void);
121 virtual ms_t
start(ms_t now) {
return TIME_NEVER; }
131 virtual ms_t
poke(ms_t t) {
return TIME_NEVER; };
133 static void*
operator new (
size_t size);
134 static void operator delete (
void *p);
149 ms_t time_az1, time_az2, time_alt1, time_alt2;
150 signed int cal_count;
152 ph_az_forward, ph_az_backward,
153 ph_alt_upward, ph_alt_downward} phase;
164 void at_endstop(ms_t t,
int az_click_count,
int alt_click_count);
180 virtual ms_t
start(ms_t);
181 virtual void cancel(
void);
182 virtual ms_t
poke(ms_t t);
185 virtual void at_endstop(ms_t t,
int az_click_count,
int alt_click_count);
void at_endstop(ms_t t, int az_click_count, int alt_click_count)
The method called when the system detects a timeout, at the limit of an axis's travel.
Definition: activities.cpp:184
Activity: track a point on the celestial sphere through a sidereal rotation.
Definition: activities.h:204
virtual void az_click(ms_t t, double azimuth)
The method called when the system detects an azimuthal click.
Definition: activities.cpp:64
The State class holds the state of the system while it is slewing or tracking.
Definition: state.h:131
void replace(Activity *)
Replace any activities in the queue.
Definition: activities.cpp:675
State *const state
The state which we are to manipulate.
Definition: activities.h:39
void cancel(void)
Cancel all the activities in the queue.
Definition: activities.cpp:661
Calibrating.
Definition: activities.h:146
TelescopeController *const controller
The controller object provides methods for physically moving the telescope.
Definition: activities.h:45
Calibration(TelescopeController *, State *)
Create a calibration instance.
Definition: activities.cpp:74
static int n_activities(void)
Return the number of currently allocated activities.
Definition: activities.cpp:495
ScheduleFollowing(TelescopeController *, State *, ActivityTypes)
Create an instance of the activity.
Definition: activities.cpp:262
virtual void cancel(void)
Cancel the activity.
Definition: activities.cpp:268
byte activity_status
The internal status of the object: complete / invalid.
Definition: activities.h:54
double clicks_per_sec_az(void)
Return the relationship between applied motor power and angular speed, for the azimuthal motor...
Definition: activities.cpp:247
Activity: Driving the telescope to a given AzAlt location.
Definition: activities.h:191
virtual ms_t poke(ms_t t)
From time to time, the main loop will 'poke' this activity, by calling this function.
Definition: activities.h:131
ms_t start(ms_t)
The activity will be started by the main loop calling the start function.
Definition: activities.cpp:451
virtual void cancel(void)
Cancel the activity.
Definition: activities.cpp:56
ActivityTypes type(void)
Return the type of Activity.
Definition: activities.h:111
virtual void at_endstop(ms_t t, int az_click_count, int alt_click_count)=0
The method called when the system detects a timeout, at the limit of an axis's travel.
virtual ms_t start(ms_t)
The activity will be started by the main loop calling the start function.
Definition: activities.cpp:273
TrackAzimuth(TelescopeController *, State *, double speed)
Create a new activity which tracks across the sky in azimuth.
Definition: activities.cpp:435
void append(Activity *)
Appends the given activity to the end of the queue.
Definition: activities.cpp:685
void mark_as_invalid(void)
Mark the activity as invalid.
Definition: activities.h:66
The Activity abstract class encapsulates the state for extended projects, such as calibrations...
Definition: activities.h:16
ActivityTypes
The activity types here correspond to the this class and its subclasses.
Definition: activities.h:26
ActivityQueue()
Maintain a queue of upcoming activities.
Definition: activities.cpp:621
bool is_complete(void) const
Return true if the activity is complete.
Definition: activities.h:101
Provides the schedule for tracking a point across the celestial sphere, typically at a speed of one s...
Definition: state.h:100
The Position class allows us to represent positions on the celestial sphere (or on Earth...
Definition: position.h:15
void mark_as_complete(void)
Set to true by a derived class when its work is done.
Definition: activities.h:64
Provides the schedule for a slew to a particular point on the celestial sphere.
Definition: state.h:72
virtual ms_t start(ms_t now)
The activity will be started by the main loop calling the start function.
Definition: activities.h:121
A class for controlling the telescope.
Definition: qp.h:11
bool is_valid(void) const
Return true if the activity is valid.
Definition: activities.h:104
static int max_activities(void)
Return the maximum number of activities it's possible to have allocated at one time.
Definition: activities.cpp:485
Activity(TelescopeController *, State *, ActivityTypes)
Construct an activity base-class.
Definition: activities.cpp:45
static void delete_all_allocations(void)
Delete all activity allocations.
Definition: activities.cpp:605
Maintain a queue of Activity instances.
Definition: activities.h:231
ms_t start(ms_t)
The activity will be started by the main loop calling the start function.
Definition: activities.cpp:422
Activity * next()
Return the next activity.
Definition: activities.cpp:645
TrackSidereal(TelescopeController *, State *, Position obs, double speed=0.0)
Create a tracking activity.
Definition: activities.cpp:398
Track across the sky in azimuth.
Definition: activities.h:218
double clicks_per_sec_alt(void)
Return the relationship between applied motor power and angular speed, for the azimuthal motor...
Definition: activities.cpp:257
void alt_click(ms_t t, double)
The method called when the system detects an altitude click.
Definition: activities.cpp:151
ms_t start(ms_t)
The activity will be started by the main loop calling the start function.
Definition: activities.cpp:108
ms_t start(ms_t)
The activity will be started by the main loop calling the start function.
Definition: activities.cpp:369
virtual ms_t poke(ms_t t)
From time to time, the main loop will 'poke' this activity, by calling this function.
Definition: activities.cpp:278
Activity * current() const
Return the current activity.
Definition: activities.cpp:632
void az_click(ms_t t, double)
The method called when the system detects an azimuthal click.
Definition: activities.cpp:117
The base of a couple of classes where the activity consists of following a schedle of rotations...
Definition: activities.h:173
virtual void at_endstop(ms_t t, int az_click_count, int alt_click_count)
The method called when the system detects a timeout, at the limit of an axis's travel.
Definition: activities.cpp:340
virtual void alt_click(ms_t t, double altitude)
The method called when the system detects an altitude click.
Definition: activities.cpp:69
DriveAzAlt(TelescopeController *, State *, double phi, double theta)
Provide the target to drive to.
Definition: activities.cpp:358