Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
BIAS::DPPanTiltControl Class Reference

Basic controller interface for Directed Perception Pan Tilt Unit. More...

#include <PanTilt/DPPanTiltControl.hh>

+ Inheritance diagram for BIAS::DPPanTiltControl:

Public Types

enum  DPPanTiltStepping {
  AUTO = 0, HALF, QUARTER, EIGHTH,
  FULL
}
 

Public Member Functions

void AwaitCompletion ()
 Await completion of currently executed command. More...
 
void ClosePanTiltUnit ()
 closes the comport stream connected to PTU More...
 
 DPPanTiltControl ()
 Standard constructor. More...
 
void GetAcceleration (long &panAcc, long &tiltAcc)
 
void GetCurrentPosition (long &lPanPos, long &lTiltPos)
 
void GetCurrentPositionDegrees (double &dPanDeg, double &dTiltDeg)
 
void GetCurrentPositionRadians (double &dPanRad, double &dTiltRad)
 
double GetPanResolution ()
 Get the resolution of the pan axis. More...
 
void GetSpeed (long &panSpeed, long &tiltSpeed)
 
double GetTiltResolution ()
 Get the resolution of the tilt axis. More...
 
bool InitPanTiltUnit (int nPort, bool bUSB=false)
 Open the given serial port and initialize the pan tilt unit. More...
 
bool InitPanTiltUnit (const char *portName)
 Open the given port and initialize the pan tilt unit. More...
 
void MoveDown (int nValue)
 Move camera nValue steps downwards. More...
 
void MoveLeft (int nValue)
 Move camera nValue steps left. More...
 
void MoveRight (int nValue)
 Move camera nValue steps right. More...
 
void MoveUp (int nValue)
 Move camera nValue steps upwards. More...
 
void QueryResolution (double &panResolution, double &tiltResolution, bool updateInternal=false)
 Get resolution of the motor. More...
 
int ReadRawLine (std::string &cmd)
 Read a line from the serial (or USB) port. More...
 
bool ResetPanTiltUnit ()
 Reset the position of the pan tilt unit to 0. More...
 
void SendRawCommand (std::string cmd)
 Send a command string terminated by a space or carriage return character to the serial (or USB) port. More...
 
char SetAcceleration (int nPanAcc, int nTiltAcc)
 Set acceleration for movement. More...
 
int SetMode (int nMode)
 Set the mode in which the camera is to operate. More...
 
int SetMotorStepping (int panStepping, int tiltStepping)
 Set the stepping of the motor. More...
 
void SetPosition (int nPanPos, int nTiltPos, bool bWaitComplete=true)
 Set the current position of the PTU in steps. More...
 
char SetSpeed (int nPanSpeed, int nTiltSpeed)
 Set speed for movement. More...
 
void StartCircularMovement ()
 Start a thread moving the PTU in a circle. More...
 
void StopPanTiltUnit ()
 Stop the currently moving pan tilt unit. More...
 
void UseDefaultOrientation (bool use)
 Set the orientation of the PTU (default or upside-down). More...
 
 ~DPPanTiltControl ()
 Standard destructor. More...
 

Protected Attributes

bool bDefaultOrientation_
 
portstream_fd COMstream_
 
short int maxSpeed_
 
double panResolution_
 
double tiltResolution_
 

Detailed Description

Basic controller interface for Directed Perception Pan Tilt Unit.

Author
MIP
Examples:
ExampleDPPanTiltControl.cpp, and ExampleDPPanTiltControl2.cpp.

Definition at line 69 of file DPPanTiltControl.hh.

Member Enumeration Documentation

Enumerator
AUTO 
HALF 
QUARTER 
EIGHTH 
FULL 

Definition at line 73 of file DPPanTiltControl.hh.

Constructor & Destructor Documentation

DPPanTiltControl::DPPanTiltControl ( )

Standard constructor.

Definition at line 12 of file DPPanTiltControl.cpp.

DPPanTiltControl::~DPPanTiltControl ( )

Standard destructor.

Definition at line 20 of file DPPanTiltControl.cpp.

Member Function Documentation

void DPPanTiltControl::AwaitCompletion ( )

Await completion of currently executed command.

Examples:
ExampleDPPanTiltControl.cpp, and ExampleDPPanTiltControl2.cpp.

Definition at line 90 of file DPPanTiltControl.cpp.

void DPPanTiltControl::ClosePanTiltUnit ( )

closes the comport stream connected to PTU

Examples:
ExampleDPPanTiltControl.cpp, and ExampleDPPanTiltControl2.cpp.

Definition at line 156 of file DPPanTiltControl.cpp.

Referenced by BIAS::PanTiltAutoControl::~PanTiltAutoControl().

void DPPanTiltControl::GetAcceleration ( long &  panAcc,
long &  tiltAcc 
)
Returns
Returns the current acceleration

Definition at line 190 of file DPPanTiltControl.cpp.

void DPPanTiltControl::GetCurrentPosition ( long &  lPanPos,
long &  lTiltPos 
)
Returns
Returns the current position of the PTU in steps

Definition at line 229 of file DPPanTiltControl.cpp.

Referenced by BIAS::PanTiltAutoControl::StartControl(), BIAS::PanTiltAutoControl::StartMoveTo(), and BIAS::DPPanTiltControlExtended::threadFuncCircle_().

void DPPanTiltControl::GetCurrentPositionDegrees ( double &  dPanDeg,
double &  dTiltDeg 
)
Returns
Returns the current position of the PTU in degrees

Definition at line 236 of file DPPanTiltControl.cpp.

void DPPanTiltControl::GetCurrentPositionRadians ( double &  dPanRad,
double &  dTiltRad 
)
Returns
Returns the current position of the PTU in radians

Definition at line 243 of file DPPanTiltControl.cpp.

double BIAS::DPPanTiltControl::GetPanResolution ( )
inline

Get the resolution of the pan axis.

Returns
Returns the pan resolution in radians per step
Examples:
ExampleDPPanTiltControl.cpp.

Definition at line 141 of file DPPanTiltControl.hh.

void DPPanTiltControl::GetSpeed ( long &  panSpeed,
long &  tiltSpeed 
)
Returns
Returns the current speed

Definition at line 176 of file DPPanTiltControl.cpp.

double BIAS::DPPanTiltControl::GetTiltResolution ( )
inline

Get the resolution of the tilt axis.

Returns
Returns the tilt resolution in radians per step

Definition at line 145 of file DPPanTiltControl.hh.

bool DPPanTiltControl::InitPanTiltUnit ( int  nPort,
bool  bUSB = false 
)

Open the given serial port and initialize the pan tilt unit.

Parameters
[in]nPortThe number of the serial port (or USB port)
[in]bUSBUse USB port instead of serial port
Returns
Returns true on success, false for errors
Examples:
ExampleDPPanTiltControl.cpp, and ExampleDPPanTiltControl2.cpp.

Definition at line 95 of file DPPanTiltControl.cpp.

bool DPPanTiltControl::InitPanTiltUnit ( const char *  portName)

Open the given port and initialize the pan tilt unit.

Parameters
[in]portNameThe name of the serial port or USB port to open, e.g. /dev/ttyUSB0
Returns
Returns true on success, false for errors

Definition at line 114 of file DPPanTiltControl.cpp.

void DPPanTiltControl::MoveDown ( int  nValue)

Move camera nValue steps downwards.

Definition at line 204 of file DPPanTiltControl.cpp.

Referenced by BIAS::DPPanTiltControlDialog::OnDown().

void DPPanTiltControl::MoveLeft ( int  nValue)

Move camera nValue steps left.

Definition at line 212 of file DPPanTiltControl.cpp.

Referenced by BIAS::DPPanTiltControlDialog::OnLeft().

void DPPanTiltControl::MoveRight ( int  nValue)

Move camera nValue steps right.

Definition at line 220 of file DPPanTiltControl.cpp.

Referenced by BIAS::DPPanTiltControlDialog::OnRight().

void DPPanTiltControl::MoveUp ( int  nValue)

Move camera nValue steps upwards.

Definition at line 196 of file DPPanTiltControl.cpp.

Referenced by BIAS::DPPanTiltControlDialog::OnUp().

void DPPanTiltControl::QueryResolution ( double &  panResolution,
double &  tiltResolution,
bool  updateInternal = false 
)

Get resolution of the motor.

Parameters
[out]panResolutionReturn the pan resolution
[out]tiltResolutionReturns the tilt resolution

Definition at line 430 of file DPPanTiltControl.cpp.

int DPPanTiltControl::ReadRawLine ( std::string &  cmd)

Read a line from the serial (or USB) port.

Returns
Returns the length of the read string, or 0 when nothing has been read

Definition at line 269 of file DPPanTiltControl.cpp.

bool DPPanTiltControl::ResetPanTiltUnit ( )

Reset the position of the pan tilt unit to 0.

Returns
Returns true on success, false for errors

Definition at line 54 of file DPPanTiltControl.cpp.

Referenced by BIAS::DPPanTiltControlDialog::OnReset().

void DPPanTiltControl::SendRawCommand ( std::string  cmd)

Send a command string terminated by a space or carriage return character to the serial (or USB) port.

Definition at line 264 of file DPPanTiltControl.cpp.

char DPPanTiltControl::SetAcceleration ( int  nPanAcc,
int  nTiltAcc 
)

Set acceleration for movement.

Examples:
ExampleDPPanTiltControl.cpp.

Definition at line 182 of file DPPanTiltControl.cpp.

int DPPanTiltControl::SetMode ( int  nMode)

Set the mode in which the camera is to operate.

Parameters
[in]nModeDefines the mode, 0 is speed control mode, 1 is absolute positioning mode
Returns
Returns 0 on success, != 0 for errors
Examples:
ExampleDPPanTiltControl.cpp, and ExampleDPPanTiltControl2.cpp.

Definition at line 24 of file DPPanTiltControl.cpp.

Referenced by BIAS::DPPanTiltControlDialog::OnQuit(), BIAS::PanTiltManualControl::StartControl(), BIAS::PanTiltAutoControl::StartControl(), BIAS::PanTiltAutoControl::StartMoveTo(), and BIAS::DPPanTiltControlExtended::threadFuncCircle_().

int DPPanTiltControl::SetMotorStepping ( int  panStepping,
int  tiltStepping 
)

Set the stepping of the motor.

Definition at line 279 of file DPPanTiltControl.cpp.

void DPPanTiltControl::SetPosition ( int  nPanPos,
int  nTiltPos,
bool  bWaitComplete = true 
)

Set the current position of the PTU in steps.

Examples:
ExampleDPPanTiltControl.cpp, and ExampleDPPanTiltControl2.cpp.

Definition at line 250 of file DPPanTiltControl.cpp.

Referenced by BIAS::PanTiltManualControl::StartControl(), and BIAS::DPPanTiltControlExtended::threadFuncCircle_().

char DPPanTiltControl::SetSpeed ( int  nPanSpeed,
int  nTiltSpeed 
)
void BIAS::DPPanTiltControl::StartCircularMovement ( )

Start a thread moving the PTU in a circle.

void DPPanTiltControl::StopPanTiltUnit ( )

Stop the currently moving pan tilt unit.

Definition at line 83 of file DPPanTiltControl.cpp.

void BIAS::DPPanTiltControl::UseDefaultOrientation ( bool  use)
inline

Set the orientation of the PTU (default or upside-down).

Parameters
[in]useUse true for default orientation and false for mounting upside down (e.g. when mounted under helicopter)
Note
Implemented for helicopter project by Ingo Schiller

Definition at line 187 of file DPPanTiltControl.hh.

Member Data Documentation

bool BIAS::DPPanTiltControl::bDefaultOrientation_
protected

Definition at line 194 of file DPPanTiltControl.hh.

portstream_fd BIAS::DPPanTiltControl::COMstream_
protected

Definition at line 191 of file DPPanTiltControl.hh.

short int BIAS::DPPanTiltControl::maxSpeed_
protected

Definition at line 192 of file DPPanTiltControl.hh.

double BIAS::DPPanTiltControl::panResolution_
protected

Definition at line 193 of file DPPanTiltControl.hh.

double BIAS::DPPanTiltControl::tiltResolution_
protected

Definition at line 193 of file DPPanTiltControl.hh.


The documentation for this class was generated from the following files: