K-FSW v1.2.1-59-gcaca356
KFSW: modular flight software on Zephyr, for small satellites
Loading...
Searching...
No Matches
Pass tracking

API Areas

 Which spacecraft the rules are for
 

Data Structures

struct  kfsw_gpredict_bearing
 
struct  kfsw_gpredict_status
 

Enumerations

enum  kfsw_gpredict_state {
  KFSW_GPREDICT_PARKED = 0 , KFSW_GPREDICT_TRACKING = 1 , KFSW_GPREDICT_HOLDING = 2 , KFSW_GPREDICT_PARKING = 3 ,
  KFSW_GPREDICT_FAULT = 4
}
 
enum  kfsw_gpredict_event {
  KFSW_GPREDICT_EVENT_BEARING = 0 , KFSW_GPREDICT_EVENT_SILENCE = 1 , KFSW_GPREDICT_EVENT_PARKED = 2 , KFSW_GPREDICT_EVENT_PARK_COMMANDED = 3 ,
  KFSW_GPREDICT_EVENT_FAULT = 4 , KFSW_GPREDICT_EVENT_CLEARED = 5
}
 

Functions

enum kfsw_gpredict_state kfsw_gpredict_next (enum kfsw_gpredict_state state, enum kfsw_gpredict_event event)
 
const char * kfsw_gpredict_state_name (enum kfsw_gpredict_state state)
 
int kfsw_gpredict_init (void)
 
int kfsw_gpredict_bearing (const struct kfsw_gpredict_bearing *bearing)
 
int kfsw_gpredict_frequency (uint64_t frequency_hz)
 
int kfsw_gpredict_park (void)
 
int kfsw_gpredict_clear (void)
 
int kfsw_gpredict_get_status (struct kfsw_gpredict_status *status)
 

Variables

const struct kfsw_param_definition_set kfsw_gpredict_param_definitions
 

Description

Following a spacecraft across a pass, driven by a predictor on the ground.

Gpredict computes the pass and speaks the hamlib protocols: it sends a bearing to a rotator daemon and a corrected frequency to a radio daemon. This module is the other end of those two conversations, so prediction stays where it already works and this node only has to point and tune.

Every question worth getting right here is about what happens when the conversation stops. A rotator left at the last bearing it was given points at nothing; one that returns to its park position in the middle of a pass is worse, because the pass is lost and nobody is told. So the decision is a state machine with a grace period: a gap shorter than the grace is a gap in the predictor, and the antenna holds; a gap longer than it is the end of the pass, and the antenna parks.

Enumeration Documentation

◆ kfsw_gpredict_event

#include <gpredict.h>

What happened.

The state machine is driven only by these.

Enumerator
KFSW_GPREDICT_EVENT_BEARING 

A bearing arrived from the predictor.

KFSW_GPREDICT_EVENT_SILENCE 

The grace period expired with no bearing.

KFSW_GPREDICT_EVENT_PARKED 

The rotator reported it reached the park position.

KFSW_GPREDICT_EVENT_PARK_COMMANDED 

An operator asked for the park position now.

KFSW_GPREDICT_EVENT_FAULT 

The rotator or the link to it failed.

KFSW_GPREDICT_EVENT_CLEARED 

An operator cleared a fault.

◆ kfsw_gpredict_state

#include <gpredict.h>

Where the tracker is.

Enumerator
KFSW_GPREDICT_PARKED 

Nothing has ever been tracked, or the last pass finished and parked.

KFSW_GPREDICT_TRACKING 

Bearings are arriving and the antenna is following them.

KFSW_GPREDICT_HOLDING 

Bearings stopped arriving but not for long enough to call the pass over.

The antenna holds its last bearing, because a predictor that stalls for a second is not a pass that ended.

KFSW_GPREDICT_PARKING 

On the way to the park position, after the pass or on command.

It is left when the rotator reports it arrived, so until a rotator driver exists this state is where a build without one stays.

KFSW_GPREDICT_FAULT 

The rotator reported a problem, or a bearing was refused.

Tracking does not resume on its own: an operator has to clear it, because a fault that clears itself hides a rotator that is failing.

Function Documentation

◆ kfsw_gpredict_bearing()

int kfsw_gpredict_bearing ( const struct kfsw_gpredict_bearing *  bearing)

#include <gpredict.h>

Offer a bearing from the predictor.

Return values
0Accepted; the antenna is tracking.
-EINVALA NULL, or a bearing outside the rotator's range.
-EPERMThe tracker is in fault and has not been cleared.

◆ kfsw_gpredict_clear()

int kfsw_gpredict_clear ( void  )

#include <gpredict.h>

Clear a fault and park.

Returns -EALREADY when there is nothing to clear.

◆ kfsw_gpredict_frequency()

int kfsw_gpredict_frequency ( uint64_t  frequency_hz)

#include <gpredict.h>

Offer a Doppler-corrected frequency.

Zero is refused with -EINVAL.

◆ kfsw_gpredict_get_status()

int kfsw_gpredict_get_status ( struct kfsw_gpredict_status *  status)

#include <gpredict.h>

Read the tracker.

Returns -EINVAL for a NULL destination.

◆ kfsw_gpredict_init()

int kfsw_gpredict_init ( void  )

#include <gpredict.h>

Start the tracker parked, with the compiled grace period.

◆ kfsw_gpredict_next()

enum kfsw_gpredict_state kfsw_gpredict_next ( enum kfsw_gpredict_state  state,
enum kfsw_gpredict_event  event 
)

#include <gpredict.h>

Decide the next state.

Pure: the same state and event always give the same answer, which is what makes the end of a pass testable without a rotator.

Parameters
stateWhere the tracker is.
eventWhat happened.
Returns
The state to move to, which may be state.

◆ kfsw_gpredict_park()

int kfsw_gpredict_park ( void  )

#include <gpredict.h>

Ask for the park position now, whatever the pass is doing.

Return values
0On the way to the park position.
-EPERMThe tracker is in fault. The rotator cannot be trusted to move, so an operator clears the fault first.

◆ kfsw_gpredict_state_name()

const char * kfsw_gpredict_state_name ( enum kfsw_gpredict_state  state)

#include <gpredict.h>

Human-readable name of a state, for the shell and for a log line.

Variable Documentation

◆ kfsw_gpredict_param_definitions

const struct kfsw_param_definition_set kfsw_gpredict_param_definitions
extern

#include <gpredict.h>

Parameter table of the pass tracker.