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>
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 §ion) | ||
Loads the rovio camera calibration parameters (of leave the default ones if not found) (See CGenericSensor), then call to "loadConfig_sensorSpecific"
| |||
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 |
mrpt::hwdrivers::CRovio::CRovio | ( | ) |
virtual mrpt::hwdrivers::CRovio::~CRovio | ( | ) | [virtual] |
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.
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)
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()
bool mrpt::hwdrivers::CRovio::getPosition | ( | mrpt::math::TPose2D & | out_pose ) |
Returns the Rovio's pose.
bool mrpt::hwdrivers::CRovio::getRovioState | ( | TRovioState & | state ) |
Returns a TRovioState with internal information of Rovio (State, Navigation Signal Strength, Wifi Signal Strength)
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
void mrpt::hwdrivers::CRovio::initialize | ( | ) |
Establish conection with Rovio and log in its system: Important, fill out "options" members *BEFORE* calling this method.
std::runtime | On errors |
bool mrpt::hwdrivers::CRovio::isVideoStreamming | ( | ) | const |
Return true if video is streaming correctly.
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"
This | method 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
direction | 'f'->forward, 'b'->backward, 'r'->right, 'l'->left |
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()
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
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()".
bool mrpt::hwdrivers::CRovio::takeHeadDown | ( | ) |
bool mrpt::hwdrivers::CRovio::takeHeadMiddle | ( | ) |
bool mrpt::hwdrivers::CRovio::takeHeadUp | ( | ) |
Head positions.
void mrpt::hwdrivers::CRovio::thread_video | ( | ) | [private] |
This function takes a frame and waits until getLastImage ask for it, and so on.
bool mrpt::hwdrivers::CRovio::m_videothread_finished [private] |
bool mrpt::hwdrivers::CRovio::m_videothread_initialized_done [private] |
bool mrpt::hwdrivers::CRovio::m_videothread_initialized_error [private] |
bool mrpt::hwdrivers::CRovio::m_videothread_must_exit [private] |
Page generated by Doxygen 1.7.2 for MRPT 0.9.4 SVN: at Mon Jan 10 22:46:17 UTC 2011 |