A class to interface a Rovio robot (manufactured by WowWee).
Supports: Simple motion commands, video streaming.
#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 std::string &path_name) |
bool | pathDelete (const std::string &path_name) |
bool | pathGetList (std::string &path_list) |
Get list of saved paths. | |
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 | |
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 (mrpt::obs::CObservationImagePtr &lastImage) |
Returns the next frame from Rovio's live video stream, after starting the live streaming with retrieve_video() | |
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. | |
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 std::string &path_name) |
bool | general_command (int act, std::string &response, std::string &errormsg) |
mrpt::hwdrivers::CRovio::CRovio | ( | ) |
|
virtual |
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.
|
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 | ( | mrpt::obs::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 |
|
private |
|
private |
bool mrpt::hwdrivers::CRovio::pathDelete | ( | const std::string & | path_name | ) |
bool mrpt::hwdrivers::CRovio::pathGetList | ( | std::string & | path_list | ) |
Get list of saved paths.
bool mrpt::hwdrivers::CRovio::pathRecord | ( | ) |
bool mrpt::hwdrivers::CRovio::pathRecordAbort | ( | ) |
bool mrpt::hwdrivers::CRovio::pathRecordSave | ( | const std::string & | path_name | ) |
bool mrpt::hwdrivers::CRovio::pathRename | ( | const std::string & | old_name, |
const std::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
|
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.
|
private |
This function takes a frame and waits until getLastImage ask for it, and so on.
|
private |
|
private |
struct mrpt::hwdrivers::CRovio::TEncoders mrpt::hwdrivers::CRovio::encoders |
|
private |
|
private |
|
private |
|
private |
|
private |
struct mrpt::hwdrivers::CRovio::TOptions mrpt::hwdrivers::CRovio::options |
Page generated by Doxygen 1.9.8 for MRPT 1.4.0 SVN: at Thu Dec 14 16:54:58 UTC 2023 |