class mrpt::nav::CRobot2NavInterfaceForSimulator_Holo

Overview

CRobot2NavInterface implemented for a simulator object based on mrpt::kinematics::CVehicleSimul_Holo.

Only senseObstacles() remains virtual for the user to implement it.

See also:

CReactiveNavigationSystem, CAbstractNavigator, mrpt::kinematics::CVehicleSimulVirtualBase

#include <mrpt/nav/reactive/CRobot2NavInterfaceForSimulator.h>

class CRobot2NavInterfaceForSimulator_Holo: public mrpt::nav::CRobot2NavInterface
{
public:
    // construction

    CRobot2NavInterfaceForSimulator_Holo(mrpt::kinematics::CVehicleSimul_Holo& simul);

    // methods

    virtual bool getCurrentPoseAndSpeeds(
        mrpt::math::TPose2D& curPose,
        mrpt::math::TTwist2D& curVelGlobal,
        mrpt::system::TTimeStamp& timestamp,
        mrpt::math::TPose2D& curOdometry,
        std::string& frame_id
        );

    virtual bool changeSpeeds(const mrpt::kinematics::CVehicleVelCmd& vel_cmd);
    virtual bool stop(bool isEmergencyStop);
    virtual mrpt::kinematics::CVehicleVelCmd::Ptr getEmergencyStopCmd();
    virtual mrpt::kinematics::CVehicleVelCmd::Ptr getStopCmd();
    virtual mrpt::kinematics::CVehicleVelCmd::Ptr getAlignCmd(const double relative_heading_radians);
    virtual double getNavigationTime();
    virtual void resetNavigationTimer();
};

Inherited Members

public:
    // structs

    struct TMsg;

    // methods

    virtual void sendNavigationStartEvent();
    virtual void sendNavigationEndEvent();
    virtual void sendWaypointReachedEvent(int waypoint_index, bool reached_nSkipped);
    virtual void sendNewWaypointTargetEvent(int waypoint_index);
    virtual void sendNavigationEndDueToErrorEvent();
    virtual void sendWaySeemsBlockedEvent();
    virtual void sendApparentCollisionEvent();
    virtual void sendCannotGetCloserToBlockedTargetEvent();

    virtual bool getCurrentPoseAndSpeeds(
        mrpt::math::TPose2D& curPose,
        mrpt::math::TTwist2D& curVelGlobal,
        mrpt::system::TTimeStamp& timestamp,
        mrpt::math::TPose2D& curOdometry,
        std::string& frame_id
        ) = 0;

    virtual bool changeSpeeds(const mrpt::kinematics::CVehicleVelCmd& vel_cmd) = 0;
    virtual bool changeSpeedsNOP();
    virtual bool stop(bool isEmergencyStop = true) = 0;
    virtual mrpt::kinematics::CVehicleVelCmd::Ptr getEmergencyStopCmd() = 0;
    virtual mrpt::kinematics::CVehicleVelCmd::Ptr getStopCmd() = 0;
    virtual mrpt::kinematics::CVehicleVelCmd::Ptr getAlignCmd(const double relative_heading_radians);
    virtual bool startWatchdog(float T_ms);
    virtual bool stopWatchdog();
    virtual bool senseObstacles(mrpt::maps::CSimplePointsMap& obstacles, mrpt::system::TTimeStamp& timestamp) = 0;
    virtual double getNavigationTime();
    virtual void resetNavigationTimer();

Methods

virtual bool getCurrentPoseAndSpeeds(
    mrpt::math::TPose2D& curPose,
    mrpt::math::TTwist2D& curVelGlobal,
    mrpt::system::TTimeStamp& timestamp,
    mrpt::math::TPose2D& curOdometry,
    std::string& frame_id
    )

Get the current pose and velocity of the robot.

The implementation should not take too much time to return, so if it might take more than ~10ms to ask the robot for the instantaneous data, it may be good enough to return the latest values from a cache which is updated in a parallel thread.

Returns:

false on any error retrieving these values from the robot.

virtual bool changeSpeeds(const mrpt::kinematics::CVehicleVelCmd& vel_cmd)

Sends a velocity command to the robot.

The number components in each command depends on children classes of mrpt::kinematics::CVehicleVelCmd. One robot may accept one or more different CVehicleVelCmd classes. This method resets the watchdog timer (that may be or may be not implemented in a particular robotic platform) started with startWatchdog()

Returns:

false on any error.

See also:

startWatchdog

virtual bool stop(bool isEmergencyStop)

Stop the robot right now.

Parameters:

isEmergencyStop

true if stop is due to some unexpected error. false if “stop” happens as part of a normal operation (e.g. target reached).

Returns:

false on any error.

virtual mrpt::kinematics::CVehicleVelCmd::Ptr getEmergencyStopCmd()

Gets the emergency stop command for the current robot.

Returns:

the emergency stop command

virtual mrpt::kinematics::CVehicleVelCmd::Ptr getStopCmd()

Gets the emergency stop command for the current robot.

Returns:

the emergency stop command

virtual mrpt::kinematics::CVehicleVelCmd::Ptr getAlignCmd(const double relative_heading_radians)

Gets a motion command to make the robot to align with a given relative heading, without translating.

Only for circular robots that can rotate in place; otherwise, return an empty smart pointer to indicate that the operation is not possible (this is what the default implementation does).

virtual double getNavigationTime()

See CRobot2NavInterface::getNavigationTime().

In this class, simulation time is returned instead of wall-clock time.

virtual void resetNavigationTimer()

See CRobot2NavInterface::resetNavigationTimer()