MRPT logo

mrpt::hwdrivers::CPtuDPerception Class Reference

This class implements initialization and comunication methods to control a Pan and Tilt Unit model PTU-46-17.5, working in radians . More...

#include <mrpt/hwdrivers/CPtuDPerception.h>

Inheritance diagram for mrpt::hwdrivers::CPtuDPerception:

mrpt::hwdrivers::CPtuBase

List of all members.

Public Types

enum  {
  NoError = 1, ComError = 2, TimeoutError = 3, InitError = 5,
  PanHitError = 7, TiltHitError = 11, PanTiltHitError = 13, MaxLimitError = 17,
  MinLimitError = 19, OutOfRange = 23, IllegalCommandError = 29, UnExpectedError = 31
}
enum  { Pan = 'P', Tilt = 'T' }
enum  { Regular = 'R', High = 'H', Low = 'L', Off = 'O' }
enum  { Com1 = 1, Com2 = 2, Com3 = 3, Com4 = 4 }

Public Member Functions

 CPtuDPerception ()
 Default constructor.
 ~CPtuDPerception ()
 Destructor.
bool moveToAbsPos (char axis, double nRad)
 Specification of positions in absolute terms.
bool absPosQ (char axis, double &nRad)
 Query position in absolute terms.
bool moveToOffPos (char axis, double nRad)
 Specify desired axis position as an offset from the current position.
bool offPosQ (char axis, double &nRad)
 Query position in relative terms.
bool maxPosQ (char axis, double &nRad)
 Query max movement limit of a axis in absolute terms.
bool minPosQ (char axis, double &nRad)
 Query min movement limit of a axis in absolute terms.
bool enableLimitsQ (bool &enable)
 Query if exist movement limits.
bool enableLimits (bool set)
 Enable/Disable movement limits.
bool inmediateExecution (bool set)
 With I mode (default) instructs pan-tilt unit to immediately execute positional commands.
bool aWait (void)
 Wait the finish of the last position command to continue accept commands.
bool haltAll ()
 Inmediately stop all.
bool halt (char axis)
 Inmediately stop.
bool speed (char axis, double radSec)
 Specification of turn speed.
bool speedQ (char axis, double &radSec)
 Query turn speed.
bool aceleration (char axis, double radSec2)
 Specification (de/a)celeration in turn.
bool acelerationQ (char axis, double &radSec2)
 Query (de/a)celeration in turn.
bool baseSpeed (char axis, double radSec)
 Specification of velocity to which start and finish the (de/a)celeration.
bool baseSpeedQ (char axis, double &radSec)
 Query velocity to which start and finish the (de/a)celeration.
bool upperSpeed (char axis, double radSec)
 Specification of velocity upper limit.
bool upperSpeedQ (char axis, double &radSec)
 Query velocity upper limit.
bool lowerSpeed (char axis, double radSec)
 Specification of velocity lower limit.
bool lowerSpeedQ (char axis, double &radSec)
 Query velocity lower limit.
bool reset (void)
 Reset PTU to initial state.
bool save (void)
 Save or restart default values.
bool restoreDefaults (void)
 Restore default values.
bool restoreFactoryDefaults (void)
 Restore factory default values.
bool version (char *nVersion)
 Version and CopyRights.
bool powerModeQ (bool transit, char &mode)
 Query power mode.
bool powerMode (bool transit, char mode)
 Specification of power mode.
bool verbose (bool set)
 Check errors, returns 0 if there are not errors or error code in otherwise Error codes:.
bool echoModeQ (bool &mode)
 Query echo mode.
bool echoMode (bool mode)
 Enable/Disable echo response with command.
bool resolution (void)
 Query the pan and tilt resolution per position moved and initialize local atributes.

Public Attributes

int nError
 TimeoutError: Only occurs if the communication is cut with PTU so it is advisable to check the connection and initialize again the comunication.

Private Member Functions

bool transmit (const char *command)
 To transmition commands to the PTU.
bool receive (const char *command, char **response)
 To receive the responseof the PTU.
bool radQuerry (char axis, char command, double &nRad)
 Used to obtains a number of radians.
bool radAsign (char axis, char command, double nRad)
 Method used for asign a number of radians with a command.
double convertToDouble (char *sDouble)
 Convert string to double.
long convertToLong (char *sLong)
 Convert string to long.


Detailed Description

This class implements initialization and comunication methods to control a Pan and Tilt Unit model PTU-46-17.5, working in radians .

Definition at line 42 of file CPtuDPerception.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
NoError 
ComError 
TimeoutError 
InitError 
PanHitError 
TiltHitError 
PanTiltHitError 
MaxLimitError 
MinLimitError 
OutOfRange 
IllegalCommandError 
UnExpectedError 

Definition at line 356 of file CPtuDPerception.h.

anonymous enum

Enumerator:
Pan 
Tilt 

Definition at line 368 of file CPtuDPerception.h.

anonymous enum

Enumerator:
Regular 
High 
Low 
Off 

Definition at line 369 of file CPtuDPerception.h.

anonymous enum

Enumerator:
Com1 
Com2 
Com3 
Com4 

Definition at line 370 of file CPtuDPerception.h.


Constructor & Destructor Documentation

mrpt::hwdrivers::CPtuDPerception::CPtuDPerception (  )  [inline]

Default constructor.

Definition at line 49 of file CPtuDPerception.h.

mrpt::hwdrivers::CPtuDPerception::~CPtuDPerception (  )  [inline]

Destructor.

Definition at line 53 of file CPtuDPerception.h.


Member Function Documentation

bool mrpt::hwdrivers::CPtuDPerception::absPosQ ( char  axis,
double &  nRad 
) [virtual]

Query position in absolute terms.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::aceleration ( char  axis,
double  radSec2 
) [virtual]

Specification (de/a)celeration in turn.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::acelerationQ ( char  axis,
double &  radSec2 
) [virtual]

Query (de/a)celeration in turn.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::aWait ( void   )  [virtual]

Wait the finish of the last position command to continue accept commands.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::baseSpeed ( char  axis,
double  radSec 
) [virtual]

Specification of velocity to which start and finish the (de/a)celeration.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::baseSpeedQ ( char  axis,
double &  radSec 
) [virtual]

Query velocity to which start and finish the (de/a)celeration.

Implements mrpt::hwdrivers::CPtuBase.

double mrpt::hwdrivers::CPtuDPerception::convertToDouble ( char *  sDouble  )  [private]

Convert string to double.

long mrpt::hwdrivers::CPtuDPerception::convertToLong ( char *  sLong  )  [private]

Convert string to long.

bool mrpt::hwdrivers::CPtuDPerception::echoMode ( bool  mode  )  [virtual]

Enable/Disable echo response with command.


        Example of use (EE supposed):
                PP * 22
                ED *
                <pp entered again, but not echoed>* 22

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::echoModeQ ( bool &  mode  )  [virtual]

Query echo mode.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::enableLimits ( bool  set  )  [virtual]

Enable/Disable movement limits.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::enableLimitsQ ( bool &  enable  )  [virtual]

Query if exist movement limits.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::halt ( char  axis  )  [virtual]

Inmediately stop.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::haltAll (  )  [virtual]

Inmediately stop all.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::inmediateExecution ( bool  set  )  [virtual]

With I mode (default) instructs pan-tilt unit to immediately execute positional commands.


In S mode instructs pan-tilt unit to execute positional commands only when an Await Position Command Completion command is executed or when put into Immediate Execution Mode.

        Example of use of S mode:
                DR *
                S *
                PP1500 *
                TP-900 *
                PP * Current Pan position is 0
                TP * Current Tilt position is 0
                A *
                PP * Current Pan position is 1500
                TP * Current Tilt position is -900

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::lowerSpeed ( char  axis,
double  radSec 
) [virtual]

Specification of velocity lower limit.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::lowerSpeedQ ( char  axis,
double &  radSec 
) [virtual]

Query velocity lower limit.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::maxPosQ ( char  axis,
double &  nRad 
) [virtual]

Query max movement limit of a axis in absolute terms.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::minPosQ ( char  axis,
double &  nRad 
) [virtual]

Query min movement limit of a axis in absolute terms.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::moveToAbsPos ( char  axis,
double  nRad 
) [virtual]

Specification of positions in absolute terms.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::moveToOffPos ( char  axis,
double  nRad 
) [virtual]

Specify desired axis position as an offset from the current position.


This method recives the number of radians to move.

        Example of use:
                TT-500 *
                A *
                TO * Current Tilt position is -500
                TO500 *
                A *
                TT * Current Pan position is 1000 

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::offPosQ ( char  axis,
double &  nRad 
) [virtual]

Query position in relative terms.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::powerMode ( bool  transit,
char  mode 
) [virtual]

Specification of power mode.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::powerModeQ ( bool  transit,
char &  mode 
) [virtual]

Query power mode.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::radAsign ( char  axis,
char  command,
double  nRad 
) [private, virtual]

Method used for asign a number of radians with a command.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::radQuerry ( char  axis,
char  command,
double &  nRad 
) [private, virtual]

Used to obtains a number of radians.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::receive ( const char *  command,
char **  response 
) [private, virtual]

To receive the responseof the PTU.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::reset ( void   )  [virtual]

Reset PTU to initial state.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::resolution ( void   )  [virtual]

Query the pan and tilt resolution per position moved and initialize local atributes.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::restoreDefaults ( void   )  [virtual]

Restore default values.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::restoreFactoryDefaults ( void   )  [virtual]

Restore factory default values.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::save ( void   )  [virtual]

Save or restart default values.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::speed ( char  axis,
double  radSec 
) [virtual]

Specification of turn speed.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::speedQ ( char  axis,
double &  radSec 
) [virtual]

Query turn speed.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::transmit ( const char *  command  )  [private, virtual]

To transmition commands to the PTU.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::upperSpeed ( char  axis,
double  radSec 
) [virtual]

Specification of velocity upper limit.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::upperSpeedQ ( char  axis,
double &  radSec 
) [virtual]

Query velocity upper limit.

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::verbose ( bool  set  )  [virtual]

Check errors, returns 0 if there are not errors or error code in otherwise Error codes:.

        1: Com error
        2: Time out error
        3: Init error
        4: Pan tilt hit error
        5: Pan hit error
        6: Tilt hit error
        7: Max limit error
        8: Min limit error
        9: Out of range
        10: Illegal command error
        11: Unexpected error
                        **/

                        int checkErrors();

                        inline bool noError() { return nError==1; }
                        inline bool comError() { return (nError % CPtuDPerception::ComError)==0; }
                        inline bool timeoutError() { return (nError % CPtuDPerception::TimeoutError)==0; }
                        inline bool initError() { return (nError % CPtuDPerception::InitError)==0; }
                        inline bool panTiltHitError() { return (nError % CPtuDPerception::PanTiltHitError)==0; }
                        inline bool panHitError() { return (nError % CPtuDPerception::PanHitError)==0; }
                        inline bool tiltHitError() { return (nError % CPtuDPerception::TiltHitError)==0; }
                        inline bool maxLimitError() { return (nError % CPtuDPerception::MaxLimitError)==0; }
                        inline bool minLimitError () { return (nError % CPtuDPerception::MinLimitError)==0; }
                        inline bool outOfRange() { return (nError % CPtuDPerception::OutOfRange)==0; }
                        inline bool illegalCommandError() { return (nError % CPtuDPerception::IllegalCommandError)==0; }
                        inline bool unExpectedError() { return (nError % CPtuDPerception::UnExpectedError)==0; }
                        
                        inline void clearErrors() { nError=NoError; }


                /*************************** Other member methods *****************/

                public:

                        bool init(const std::string port);

                        void close();

                        double radError(char axis,double nRadMoved);

                        long radToPos(char axis,double nRad);

                        double posToRad(char axis,long nPos);

                        bool scan(char axis, int wait, float initial, float final, double radPre);
                                                
                        bool verboseQ(bool &modo);

Implements mrpt::hwdrivers::CPtuBase.

bool mrpt::hwdrivers::CPtuDPerception::version ( char *  nVersion  )  [virtual]

Version and CopyRights.

Implements mrpt::hwdrivers::CPtuBase.


Member Data Documentation

TimeoutError: Only occurs if the communication is cut with PTU so it is advisable to check the connection and initialize again the comunication.

Definition at line 366 of file CPtuDPerception.h.




Page generated by Doxygen 1.5.8 for MRPT 0.6.5 SVN:exported at Mon Jan 12 13:00:16 UTC 2009