planners/ik_aca/IK_ACA.h

Go to the documentation of this file.
00001 //=========================================================================
00002 //
00003 //  File:  IK_ACA.h
00004 //
00005 //  Created 31-Jul-01 by Shane Schneider
00006 //
00007 //              Inverse ACA planner for inverse kinematics.
00008 //              Contains the inheritance from InvKinBase.
00009 
00010 #ifndef IK_ACA_h
00011 #define IK_ACA_h 1
00012 
00013 #pragma warning( disable : 4250 )
00014 
00015 
00016 // Parent Classes
00017 #include "../inversekin/IK_InvKinBase.h"
00018 #include "Planners/PL_GraphBase.h"
00019 #include <math/Matrix4x4.h>
00020 #include <Kinematics/Jacobian.h>
00021 
00022 // Additional LEDA Classes
00023 #include <LEDA/node_map.h>
00024 
00025 
00026 //----------- Forward Declarations -----------------
00027 
00028 //## Class: IK_ACA%3921BC600296
00029 //## Category: Inverse Planners%36FB140B003C
00030 //## Persistence: Transient
00031 //## Cardinality/Multiplicity: n
00032 
00033 class IK_ACA : 
00034         virtual public IK_InvKinBase,  //## Inherits: <unnamed>%3921BC73013F
00035         virtual public PL_GraphBase
00036 {
00037 
00038   public:
00039           // Default Constructor
00040           IK_ACA();
00041 
00042     //## Destructor (generated)
00043       virtual ~IK_ACA();
00044 
00045       virtual bool DrawExplicit () const;
00046 
00047           virtual bool Load (const char *filename);
00048 
00049       virtual bool Plan ();
00050 
00051           virtual bool Save (const char *filename) const;
00052 
00053           virtual void SetStartConfig( const Configuration& configuration );
00054 
00055           virtual void SetGoalConfig( const Configuration& configuration );
00056 
00057           void SetEmbryosPerLandmark( const int& num_of_embryos );
00058           int  GetEmbryosPerLandmark() const;
00059 
00060       // Assigns the collision detector
00061       virtual void SetCollisionDetector (CollisionDetectorBase* collisionDetector);
00062 
00063         // Additional Public Declarations
00064 
00065           virtual void CopySettings( PlannerBase* original );
00066           
00067   protected:
00068         // Additional Implementation Declarations
00069 
00070           virtual void AssignGoalConfig( const Configuration& config );
00071 
00072           // SaveContents
00073           //    Saves the graph and other relevent ACA parameters to the given ostream pointer
00074           virtual bool SaveContents( std::ofstream& outfile ) const;
00075 
00076           // LoadContents
00077           //    Load the graph and other relevent ACA parameters to the given ostream pointer
00078           virtual bool LoadContents( std::ifstream& infile );
00079 
00080           //    DrawSpecific:  Draw the additional ACA embryos that do not get normally drawn with
00081           //                               PL_GraphBase::DrawExplicit().
00082           virtual bool DrawSpecific() const;
00083 
00084           // InitNewSearch
00085           //    Initiates parameters to indicate a new search has been requested.
00086           virtual void InitNewSearch();
00087 
00088 
00089           // Distance...
00090           //    Computes the squared distance between two frames based on the distance metric
00091           //    defined by Ahuactizin and Gupta (Aug 1999).
00092           virtual double FrameDistance ( const Matrix4x4& frameA, const Matrix4x4& frameB ) const;
00093 
00094           // ComputePath
00095           //    Computes the final path from the tree and search path to the actual or best goal config
00096           SuccessResultType ComputePath ( const node& landmark, const list<Configuration>& myPath );
00097           
00098 
00099         // ACA Alogrithmic Functions
00100           node Explore();       // Finds the furthest embryo in road map and coverts it into a landmark.
00101           SuccessResultType Search( const node& landmark ); // searchs C-space for goal frame from given config.
00102 
00103           SuccessResultType Search1( const node& landmark );
00104           VectorN ComputeEndEffDiff(Matrix4x4 &frStart, Matrix4x4 &frEnd);
00105           Configuration GetNextConfig( Configuration& q0 );
00106 
00107 
00108         // Cost Minimizing Functions
00109           double FindJointAdjust( const unsigned int& jointNum, const Matrix4x4& toolFrame ) const; 
00110                                                                         // finds the joint adjustment to minimize goal and tool frame distance
00111           Configuration MinimizeDistance( const Configuration& config , list<Configuration>& minPath );
00112                                                                         // returns a valid configuration that minimizes goal and tool frame distance
00113                                                                         // based on the given configuration
00114 
00115 
00116 
00117           // Embryo Functions
00118           //    Functions are used to create a new embryo
00119           void CreateEmbryo(const node& landmark, const int& embryoID); // Creates a valid embryo for a given landmark.
00120           void CreateEmbryos(const node& landmark ); // Creates required number of new embryos for given landmark
00121 
00122 
00123     // Additional Protected Declarations
00124           node_map<Configuration>* embryo;      // pointer to the embryo configurations associated with each landmark (node)
00125 
00126 
00127           list<Configuration> searchPath;   // records the successive configurations the search routine computes.
00128 
00129   private:
00130     // Additional Private Declarations
00131           int embryosPerLandmark;                       // indicates how many embryos are associated with each landmark.
00132           node searchLandmark;                          // indicates which landmark will be used by the search algorithm
00133 
00134           // Best config parameters
00135           node bestLandmark;                            // indicates which landmark results in config that is closest to goal frame
00136           list<Configuration> bestPath;         // records the successive configurations that result in the best path.
00137           double bestDistance_sq;                       // records the square of the best frame distance.
00138           int m_FrameID;                                        // the id of the goal frame in the frame manager
00139           CJacobian *jacobian;
00140 
00141 
00142   private: //## implementation
00143     // Additional Implementation Declarations
00144 
00145           void InitBestParams();                                // initializes the parameters used to keep track of the best path that
00146                                                                                 // gets config closest to goal frame.
00147 
00148 
00149 };
00150 
00151 
00152 // Class IK_ACA 
00153 
00154 
00155 #endif

Generated on Sat Apr 1 21:30:43 2006 for Motion Planning Kernel by  doxygen 1.4.6-NO