On 21.04.2013 15:40, Luca Olivetti wrote:
Al 21/04/13 14:54, En/na Klaus Schmidinger ha escrit:
I'm currently implementing support for steerable dishes, loosely based
on https://linuxtv.org/patch/12911. In doing so, I'm defining a virtual
base class cPositioner, which defines all the functions necessary to
control the positioner.

Is there a preview of the API to comment on?
At the very least it should have a "GotoSource" method an
"IsPositionedAt" method and something to give visual feedback while the
dish is moving, but then my views may be biased by my own implementation.

Here's the current interface:

class cPositioner {
private:
  int speed; // the rotation speed of the positioner (degrees * 10 per second)
  int lastLongitude;
  int targetLongitude;
  cTimeMs movementStart;
protected:
  int CalcHourAngle(int Longitude);
      ///< Takes the longitude and latitude of the dish location from the system
      ///< setup and the given Longitude to calculate the "hour angle" to which 
to drive
      ///< the dish to in order to point to the satellite at orbital position 
Longitude.
      ///< An hour angle of zero means the dish shall point directly towards the
      ///< celestial equator (which is south on the northern hemisphere, and 
north on
      ///< the southern hemisphere). Negative values mean that the dish needs 
to be
      ///< moved to the left (as seen from behind the dish), while positive 
values
      ///< require a movement to the right.
      ///< See GotoAngle() for the sematics of angles.
public:
  cPositioner(void);
  virtual ~cPositioner();
  virtual void DriveEast(void) {}
          ///< Continuously drive the dish to the east, until Halt() is called 
or it hits the
          ///< soft or hard limit.
  virtual void DriveWest(void) {}
          ///< Continuously drive the dish to the west, until Halt() is called 
or it hits the
          ///< soft or hard limit.
  virtual void StepEast(void) {}
          ///< Move the dish one step to the east.
  virtual void StepWest(void) {}
          ///< Move the dish one step to the west.
  virtual void Halt(void) {}
          ///< Stop any ongoing motion of the dish.
  virtual void SetLimitEast(void) {}
          ///< Set the east soft limit of the dish movement to the current 
position.
  virtual void SetLimitWest(void) {}
          ///< Set the west soft limit of the dish movement to the current 
position.
  virtual void DisableLimits(void) {}
          ///< Disables the soft limits for the dish movement.
  virtual void StorePosition(int Number) {}
          ///< Store the current position as a satellite position with the 
given Number.
          ///< Number can be in the range 1...255. However, a particular 
positioner
          ///< may only have a limited number of satellite positions it can 
store.
  virtual void GotoPosition(int Number, int Longitude);
          ///< Drive the dish to the satellite position stored under the given 
Number.
          ///< Number must be one of the values previously used with 
StorePosition().
          ///< The special value 0 shall drive the dish to a "reference 
position",
          ///< which usually is due south (or north, if you're on the southern 
hemisphere).
          ///< Longitude will be used to calculate how long it takes to drive 
the dish
          ///< from its current position to the given Longitude.
          ///< A derived class must call the base class function to have the 
target
          ///< longitude stored.
  virtual void GotoAngle(int Longitude);
          ///< Drive the dish to the given angular position. Longitude can be 
in the range
          ///< -1800...+1800. A positive sign indicates a position east of 
Greenwich,
          ///< while western positions have a negative sign. The absolute value 
is in
          ///< "degrees * 10", which allows for a resolution of 1/10 of a 
degree.
          ///< A derived class must call the base class function to have the 
target
          ///< longitude stored.
  virtual int CurrentLongitude(void);
          ///< Returns the longitude the dish currently points at. If the dish 
is in motion,
          ///< this may be an estimate based on the angular speed of the 
positioner.
          ///< See GotoAngle() for the sematics of angles.
          ///< The default implementation takes the last and target longitude 
as well as
          ///< the rotation speed of the positioner to calculate the estimated 
current
          ///< longitude the dish points to.
  int TargetLongitude(void) { return targetLongitude; }
          ///< Returns the longitude the dish is supposed to be driven to. Once 
the target
          ///< longitude has been reached, this is the same as the value 
returned by
          ///< CurrentLongitude(). See GotoAngle() for the sematics of angles.
  };


Any visual feedback will be done via the channel display of the skin, by 
comparing
CurrentLongitude() to TargetLongitude(). And of course any section filtering 
will
start only after the target position has been reached.

Klaus

_______________________________________________
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

Reply via email to