zyonz_nbv_geometric_simple_alg.cpp
Go to the documentation of this file.
00001 #include "zyonz_nbv_geometric_simple_alg.h"
00002 
00003 ZyonzNbvGeometricSimpleAlgorithm::ZyonzNbvGeometricSimpleAlgorithm(void):
00004 nbv_ptr_(boost::make_shared<geometry_msgs::PoseStamped> ())
00005 {
00006 }
00007 
00008 ZyonzNbvGeometricSimpleAlgorithm::~ZyonzNbvGeometricSimpleAlgorithm(void)
00009 {
00010 }
00011 
00012 void ZyonzNbvGeometricSimpleAlgorithm::config_update(Config& new_cfg, uint32_t level)
00013 {
00014   this->lock();
00015 
00016   // save the current configuration
00017   this->config_=new_cfg;
00018   
00019   this->unlock();
00020 }
00021 
00022 // ZyonzNbvGeometricSimpleAlgorithm Public API
00023 bool ZyonzNbvGeometricSimpleAlgorithm::isRunning(geometry_msgs::PoseStamped& viewpoint, geometry_msgs::PoseStamped& viewpoint_roi)
00024 {
00025     // NBV Transform definition
00026     tf::Quaternion tf_quat(tf::Quaternion::getIdentity());
00027 
00028     if (viewpoint_roi.pose.position.x < 0.0)
00029         tf_quat.setEuler(M_PI_4/2,0.0, 0.0 ); // (YAW, PITCH, ROLL) -> (Y, X, Z)
00030     else 
00031         tf_quat.setEuler(-M_PI_4/2,0.0, 0.0 ); // (YAW, PITCH, ROLL) -> (Y, X, Z)
00032 
00033     tf::Transform TF(tf_quat);
00034 
00035     // Poses conversions
00036     tf::Stamped<tf::Transform> w_tf_viewpoint;
00037     tf::poseStampedMsgToTF (viewpoint, w_tf_viewpoint); 
00038     
00039     tf::Stamped<tf::Transform> viewpoint_tf_roi;
00040     tf::poseStampedMsgToTF (viewpoint_roi, viewpoint_tf_roi); 
00041     
00042     // Compute NBV pose
00043     tf::Stamped<tf::Transform> w_tf_nbv (w_tf_viewpoint * viewpoint_tf_roi * TF * viewpoint_tf_roi.inverse(), ros::Time::now(), w_tf_viewpoint.frame_id_);
00044 
00045     tf::poseStampedTFToMsg(w_tf_nbv, *nbv_ptr_);
00046 
00047     return true;
00048 }
00049 
00050 geometry_msgs::PoseStamped::Ptr ZyonzNbvGeometricSimpleAlgorithm::get_nbv () const
00051 {
00052     return nbv_ptr_; 
00053 }
00054 
00055 
00056 


zyonz_nbv_geometric_simple
Author(s): Sergi Foix
autogenerated on Fri Dec 6 2013 21:49:17