Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef STRUCTURE_LEARNER_BASE_H_
00009 #define STRUCTURE_LEARNER_BASE_H_
00010
00011 #include "structs.h"
00012
00013 #include <iostream>
00014 #include <fstream>
00015
00016 using namespace std;
00017 using namespace geometry_msgs;
00018 using namespace sensor_msgs;
00019 using namespace articulation_models;
00020 using namespace articulation_msgs;
00021 using namespace articulation_structure;
00022
00023 class EvalStampStruct {
00024 public:
00025 bool bestGraph;
00026 bool evalInFastSearch;
00027 bool bestFast;
00028 bool bestTree;
00029 double BIC;
00030 int segment;
00031 EvalStampStruct():bestGraph(false),evalInFastSearch(false),bestFast(false),bestTree(false),BIC(0),segment(0) {}
00032 };
00033
00034 class EvalStruct {
00035 public:
00036 bool bestGraphOnce;
00037 bool bestTreeOnce;
00038 bool bestFastOnce;
00039 int segments;
00040 std::map<int,EvalStampStruct> stampEval;
00041 EvalStruct():bestGraphOnce(false),bestTreeOnce(false),bestFastOnce(false),segments(0) {}
00042 };
00043
00044 class KinematicStructureLearner: public KinematicParams, public KinematicData {
00045 public:
00046 boost::mutex frame_mutex_;
00047
00048 ros::Publisher model_pub;
00049 ros::Publisher marker_pub;
00050
00051 ros::NodeHandle nh;
00052 ros::NodeHandle nh_local;
00053
00054 ros::Subscriber pose_sub1;
00055 ros::Subscriber pose_sub2;
00056 ros::Subscriber pose_sub3;
00057 ros::Subscriber pose_sub4;
00058
00059 map< string, KinematicGraph > graphMap;
00060 std::map< std::string, EvalStruct> evalGraph;
00061
00062 std::map< int, double> evalGraphBIC;
00063 std::map< int, double> evalFastBIC;
00064 std::map< int, double> evalTreeBIC;
00065
00066 std::map< int, double> evalModelsRuntime;
00067 std::map< int, double> evalGraphRuntime;
00068 std::map< int, double> evalFastRuntime;
00069 std::map< int, double> evalTreeRuntime;
00070
00071 std::map< int, double> evalDOF;
00072 std::map< int, double> evalLinks;
00073
00074 KinematicGraph currentGraph;
00075 map< string, KinematicGraph > previousGraphs;
00076
00077 KinematicStructureLearner();
00078
00079 KinematicGraph getSpanningTree(bool increasing);
00080 virtual void sendModels(KinematicGraph E_new);
00081 virtual void sendTreeTransforms(KinematicGraph E_new);
00082 void saveGraphEval();
00083 void saveBICEval();
00084 void saveRuntimeEval();
00085 void saveDOFLinkEval();
00086 virtual void sendStructureVisualization(KinematicGraph graph);
00087 std::vector<double> downsampleStamps(std::vector<double> vec,size_t num);
00088 virtual void selectSceneModel();
00089 virtual void sendSceneModel();
00090 void poseCallback(const PoseStampedIdMsgConstPtr& pose);
00091 void poseCallback(const PoseStampedConstPtr& pose, size_t id);
00092 void poseCallback1(const PoseStampedConstPtr& pose);
00093 void poseCallback2(const PoseStampedConstPtr& pose);
00094 void poseCallback3(const PoseStampedConstPtr& pose);
00095 void poseCallback4(const PoseStampedConstPtr& pose);
00096 void showEvaluation();
00097 void analyzeTopologyOfGraphs();
00098 void enumerateGraphs();
00099 void addPreviousGraphs();
00100
00101 void evalTree();
00102 void evalFull();
00103 void evalFast(bool setCurrent);
00104 };
00105
00106
00107 #endif