constraint_app
/home/jbrooksh/drc/software/perception/constraint_app/src/matlab_mex/ConstraintApp_MB.h
Go to the documentation of this file.
00001 #ifndef CONSTRAINTAPP_MB_H
00002 #define CONSTRAINTAPP_MB_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 "ConstraintApp.h"
00017 #include "Affordance.h"
00018 #include "PointObservation.h"
00019 #include "FastFKSolver.h"
00020 
00021 class ConstraintApp_MB : public ConstraintApp
00022 {
00023  public:
00024   typedef Affordance::StateVector StateVector;
00025   typedef std::vector<double> ObservationVector;
00026   typedef std::vector<std::string> IdVector;
00027   typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor> Jacobian;
00028  
00029   ConstraintApp_MB();
00030   virtual ~ConstraintApp_MB();
00031 
00032   virtual bool WaitForObservations(unsigned int timeout_ms);
00033   virtual bool GetObservations(ObservationVector& actualObservations,
00034                                IdVector& observationIds);
00035   virtual bool GetExpectedObservations(const StateVector& state,
00036                                        const IdVector& observationIds,
00037                                        ObservationVector& observations);
00038   virtual bool GetResetAndClear();
00039   virtual void GetCurrentStateEstimate(StateVector& state);
00040   virtual void SetCurrentStateEstimate(const StateVector& state);
00041   virtual void AffordanceTrackCollectionHandler(const drc::affordance_track_collection_t *msg);
00042   virtual void AffordanceFitHandler(const drc::affordance_plus_t *msg);
00043   virtual int GetStateSize();
00044   bool GetJacobian(const StateVector& state, const IdVector& observationIds,
00045                    Jacobian& jacobian, int method /*= 1*/);
00046 
00047   void PublishFitMessage();
00048 
00049  protected:
00050   boost::mutex m_dataMutex;
00051   boost::condition_variable m_dataCondition;
00052 
00053   Affordance::Ptr m_affordance;
00054   int m_affordanceUID;
00055   bool m_wasReset;
00056   drc::affordance_plus_t m_prevFit;
00057 
00058   StateVector m_currentState;
00059 
00060   boost::shared_ptr<FastFKSolver> m_fastFKSolver;
00061 
00062   typedef PointObservation Observation;
00063   typedef std::map<std::string, Observation> ObservationMap;
00064   ObservationMap m_currentObservations;
00065 };
00066 
00067 #endif
 All Classes Files Functions Variables Typedefs