MRPT
2.0.1
|
This class implements initialization and communication methods to control a Pan and Tilt Unit model PTU-46-17.5, working in radians .
Definition at line 21 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 | |
Default constructor. More... | |
~CPtuDPerception () override | |
Destructor. More... | |
bool | rangeMeasure () override |
Search limit forward. More... | |
bool | moveToAbsPos (char axis, double nRad) override |
Specification of positions in absolute terms. More... | |
bool | absPosQ (char axis, double &nRad) override |
Query position in absolute terms. More... | |
bool | moveToOffPos (char axis, double nRad) override |
Specify desired axis position as an offset from the current position. More... | |
bool | offPosQ (char axis, double &nRad) override |
Query position in relative terms. More... | |
bool | maxPosQ (char axis, double &nRad) override |
Query max movement limit of a axis in absolute terms. More... | |
bool | minPosQ (char axis, double &nRad) override |
Query min movement limit of a axis in absolute terms. More... | |
bool | enableLimitsQ (bool &enable) override |
Query if exist movement limits. More... | |
bool | enableLimits (bool set) override |
Enable/Disable movement limits. More... | |
bool | inmediateExecution (bool set) override |
With I mode (default) instructs pan-tilt unit to immediately execute positional commands. More... | |
bool | aWait () override |
Wait the finish of the last position command to continue accept commands. More... | |
bool | haltAll () override |
Inmediately stop all. More... | |
bool | halt (char axis) override |
Inmediately stop. More... | |
bool | speed (char axis, double radSec) override |
Specification of turn speed. More... | |
bool | speedQ (char axis, double &radSec) override |
Query turn speed. More... | |
bool | aceleration (char axis, double radSec2) override |
Specification (de/a)celeration in turn. More... | |
bool | acelerationQ (char axis, double &radSec2) override |
Query (de/a)celeration in turn. More... | |
bool | baseSpeed (char axis, double radSec) override |
Specification of velocity to which start and finish the (de/a)celeration. More... | |
bool | baseSpeedQ (char axis, double &radSec) override |
Query velocity to which start and finish the (de/a)celeration. More... | |
bool | upperSpeed (char axis, double radSec) override |
Specification of velocity upper limit. More... | |
bool | upperSpeedQ (char axis, double &radSec) override |
Query velocity upper limit. More... | |
bool | lowerSpeed (char axis, double radSec) override |
Specification of velocity lower limit. More... | |
bool | lowerSpeedQ (char axis, double &radSec) override |
Query velocity lower limit. More... | |
bool | reset () override |
Reset PTU to initial state. More... | |
bool | save () override |
Save or restart default values. More... | |
bool | restoreDefaults () override |
Restore default values. More... | |
bool | restoreFactoryDefaults () override |
Restore factory default values. More... | |
bool | version (char *nVersion) override |
Version and CopyRights. More... | |
void | nversion (double &nVersion) override |
Number of version. More... | |
bool | powerModeQ (bool transit, char &mode) override |
Query power mode. More... | |
bool | powerMode (bool transit, char mode) override |
Specification of power mode. More... | |
double | status ([[maybe_unused]] double &rad) override |
Check if ptu is moving. More... | |
bool | setLimits (char axis, double &l, double &u) override |
Set limits of movement. More... | |
bool | changeMotionDir () override |
int | checkErrors () override |
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 () |
void | clearErrors () override |
Clear errors. More... | |
bool | init (const std::string &port) override |
PTU and serial port initialization. More... | |
void | close () override |
Close Connection with serial port. More... | |
double | radError (char axis, double nRadMoved) override |
To obtains the mistake for use discrete values when the movement is expressed in radians. More... | |
long | radToPos (char axis, double nRad) override |
To obtain the discrete value for a number of radians. More... | |
double | posToRad (char axis, long nPos) override |
To obtain the number of radians for a discrete value. More... | |
bool | scan (char axis, int wait, float initial, float final, double radPre) override |
Performs a scan in the axis indicated and whit the precision desired. More... | |
bool | verboseQ (bool &modo) override |
Query verbose mode. More... | |
bool | verbose (bool set) override |
Set verbose. More... | |
bool | echoModeQ (bool &mode) override |
Query echo mode. More... | |
bool | echoMode (bool mode) override |
Enable/Disable echo response with command. More... | |
bool | resolution () override |
Query the pan and tilt resolution per position moved and initialize local atributes. More... | |
virtual double | status (double &rad)=0 |
Check if ptu is moving. 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 communication. More... | |
double | tiltResolution |
double | panResolution |
Protected Attributes | |
mrpt::comms::CSerialPort | serPort |
Private Member Functions | |
bool | transmit (const char *command) override |
To transmition commands to the PTU. More... | |
bool | receive (const char *command, char *response) override |
To receive the responseof the PTU. More... | |
bool | radQuerry (char axis, char command, double &nRad) override |
Used to obtains a number of radians. More... | |
bool | radAsign (char axis, char command, double nRad) override |
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 377 of file CPtuDPerception.h.
anonymous enum |
Enumerator | |
---|---|
Pan | |
Tilt |
Definition at line 400 of file CPtuDPerception.h.
anonymous enum |
Enumerator | |
---|---|
Regular | |
High | |
Low | |
Off |
Definition at line 405 of file CPtuDPerception.h.
anonymous enum |
Enumerator | |
---|---|
Com1 | |
Com2 | |
Com3 | |
Com4 |
Definition at line 412 of file CPtuDPerception.h.
|
default |
Default constructor.
|
inlineoverride |
Destructor.
Definition at line 30 of file CPtuDPerception.h.
References close().
|
overridevirtual |
Query position in absolute terms.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 41 of file CPtuDPerception.cpp.
|
overridevirtual |
Specification (de/a)celeration in turn.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 106 of file CPtuDPerception.cpp.
|
overridevirtual |
Query (de/a)celeration in turn.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 115 of file CPtuDPerception.cpp.
|
overridevirtual |
Wait the finish of the last position command to continue accept commands.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 220 of file CPtuDPerception.cpp.
|
overridevirtual |
Specification of velocity to which start and finish the (de/a)celeration.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 124 of file CPtuDPerception.cpp.
|
overridevirtual |
Query velocity to which start and finish the (de/a)celeration.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 133 of file CPtuDPerception.cpp.
|
overridevirtual |
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 831 of file CPtuDPerception.cpp.
|
overridevirtual |
Check errors, returns 0 if there are not errors or error code in otherwise Error codes:
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 745 of file CPtuDPerception.cpp.
|
inlineoverridevirtual |
Clear errors.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 271 of file CPtuDPerception.h.
|
overridevirtual |
Close Connection with serial port.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 405 of file CPtuDPerception.cpp.
Referenced by ~CPtuDPerception().
|
inline |
Definition at line 227 of file CPtuDPerception.h.
|
privatevirtual |
Convert string to double.
Definition at line 733 of file CPtuDPerception.cpp.
|
privatevirtual |
Convert string to long.
Definition at line 721 of file CPtuDPerception.cpp.
|
overridevirtual |
Enable/Disable echo response with command.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 553 of file CPtuDPerception.cpp.
|
overridevirtual |
Query echo mode.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 535 of file CPtuDPerception.cpp.
References mrpt::system::upperCase().
|
overridevirtual |
Enable/Disable movement limits.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 196 of file CPtuDPerception.cpp.
|
overridevirtual |
Query if exist movement limits.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 178 of file CPtuDPerception.cpp.
References mrpt::system::upperCase().
|
overridevirtual |
Inmediately stop.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 238 of file CPtuDPerception.cpp.
|
overridevirtual |
Inmediately stop all.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 229 of file CPtuDPerception.cpp.
|
inline |
Definition at line 260 of file CPtuDPerception.h.
References IllegalCommandError, and nError.
|
overridevirtual |
PTU and serial port initialization.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 343 of file CPtuDPerception.cpp.
|
inline |
Definition at line 232 of file CPtuDPerception.h.
|
overridevirtual |
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 208 of file CPtuDPerception.cpp.
|
overridevirtual |
Specification of velocity lower limit.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 160 of file CPtuDPerception.cpp.
|
overridevirtual |
Query velocity lower limit.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 169 of file CPtuDPerception.cpp.
|
inline |
Definition at line 248 of file CPtuDPerception.h.
References MaxLimitError, and nError.
|
overridevirtual |
Query max movement limit of a axis in absolute terms.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 70 of file CPtuDPerception.cpp.
|
inline |
Definition at line 252 of file CPtuDPerception.h.
References MinLimitError, and nError.
|
overridevirtual |
Query min movement limit of a axis in absolute terms.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 79 of file CPtuDPerception.cpp.
|
overridevirtual |
Specification of positions in absolute terms.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 30 of file CPtuDPerception.cpp.
|
overridevirtual |
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 50 of file CPtuDPerception.cpp.
|
inline |
Definition at line 226 of file CPtuDPerception.h.
References nError.
|
overridevirtual |
Number of version.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 809 of file CPtuDPerception.cpp.
|
overridevirtual |
Query position in relative terms.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 61 of file CPtuDPerception.cpp.
|
inline |
Definition at line 256 of file CPtuDPerception.h.
References nError, and OutOfRange.
|
inline |
Definition at line 240 of file CPtuDPerception.h.
References nError, and PanHitError.
|
inline |
Definition at line 236 of file CPtuDPerception.h.
References nError, and PanTiltHitError.
|
overridevirtual |
To obtain the number of radians for a discrete value.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 709 of file CPtuDPerception.cpp.
|
overridevirtual |
Specification of power mode.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 328 of file CPtuDPerception.cpp.
|
overridevirtual |
Query power mode.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 300 of file CPtuDPerception.cpp.
References mrpt::system::upperCase().
|
overrideprivatevirtual |
Method used for asign a number of radians with a command.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 602 of file CPtuDPerception.cpp.
References mrpt::system::os::sprintf(), and mrpt::system::os::strcpy().
|
overridevirtual |
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 410 of file CPtuDPerception.cpp.
|
overrideprivatevirtual |
Used to obtains a number of radians.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 582 of file CPtuDPerception.cpp.
References convertToLong().
|
overridevirtual |
To obtain the discrete value for a number of radians.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 697 of file CPtuDPerception.cpp.
|
overridevirtual |
Search limit forward.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 841 of file CPtuDPerception.cpp.
|
overrideprivatevirtual |
To receive the responseof the PTU.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 447 of file CPtuDPerception.cpp.
References mrpt::system::os::strcpy().
|
overridevirtual |
Reset PTU to initial state.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 252 of file CPtuDPerception.cpp.
|
overridevirtual |
Query the pan and tilt resolution per position moved and initialize local atributes.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 565 of file CPtuDPerception.cpp.
References DEG2RAD.
|
overridevirtual |
Restore default values.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 273 of file CPtuDPerception.cpp.
|
overridevirtual |
Restore factory default values.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 282 of file CPtuDPerception.cpp.
|
overridevirtual |
Save or restart default values.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 264 of file CPtuDPerception.cpp.
|
overridevirtual |
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 622 of file CPtuDPerception.cpp.
|
overridevirtual |
Set limits of movement.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 819 of file CPtuDPerception.cpp.
|
overridevirtual |
Specification of turn speed.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 88 of file CPtuDPerception.cpp.
|
overridevirtual |
Query turn speed.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 97 of file CPtuDPerception.cpp.
|
inlineoverride |
Check if ptu is moving.
Definition at line 194 of file CPtuDPerception.h.
|
pure virtualinherited |
Check if ptu is moving.
Implemented in mrpt::hwdrivers::CTuMicos.
|
inline |
Definition at line 244 of file CPtuDPerception.h.
References nError, and TiltHitError.
|
inline |
Definition at line 228 of file CPtuDPerception.h.
References nError, and TimeoutError.
|
overrideprivatevirtual |
To transmition commands to the PTU.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 426 of file CPtuDPerception.cpp.
References mrpt::system::os::strcat(), and mrpt::system::os::strcpy().
|
inline |
Definition at line 264 of file CPtuDPerception.h.
References nError, and UnExpectedError.
|
overridevirtual |
Specification of velocity upper limit.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 142 of file CPtuDPerception.cpp.
|
overridevirtual |
Query velocity upper limit.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 151 of file CPtuDPerception.cpp.
|
overridevirtual |
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 523 of file CPtuDPerception.cpp.
|
overridevirtual |
Query verbose mode.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 505 of file CPtuDPerception.cpp.
|
overridevirtual |
Version and CopyRights.
Implements mrpt::hwdrivers::CPtuBase.
Definition at line 291 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 communication.
Definition at line 398 of file CPtuDPerception.h.
Referenced by clearErrors(), comError(), illegalCommandError(), initError(), maxLimitError(), minLimitError(), noError(), outOfRange(), panHitError(), panTiltHitError(), tiltHitError(), timeoutError(), and unExpectedError().
|
inherited |
Definition at line 25 of file CPtuBase.h.
|
protectedinherited |
Definition at line 28 of file CPtuBase.h.
|
inherited |
Definition at line 25 of file CPtuBase.h.
Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020 |