pasula_learner_alg_node.cpp
Go to the documentation of this file.
00001 #include "pasula_learner_alg_node.h"
00002 
00003 PasulaLearnerAlgNode::PasulaLearnerAlgNode(void) :
00004   algorithm_base::IriBaseAlgorithm<PasulaLearnerAlgorithm>()
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   this->learn_rules_server_ = this->public_node_handle_.advertiseService("learn_rules", &PasulaLearnerAlgNode::learn_rulesCallback, this);
00015   
00016   // [init clients]
00017   
00018   // [init action servers]
00019   
00020   // [init action clients]
00021 }
00022 
00023 PasulaLearnerAlgNode::~PasulaLearnerAlgNode(void)
00024 {
00025   // [free dynamic memory]
00026 }
00027 
00028 void PasulaLearnerAlgNode::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 PasulaLearnerAlgNode::learn_rulesCallback(iri_learning_msgs::LearnRulesFromTransitions::Request &req, iri_learning_msgs::LearnRulesFromTransitions::Response &res) 
00043 { 
00044   ROS_INFO("PasulaLearnerAlgNode::learn_rulesCallback: New Request Received!"); 
00045 
00046   //use appropiate mutex to shared variables if necessary 
00047   //this->alg_.lock(); 
00048   //this->learn_rules_mutex_.enter(); 
00049   res.ok = this->alg_.learn_rules();
00050   //unlock previously blocked shared variables 
00051   //this->alg_.unlock(); 
00052   //this->learn_rules_mutex_.exit(); 
00053   
00054   return true; 
00055 }
00056 
00057 /*  [action callbacks] */
00058 
00059 /*  [action requests] */
00060 
00061 void PasulaLearnerAlgNode::node_config_update(Config &config, uint32_t level)
00062 {
00063   this->alg_.lock();
00064 
00065   this->alg_.unlock();
00066 }
00067 
00068 void PasulaLearnerAlgNode::addNodeDiagnostics(void)
00069 {
00070 }
00071 
00072 /* main function */
00073 int main(int argc,char *argv[])
00074 {
00075   return algorithm_base::main<PasulaLearnerAlgNode>(argc, argv, "pasula_learner_alg_node");
00076 }


iri_pasula_learner
Author(s): dmartinez
autogenerated on Fri Dec 6 2013 23:28:46