Main MRPT website > C++ reference
MRPT logo
Classes | Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

mrpt::hwdrivers::CRovio Class Reference


Detailed Description

A class to interface a Rovio robot (manufactured by WowWee).

Supports: Simple motion commands, video streaming.

Definition at line 52 of file CRovio.h.

#include <mrpt/hwdrivers/CRovio.h>

List of all members.

Classes

struct  TEncoders
struct  TOptions
struct  TRovioState

Public Types

enum  status {
  idle, driving_home, docking, executing_path,
  recording_path
}

Public Member Functions

void initialize ()
 Establish conection with Rovio and log in its system: Important, fill out "options" members *BEFORE* calling this method.
bool move (char direction, int speed=5)
 move send Rovio the command to move in the specified direcction
bool rotate (char direction, int speed=5)
 rotate send Rovio the command to rotate in the specified direcction 'r'->right, 'l'->left
bool takeHeadUp ()
 Head positions.
bool takeHeadMiddle ()
bool takeHeadDown ()
bool pathRecord ()
bool pathRecordAbort ()
bool pathRecordSave (const string &path_name)
bool pathDelete (const string &path_name)
bool pathGetList (string &path_list)
 Get list of saved paths.
bool pathRunForward ()
bool pathRunBackward ()
bool pathRunStop ()
bool pathRunPause ()
bool pathRename (const string &old_name, const string &new_name)
bool goHome (bool dock, int speed=5)
 goHome(bool dock) drives Rovio in front of charging station if the paremeter dock is set to false, otherwise it also docks
void loadConfig (const mrpt::utils::CConfigFileBase &configSource, const std::string &section)
 Loads the rovio camera calibration parameters (of leave the default ones if not found) (See CGenericSensor), then call to "loadConfig_sensorSpecific"

Exceptions:
Thismethod throws an exception with a descriptive message if some critical parameter is missing or has an invalid value.

bool retrieve_video ()
 This function launchs a thread with the function "thread_video()" which gets frames into a buffer.
bool stop_video ()
 This function stops and joins the thread launched by "retrieve_video()".
bool getNextImageSync (CObservationImagePtr &lastImage)
 Returns the next frame from Rovio's live video stream, after starting the live streaming with retrieve_video()
bool captureImageAsync (CImage &out_img, bool recttified)
 Returns a snapshot from Rovio, if rectified is set true, the returned image is rectified with the parameters of intrinsic_matrix and distortion_matrix.
bool isVideoStreamming () const
 Return true if video is streaming correctly.
bool getRovioState (TRovioState &state)
 Returns a TRovioState with internal information of Rovio (State, Navigation Signal Strength, Wifi Signal Strength)
bool getEncoders (TEncoders &encoders)
 Returns a TEncoders with information of Rovio encoders (since last read, it seems Rovio is continuously reading with unknown sample time)
bool getPosition (mrpt::math::TPose2D &out_pose)
 Returns the Rovio's pose.
 CRovio ()
virtual ~CRovio ()

Public Attributes

struct
mrpt::hwdrivers::CRovio::TOptions 
options
struct
mrpt::hwdrivers::CRovio::TEncoders 
encoders

Private Member Functions

void thread_video ()
 This function takes a frame and waits until getLastImage ask for it, and so on.
bool send_cmd_action (int act, int speed)
bool path_management (int act)
bool path_management (int act, const string &path_name)
bool general_command (int act, string &response, string &errormsg)

Private Attributes

mrpt::system::TThreadHandle m_videoThread
bool m_videothread_must_exit
bool m_videothread_initialized_done
bool m_videothread_initialized_error
bool m_videothread_finished
mrpt::slam::CObservationImagePtr buffer_img
mrpt::synch::CCriticalSection buffer_img_cs

Member Enumeration Documentation

Enumerator:
idle 
driving_home 
docking 
executing_path 
recording_path 

Definition at line 90 of file CRovio.h.


Constructor & Destructor Documentation

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

Member Function Documentation

bool mrpt::hwdrivers::CRovio::captureImageAsync ( CImage out_img,
bool  recttified 
)

Returns a snapshot from Rovio, if rectified is set true, the returned image is rectified with the parameters of intrinsic_matrix and distortion_matrix.

This function works asynchronously and does not need to have enabled the live video streaming.

Returns:
False on error
See also:
captureImageSync
bool mrpt::hwdrivers::CRovio::general_command ( int  act,
string &  response,
string &  errormsg 
) [private]
bool mrpt::hwdrivers::CRovio::getEncoders ( TEncoders encoders)

Returns a TEncoders with information of Rovio encoders (since last read, it seems Rovio is continuously reading with unknown sample time)

Returns:
False on error
bool mrpt::hwdrivers::CRovio::getNextImageSync ( CObservationImagePtr lastImage)

Returns the next frame from Rovio's live video stream, after starting the live streaming with retrieve_video()

Returns:
False on error
See also:
retrieve_video, captureImageAsync
bool mrpt::hwdrivers::CRovio::getPosition ( mrpt::math::TPose2D out_pose)

Returns the Rovio's pose.

Returns:
False on error
bool mrpt::hwdrivers::CRovio::getRovioState ( TRovioState state)

Returns a TRovioState with internal information of Rovio (State, Navigation Signal Strength, Wifi Signal Strength)

Returns:
False on error
bool mrpt::hwdrivers::CRovio::goHome ( bool  dock,
int  speed = 5 
)

goHome(bool dock) drives Rovio in front of charging station if the paremeter dock is set to false, otherwise it also docks

Returns:
False on error
void mrpt::hwdrivers::CRovio::initialize ( )

Establish conection with Rovio and log in its system: Important, fill out "options" members *BEFORE* calling this method.

Exceptions:
std::runtimeOn errors
bool mrpt::hwdrivers::CRovio::isVideoStreamming ( ) const

Return true if video is streaming correctly.

See also:
retrieve_video
void mrpt::hwdrivers::CRovio::loadConfig ( const mrpt::utils::CConfigFileBase configSource,
const std::string &  section 
)

Loads the rovio camera calibration parameters (of leave the default ones if not found) (See CGenericSensor), then call to "loadConfig_sensorSpecific"

Exceptions:
Thismethod throws an exception with a descriptive message if some critical parameter is missing or has an invalid value.

bool mrpt::hwdrivers::CRovio::move ( char  direction,
int  speed = 5 
)

move send Rovio the command to move in the specified direcction

Parameters:
direction'f'->forward, 'b'->backward, 'r'->right, 'l'->left
Returns:
False on error
bool mrpt::hwdrivers::CRovio::path_management ( int  act) [private]
bool mrpt::hwdrivers::CRovio::path_management ( int  act,
const string &  path_name 
) [private]
bool mrpt::hwdrivers::CRovio::pathDelete ( const string &  path_name)
bool mrpt::hwdrivers::CRovio::pathGetList ( string &  path_list)

Get list of saved paths.

bool mrpt::hwdrivers::CRovio::pathRecord ( )
bool mrpt::hwdrivers::CRovio::pathRecordAbort ( )
bool mrpt::hwdrivers::CRovio::pathRecordSave ( const string &  path_name)
bool mrpt::hwdrivers::CRovio::pathRename ( const string &  old_name,
const string &  new_name 
)
bool mrpt::hwdrivers::CRovio::pathRunBackward ( )
bool mrpt::hwdrivers::CRovio::pathRunForward ( )
bool mrpt::hwdrivers::CRovio::pathRunPause ( )
bool mrpt::hwdrivers::CRovio::pathRunStop ( )
bool mrpt::hwdrivers::CRovio::retrieve_video ( )

This function launchs a thread with the function "thread_video()" which gets frames into a buffer.

After calling this method, images can be obtained with getNextImageSync()

Returns:
False on error
See also:
getNextImageSync
bool mrpt::hwdrivers::CRovio::rotate ( char  direction,
int  speed = 5 
)

rotate send Rovio the command to rotate in the specified direcction 'r'->right, 'l'->left

Returns:
False on error
bool mrpt::hwdrivers::CRovio::send_cmd_action ( int  act,
int  speed 
) [private]
bool mrpt::hwdrivers::CRovio::stop_video ( )

This function stops and joins the thread launched by "retrieve_video()".

Returns:
False on error
bool mrpt::hwdrivers::CRovio::takeHeadDown ( )
bool mrpt::hwdrivers::CRovio::takeHeadMiddle ( )
bool mrpt::hwdrivers::CRovio::takeHeadUp ( )

Head positions.

Returns:
False on error
void mrpt::hwdrivers::CRovio::thread_video ( ) [private]

This function takes a frame and waits until getLastImage ask for it, and so on.


Member Data Documentation

Definition at line 61 of file CRovio.h.

Definition at line 62 of file CRovio.h.

Definition at line 55 of file CRovio.h.

Definition at line 59 of file CRovio.h.

Definition at line 57 of file CRovio.h.

Definition at line 58 of file CRovio.h.

Definition at line 56 of file CRovio.h.




Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:40:17 UTC 2011