constraint_app
/home/jbrooksh/drc/software/perception/constraint_app/src/matlab_mex/ConstraintApp_RB_UKF.h
Go to the documentation of this file.
00001 #ifndef CONSTRAINTAPP_RB_UKF_H
00002 #define CONSTRAINTAPP_RB_UKF_H
00003 
00004 #include <boost/thread.hpp>
00005 #include <boost/thread/condition_variable.hpp>
00006 #include <iostream>
00007 #include <fstream>
00008 #include <lcmtypes/drc_lcmtypes.hpp>
00009 #include <kdl/tree.hpp>
00010 #include <kdl/frames.hpp>
00011 #include <kdl_parser/kdl_parser.hpp>
00012 #include <forward_kinematics/treefksolverposfull_recursive.hpp>
00013 #include <map>
00014 #include <vector>
00015 #include <string>
00016 #include "PointObservation.h"
00017 #include "ConstraintApp.h"
00018 
00019 class ConstraintApp_RB_UKF : public ConstraintApp
00020 {
00021 public:
00022   typedef std::vector<double> JointVector;
00023   class Configuration {
00024   public:
00025     KDL::Frame base_expressedIn_world;
00026     JointVector joints;
00027   };
00028   class Link {
00029   public:
00030   Link(const KDL::Vector& lb, const int _id) : link_expressedIn_base(lb), id(_id) {}
00031     KDL::Vector link_expressedIn_base;
00032     int id;
00033   };
00034   typedef std::map<int, Link> LinkMap;
00035   typedef PointObservation Observation;
00036   typedef std::map<int, Observation> ObservationMap;
00037 
00038   ConstraintApp_RB_UKF();
00039   virtual ~ConstraintApp_RB_UKF();
00040 
00041   virtual bool WaitForObservations(unsigned int timeout_ms);
00042   virtual bool GetObservations(std::vector<double>& actualObservations,
00043                                std::vector<int>& observationIds);
00044   virtual bool GetExpectedObservations(const std::vector<double>& state,
00045                                        const std::vector<int>& observationIds,
00046                                        std::vector<double>& observations);
00047   virtual bool GetResetAndClear();
00048   virtual void GetCurrentStateEstimate(std::vector<double>& state);
00049   virtual void SetCurrentStateEstimate(const std::vector<double>& state);
00050 
00051   virtual void AffordanceTrackCollectionHandler(const drc::affordance_track_collection_t *msg);
00052   virtual void AffordanceFitHandler(const drc::affordance_t *msg);
00053   virtual int GetStateSize() { return 6; }
00054 
00055  protected:
00056   boost::mutex m_dataMutex;
00057   boost::condition_variable m_dataCondition;
00058   Configuration m_currentEstimate;
00059   LinkMap m_currentLinks;
00060   ObservationMap m_currentObservations;
00061   bool m_wasReset;
00062 
00063   int m_nextLinkId;
00064 };
00065 
00066 #endif
 All Classes Files Functions Variables Typedefs