VRmixin.h
Go to the documentation of this file.00001
00002 #ifndef _VRmixin_h_
00003 #define _VRmixin_h_
00004
00005 #include <string>
00006 #include <iostream>
00007
00008 #include "Behaviors/BehaviorBase.h"
00009 #include "Shared/fmatSpatial.h"
00010 #include "Vision/RawCameraGenerator.h"
00011 #include "Motion/WalkMC.h"
00012
00013 #include "ShapeAgent.h"
00014 #include "BlobData.h"
00015 #include "SketchRoot.h"
00016
00017 #if (defined(TGT_HAS_ARMS) || !defined(STRICT_TGT_MODEL)) && !defined(TGT_IS_AIBO)
00018 class Grasper;
00019 #endif
00020
00021 namespace DualCoding {
00022
00023 class Lookout;
00024 #ifdef TGT_HAS_WALK
00025 class Pilot;
00026 #endif
00027 class SketchDataRoot;
00028 class SketchSpace;
00029 class ShapeRoot;
00030 class MapBuilder;
00031 class ShapeBasedParticleFilter;
00032 class VisualOdometry;
00033
00034 typedef unsigned char cmap_t;
00035
00036
00037 class VRmixin {
00038 protected:
00039 static unsigned int instanceCount;
00040 static unsigned int crewCount;
00041
00042 public:
00043
00044 static SketchSpace& getCamSkS();
00045 static SketchSpace& getLocalSkS();
00046 static SketchSpace& getWorldSkS();
00047 static ShapeSpace& getGroundShS();
00048
00049 static SketchSpace& camSkS;
00050 static ShapeSpace& camShS;
00051
00052 static ShapeSpace& groundShS;
00053
00054 static SketchSpace& localSkS;
00055 static ShapeSpace& localShS;
00056
00057 static SketchSpace& worldSkS;
00058 static ShapeSpace& worldShS;
00059 static Shape<AgentData> theAgent;
00060
00061 static MapBuilder* mapBuilder;
00062 static Lookout* lookout;
00063 #ifdef TGT_HAS_WALK
00064 static Pilot* pilot;
00065 #endif
00066 #if (defined(TGT_HAS_ARMS) || !defined(STRICT_TGT_MODEL)) && !defined(TGT_IS_AIBO)
00067 static Grasper* grasper;
00068 #endif
00069
00070 static ShapeBasedParticleFilter *particleFilter;
00071 static bool isWalkingFlag;
00072
00073 private:
00074 static Socket *camDialogSock;
00075 static Socket *camSketchSock;
00076 static Socket *localDialogSock;
00077 static Socket *localSketchSock;
00078 static Socket *worldDialogSock;
00079 static Socket *worldSketchSock;
00080
00081 public:
00082
00083 VRmixin();
00084
00085
00086 virtual ~VRmixin(void);
00087
00088 static void startCrew();
00089 static void stopCrew();
00090 static void requireCrew(const std::string &memberName);
00091
00092 static bool isWalking();
00093
00094
00095 static bool encodeSketch(const SketchDataRoot& image);
00096
00097
00098 static Sketch<uchar> sketchFromSeg();
00099
00100
00101 static Sketch<uchar> sketchFromChannel(const RawCameraGenerator::channel_id_t chan);
00102
00103
00104 static Sketch<uchar> sketchFromRawY();
00105
00106
00107 static Sketch<yuv> sketchFromYUV();
00108
00109
00110 static Sketch<usint> sketchFromDepth();
00111
00112
00113 static std::vector<Shape<BlobData> >
00114 getBlobsFromRegionGenerator(const color_index color, int minarea=25,
00115 const BlobData::BlobOrientation_t orient=BlobData::groundplane,
00116 const coordinate_t height=0,
00117 const int maxblobs=50);
00118
00119
00120 static void processSketchRequest(const std::string &line,
00121 SketchSpace &sketches,
00122 ShapeSpace &shapes);
00123
00124 #ifdef TGT_HAS_CAMERA
00125
00126 static void projectToGround();
00127 #endif
00128
00129
00130 static void projectToGround(const fmat::Transform& camToBase);
00131 static void projectToGround(const fmat::Transform& camToBase, const PlaneEquation& groundplane);
00132
00133 static bool autoRefreshWorldAllowed;
00134 static bool autoRefreshLocalAllowed;
00135 static bool autoRefreshCameraAllowed;
00136 static void refreshSketchWorld();
00137 static void refreshSketchLocal();
00138 static void refreshSketchCamera();
00139 static void autoRefreshSketchWorld();
00140 static void autoRefreshSketchLocal();
00141 static void autoRefreshSketchCamera();
00142
00143
00144 static Point robotObstaclesPt;
00145
00146
00147 static AngTwoPi robotObstaclesOri;
00148
00149 static std::vector<ShapeRoot> drawShapes;
00150
00151 static VisualOdometry *imageOdometry;
00152
00153 private:
00154
00155 static VRmixin* theOne;
00156
00157
00158 VRmixin (const VRmixin&);
00159 VRmixin& operator=(const VRmixin&);
00160
00161
00162 static int camDialogSockCallback(char *buf, int bytes);
00163
00164
00165 static int localDialogSockCallback(char *buf, int bytes);
00166
00167
00168 static int worldDialogSockCallback(char *buf, int bytes);
00169
00170 static void dialogCallback(char* buf, int bytes, std::string& incomplete,
00171 SketchSpace &SkS, ShapeSpace &ShS);
00172 };
00173
00174 }
00175
00176 #endif