MRPT logo

mrpt::hwdrivers::CActivMediaRobotBase Class Reference

This software driver implements the communications (and some rudimentary control) for ActivMedia robotic bases (Pioneer DX/AT, PeopleBot, etc). More...

#include <mrpt/hwdrivers/CActivMediaRobotBase.h>

Inheritance diagram for mrpt::hwdrivers::CActivMediaRobotBase:

mrpt::hwdrivers::CGenericSensor mrpt::utils::CUncopiable

List of all members.

Classes

struct  TRobotDescription
 A structure describing the robot. More...

Public Member Functions

void initialize ()
 Connects to the robot.
 CActivMediaRobotBase ()
 Constructor.
virtual ~CActivMediaRobotBase ()
 Destructor: turns off communications.
void loadConfig (const mrpt::utils::CConfigFileBase &configSource, const std::string &iniSection)
 Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes) See hwdrivers::CActivMediaRobotBase for the possible parameters.
void setSerialPortConfig (const std::string &portName, int portBaudRate)
 Manually sets the serial port configuration.
std::string getSerialPort () const
 Returns the current value of the serial port.
int getSerialPortBaudRate () const
 Returns the current value of the serial port baudrate.
void doProcess ()
 Collect odometry readings and put them in the "observations" queue: DO NOT call this normally, it's useful only for the application rawloggrabber.
void changeOdometry (const mrpt::poses::CPose2D &newOdometry)
 Change the current robot odometry pose.
void getOdometry (poses::CPose2D &out_odom)
 Get the current robot's odometry.
void getOdometryFull (poses::CPose2D &out_odom, double &out_lin_vel, double &out_ang_vel, int64_t &out_left_encoder_ticks, int64_t &out_right_encoder_ticks)
 Get the current robot's odometry.
void getOdometryIncrement (poses::CPose2D &out_incr_odom, double &out_lin_vel, double &out_ang_vel, int64_t &out_incr_left_encoder_ticks, int64_t &out_incr_right_encoder_ticks)
 Get the robot's odometry increment since the last call to this method (the first time the increments are always fixed to zero).
void getSonarsReadings (bool &thereIsObservation, mrpt::slam::CObservationRange &obs)
 Get the readings from the sonars, only if the observations are new.
void getBatteryCharge (double &out_batery_volts)
 Get the robot battery charge.
void setVelocities (const double lin_vel, const double ang_vel)
 Set the robot linear and angular velocities.
void enableSonars ()
 Enable sonars.
void disableSonars ()
 Disable sonars.
void getBumpers (vector_bool &bumper_state)
 Get state of bumpers: at output, the vector will be resized to the number of bumpers, and elements with "true" means bumper is pressed.
void getRobotInformation (TRobotDescription &info)
 Get information about the robot and its sensors.

Protected Member Functions

void disconnectAndDisableMotors ()
void connectAndEnableMotors ()

Protected Attributes

std::string m_com_port
 The serial port name to use for communications (COM1, ttyS1,...).
int m_robotBaud
 The bauds for ARIA communications to the robot.
bool m_firstIncreOdometry
 Used in getOdometryIncrement.
bool m_enableSonars
void * m_robot
void * m_sonarDev
void * m_simpleConnector
 The connection to the robot.
unsigned int m_lastTimeSonars
bool m_enableJoyControl
 For use with rawlog-grabber.
float m_joy_max_v
float m_joy_max_w
CJoystick m_joystick
 The joystick opened at first usage.
mrpt::system::TTimeStamp m_last_do_process
double m_capture_rate
 In Hz, the rate at which sonars & odometry are gathered (default=10Hz).


Detailed Description

This software driver implements the communications (and some rudimentary control) for ActivMedia robotic bases (Pioneer DX/AT, PeopleBot, etc).

There is implemented access to robot odometry, ticks counts, velocities, battery charge status, and sonar readings, as well as basic velocity control.

It is required to check MRPT_BUILD_ARIA in the cmake configuration to enable this class to work properly.

See also the application "rawlog-grabber" for a ready-to-use application to gather data from the robot base. Through that "common sensor interface", this object can collect these kinds of observations:

To use this class out of rawlog-grabber, "initialize" must be called to connect to the robot. Before that, set the serial port with setSerialPortConfig.

Example .ini block for rawlog-grabber (format used in "loadConfig"):

  PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
 -------------------------------------------------------
   [supplied_section_name]
    robotPort_WIN               = COM1
    robotPort_LIN               = /dev/ttyUSB0
    robotBaud                   = 115200
    enableSonars         = 0     ; 0:Disabled (default), 1: Enabled
    capture_rate         = 10.0  ; In Hz, the rate at which sonars & odometry are gathered (default=10Hz)

    joystick_control            = 0             ; 0:Disabled (default), 1: Enabled
    joystick_max_v              = 0.1   ; Max joystick control speed (m/s)
           joystick_max_w_degps = 20    ; Max joystick control speed (deg/s)

Definition at line 75 of file CActivMediaRobotBase.h.


Constructor & Destructor Documentation

mrpt::hwdrivers::CActivMediaRobotBase::CActivMediaRobotBase (  ) 

Constructor.

virtual mrpt::hwdrivers::CActivMediaRobotBase::~CActivMediaRobotBase (  )  [virtual]

Destructor: turns off communications.


Member Function Documentation

void mrpt::hwdrivers::CActivMediaRobotBase::changeOdometry ( const mrpt::poses::CPose2D newOdometry  ) 

Change the current robot odometry pose.

void mrpt::hwdrivers::CActivMediaRobotBase::connectAndEnableMotors (  )  [protected]

void mrpt::hwdrivers::CActivMediaRobotBase::disableSonars (  ) 

Disable sonars.

void mrpt::hwdrivers::CActivMediaRobotBase::disconnectAndDisableMotors (  )  [protected]

void mrpt::hwdrivers::CActivMediaRobotBase::doProcess (  )  [virtual]

Collect odometry readings and put them in the "observations" queue: DO NOT call this normally, it's useful only for the application rawloggrabber.

Implements mrpt::hwdrivers::CGenericSensor.

void mrpt::hwdrivers::CActivMediaRobotBase::enableSonars (  ) 

Enable sonars.

void mrpt::hwdrivers::CActivMediaRobotBase::getBatteryCharge ( double &  out_batery_volts  ) 

Get the robot battery charge.

void mrpt::hwdrivers::CActivMediaRobotBase::getBumpers ( vector_bool bumper_state  ) 

Get state of bumpers: at output, the vector will be resized to the number of bumpers, and elements with "true" means bumper is pressed.

void mrpt::hwdrivers::CActivMediaRobotBase::getOdometry ( poses::CPose2D out_odom  ) 

Get the current robot's odometry.

Parameters:
out_odom The odometry will be returned here.
See also:
getOdometryFull, getOdometryIncrement

void mrpt::hwdrivers::CActivMediaRobotBase::getOdometryFull ( poses::CPose2D out_odom,
double &  out_lin_vel,
double &  out_ang_vel,
int64_t &  out_left_encoder_ticks,
int64_t &  out_right_encoder_ticks 
)

Get the current robot's odometry.

Parameters:
out_odom The odometry will be returned here.
out_lin_vel The linear speed, in m/s, positive is forward.
out_ang_vel The angular speed, in rad/s, positive is anticlockwise.
out_left_encoder_ticks The current overall count of ticks for the left wheel encoder.
out_right_encoder_ticks The current overall count of ticks for the right wheel encoder.
See also:
getOdometry, getOdometryIncrement

void mrpt::hwdrivers::CActivMediaRobotBase::getOdometryIncrement ( poses::CPose2D out_incr_odom,
double &  out_lin_vel,
double &  out_ang_vel,
int64_t &  out_incr_left_encoder_ticks,
int64_t &  out_incr_right_encoder_ticks 
)

Get the robot's odometry increment since the last call to this method (the first time the increments are always fixed to zero).

Parameters:
out_odom The odometry increment.
out_lin_vel The current linear speed, in m/s, positive is forward (Absolute values, not increments)
out_ang_vel The angular speed, in rad/s, positive is anticlockwise (Absolute values, not increments).
out_left_encoder_ticks The increment in ticks for the left wheel encoder.
out_right_encoder_ticks The increment in ticks for the right wheel encoder.
See also:
getOdometry, getOdometryFull

void mrpt::hwdrivers::CActivMediaRobotBase::getRobotInformation ( TRobotDescription info  ) 

Get information about the robot and its sensors.

std::string mrpt::hwdrivers::CActivMediaRobotBase::getSerialPort (  )  const [inline]

Returns the current value of the serial port.

Definition at line 118 of file CActivMediaRobotBase.h.

int mrpt::hwdrivers::CActivMediaRobotBase::getSerialPortBaudRate (  )  const [inline]

Returns the current value of the serial port baudrate.

Definition at line 121 of file CActivMediaRobotBase.h.

void mrpt::hwdrivers::CActivMediaRobotBase::getSonarsReadings ( bool &  thereIsObservation,
mrpt::slam::CObservationRange obs 
)

Get the readings from the sonars, only if the observations are new.

void mrpt::hwdrivers::CActivMediaRobotBase::initialize (  )  [virtual]

Connects to the robot.

Reimplemented from mrpt::hwdrivers::CGenericSensor.

void mrpt::hwdrivers::CActivMediaRobotBase::loadConfig ( const mrpt::utils::CConfigFileBase configSource,
const std::string &  iniSection 
) [virtual]

Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes) See hwdrivers::CActivMediaRobotBase for the possible parameters.

See also:
setSerialPortConfig

Implements mrpt::hwdrivers::CGenericSensor.

void mrpt::hwdrivers::CActivMediaRobotBase::setSerialPortConfig ( const std::string &  portName,
int  portBaudRate 
)

Manually sets the serial port configuration.

Parameters:
portName Examples: Windows: "COM1" , Linux: "/dev/ttyUSB0"
portBaudRate 9600, 115200, etc..
See also:
loadConfig

void mrpt::hwdrivers::CActivMediaRobotBase::setVelocities ( const double  lin_vel,
const double  ang_vel 
)

Set the robot linear and angular velocities.

Parameters:
lin_vel Linear speed, in m/s.
ang_vel Angular speed, in rad/s.


Member Data Documentation

In Hz, the rate at which sonars & odometry are gathered (default=10Hz).

Definition at line 210 of file CActivMediaRobotBase.h.

The serial port name to use for communications (COM1, ttyS1,...).

Definition at line 192 of file CActivMediaRobotBase.h.

For use with rawlog-grabber.

Definition at line 204 of file CActivMediaRobotBase.h.

Definition at line 196 of file CActivMediaRobotBase.h.

Used in getOdometryIncrement.

Definition at line 195 of file CActivMediaRobotBase.h.

Definition at line 205 of file CActivMediaRobotBase.h.

Definition at line 205 of file CActivMediaRobotBase.h.

The joystick opened at first usage.

Definition at line 207 of file CActivMediaRobotBase.h.

Definition at line 209 of file CActivMediaRobotBase.h.

Definition at line 202 of file CActivMediaRobotBase.h.

Definition at line 198 of file CActivMediaRobotBase.h.

The bauds for ARIA communications to the robot.

Definition at line 193 of file CActivMediaRobotBase.h.

The connection to the robot.

Definition at line 200 of file CActivMediaRobotBase.h.

Definition at line 199 of file CActivMediaRobotBase.h.




Page generated by Doxygen 1.5.9 for MRPT 0.7.1 SVN: at Mon Aug 17 22:32:05 EDT 2009