Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | 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 30 of file CRovio.h.

#include <mrpt/hwdrivers/CRovio.h>

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. More...
 
bool move (char direction, int speed=5)
 move send Rovio the command to move in the specified direcction More...
 
bool rotate (char direction, int speed=5)
 rotate send Rovio the command to rotate in the specified direcction 'r'->right, 'l'->left More...
 
bool takeHeadUp ()
 Head positions. More...
 
bool takeHeadMiddle ()
 
bool takeHeadDown ()
 
bool pathRecord ()
 
bool pathRecordAbort ()
 
bool pathRecordSave (const std::string &path_name)
 
bool pathDelete (const std::string &path_name)
 
bool pathGetList (std::string &path_list)
 Get list of saved paths. More...
 
bool pathRunForward ()
 
bool pathRunBackward ()
 
bool pathRunStop ()
 
bool pathRunPause ()
 
bool pathRename (const std::string &old_name, const std::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 More...
 
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". More...
 
bool retrieve_video ()
 This function launchs a thread with the function "thread_video()" which gets frames into a buffer. More...
 
bool stop_video ()
 This function stops and joins the thread launched by "retrieve_video()". More...
 
bool getNextImageSync (mrpt::obs::CObservationImagePtr &lastImage)
 Returns the next frame from Rovio's live video stream, after starting the live streaming with retrieve_video() More...
 
bool captureImageAsync (mrpt::utils::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. More...
 
bool isVideoStreamming () const
 Return true if video is streaming correctly. More...
 
bool getRovioState (TRovioState &state)
 Returns a TRovioState with internal information of Rovio (State, Navigation Signal Strength, Wifi Signal Strength) More...
 
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) More...
 
bool getPosition (mrpt::math::TPose2D &out_pose)
 Returns the Rovio's pose. More...
 
 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. More...
 
bool send_cmd_action (int act, int speed)
 
bool path_management (int act)
 
bool path_management (int act, const std::string &path_name)
 
bool general_command (int act, std::string &response, std::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::obs::CObservationImagePtr buffer_img
 
mrpt::synch::CCriticalSection buffer_img_cs
 

Member Enumeration Documentation

◆ status

Enumerator
idle 
driving_home 
docking 
executing_path 
recording_path 

Definition at line 68 of file CRovio.h.

Constructor & Destructor Documentation

◆ CRovio()

mrpt::hwdrivers::CRovio::CRovio ( )

◆ ~CRovio()

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

Member Function Documentation

◆ captureImageAsync()

bool mrpt::hwdrivers::CRovio::captureImageAsync ( mrpt::utils::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

◆ general_command()

bool mrpt::hwdrivers::CRovio::general_command ( int  act,
std::string &  response,
std::string &  errormsg 
)
private

◆ getEncoders()

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

◆ getNextImageSync()

bool mrpt::hwdrivers::CRovio::getNextImageSync ( mrpt::obs::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

◆ getPosition()

bool mrpt::hwdrivers::CRovio::getPosition ( mrpt::math::TPose2D out_pose)

Returns the Rovio's pose.

Returns
False on error

◆ getRovioState()

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

◆ goHome()

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

◆ initialize()

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

◆ isVideoStreamming()

bool mrpt::hwdrivers::CRovio::isVideoStreamming ( ) const

Return true if video is streaming correctly.

See also
retrieve_video

◆ loadConfig()

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.

◆ move()

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

◆ path_management() [1/2]

bool mrpt::hwdrivers::CRovio::path_management ( int  act)
private

◆ path_management() [2/2]

bool mrpt::hwdrivers::CRovio::path_management ( int  act,
const std::string &  path_name 
)
private

◆ pathDelete()

bool mrpt::hwdrivers::CRovio::pathDelete ( const std::string &  path_name)

◆ pathGetList()

bool mrpt::hwdrivers::CRovio::pathGetList ( std::string &  path_list)

Get list of saved paths.

◆ pathRecord()

bool mrpt::hwdrivers::CRovio::pathRecord ( )

◆ pathRecordAbort()

bool mrpt::hwdrivers::CRovio::pathRecordAbort ( )

◆ pathRecordSave()

bool mrpt::hwdrivers::CRovio::pathRecordSave ( const std::string &  path_name)

◆ pathRename()

bool mrpt::hwdrivers::CRovio::pathRename ( const std::string &  old_name,
const std::string &  new_name 
)

◆ pathRunBackward()

bool mrpt::hwdrivers::CRovio::pathRunBackward ( )

◆ pathRunForward()

bool mrpt::hwdrivers::CRovio::pathRunForward ( )

◆ pathRunPause()

bool mrpt::hwdrivers::CRovio::pathRunPause ( )

◆ pathRunStop()

bool mrpt::hwdrivers::CRovio::pathRunStop ( )

◆ retrieve_video()

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

◆ rotate()

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

◆ send_cmd_action()

bool mrpt::hwdrivers::CRovio::send_cmd_action ( int  act,
int  speed 
)
private

◆ stop_video()

bool mrpt::hwdrivers::CRovio::stop_video ( )

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

Returns
False on error

◆ takeHeadDown()

bool mrpt::hwdrivers::CRovio::takeHeadDown ( )

◆ takeHeadMiddle()

bool mrpt::hwdrivers::CRovio::takeHeadMiddle ( )

◆ takeHeadUp()

bool mrpt::hwdrivers::CRovio::takeHeadUp ( )

Head positions.

Returns
False on error

◆ thread_video()

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

◆ buffer_img

mrpt::obs::CObservationImagePtr mrpt::hwdrivers::CRovio::buffer_img
private

Definition at line 39 of file CRovio.h.

◆ buffer_img_cs

mrpt::synch::CCriticalSection mrpt::hwdrivers::CRovio::buffer_img_cs
private

Definition at line 40 of file CRovio.h.

◆ encoders

struct mrpt::hwdrivers::CRovio::TEncoders mrpt::hwdrivers::CRovio::encoders

◆ m_videoThread

mrpt::system::TThreadHandle mrpt::hwdrivers::CRovio::m_videoThread
private

Definition at line 33 of file CRovio.h.

◆ m_videothread_finished

bool mrpt::hwdrivers::CRovio::m_videothread_finished
private

Definition at line 37 of file CRovio.h.

◆ m_videothread_initialized_done

bool mrpt::hwdrivers::CRovio::m_videothread_initialized_done
private

Definition at line 35 of file CRovio.h.

◆ m_videothread_initialized_error

bool mrpt::hwdrivers::CRovio::m_videothread_initialized_error
private

Definition at line 36 of file CRovio.h.

◆ m_videothread_must_exit

bool mrpt::hwdrivers::CRovio::m_videothread_must_exit
private

Definition at line 34 of file CRovio.h.

◆ options

struct mrpt::hwdrivers::CRovio::TOptions mrpt::hwdrivers::CRovio::options



Page generated by Doxygen 1.8.16 for MRPT 1.4.0 SVN: at Mon Oct 14 23:11:08 UTC 2019