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 24 of file CPtuDPerception.h.
#include <mrpt/hwdrivers/CPtuDPerception.h>
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. More... | |
virtual | ~CPtuDPerception () |
Destructor. More... | |
virtual bool | rangeMeasure () |
Search limit forward. More... | |
virtual bool | moveToAbsPos (char axis, double nRad) |
Specification of positions in absolute terms. More... | |
virtual bool | absPosQ (char axis, double &nRad) |
Query position in absolute terms. More... | |
virtual bool | moveToOffPos (char axis, double nRad) |
Specify desired axis position as an offset from the current position. More... | |
virtual bool | offPosQ (char axis, double &nRad) |
Query position in relative terms. More... | |
virtual bool | maxPosQ (char axis, double &nRad) |
Query max movement limit of a axis in absolute terms. More... | |
virtual bool | minPosQ (char axis, double &nRad) |
Query min movement limit of a axis in absolute terms. More... | |
virtual bool | enableLimitsQ (bool &enable) |
Query if exist movement limits. More... | |
virtual bool | enableLimits (bool set) |
Enable/Disable movement limits. More... | |
virtual bool | inmediateExecution (bool set) |
With I mode (default) instructs pan-tilt unit to immediately execute positional commands. More... | |
virtual bool | aWait (void) |
Wait the finish of the last position command to continue accept commands. More... | |
virtual bool | haltAll () |
Inmediately stop all. More... | |
virtual bool | halt (char axis) |
Inmediately stop. More... | |
virtual bool | speed (char axis, double radSec) |
Specification of turn speed. More... | |
virtual bool | speedQ (char axis, double &radSec) |
Query turn speed. More... | |
virtual bool | aceleration (char axis, double radSec2) |
Specification (de/a)celeration in turn. More... | |
virtual bool | acelerationQ (char axis, double &radSec2) |
Query (de/a)celeration in turn. More... | |
virtual bool | baseSpeed (char axis, double radSec) |
Specification of velocity to which start and finish the (de/a)celeration. More... | |
virtual bool | baseSpeedQ (char axis, double &radSec) |
Query velocity to which start and finish the (de/a)celeration. More... | |
virtual bool | upperSpeed (char axis, double radSec) |
Specification of velocity upper limit. More... | |
virtual bool | upperSpeedQ (char axis, double &radSec) |
Query velocity upper limit. More... | |
virtual bool | lowerSpeed (char axis, double radSec) |
Specification of velocity lower limit. More... | |
virtual bool | lowerSpeedQ (char axis, double &radSec) |
Query velocity lower limit. More... | |
virtual bool | reset (void) |
Reset PTU to initial state. More... | |
virtual bool | save (void) |
Save or restart default values. More... | |
virtual bool | restoreDefaults (void) |
Restore default values. More... | |
virtual bool | restoreFactoryDefaults (void) |
Restore factory default values. More... | |
virtual bool | version (char *nVersion) |
Version and CopyRights. More... | |
virtual void | nversion (double &nVersion) |
Number of version. More... | |
virtual bool | powerModeQ (bool transit, char &mode) |
Query power mode. More... | |
virtual bool | powerMode (bool transit, char mode) |
Specification of power mode. More... | |
virtual double | status (double &rad) |
Check if ptu is moving. More... | |
virtual bool | setLimits (char axis, double &l, double &u) |
Set limits of movement. More... | |
virtual bool | changeMotionDir () |
virtual int | checkErrors () |
Check errors, returns 0 if there are not errors or error code in otherwise Error codes: More... | |
bool | noError () |
bool | comError () |
bool | timeoutError () |
bool | initError () |
bool | panTiltHitError () |
bool | panHitError () |
bool | tiltHitError () |
bool | maxLimitError () |
bool | minLimitError () |
bool | outOfRange () |
bool | illegalCommandError () |
bool | unExpectedError () |
virtual void | clearErrors () |
Clear errors. More... | |
virtual bool | init (const std::string &port) |
PTU and serial port initialization. More... | |
virtual void | close () |
Close Connection with serial port. More... | |
virtual double | radError (char axis, double nRadMoved) |
To obtains the mistake for use discrete values when the movement is expressed in radians. More... | |
virtual long | radToPos (char axis, double nRad) |
To obtain the discrete value for a number of radians. More... | |
virtual double | posToRad (char axis, long nPos) |
To obtain the number of radians for a discrete value. More... | |
virtual bool | scan (char axis, int wait, float initial, float final, double radPre) |
Performs a scan in the axis indicated and whit the precision desired. More... | |
virtual bool | verboseQ (bool &modo) |
Query verbose mode. More... | |
virtual bool | verbose (bool set) |
Set verbose. More... | |
virtual bool | echoModeQ (bool &mode) |
Query echo mode. More... | |
virtual bool | echoMode (bool mode) |
Enable/Disable echo response with command. More... | |
virtual bool | resolution (void) |
Query the pan and tilt resolution per position moved and initialize local atributes. More... | |
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. More... | |
double | tiltResolution |
double | panResolution |
Protected Attributes | |
mrpt::comms::CSerialPort | serPort |
Private Member Functions | |
virtual bool | transmit (const char *command) |
To transmition commands to the PTU. More... | |
virtual bool | receive (const char *command, char *response) |
To receive the responseof the PTU. More... | |
virtual bool | radQuerry (char axis, char command, double &nRad) |
Used to obtains a number of radians. More... | |
virtual bool | radAsign (char axis, char command, double nRad) |
Method used for asign a number of radians with a command. More... | |
virtual double | convertToDouble (char *sDouble) |
Convert string to double. More... | |
virtual long | convertToLong (char *sLong) |
Convert string to long. More... | |
anonymous enum |
Enumerator | |
---|---|
NoError | |
ComError | |
TimeoutError | |
InitError | |
PanHitError | |
TiltHitError | |
PanTiltHitError | |
MaxLimitError | |
MinLimitError | |
OutOfRange | |
IllegalCommandError | |
UnExpectedError |
Definition at line 384 of file CPtuDPerception.h.
anonymous enum |
Enumerator | |
---|---|
Pan | |
Tilt |
Definition at line 407 of file CPtuDPerception.h.
anonymous enum |
Enumerator | |
---|---|
Regular | |
High | |
Low | |
Off |
Definition at line 412 of file CPtuDPerception.h.
anonymous enum |
Enumerator | |
---|---|
Com1 | |
Com2 | |
Com3 | |
Com4 |
Definition at line 419 of file CPtuDPerception.h.
|
inline |
Default constructor.
Definition at line 29 of file CPtuDPerception.h.
|
inlinevirtual |
Destructor.
Definition at line 33 of file CPtuDPerception.h.
References close().
|
virtual |
Query position in absolute terms.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 39 of file CPtuDPerception.cpp.
|
virtual |
Specification (de/a)celeration in turn.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 104 of file CPtuDPerception.cpp.
|
virtual |
Query (de/a)celeration in turn.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 113 of file CPtuDPerception.cpp.
|
virtual |
Wait the finish of the last position command to continue accept commands.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 218 of file CPtuDPerception.cpp.
|
virtual |
Specification of velocity to which start and finish the (de/a)celeration.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 122 of file CPtuDPerception.cpp.
|
virtual |
Query velocity to which start and finish the (de/a)celeration.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 131 of file CPtuDPerception.cpp.
|
virtual |
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 830 of file CPtuDPerception.cpp.
|
virtual |
Check errors, returns 0 if there are not errors or error code in otherwise Error codes:
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 743 of file CPtuDPerception.cpp.
|
inlinevirtual |
Clear errors.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 278 of file CPtuDPerception.h.
|
virtual |
Close Connection with serial port.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 403 of file CPtuDPerception.cpp.
Referenced by ~CPtuDPerception().
|
inline |
Definition at line 234 of file CPtuDPerception.h.
|
privatevirtual |
Convert string to double.
Definition at line 731 of file CPtuDPerception.cpp.
|
privatevirtual |
Convert string to long.
Definition at line 719 of file CPtuDPerception.cpp.
|
virtual |
Enable/Disable echo response with command.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 551 of file CPtuDPerception.cpp.
|
virtual |
Query echo mode.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 533 of file CPtuDPerception.cpp.
References mrpt::system::upperCase().
|
virtual |
Enable/Disable movement limits.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 194 of file CPtuDPerception.cpp.
|
virtual |
Query if exist movement limits.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 176 of file CPtuDPerception.cpp.
References mrpt::system::upperCase().
|
virtual |
Inmediately stop.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 236 of file CPtuDPerception.cpp.
|
virtual |
Inmediately stop all.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 227 of file CPtuDPerception.cpp.
|
inline |
Definition at line 267 of file CPtuDPerception.h.
References IllegalCommandError, and nError.
|
virtual |
PTU and serial port initialization.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 341 of file CPtuDPerception.cpp.
References RAD2DEG.
|
inline |
Definition at line 239 of file CPtuDPerception.h.
|
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.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 206 of file CPtuDPerception.cpp.
|
virtual |
Specification of velocity lower limit.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 158 of file CPtuDPerception.cpp.
|
virtual |
Query velocity lower limit.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 167 of file CPtuDPerception.cpp.
|
inline |
Definition at line 255 of file CPtuDPerception.h.
References MaxLimitError, and nError.
|
virtual |
Query max movement limit of a axis in absolute terms.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 68 of file CPtuDPerception.cpp.
|
inline |
Definition at line 259 of file CPtuDPerception.h.
References MinLimitError, and nError.
|
virtual |
Query min movement limit of a axis in absolute terms.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 77 of file CPtuDPerception.cpp.
|
virtual |
Specification of positions in absolute terms.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 28 of file CPtuDPerception.cpp.
|
virtual |
Specify desired axis position as an offset from the current position.
This method recives the number of radians to move.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 48 of file CPtuDPerception.cpp.
|
inline |
Definition at line 233 of file CPtuDPerception.h.
References nError.
|
virtual |
Number of version.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 807 of file CPtuDPerception.cpp.
|
virtual |
Query position in relative terms.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 59 of file CPtuDPerception.cpp.
|
inline |
Definition at line 263 of file CPtuDPerception.h.
References nError, and OutOfRange.
|
inline |
Definition at line 247 of file CPtuDPerception.h.
References nError, and PanHitError.
|
inline |
Definition at line 243 of file CPtuDPerception.h.
References nError, and PanTiltHitError.
|
virtual |
To obtain the number of radians for a discrete value.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 707 of file CPtuDPerception.cpp.
|
virtual |
Specification of power mode.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 326 of file CPtuDPerception.cpp.
|
virtual |
Query power mode.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 298 of file CPtuDPerception.cpp.
References mrpt::system::upperCase().
|
privatevirtual |
Method used for asign a number of radians with a command.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 600 of file CPtuDPerception.cpp.
References mrpt::system::os::sprintf(), and mrpt::system::os::strcpy().
|
virtual |
To obtains the mistake for use discrete values when the movement is expressed in radians.
Parameters are the absolute position in radians and the axis desired
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 408 of file CPtuDPerception.cpp.
|
privatevirtual |
Used to obtains a number of radians.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 580 of file CPtuDPerception.cpp.
References convertToLong().
|
virtual |
To obtain the discrete value for a number of radians.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 695 of file CPtuDPerception.cpp.
|
virtual |
Search limit forward.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 840 of file CPtuDPerception.cpp.
|
privatevirtual |
To receive the responseof the PTU.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 445 of file CPtuDPerception.cpp.
References mrpt::system::os::strcpy().
|
virtual |
Reset PTU to initial state.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 250 of file CPtuDPerception.cpp.
|
virtual |
Query the pan and tilt resolution per position moved and initialize local atributes.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 563 of file CPtuDPerception.cpp.
References DEG2RAD.
|
virtual |
Restore default values.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 271 of file CPtuDPerception.cpp.
|
virtual |
Restore factory default values.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 280 of file CPtuDPerception.cpp.
|
virtual |
Save or restart default values.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 262 of file CPtuDPerception.cpp.
|
virtual |
Performs a scan in the axis indicated and whit the precision desired.
<axis> | {Pan or Till} |
<tWait> | {Wait time betwen commands} |
<initial> | {initial position} |
<final> | {final position} |
<radPre> | {radians precision for the scan} |
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 620 of file CPtuDPerception.cpp.
|
virtual |
Set limits of movement.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 817 of file CPtuDPerception.cpp.
References MRPT_UNUSED_PARAM.
|
virtual |
Specification of turn speed.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 86 of file CPtuDPerception.cpp.
|
virtual |
Query turn speed.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 95 of file CPtuDPerception.cpp.
|
inlinevirtual |
Check if ptu is moving.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 197 of file CPtuDPerception.h.
References MRPT_UNUSED_PARAM.
|
inline |
Definition at line 251 of file CPtuDPerception.h.
References nError, and TiltHitError.
|
inline |
Definition at line 235 of file CPtuDPerception.h.
References nError, and TimeoutError.
|
privatevirtual |
To transmition commands to the PTU.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 424 of file CPtuDPerception.cpp.
References mrpt::system::os::strcat(), and mrpt::system::os::strcpy().
|
inline |
Definition at line 271 of file CPtuDPerception.h.
References nError, and UnExpectedError.
|
virtual |
Specification of velocity upper limit.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 140 of file CPtuDPerception.cpp.
|
virtual |
Query velocity upper limit.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 149 of file CPtuDPerception.cpp.
|
virtual |
Set verbose.
Example of response with FV (verbose) active: FV * PP * Current pan position is 0 Example of response with FT (terse) active: FT * PP * 0
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 521 of file CPtuDPerception.cpp.
|
virtual |
Query verbose mode.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 503 of file CPtuDPerception.cpp.
|
virtual |
Version and CopyRights.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 289 of file CPtuDPerception.cpp.
int mrpt::hwdrivers::CPtuDPerception::nError |
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 405 of file CPtuDPerception.h.
Referenced by clearErrors(), comError(), illegalCommandError(), initError(), maxLimitError(), minLimitError(), noError(), outOfRange(), panHitError(), panTiltHitError(), tiltHitError(), timeoutError(), and unExpectedError().
|
inherited |
Definition at line 28 of file CPtuBase.h.
|
protectedinherited |
Definition at line 31 of file CPtuBase.h.
|
inherited |
Definition at line 28 of file CPtuBase.h.
Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019 |