00001 #ifndef _HEADER_PL_PRM_CLOSED_
00002 #define _HEADER_PL_PRM_CLOSED_
00003
00004 #include "planners/prm/PL_PRM.h"
00005 #include <LEDA/dynamic_trees.h>
00006
00007 #undef array
00008 #undef vector
00009 #undef map
00010 #undef string
00011 #undef set
00012
00013 class IK_Jacobian;
00014
00015 typedef list<Configuration> Fragment;
00016
00017
00018 class LocalPlannerClosed : public IK_Jacobian
00019 {
00020 public:
00021 LocalPlannerClosed(){};
00022 ~LocalPlannerClosed(){};
00023 virtual bool Plan ();
00024
00025 protected:
00026 double Distance(Configuration &frame1, Configuration &frame2);
00027 };
00028
00029
00030 class PL_PRM_ClosedChain: public PL_PRM
00031 {
00032 public:
00033 PL_PRM_ClosedChain();
00034 ~PL_PRM_ClosedChain();
00035
00036 virtual bool Plan ();
00037 virtual void SetCollisionDetector (CD_BasicStyle* collisionDetector);
00038
00039 bool GetClosedConfiguration(Configuration &conf);
00040 void SetUseJacobian(BOOL use) {useJacobian = (use == TRUE);};
00041 void SetUsePlanarConstraint(BOOL use) {usePlanarConstraint = (use == TRUE);};
00042 void SetUseGoalPose(BOOL use) {useGoalPose = (use == TRUE);}
00043 void SetUseOrientConstraint(BOOL use) {useOrientConstraint = (use == TRUE);};
00044
00045 BOOL GetUseJacobian( ) {return (useJacobian)?TRUE:FALSE;};
00046 BOOL GetUsePlanarConstraint( ) {return (usePlanarConstraint)?TRUE:FALSE;};
00047 BOOL GetUseGoalPose( ) {return (useGoalPose)?TRUE:FALSE;};
00048 BOOL GetUseOrientConstraint( ){return (useOrientConstraint)?TRUE:FALSE;};
00049
00050
00051 double Error(const Configuration &p1) const;
00052 double Error1(const Configuration &p1, const Frame &pose) const;
00053 double Error2(const Configuration &p1, const Frame &pose) const;
00054 double Error3(const Configuration &p1, const Frame &pose) const;
00055 double Error4(const Configuration &p1, const Frame &pose) const;
00056
00057 Frame GetToolFrame( const Configuration& config ) const;
00058 virtual bool GenerateRandomConfigForPose (Configuration& conf, Frame &endEffPose);
00059
00060 protected:
00061
00062 bool GetSatisfactoryConfiguration(Configuration &conf, Frame &pose) const;
00063 virtual Configuration GenerateRandomConfig () const;
00064 virtual Configuration GenerateRandomConfig ( const Configuration& seed, const double& std_dev ) const;
00065 virtual void ConnectEdgesFull( const node& n1, const double& radius_squared );
00066 virtual bool IsInterfering ( const Configuration& c1, const Configuration& c2 ) const;
00067 virtual bool IsInterfering ( const Configuration& c1 ) const;
00068 virtual SuccessResultType TranslatePath();
00069 bool Plan_As_Usual ();
00070 void GetRotAngles( const Matrix4x4& frame, double& roll, double& pitch, double& yaw ) const;
00071
00072 protected:
00073 Fragment *edgeFrag;
00074 CD_BasicStyle *pCollisionDetector;
00075 bool useJacobian;
00076 bool useGoalPose;
00077 bool usePlanarConstraint;
00078 bool useOrientConstraint;
00079 Frame planeDesired;
00080 Frame orientDesired;
00081 bool MakeItClosed(Configuration &conf) const;
00082
00083 bool IsClosed(const Configuration &conf) const;
00084 void UpdatePlanarConstraint();
00085 void UpdateOrientConstraint();
00086
00087 private:
00088 edge_map<Fragment> edgePath;
00089 LocalPlannerClosed* planner;
00090
00091 };
00092
00093
00094
00095
00096
00097 #endif