class mrpt::hwdrivers::CTuMicos

Overview

This class implements initialization and communication methods to control a Tilt Unit model DT-80, working in radians .

#include <mrpt/hwdrivers/CTuMicos.h>

class CTuMicos:
    public mrpt::hwdrivers::CPtuBase,
    public mrpt::system::COutputLogger
{
public:
    // fields

    int axis_index;
    double tiltResolution;
    double panResolution;

    // construction

    CTuMicos();

    // methods

    virtual bool rangeMeasure();
    virtual bool moveToAbsPos(char axis, double nRad);
    virtual bool absPosQ(char axis, double& nRad);
    virtual bool moveToOffPos(char axis, double nRad);
    virtual bool offPosQ(char axis, double& nRad);
    virtual bool maxPosQ(char axis, double& nRad);
    virtual bool minPosQ(char axis, double& nRad);
    virtual bool enableLimitsQ(bool& enable);
    virtual bool enableLimits(bool set);
    virtual bool inmediateExecution(bool set);
    virtual bool aWait();
    virtual bool haltAll();
    virtual bool halt(char axis);
    virtual bool speed(char axis, double radSec);
    virtual bool speedQ(char axis, double& radSec);
    virtual bool aceleration(char axis, double radSec2);
    virtual bool acelerationQ(char axis, double& radSec2);
    virtual bool baseSpeed(char axis, double radSec);
    virtual bool baseSpeedQ(char axis, double& radSec);
    virtual bool upperSpeed(char axis, double radSec);
    virtual bool upperSpeedQ(char axis, double& radSec);
    virtual bool lowerSpeed(char axis, double radSec);
    virtual bool lowerSpeedQ(char axis, double& radSec);
    virtual bool reset();
    virtual bool save();
    virtual bool restoreDefaults();
    virtual bool restoreFactoryDefaults();
    virtual bool version(char* nVersion);
    virtual void nversion(double& nVersion);
    virtual bool powerModeQ(bool transit, char& mode);
    virtual bool powerMode(bool transit, char mode);
    bool clear();
    virtual bool setLimits(char axis, double& l, double& u);
    virtual bool changeMotionDir();
    virtual int checkErrors();
    virtual void clearErrors();
    virtual bool init(const std::string& port);
    virtual void close();
    virtual double radError(char axis, double nRadMoved);
    virtual long radToPos(char axis, double nRad);
    virtual double posToRad(char axis, long nPos);
    virtual bool scan(char axis, int wait, float initial, float final, double radPre);
    virtual bool verboseQ(bool& modo);
    virtual bool verbose(bool set);
    virtual bool echoModeQ(bool& mode);
    virtual bool echoMode(bool mode);
    virtual bool resolution();
    virtual double status(double& rad);
};

Inherited Members

public:
    // structs

    struct TMsg;

    // methods

    virtual bool rangeMeasure() = 0;
    virtual bool moveToAbsPos(char axis, double nRad) = 0;
    virtual bool absPosQ(char axis, double& nRad) = 0;
    virtual bool moveToOffPos(char axis, double nRad) = 0;
    virtual bool offPosQ(char axis, double& nRad) = 0;
    virtual bool maxPosQ(char axis, double& nRad) = 0;
    virtual bool minPosQ(char axis, double& nRad) = 0;
    virtual bool enableLimitsQ(bool& enable) = 0;
    virtual bool enableLimits(bool set) = 0;
    virtual bool inmediateExecution(bool set) = 0;
    virtual bool aWait() = 0;
    virtual bool haltAll() = 0;
    virtual bool halt(char axis) = 0;
    virtual bool speed(char axis, double RadSec) = 0;
    virtual bool speedQ(char axis, double& RadSec) = 0;
    virtual bool aceleration(char axis, double RadSec2) = 0;
    virtual bool acelerationQ(char axis, double& RadSec2) = 0;
    virtual bool baseSpeed(char axis, double RadSec) = 0;
    virtual bool baseSpeedQ(char axis, double& RadSec) = 0;
    virtual bool upperSpeed(char axis, double RadSec) = 0;
    virtual bool upperSpeedQ(char axis, double& RadSec) = 0;
    virtual bool lowerSpeed(char axis, double RadSec) = 0;
    virtual bool lowerSpeedQ(char axis, double& RadSec) = 0;
    virtual bool reset() = 0;
    virtual bool save() = 0;
    virtual bool restoreDefaults() = 0;
    virtual bool restoreFactoryDefaults() = 0;
    virtual bool version(char* nVersion) = 0;
    virtual void nversion(double& nVersion) = 0;
    virtual bool powerModeQ(bool transit, char& mode) = 0;
    virtual bool powerMode(bool transit, char mode) = 0;
    virtual double status(double& rad) = 0;
    virtual bool setLimits(char axis, double& l, double& u) = 0;
    virtual bool changeMotionDir() = 0;
    virtual int checkErrors() = 0;
    virtual void clearErrors() = 0;
    virtual bool init(const std::string& port) = 0;
    virtual void close() = 0;
    virtual double radError(char axis, double nRadMoved) = 0;
    virtual long radToPos(char axis, double nRad) = 0;
    virtual double posToRad(char axis, long nPos) = 0;
    virtual bool scan(char axis, int wait, float initial, float final, double RadPre) = 0;
    virtual bool verboseQ(bool& modo) = 0;
    virtual bool verbose(bool set) = 0;
    virtual bool echoModeQ(bool& mode) = 0;
    virtual bool echoMode(bool mode) = 0;
    virtual bool resolution() = 0;

Construction

CTuMicos()

Default constructor.

Methods

virtual bool rangeMeasure()

Search limit forward.

virtual bool moveToAbsPos(char axis, double nRad)

Specification of positions in absolute terms.

virtual bool absPosQ(char axis, double& nRad)

Query position in absolute terms.

virtual bool moveToOffPos(char axis, double nRad)

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
virtual bool offPosQ(char axis, double& nRad)

Query position in relative terms.

virtual bool maxPosQ(char axis, double& nRad)

Query max movement limit of a axis in absolute terms.

virtual bool minPosQ(char axis, double& nRad)

Query min movement limit of a axis in absolute terms.

virtual bool enableLimitsQ(bool& enable)

Query if exist movement limits.

virtual bool enableLimits(bool set)

Enable/Disable movement limits.

virtual bool inmediateExecution(bool set)

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
virtual bool aWait()

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

virtual bool haltAll()

Inmediately stop all.

virtual bool halt(char axis)

Inmediately stop.

virtual bool speed(char axis, double radSec)

Specification of turn speed.

virtual bool speedQ(char axis, double& radSec)

Query turn speed.

virtual bool aceleration(char axis, double radSec2)

Specification (de/a)celeration in turn.

virtual bool acelerationQ(char axis, double& radSec2)

Query (de/a)celeration in turn.

virtual bool baseSpeed(char axis, double radSec)

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

virtual bool baseSpeedQ(char axis, double& radSec)

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

virtual bool upperSpeed(char axis, double radSec)

Specification of velocity upper limit.

virtual bool upperSpeedQ(char axis, double& radSec)

Query velocity upper limit.

virtual bool lowerSpeed(char axis, double radSec)

Specification of velocity lower limit.

virtual bool lowerSpeedQ(char axis, double& radSec)

Query velocity lower limit.

virtual bool reset()

Reset PTU to initial state.

virtual bool save()

Save or restart default values.

virtual bool restoreDefaults()

Restore default values.

virtual bool restoreFactoryDefaults()

Restore factory default values.

virtual bool version(char* nVersion)

Version and CopyRights.

virtual void nversion(double& nVersion)

Number of version.

virtual bool powerModeQ(bool transit, char& mode)

Query power mode.

virtual bool powerMode(bool transit, char mode)

Specification of power mode.

bool clear()

Clear controller internal stack.

virtual bool setLimits(char axis, double& l, double& u)

Set limits of movement.

virtual int checkErrors()

Check errors, returns 0 if there are not errors or error code otherwise.

virtual void clearErrors()

Clear errors.

virtual bool init(const std::string& port)

PTU and serial port initialization.

virtual void close()

Close Connection with serial port.

virtual double radError(char axis, double nRadMoved)

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

virtual long radToPos(char axis, double nRad)

To obtain the discrete value for a number of radians.

virtual double posToRad(char axis, long nPos)

To obtain the number of radians for a discrete value.

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.

Parameters:

<axis>

{Pan or Till}

<tWait>

{Wait time betwen commands}

<initial>

{initial position}

<final>

{final position}

<radPre>

{radians precision for the scan}

virtual bool verboseQ(bool& modo)

Query verbose mode.

virtual bool verbose(bool set)

Set verbose.

conde Example of response with FV (verbose) active: FV * PP * Current pan position is 0 Example of response with FT (terse) active: FT * PP * 0

virtual bool echoModeQ(bool& mode)

Query echo mode.

virtual bool echoMode(bool mode)

Enable/Disable echo response with command.

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

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

virtual double status(double& rad)

Check if ptu is moving.