ND_Navigation.H
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include "Component/ModelComponent.H"
00038 #include "Component/ModelParam.H"
00039
00040 #include "Robots/RobotBrain/RobotBrainComponent.H"
00041 #include "Util/Timer.H"
00042
00043 #include "Ice/RobotBrainObjects.ice.H"
00044 #include "Ice/RobotSimEvents.ice.H"
00045 #include <IceUtil/Thread.h>
00046
00047 #include "Robots/Beobot2/BeoCommon.H"
00048
00049 #include "Media/FrameSeries.H"
00050
00051 #include "Image/Image.H"
00052
00053 #include <vector>
00054
00055 #ifndef ND_NAVIGATIONI_H
00056 #define ND_NAVIGATIONI_H
00057
00058 typedef struct _RegionInformation
00059 {
00060 uint start;
00061 uint end;
00062
00063 float minDistance;
00064 uint minIndex;
00065 }
00066 RegionInformation;
00067
00068 class ND_Navigation : public RobotBrainComponent
00069 {
00070 public:
00071
00072 ND_Navigation(OptionManager& mgr,
00073 const std::string& descrName = "ND_Navigation",
00074 const std::string& tagName = "ND_Navigation");
00075
00076 ~ND_Navigation();
00077
00078 virtual void evolve();
00079
00080
00081 virtual void updateMessage
00082 (const RobotSimEvents::EventMessagePtr& eMsg,
00083 const Ice::Current&);
00084
00085 virtual void registerTopics();
00086
00087 void start1();
00088
00089 private:
00090 Beobot2::MotorCommand computeND_Navigation();
00091 void updateMotor(double tran,double rot);
00092
00093 void findGapsAndRegions();
00094
00095 void setMinimumDistances();
00096
00097 void findGoalRegion();
00098
00099 void biasForSafety();
00100
00101 void drawSituation();
00102
00103 void drawRangeLine(float dist, int angle, PixRGB<byte> c);
00104
00105 bool isNavigableRegion(uint index);
00106
00107 std::string itsLogFilename;
00108 IceUtil::Mutex its_logFilename_mutex;
00109
00110
00111 std::vector<double> itsDistances;
00112 std::vector<double> itsAngles;
00113
00114 float itsMinDistance;
00115 float itsMaxDistance;
00116 uint itsGoalSector;
00117 uint itsGoalRegion;
00118
00119 uint itsNextDirection;
00120 uint itsPrevDirection;
00121 uint itsLeftEnd;
00122 uint itsRightEnd;
00123
00124 uint itsBigJumpCount;
00125
00126 std::vector<uint> itsGaps;
00127 std::vector<RegionInformation > itsRegions;
00128
00129 nub::soft_ref<OutputFrameSeries> itsOfs;
00130 Image<PixRGB<byte> > itsDispImg;
00131
00132 Timer itsTimer;
00133 int itsCurrMessageID;
00134
00135 };
00136
00137 #endif
00138
00139
00140
00141
00142
00143
00144