Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef STRUCTS_H_
00009 #define STRUCTS_H_
00010
00011 #include <ros/ros.h>
00012
00013 #include "articulation_msgs/ModelMsg.h"
00014 #include "articulation_msgs/TrackMsg.h"
00015 #include "articulation_msgs/ParamMsg.h"
00016
00017 #include "articulation_models/models/factory.h"
00018 #include "articulation_models/models/rotational_model.h"
00019 #include "articulation_models/models/prismatic_model.h"
00020
00021 #include "articulation_structure/PoseStampedIdMsg.h"
00022 #include "geometry_msgs/PoseStamped.h"
00023 #include "geometry_msgs/Pose.h"
00024
00025 #include <tf/transform_broadcaster.h>
00026 #include <tf/transform_listener.h>
00027 #include <visualization_msgs/Marker.h>
00028
00029 #include "utils.h"
00030
00031 #include "Eigen/Core"
00032 #include <Eigen/SVD>
00033 #include <sys/types.h>
00034 #include <unistd.h>
00035
00036 typedef std::vector<std::pair< std::pair<int,int>,articulation_models::GenericModelPtr> > KinematicGraphType;
00037 typedef std::map<int,geometry_msgs::Pose> PoseMap;
00038 typedef std::map<int, std::map<int, std::map<double, int> > > PoseIndex;
00039
00040 class KinematicParams {
00041 public:
00042 double sigma_position;
00043 double sigma_orientation;
00044 double sigmax_position;
00045 double sigmax_orientation;
00046 int eval_every;
00047 double eval_every_power;
00048 bool supress_similar;
00049 bool reuse_model;
00050 std::string restricted_graphs;
00051 bool restrict_graphs;
00052 bool reduce_dofs;
00053 bool search_all_models;
00054 std::string full_eval;
00055 articulation_models::MultiModelFactory factory;
00056 KinematicParams();
00057 void LoadParams(ros::NodeHandle &nh_local,bool show=true);
00058 };
00059
00060 class KinematicData {
00061 public:
00062 std::map<int, double > latestTimestamp;
00063 std::map<double, std::map<int, articulation_structure::PoseStampedIdMsgConstPtr> > stampedMarker;
00064 std::map<double, std::map<int, articulation_structure::PoseStampedIdMsgConstPtr> > stampedMarkerProjected;
00065 std::map<int, std::map<double, articulation_structure::PoseStampedIdMsgConstPtr> > markerStamped;
00066 PoseIndex poseIndex;
00067 std::map< int, std::map<int,articulation_msgs::TrackMsgPtr> > trajectories;
00068 std::map< int, std::map<int,articulation_models::GenericModelPtr> > models;
00069 std::map< int, std::map<int,std::vector<articulation_models::GenericModelPtr> > > models_all;
00070 void addPose(geometry_msgs::PoseStamped pose1, geometry_msgs::PoseStamped pose2, size_t id1, size_t id2,KinematicParams ¶ms);
00071 void updateModel(size_t id1, size_t id2,KinematicParams ¶ms);
00072 std::vector<double> intersectionOfStamps();
00073 virtual PoseMap getObservation(double timestamp );
00074 };
00075
00076 class KinematicGraph: public KinematicGraphType {
00077 public:
00078 double BIC;
00079 int DOF;
00080 double avg_pos_err;
00081 double avg_orient_err;
00082 double loglh;
00083 double k;
00084 KinematicGraph();
00085 KinematicGraph(const KinematicGraph &other);
00086 KinematicGraph(const KinematicGraph &other,bool deepcopy);
00087 void CopyFrom(const KinematicGraph &other);
00088 size_t getNumberOfParameters();
00089 int getNominalDOFs();
00090 std::string getTreeName(bool show_name,bool show_samples,bool show_dof);
00091
00092 virtual PoseMap getPrediction(double timestamp, PoseMap &observedMarkers, PoseMap &predictedMarkersEmpty, KinematicParams ¶ms,KinematicData &data);
00093 void projectConfigurationSpace(int reducedDOFs,std::vector<double> stamps, KinematicParams ¶ms,KinematicData &data);
00094
00095 void evaluateSingleStamp(double timestamp,
00096 double &avgPositionError,
00097 double &avgOrientationError,
00098 double &loglikelihood,KinematicParams ¶ms,KinematicData &data);
00099 void evaluate(
00100 std::vector<double> stamps,KinematicParams ¶ms,KinematicData &data);
00101 int distanceTo(KinematicGraph &other);
00102
00103 };
00104
00105 #endif