cPTU_Control Class Reference
[Base_ptucontrol]

Driver for Directed Perception Pan and Tilt units (PTU), model PTUD46. More...

#include <ptu_control.h>

Inheritance diagram for cPTU_Control:
Inheritance graph
[legend]
Collaboration diagram for cPTU_Control:
Collaboration graph
[legend]

Public Member Functions

 cPTU_Control ()
 Class constructor. Opens device and sets communication parameters.
 ~cPTU_Control ()
 Class destructor. Closes device.
char Reset_Parser (long time)
int OpenSerialPort (char *sn)
 Class methods used to configure the serial port.
int OpenSerialPort (char *sn, int baud)
int CloseSerialPort (void)
 (updated)
int Reset (void)
 Class methods used to configure PTU.
int SetAsciiEchoMode (char e)
 Enables/Disables Echo mode.
int SetImmediatePositionExecution (void)
 Orders PTU unit to immediatly pursue the last ordered position.(updated).
int SetSlaveModeExecution (void)
 Orders P&T unit go to every position ordered, regardless of any updating orders.(updated).
int SetPureVelocityControl (void)
 Enables Pure Velocity control.
int SetIndependentVelocityControl (void)
 Enables Independent Velocity control.
int Halt (char halt_type)
 Immediatly stops movement (updated).
int SetCheckLimits (unsigned char val)
 Several miscelaneous class methods.
void Wait (int t)
 Waits for t miliseconds of for PTU completion (updated).
long GetCurrentPanP (void)
 Class methods used to get PTU current and desired position, speed and acceleration.
double GetCurrentPanPdeg (void)
 Gets Current Pan Angle (updated).
long GetDesiredPanP (void)
 Gets Desired Pan Position (updated).
double GetDesiredPanPdeg (void)
 Gets Desired Pan angle (updated).
long GetCurrentTiltP (void)
 Gets Current Tilt Position (updated).
double GetCurrentTiltPdeg (void)
 Gets Current tilt Angle (updated).
long GetDesiredTiltP (void)
 Gets Desired Tilt Position (updated).
double GetDesiredTiltPdeg (void)
 Gets Desired Tilt angle (updated).
long GetCurrentPanS (void)
 Gets Current Pan Speed (updated).
double GetCurrentPanSdegsec (void)
 Gets Current Pan Speed degrees per sec (updated).
long GetDesiredPanS (void)
 Gets desired Pan Speed (updated).
double GetDesiredPanSdegsec (void)
 Gets desired Pan Speed degsec(updated).
long GetCurrentTiltS (void)
 Gets Current Tilt Speed (updated).
double GetCurrentTiltSdegsec (void)
 Gets Current Pan Speed degrees per sec (updated).
long GetDesiredTiltS (void)
 Gets Desired Tilt Speed (updated).
double GetDesiredTiltSdegsec (void)
 Gets Desired Tilt Speed (updated).
long GetCurrentPanA (void)
 Gets Current Pan Acceleration (updated).
long GetDesiredPanA (void)
 Gets Desired Pan Acceleration (updated).
long GetCurrentTiltA (void)
 Gets Current Tilt Acceleration (updated).
long GetDesiredTiltA (void)
 Gets Desired Tilt Acceleration (updated).
long GetDesiredPanR (void)
 Gets Desired Pan Resolution (updated).
long GetDesiredTiltR (void)
 Gets Desired Tilt Resolution (updated).

int SetPanSpeed (unsigned short int Speed)
 Class methods used to set PTU motion parameters, position, speed and acceleration.
int SetTiltSpeed (unsigned short int Speed)
 Sets tilt speed (updated).
int PanToPosition (short int Pos)
 Pans unit to Pos position. (updated).
int PanToAngle (double Angle)
 Pans unit to angle Angle.
int PanOffsetToPosition (int Offset)
 Pans unit to Offset from current position.
int TiltToPosition (short int Pos)
 Tilts unit to Pos position. (updated).
int TiltToAngle (double Angle)
 Tilts unit to angle Angle.
int TiltOffsetToPosition (int Offset)
 Tilts unit to Offset from current position.
int PanTiltPosSpeed (short int PanPos, short int TiltPos, unsigned short int PanSpeed, unsigned short int TiltSpeed)
 Sends 4 motion orders to PTU. Pan ans Tilt position speed and halt flag. (updated).
int PanTiltAngleSpeed (double PanAngle, double TiltAngle, unsigned short int PanSpeed, unsigned short int TiltSpeed)
 Sends 4 motion orders to PTU. Pan ans Tilt position speed and halt flag. Its the same has PanTiltPosSpeed but pos is given in degrees.
int PanTiltAngleSpeedAngleperSec (double PanAngle, double TiltAngle, double PanSpeed, double TiltSpeed)
 Sends 4 motion orders to PTU. Pan ans Tilt position speed and halt flag. Its the same has PanTiltPosSpeed but pos is given in degrees.
int SetPureVelocity (signed short int ps, signed short int ts)
 Sets Pan and Tilt velocities. Pure velocity control must be enabled using SetPureVelocityControl(void).
int SetPureVelocity_DegperSec (double ps, double ts)
 Sets Pan and Tilt velocities. Pure velocity control must be enabled using SetPureVelocityControl(void).

Private Member Functions

short int CheckPanLimits (short int Pos, unsigned char checkflag)
 Class methods used to check if pan, speed and acceleration values are within allowed values.
short int CheckTiltLimits (short int Pos, unsigned char checkflag)
 Checks for tilt limits.
unsigned short int CheckPanSLimits (unsigned short int Sp, unsigned char checkflag)
 Checks for pan speed limits.
unsigned short int CheckTiltSLimits (unsigned short int Sp, unsigned char checkflag)
 Checks for tilt speed limits.

Private Attributes

struct {
   char *   ComPort
   portstream_fd   ComPortHandle
   struct {
      char   verbose:1
      char   CheckLimits:1
   }   flg
   struct {
      struct {
         int   Max
         int   Min
      }   Pan
      struct {
         int   Max
         int   Min
      }   PanS
      struct {
         int   Max
         int   Min
      }   Tilt
      struct {
         int   Max
         int   Min
      }   TiltS
   }   Limits
   double   Resolution
Parameters

Detailed Description

Driver for Directed Perception Pan and Tilt units (PTU), model PTUD46.

Todo:
implement set POWER_LEVEL functions

Constructor & Destructor Documentation

cPTU_Control::cPTU_Control (  )  [inline]

Class constructor. Opens device and sets communication parameters.

Returns:

References _PANTILTRESOLUTION_, and TRUE.

cPTU_Control::~cPTU_Control (  )  [inline]

Class destructor. Closes device.

Returns:

Member Function Documentation

int cPTU_Control::CloseSerialPort ( void   )  [inline]

(updated)

Parameters:
@return 

References cPTU_Base::close_host_port().

Here is the call graph for this function:

long cPTU_Control::GetCurrentPanA ( void   )  [inline]

Gets Current Pan Acceleration (updated).

Returns:
The current pan acceleration value

References ACCELERATION, cPTU_Base::get_current(), and PAN.

Here is the call graph for this function:

long cPTU_Control::GetCurrentPanP ( void   )  [inline]

Class methods used to get PTU current and desired position, speed and acceleration.

Gets Current Pan Position (updated)

Returns:
The current Pan Position value

References cPTU_Base::get_current(), PAN, and POSITION.

Referenced by GetCurrentPanPdeg().

Here is the call graph for this function:

Here is the caller graph for this function:

double cPTU_Control::GetCurrentPanPdeg ( void   )  [inline]

Gets Current Pan Angle (updated).

Returns:
The current Pan Angle value

References _PANTILTRESOLUTION_, and GetCurrentPanP().

Here is the call graph for this function:

long cPTU_Control::GetCurrentPanS ( void   )  [inline]

Gets Current Pan Speed (updated).

Returns:
The current pan speed value

References cPTU_Base::get_current(), PAN, and SPEED.

Here is the call graph for this function:

double cPTU_Control::GetCurrentPanSdegsec ( void   )  [inline]

Gets Current Pan Speed degrees per sec (updated).

Returns:
The current pan speed value

References _PANTILTRESOLUTION_, cPTU_Base::get_current(), PAN, and SPEED.

Here is the call graph for this function:

long cPTU_Control::GetCurrentTiltA ( void   )  [inline]

Gets Current Tilt Acceleration (updated).

Returns:
The current tilt acceleration value

References ACCELERATION, cPTU_Base::get_current(), and TILT.

Here is the call graph for this function:

long cPTU_Control::GetCurrentTiltP ( void   )  [inline]

Gets Current Tilt Position (updated).

Returns:
The current Tilt Position value

References cPTU_Base::get_current(), POSITION, and TILT.

Referenced by GetCurrentTiltPdeg().

Here is the call graph for this function:

Here is the caller graph for this function:

double cPTU_Control::GetCurrentTiltPdeg ( void   )  [inline]

Gets Current tilt Angle (updated).

Returns:
The current Tilt Angle value

References _PANTILTRESOLUTION_, and GetCurrentTiltP().

Here is the call graph for this function:

long cPTU_Control::GetCurrentTiltS ( void   )  [inline]

Gets Current Tilt Speed (updated).

Returns:
The current tilt speed value

References cPTU_Base::get_current(), SPEED, and TILT.

Here is the call graph for this function:

double cPTU_Control::GetCurrentTiltSdegsec ( void   )  [inline]

Gets Current Pan Speed degrees per sec (updated).

Returns:
The current pan speed value

References _PANTILTRESOLUTION_, cPTU_Base::get_current(), SPEED, and TILT.

Here is the call graph for this function:

long cPTU_Control::GetDesiredPanA ( void   )  [inline]

Gets Desired Pan Acceleration (updated).

Returns:
The desired pan accelaration value

References ACCELERATION, cPTU_Base::get_desired(), and PAN.

Here is the call graph for this function:

long cPTU_Control::GetDesiredPanP ( void   )  [inline]

Gets Desired Pan Position (updated).

Returns:
The Desired Pan Position value

References cPTU_Base::get_desired(), PAN, and POSITION.

Here is the call graph for this function:

double cPTU_Control::GetDesiredPanPdeg ( void   )  [inline]

Gets Desired Pan angle (updated).

Returns:
The Desired Pan Position angle

References _PANTILTRESOLUTION_, cPTU_Base::get_desired(), PAN, and POSITION.

Here is the call graph for this function:

long cPTU_Control::GetDesiredPanR ( void   )  [inline]

Gets Desired Pan Resolution (updated).

Returns:
The desired pan resolution value

References cPTU_Base::get_desired(), PAN, and RESOLUTION.

Here is the call graph for this function:

long cPTU_Control::GetDesiredPanS ( void   )  [inline]

Gets desired Pan Speed (updated).

Returns:
The desired pan speed value

References cPTU_Base::get_desired(), PAN, and SPEED.

Here is the call graph for this function:

double cPTU_Control::GetDesiredPanSdegsec ( void   )  [inline]

Gets desired Pan Speed degsec(updated).

Returns:
The desired pan speed value in degs/sec

References _PANTILTRESOLUTION_, cPTU_Base::get_desired(), PAN, and SPEED.

Here is the call graph for this function:

long cPTU_Control::GetDesiredTiltA ( void   )  [inline]

Gets Desired Tilt Acceleration (updated).

Returns:
The desired tilt acceleration value

References ACCELERATION, cPTU_Base::get_desired(), and TILT.

Here is the call graph for this function:

long cPTU_Control::GetDesiredTiltP ( void   )  [inline]

Gets Desired Tilt Position (updated).

Returns:
The Desired Tilt Position value

References cPTU_Base::get_desired(), POSITION, and TILT.

Here is the call graph for this function:

double cPTU_Control::GetDesiredTiltPdeg ( void   )  [inline]

Gets Desired Tilt angle (updated).

Returns:
The Desired Tilt Position angle

References _PANTILTRESOLUTION_, cPTU_Base::get_desired(), POSITION, and TILT.

Here is the call graph for this function:

long cPTU_Control::GetDesiredTiltR ( void   )  [inline]

Gets Desired Tilt Resolution (updated).

Returns:
The desired tilt resolution value

References cPTU_Base::get_desired(), RESOLUTION, and TILT.

Here is the call graph for this function:

long cPTU_Control::GetDesiredTiltS ( void   )  [inline]

Gets Desired Tilt Speed (updated).

Returns:
The desired tilt speed value

References cPTU_Base::get_desired(), SPEED, and TILT.

Here is the call graph for this function:

double cPTU_Control::GetDesiredTiltSdegsec ( void   )  [inline]

Gets Desired Tilt Speed (updated).

Returns:
The desired tilt speed value in degs/sec

References _PANTILTRESOLUTION_, cPTU_Base::get_desired(), SPEED, and TILT.

Here is the call graph for this function:

int cPTU_Control::Halt ( char  halt_type  )  [inline]

Immediatly stops movement (updated).

Parameters:
halt_type Can be one of the three:

  • PAN halts pan axis
  • TILT halts tilt axis
  • ALL halts both pan and tilt
Returns:
Function result (0 is OK; -1 NOK)

References cPTU_Base::halt().

Here is the call graph for this function:

int cPTU_Control::OpenSerialPort ( char *  sn,
int  baud 
) [inline]
int cPTU_Control::OpenSerialPort ( char *  sn  )  [inline]

Class methods used to configure the serial port.

Opens serial port defined by sn (updated).

Parameters:
sn Usually, in linux, serial port is /dev/ttyUSB0 (for USB connections) or /dev/ttyS0 (for serial connections)
Returns:
Function result (0 is OK; -1 NOK)

References cPTU_Base::open_host_port().

Here is the call graph for this function:

int cPTU_Control::Reset ( void   )  [inline]

Class methods used to configure PTU.

Resets pan and tilt unit. (updated).

Returns:
Function result (0 is OK; -1 NOK)

References cPTU_Base::reset_ptu().

Here is the call graph for this function:

char cPTU_Control::Reset_Parser ( long  time  )  [inline]

References cPTU_Base::reset_PTU_parser().

Here is the call graph for this function:

int cPTU_Control::SetAsciiEchoMode ( char  e  )  [inline]

Enables/Disables Echo mode.

Parameters:
e if TRUE, echo mode is enabled. If FALSE, echo mode is disabled
Returns:
Function result (0 is OK; -1 NOK)

References COMMAND_EXECUTION_MODE, OFF_MODE, ON_MODE, and cPTU_Base::set_mode().

Here is the call graph for this function:

int cPTU_Control::SetCheckLimits ( unsigned char  val  )  [inline]

Several miscelaneous class methods.

Orders class to check for PTU limits before sending the orders.
If enabled, the inserted values are saturated to max or min values if necessary. By default, the class checks PTU limits before sending the orders.

Parameters:
val TRUE to check or FALSE not to check.
Returns:
Function result (0 is OK; -1 NOK)
int cPTU_Control::SetImmediatePositionExecution ( void   )  [inline]

Orders PTU unit to immediatly pursue the last ordered position.(updated).

Returns:
Function result (0 is OK; -1 NOK)

References COMMAND_EXECUTION_MODE, EXECUTE_IMMEDIATELY, and cPTU_Base::set_mode().

Here is the call graph for this function:

int cPTU_Control::SetIndependentVelocityControl ( void   )  [inline]

Enables Independent Velocity control.

Returns:
Function result (0 is OK; -1 NOK)

References PTU_INDEPENDENT_SPEED_CONTROL_MODE, cPTU_Base::set_mode(), and SPEED_CONTROL_MODE.

Referenced by ptucontrol_command_handler().

Here is the call graph for this function:

Here is the caller graph for this function:

int cPTU_Control::SetPureVelocityControl ( void   )  [inline]

Enables Pure Velocity control.

Returns:
Function result (0 is OK; -1 NOK)

References PTU_PURE_VELOCITY_SPEED_CONTROL_MODE, cPTU_Base::set_mode(), and SPEED_CONTROL_MODE.

Referenced by ptucontrol_command_handler().

Here is the call graph for this function:

Here is the caller graph for this function:

int cPTU_Control::SetSlaveModeExecution ( void   )  [inline]

Orders P&T unit go to every position ordered, regardless of any updating orders.(updated).

Returns:
Function result (0 is OK; -1 NOK)

References COMMAND_EXECUTION_MODE, EXECUTE_UPON_IMMEDIATE_OR_AWAIT, and cPTU_Base::set_mode().

Here is the call graph for this function:

void cPTU_Control::Wait ( int  t  )  [inline]

Waits for t miliseconds of for PTU completion (updated).

Waits for t miliseconds.

  • If t>=0, the function waits for t miliseconds.
  • If t<=0, the function waits for PTU to finish the commands being executed.

One can use define FORPTUTOSTOP as an argument of Wait if we want to wait for PTU completion

Parameters:
t number of miliseconds to wait.
Returns:
void

References cPTU_Base::await_completion(), and cPTU_Base::do_delay().

Here is the call graph for this function:


Field Documentation

struct { ... } cPTU_Control::flg
struct { ... } cPTU_Control::Limits
struct { ... } cPTU_Control::Pan
struct { ... } cPTU_Control::PanS
struct { ... } cPTU_Control::Parameters [private]
struct { ... } cPTU_Control::Tilt
struct { ... } cPTU_Control::TiltS

The documentation for this class was generated from the following files:
Generated on Wed Jun 2 12:43:29 2010 for LAR Atlas by  doxygen 1.6.3