rp_ism_node.cpp
Go to the documentation of this file.
1 
18 #include "ros/ros.h"
22 #include <asr_recognizer_prediction_ism/rp_ism_nodeConfig.h>
23 #include <thread>
24 #include <signal.h>
25 
26 using namespace std;
27 using namespace recognizer_prediction_ism;
28 
29 void mySigintHandler(int sig)
30 {
31  ROS_DEBUG_NAMED("rp_ism_node", "rp_ism_node: SHUTDOWNED");
32  ros::shutdown();
33 }
34 
35 //Here we create scene recognition and pose prediction, each in different threads and interacting via shared memory.
36 int main(int argc, char **argv)
37 {
38 
39  //*** ROS stuff ***
40  ROS_INFO("Initializing ROS node for rp_ism_node");
41  ros::init(argc, argv, "rp_ism_node", ros::init_options::NoSigintHandler);
42  ros::NodeHandle n("~");
43  signal(SIGINT, mySigintHandler);
44  unsigned concurent_threads_supported = std::thread::hardware_concurrency();
45  ROS_INFO_STREAM("RP_ISM: Number of Threads: " << concurent_threads_supported);
46  ros::AsyncSpinner spinner(concurent_threads_supported); // Use dynamic # of threads
47 
48  //Buffer all scene recognition results that have been used to predict object poses. Prevents using them twice.
49  std::vector<ISM::RecognitionResultPtr> resultsAlreadyInSharedMem;
51 
52  //*** Scene recognition and pose prediction stuff ***
53 
54  ROS_DEBUG_NAMED("rp_ism_node", "rp_ism_node: Initializing ism scene recognition.");
55  SceneRecognition scene_recognition(resultsAlreadyInSharedMem, shared_memory);
56 
57  ROS_DEBUG_NAMED("rp_ism_node", "rp_ism_node: Initializing ism pose prediction.");
58  PosePrediction pose_prediction(resultsAlreadyInSharedMem, shared_memory);
59 
60  //Please do not move that call from here and especially not to the loop. This is the random Seed for PosePrediction.
61  srand (time(NULL));
62 
63  spinner.start();
65  return 0;
66 
67 }
int main(int argc, char **argv)
Definition: rp_ism_node.cpp:36
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void mySigintHandler(int sig)
Definition: rp_ism_node.cpp:29
#define ROS_DEBUG_NAMED(name,...)
#define ROS_INFO(...)
#define ROS_INFO_STREAM(args)
boost::shared_ptr< SharedRecognitionResultsManager > SharedRecognitionResultsManagerPtr
ROSCPP_DECL void shutdown()
ROSCPP_DECL void waitForShutdown()


asr_recognizer_prediction_ism
Author(s): Aumann Florian, Heller Florian, Hutmacher Robin, Meißner Pascal, Stöckle Patrick, Stroh Daniel
autogenerated on Wed Jan 8 2020 03:18:32