MRPT  1.9.9
mrpt::kinematics::CVehicleSimulVirtualBase Class Referenceabstract

Detailed Description

This class can be used to simulate the kinematics and dynamics of a differential driven planar mobile robot, including odometry errors and dynamics limitations.

Main API methods are:

  • movementCommand: Call this for send a command to the robot. This comamnd will be delayed and passed throught a first order low-pass filter to simulate robot dynamics.
  • simulateInterval: Call this for run the simulator for the desired time period.

Definition at line 31 of file CVehicleSimulVirtualBase.h.

#include <mrpt/kinematics/CVehicleSimulVirtualBase.h>

Inheritance diagram for mrpt::kinematics::CVehicleSimulVirtualBase:
Inheritance graph

Public Member Functions

 CVehicleSimulVirtualBase ()
 
virtual ~CVehicleSimulVirtualBase ()
 
Kinematic simulation and control interface
void simulateOneTimeStep (const double dt)
 Runs the simulator during "dt" seconds. More...
 
const mrpt::math::TPose2DgetCurrentGTPose () const
 Returns the instantaneous, ground truth pose in world coordinates. More...
 
void setCurrentGTPose (const mrpt::math::TPose2D &pose)
 Brute-force move robot to target coordinates ("teleport") More...
 
const mrpt::math::TPose2DgetCurrentOdometricPose () const
 Returns the current pose according to (noisy) odometry. More...
 
template<typename T >
void setCurrentOdometricPose (const T &pose)
 Brute-force overwrite robot odometry. More...
 
const mrpt::math::TTwist2DgetCurrentGTVel () const
 Returns the instantaneous, ground truth velocity vector (vx,vy,omega) in world coordinates. More...
 
mrpt::math::TTwist2D getCurrentGTVelLocal () const
 Returns the instantaneous, ground truth velocity vector (vx,vy,omega) in the robot local frame. More...
 
const mrpt::math::TTwist2DgetCurrentOdometricVel () const
 Returns the instantaneous, odometric velocity vector (vx,vy,omega) in world coordinates. More...
 
mrpt::math::TTwist2D getCurrentOdometricVelLocal () const
 Returns the instantaneous, odometric velocity vector (vx,vy,omega) in the robot local frame. More...
 
double getTime () const
 Get the current simulation time. More...
 
virtual void sendVelCmd (const CVehicleVelCmd &cmd_vel)=0
 Sends a velocity command to the robot. More...
 
virtual CVehicleVelCmd::Ptr getVelCmdType () const =0
 Gets an empty velocity command object that can be queried to find out the number of velcmd components,... More...
 
void setOdometryErrors (bool enabled, double Ax_err_bias=1e-3, double Ax_err_std=10e-3, double Ay_err_bias=1e-3, double Ay_err_std=10e-3, double Aphi_err_bias=mrpt::DEG2RAD(1e-3), double Aphi_err_std=mrpt::DEG2RAD(10e-3))
 Enable/Disable odometry errors. More...
 
void resetStatus ()
 
void resetTime ()
 Reset all simulator variables to 0 (except the. More...
 

Protected Member Functions

virtual void internal_simulControlStep (const double dt)=0
 
virtual void internal_clear ()=0
 Resets all pending cmds. More...
 

Protected Attributes

double m_firmware_control_period
 The period at which the low-level controller updates velocities (Default: 0.5 ms) More...
 
bool m_use_odo_error
 Whether to corrupt odometry with noise. More...
 
double m_Ax_err_bias
 
double m_Ax_err_std
 
double m_Ay_err_bias
 
double m_Ay_err_std
 
double m_Aphi_err_bias
 
double m_Aphi_err_std
 
State vector
double m_time
 simulation running time More...
 
mrpt::math::TPose2D m_GT_pose
 ground truth pose in world coordinates. More...
 
mrpt::math::TTwist2D m_GT_vel
 Velocity in (x,y,omega) More...
 
mrpt::math::TTwist2D m_odometric_vel
 Velocity in (x,y,omega) More...
 
mrpt::math::TPose2D m_odometry
 

Constructor & Destructor Documentation

◆ CVehicleSimulVirtualBase()

CVehicleSimulVirtualBase::CVehicleSimulVirtualBase ( )

Definition at line 18 of file CVehicleSimulVirtualBase.cpp.

◆ ~CVehicleSimulVirtualBase()

CVehicleSimulVirtualBase::~CVehicleSimulVirtualBase ( )
virtual

Definition at line 23 of file CVehicleSimulVirtualBase.cpp.

Member Function Documentation

◆ getCurrentGTPose()

const mrpt::math::TPose2D& mrpt::kinematics::CVehicleSimulVirtualBase::getCurrentGTPose ( ) const
inline

◆ getCurrentGTVel()

const mrpt::math::TTwist2D& mrpt::kinematics::CVehicleSimulVirtualBase::getCurrentGTVel ( ) const
inline

Returns the instantaneous, ground truth velocity vector (vx,vy,omega) in world coordinates.

Definition at line 63 of file CVehicleSimulVirtualBase.h.

References m_GT_vel.

Referenced by mrpt::nav::CRobot2NavInterfaceForSimulator_Holo::getCurrentPoseAndSpeeds(), and mrpt::nav::CRobot2NavInterfaceForSimulator_DiffDriven::getCurrentPoseAndSpeeds().

◆ getCurrentGTVelLocal()

mrpt::math::TTwist2D CVehicleSimulVirtualBase::getCurrentGTVelLocal ( ) const

Returns the instantaneous, ground truth velocity vector (vx,vy,omega) in the robot local frame.

Definition at line 89 of file CVehicleSimulVirtualBase.cpp.

References m_GT_pose, m_GT_vel, mrpt::math::TPose2D::phi, and mrpt::math::TTwist2D::rotate().

◆ getCurrentOdometricPose()

const mrpt::math::TPose2D& mrpt::kinematics::CVehicleSimulVirtualBase::getCurrentOdometricPose ( ) const
inline

◆ getCurrentOdometricVel()

const mrpt::math::TTwist2D& mrpt::kinematics::CVehicleSimulVirtualBase::getCurrentOdometricVel ( ) const
inline

Returns the instantaneous, odometric velocity vector (vx,vy,omega) in world coordinates.

Definition at line 70 of file CVehicleSimulVirtualBase.h.

References m_odometric_vel.

◆ getCurrentOdometricVelLocal()

mrpt::math::TTwist2D CVehicleSimulVirtualBase::getCurrentOdometricVelLocal ( ) const

Returns the instantaneous, odometric velocity vector (vx,vy,omega) in the robot local frame.

Definition at line 96 of file CVehicleSimulVirtualBase.cpp.

References m_odometric_vel, m_odometry, mrpt::math::TPose2D::phi, and mrpt::math::TTwist2D::rotate().

Referenced by simulateOneTimeStep().

◆ getTime()

◆ getVelCmdType()

virtual CVehicleVelCmd::Ptr mrpt::kinematics::CVehicleSimulVirtualBase::getVelCmdType ( ) const
pure virtual

Gets an empty velocity command object that can be queried to find out the number of velcmd components,...

Implemented in mrpt::kinematics::CVehicleSimul_DiffDriven, and mrpt::kinematics::CVehicleSimul_Holo.

◆ internal_clear()

virtual void mrpt::kinematics::CVehicleSimulVirtualBase::internal_clear ( )
protectedpure virtual

Resets all pending cmds.

Implemented in mrpt::kinematics::CVehicleSimul_DiffDriven, and mrpt::kinematics::CVehicleSimul_Holo.

Referenced by resetStatus().

◆ internal_simulControlStep()

virtual void mrpt::kinematics::CVehicleSimulVirtualBase::internal_simulControlStep ( const double  dt)
protectedpure virtual

◆ resetStatus()

◆ resetTime()

void CVehicleSimulVirtualBase::resetTime ( )

Reset all simulator variables to 0 (except the.

simulation time).

See also
resetTime Reset time counter
resetStatus

Definition at line 88 of file CVehicleSimulVirtualBase.cpp.

References m_time.

Referenced by mrpt::kinematics::CVehicleSimul_DiffDriven::CVehicleSimul_DiffDriven(), and mrpt::kinematics::CVehicleSimul_Holo::CVehicleSimul_Holo().

◆ sendVelCmd()

virtual void mrpt::kinematics::CVehicleSimulVirtualBase::sendVelCmd ( const CVehicleVelCmd cmd_vel)
pure virtual

Sends a velocity command to the robot.

The number of components and their meaning depends on the vehicle-kinematics derived class

Implemented in mrpt::kinematics::CVehicleSimul_DiffDriven, and mrpt::kinematics::CVehicleSimul_Holo.

◆ setCurrentGTPose()

void CVehicleSimulVirtualBase::setCurrentGTPose ( const mrpt::math::TPose2D pose)

Brute-force move robot to target coordinates ("teleport")

Definition at line 24 of file CVehicleSimulVirtualBase.cpp.

References m_GT_pose.

◆ setCurrentOdometricPose()

template<typename T >
void mrpt::kinematics::CVehicleSimulVirtualBase::setCurrentOdometricPose ( const T &  pose)
inline

Brute-force overwrite robot odometry.

Definition at line 56 of file CVehicleSimulVirtualBase.h.

References m_odometry.

◆ setOdometryErrors()

void mrpt::kinematics::CVehicleSimulVirtualBase::setOdometryErrors ( bool  enabled,
double  Ax_err_bias = 1e-3,
double  Ax_err_std = 10e-3,
double  Ay_err_bias = 1e-3,
double  Ay_err_std = 10e-3,
double  Aphi_err_bias = mrpt::DEG2RAD(1e-3),
double  Aphi_err_std = mrpt::DEG2RAD(10e-3) 
)
inline

Enable/Disable odometry errors.

Errors in odometry are 1 sigma Gaussian values per second

Definition at line 90 of file CVehicleSimulVirtualBase.h.

References m_Aphi_err_bias, m_Aphi_err_std, m_Ax_err_bias, m_Ax_err_std, m_Ay_err_bias, m_Ay_err_std, and m_use_odo_error.

◆ simulateOneTimeStep()

Member Data Documentation

◆ m_Aphi_err_bias

double mrpt::kinematics::CVehicleSimulVirtualBase::m_Aphi_err_bias
protected

Definition at line 133 of file CVehicleSimulVirtualBase.h.

Referenced by setOdometryErrors(), and simulateOneTimeStep().

◆ m_Aphi_err_std

double mrpt::kinematics::CVehicleSimulVirtualBase::m_Aphi_err_std
protected

Definition at line 133 of file CVehicleSimulVirtualBase.h.

Referenced by setOdometryErrors(), and simulateOneTimeStep().

◆ m_Ax_err_bias

double mrpt::kinematics::CVehicleSimulVirtualBase::m_Ax_err_bias
protected

Definition at line 131 of file CVehicleSimulVirtualBase.h.

Referenced by setOdometryErrors(), and simulateOneTimeStep().

◆ m_Ax_err_std

double mrpt::kinematics::CVehicleSimulVirtualBase::m_Ax_err_std
protected

Definition at line 131 of file CVehicleSimulVirtualBase.h.

Referenced by setOdometryErrors(), and simulateOneTimeStep().

◆ m_Ay_err_bias

double mrpt::kinematics::CVehicleSimulVirtualBase::m_Ay_err_bias
protected

Definition at line 132 of file CVehicleSimulVirtualBase.h.

Referenced by setOdometryErrors(), and simulateOneTimeStep().

◆ m_Ay_err_std

double mrpt::kinematics::CVehicleSimulVirtualBase::m_Ay_err_std
protected

Definition at line 132 of file CVehicleSimulVirtualBase.h.

Referenced by setOdometryErrors(), and simulateOneTimeStep().

◆ m_firmware_control_period

double mrpt::kinematics::CVehicleSimulVirtualBase::m_firmware_control_period
protected

The period at which the low-level controller updates velocities (Default: 0.5 ms)

Definition at line 127 of file CVehicleSimulVirtualBase.h.

Referenced by simulateOneTimeStep().

◆ m_GT_pose

mrpt::math::TPose2D mrpt::kinematics::CVehicleSimulVirtualBase::m_GT_pose
protected

ground truth pose in world coordinates.

Definition at line 118 of file CVehicleSimulVirtualBase.h.

Referenced by getCurrentGTPose(), getCurrentGTVelLocal(), resetStatus(), setCurrentGTPose(), and simulateOneTimeStep().

◆ m_GT_vel

mrpt::math::TTwist2D mrpt::kinematics::CVehicleSimulVirtualBase::m_GT_vel
protected

Velocity in (x,y,omega)

Definition at line 120 of file CVehicleSimulVirtualBase.h.

Referenced by getCurrentGTVel(), getCurrentGTVelLocal(), resetStatus(), and simulateOneTimeStep().

◆ m_odometric_vel

◆ m_odometry

◆ m_time

◆ m_use_odo_error

bool mrpt::kinematics::CVehicleSimulVirtualBase::m_use_odo_error
protected

Whether to corrupt odometry with noise.

Definition at line 130 of file CVehicleSimulVirtualBase.h.

Referenced by setOdometryErrors(), and simulateOneTimeStep().




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020