structs.h
Go to the documentation of this file.
00001 /*
00002  * structs.h
00003  *
00004  *  Created on: Jul 25, 2010
00005  *      Author: sturm
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; // marker1 x marker2 x timestamp --> pose_index
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 &params);
00071         void updateModel(size_t id1, size_t id2,KinematicParams &params);
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);    // no deepcopy
00086         KinematicGraph(const KinematicGraph &other,bool deepcopy);
00087         void CopyFrom(const KinematicGraph &other);     //deep copy
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 &params,KinematicData &data);
00093         void projectConfigurationSpace(int reducedDOFs,std::vector<double> stamps, KinematicParams &params,KinematicData &data);
00094 
00095         void evaluateSingleStamp(double timestamp,
00096                                         double &avgPositionError,
00097                                         double &avgOrientationError,
00098                                         double &loglikelihood,KinematicParams &params,KinematicData &data);
00099         void evaluate(
00100                         std::vector<double> stamps,KinematicParams &params,KinematicData &data);
00101         int distanceTo(KinematicGraph &other);
00102 
00103 };
00104 
00105 #endif /* STRUCTS_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends Defines


articulation_structure
Author(s): sturm
autogenerated on Wed Dec 26 2012 15:37:59