Driver for Directed Perception Pan and Tilt units (PTU), model PTUD46. More...
#include <ptu_control.h>
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 |
Driver for Directed Perception Pan and Tilt units (PTU), model PTUD46.
cPTU_Control::cPTU_Control | ( | ) | [inline] |
Class constructor. Opens device and sets communication parameters.
References _PANTILTRESOLUTION_, and TRUE.
cPTU_Control::~cPTU_Control | ( | ) | [inline] |
Class destructor. Closes device.
int cPTU_Control::CloseSerialPort | ( | void | ) | [inline] |
(updated)
@return |
References cPTU_Base::close_host_port().
long cPTU_Control::GetCurrentPanA | ( | void | ) | [inline] |
Gets Current Pan Acceleration (updated).
References ACCELERATION, cPTU_Base::get_current(), and PAN.
long cPTU_Control::GetCurrentPanP | ( | void | ) | [inline] |
Class methods used to get PTU current and desired position, speed and acceleration.
Gets Current Pan Position (updated)
References cPTU_Base::get_current(), PAN, and POSITION.
Referenced by GetCurrentPanPdeg().
double cPTU_Control::GetCurrentPanPdeg | ( | void | ) | [inline] |
Gets Current Pan Angle (updated).
References _PANTILTRESOLUTION_, and GetCurrentPanP().
long cPTU_Control::GetCurrentPanS | ( | void | ) | [inline] |
Gets Current Pan Speed (updated).
References cPTU_Base::get_current(), PAN, and SPEED.
double cPTU_Control::GetCurrentPanSdegsec | ( | void | ) | [inline] |
Gets Current Pan Speed degrees per sec (updated).
References _PANTILTRESOLUTION_, cPTU_Base::get_current(), PAN, and SPEED.
long cPTU_Control::GetCurrentTiltA | ( | void | ) | [inline] |
Gets Current Tilt Acceleration (updated).
References ACCELERATION, cPTU_Base::get_current(), and TILT.
long cPTU_Control::GetCurrentTiltP | ( | void | ) | [inline] |
Gets Current Tilt Position (updated).
References cPTU_Base::get_current(), POSITION, and TILT.
Referenced by GetCurrentTiltPdeg().
double cPTU_Control::GetCurrentTiltPdeg | ( | void | ) | [inline] |
Gets Current tilt Angle (updated).
References _PANTILTRESOLUTION_, and GetCurrentTiltP().
long cPTU_Control::GetCurrentTiltS | ( | void | ) | [inline] |
Gets Current Tilt Speed (updated).
References cPTU_Base::get_current(), SPEED, and TILT.
double cPTU_Control::GetCurrentTiltSdegsec | ( | void | ) | [inline] |
Gets Current Pan Speed degrees per sec (updated).
References _PANTILTRESOLUTION_, cPTU_Base::get_current(), SPEED, and TILT.
long cPTU_Control::GetDesiredPanA | ( | void | ) | [inline] |
Gets Desired Pan Acceleration (updated).
References ACCELERATION, cPTU_Base::get_desired(), and PAN.
long cPTU_Control::GetDesiredPanP | ( | void | ) | [inline] |
Gets Desired Pan Position (updated).
References cPTU_Base::get_desired(), PAN, and POSITION.
double cPTU_Control::GetDesiredPanPdeg | ( | void | ) | [inline] |
Gets Desired Pan angle (updated).
References _PANTILTRESOLUTION_, cPTU_Base::get_desired(), PAN, and POSITION.
long cPTU_Control::GetDesiredPanR | ( | void | ) | [inline] |
Gets Desired Pan Resolution (updated).
References cPTU_Base::get_desired(), PAN, and RESOLUTION.
long cPTU_Control::GetDesiredPanS | ( | void | ) | [inline] |
Gets desired Pan Speed (updated).
References cPTU_Base::get_desired(), PAN, and SPEED.
double cPTU_Control::GetDesiredPanSdegsec | ( | void | ) | [inline] |
Gets desired Pan Speed degsec(updated).
References _PANTILTRESOLUTION_, cPTU_Base::get_desired(), PAN, and SPEED.
long cPTU_Control::GetDesiredTiltA | ( | void | ) | [inline] |
Gets Desired Tilt Acceleration (updated).
References ACCELERATION, cPTU_Base::get_desired(), and TILT.
long cPTU_Control::GetDesiredTiltP | ( | void | ) | [inline] |
Gets Desired Tilt Position (updated).
References cPTU_Base::get_desired(), POSITION, and TILT.
double cPTU_Control::GetDesiredTiltPdeg | ( | void | ) | [inline] |
Gets Desired Tilt angle (updated).
References _PANTILTRESOLUTION_, cPTU_Base::get_desired(), POSITION, and TILT.
long cPTU_Control::GetDesiredTiltR | ( | void | ) | [inline] |
Gets Desired Tilt Resolution (updated).
References cPTU_Base::get_desired(), RESOLUTION, and TILT.
long cPTU_Control::GetDesiredTiltS | ( | void | ) | [inline] |
Gets Desired Tilt Speed (updated).
References cPTU_Base::get_desired(), SPEED, and TILT.
double cPTU_Control::GetDesiredTiltSdegsec | ( | void | ) | [inline] |
Gets Desired Tilt Speed (updated).
References _PANTILTRESOLUTION_, cPTU_Base::get_desired(), SPEED, and TILT.
int cPTU_Control::Halt | ( | char | halt_type | ) | [inline] |
Immediatly stops movement (updated).
halt_type | Can be one of the three:
|
References cPTU_Base::halt().
int cPTU_Control::OpenSerialPort | ( | char * | sn, | |
int | baud | |||
) | [inline] |
References cPTU_Base::open_host_port(), cPTU_Base::open_host_port_38400(), PORT_NOT_OPENED, and cPTU_Base::reset_PTU_parser().
int cPTU_Control::OpenSerialPort | ( | char * | sn | ) | [inline] |
Class methods used to configure the serial port.
Opens serial port defined by sn (updated).
sn | Usually, in linux, serial port is /dev/ttyUSB0 (for USB connections) or /dev/ttyS0 (for serial connections) |
References cPTU_Base::open_host_port().
int cPTU_Control::Reset | ( | void | ) | [inline] |
Class methods used to configure PTU.
Resets pan and tilt unit. (updated).
References cPTU_Base::reset_ptu().
char cPTU_Control::Reset_Parser | ( | long | time | ) | [inline] |
int cPTU_Control::SetAsciiEchoMode | ( | char | e | ) | [inline] |
Enables/Disables Echo mode.
e | if TRUE, echo mode is enabled. If FALSE, echo mode is disabled |
References COMMAND_EXECUTION_MODE, OFF_MODE, ON_MODE, and cPTU_Base::set_mode().
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.
val | TRUE to check or FALSE not to check. |
int cPTU_Control::SetImmediatePositionExecution | ( | void | ) | [inline] |
Orders PTU unit to immediatly pursue the last ordered position.(updated).
References COMMAND_EXECUTION_MODE, EXECUTE_IMMEDIATELY, and cPTU_Base::set_mode().
int cPTU_Control::SetIndependentVelocityControl | ( | void | ) | [inline] |
Enables Independent Velocity control.
References PTU_INDEPENDENT_SPEED_CONTROL_MODE, cPTU_Base::set_mode(), and SPEED_CONTROL_MODE.
Referenced by ptucontrol_command_handler().
int cPTU_Control::SetPureVelocityControl | ( | void | ) | [inline] |
Enables Pure Velocity control.
References PTU_PURE_VELOCITY_SPEED_CONTROL_MODE, cPTU_Base::set_mode(), and SPEED_CONTROL_MODE.
Referenced by ptucontrol_command_handler().
int cPTU_Control::SetSlaveModeExecution | ( | void | ) | [inline] |
Orders P&T unit go to every position ordered, regardless of any updating orders.(updated).
References COMMAND_EXECUTION_MODE, EXECUTE_UPON_IMMEDIATE_OR_AWAIT, and cPTU_Base::set_mode().
void cPTU_Control::Wait | ( | int | t | ) | [inline] |
Waits for t miliseconds of for PTU completion (updated).
Waits for t miliseconds.
One can use define FORPTUTOSTOP as an argument of Wait if we want to wait for PTU completion
t | number of miliseconds to wait. |
References cPTU_Base::await_completion(), and cPTU_Base::do_delay().
char* cPTU_Control::ComPort |
struct { ... } cPTU_Control::flg |
struct { ... } cPTU_Control::Limits |
struct { ... } cPTU_Control::Pan |
struct { ... } cPTU_Control::PanS |
struct { ... } cPTU_Control::Parameters [private] |
double cPTU_Control::Resolution |
struct { ... } cPTU_Control::Tilt |
struct { ... } cPTU_Control::TiltS |