zyonz_nbv_geometric_simple_alg_node.cpp
Go to the documentation of this file.
00001 #include "zyonz_nbv_geometric_simple_alg_node.h"
00002 
00003 ZyonzNbvGeometricSimpleAlgNode::ZyonzNbvGeometricSimpleAlgNode(void) :
00004   algorithm_base::IriBaseAlgorithm<ZyonzNbvGeometricSimpleAlgorithm>()
00005 {
00006   //init class attributes if necessary
00007   //this->loop_rate_ = 2;//in [Hz]
00008 
00009   // [init publishers]
00010   
00011   // [init subscribers]
00012   
00013   // [init services]
00014   get_nbv_server_ = public_node_handle_.advertiseService("get_nbv", &ZyonzNbvGeometricSimpleAlgNode::get_nbvCallback, this);
00015   
00016   // [init clients]
00017   
00018   // [init action servers]
00019   
00020   // [init action clients]
00021 }
00022 
00023 ZyonzNbvGeometricSimpleAlgNode::~ZyonzNbvGeometricSimpleAlgNode(void)
00024 {
00025   // [free dynamic memory]
00026 }
00027 
00028 void ZyonzNbvGeometricSimpleAlgNode::mainNodeThread(void)
00029 {
00030   // [fill msg structures]
00031   
00032   // [fill srv structure and make request to the server]
00033   
00034   // [fill action structure and make request to the action server]
00035 
00036   // [publish messages]
00037 }
00038 
00039 /*  [subscriber callbacks] */
00040 
00041 /*  [service callbacks] */
00042 bool ZyonzNbvGeometricSimpleAlgNode::get_nbvCallback(zyonz_nbv_geometric_simple::GetNBVPose::Request &req, zyonz_nbv_geometric_simple::GetNBVPose::Response &res) 
00043 { 
00044   ROS_INFO("ZyonzNbvGeometricSimpleAlgNode::get_nbvCallback: New Request Received!"); 
00045 
00046   //use appropiate mutex to shared variables if necessary 
00047   alg_.lock(); 
00048   get_nbv_mutex_.enter(); 
00049 
00050   if(!alg_.isRunning(req.viewpoint, req.viewpoint_roi)) 
00051   { 
00052     ROS_INFO("ZyonzNbvGeometricSimpleAlgNode::get_nbvCallback: ERROR: alg is not on run mode yet."); 
00053   } 
00054   
00055   res.nbv = *alg_.get_nbv ();
00056 
00057   //unlock previously blocked shared variables 
00058   alg_.unlock(); 
00059   get_nbv_mutex_.exit(); 
00060 
00061   return true; 
00062 }
00063 
00064 /*  [action callbacks] */
00065 
00066 /*  [action requests] */
00067 
00068 void ZyonzNbvGeometricSimpleAlgNode::node_config_update(Config &config, uint32_t level)
00069 {
00070   this->alg_.lock();
00071 
00072   this->alg_.unlock();
00073 }
00074 
00075 void ZyonzNbvGeometricSimpleAlgNode::addNodeDiagnostics(void)
00076 {
00077 }
00078 
00079 /* main function */
00080 int main(int argc,char *argv[])
00081 {
00082   return algorithm_base::main<ZyonzNbvGeometricSimpleAlgNode>(argc, argv, "zyonz_nbv_geometric_simple_alg_node");
00083 }


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