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 MapBuilder;
00030 class ShapeBasedParticleFilter;
00031
00032 typedef unsigned char cmap_t;
00033
00034
00035 class VRmixin {
00036 protected:
00037 static unsigned int instanceCount;
00038 static unsigned int crewCount;
00039
00040 public:
00041
00042 static SketchSpace& getCamSkS();
00043 static SketchSpace& getLocalSkS();
00044 static SketchSpace& getWorldSkS();
00045 static ShapeSpace& getGroundShS();
00046
00047 static SketchSpace& camSkS;
00048 static ShapeSpace& camShS;
00049
00050 static ShapeSpace& groundShS;
00051
00052 static SketchSpace& localSkS;
00053 static ShapeSpace& localShS;
00054
00055 static SketchSpace& worldSkS;
00056 static ShapeSpace& worldShS;
00057 static Shape<AgentData> theAgent;
00058
00059 static MapBuilder* mapBuilder;
00060 static Lookout* lookout;
00061 #ifdef TGT_HAS_WALK
00062 static Pilot* pilot;
00063 #endif
00064 #if (defined(TGT_HAS_ARMS) || !defined(STRICT_TGT_MODEL)) && !defined(TGT_IS_AIBO)
00065 static Grasper* grasper;
00066 #endif
00067
00068 static ShapeBasedParticleFilter *particleFilter;
00069
00070 private:
00071 static Socket *camDialogSock;
00072 static Socket *camSketchSock;
00073 static Socket *localDialogSock;
00074 static Socket *localSketchSock;
00075 static Socket *worldDialogSock;
00076 static Socket *worldSketchSock;
00077
00078 public:
00079
00080 VRmixin();
00081
00082
00083 virtual ~VRmixin(void);
00084
00085 static void startCrew();
00086 static void stopCrew();
00087
00088
00089 static bool encodeSketch(const SketchDataRoot& image);
00090
00091
00092 static Sketch<uchar> sketchFromSeg();
00093
00094
00095 static Sketch<uchar> sketchFromChannel(const RawCameraGenerator::channel_id_t chan);
00096
00097
00098 static Sketch<uchar> sketchFromRawY();
00099
00100
00101 static Sketch<yuv> sketchFromYUV();
00102
00103
00104 static Sketch<usint> sketchFromDepth();
00105
00106
00107 static std::vector<Shape<BlobData> >
00108 getBlobsFromRegionGenerator(const color_index color, int minarea=25,
00109 const BlobData::BlobOrientation_t orient=BlobData::groundplane,
00110 const coordinate_t height=0,
00111 const int maxblobs=50);
00112
00113
00114 static void processSketchRequest(const std::string &line,
00115 SketchSpace &sketches,
00116 ShapeSpace &shapes);
00117
00118 #ifdef TGT_HAS_CAMERA
00119
00120 static void projectToGround();
00121 #endif
00122
00123
00124 static void projectToGround(const fmat::Transform& camToBase);
00125 static void projectToGround(const fmat::Transform& camToBase, const PlaneEquation& groundplane);
00126
00127 private:
00128
00129 static VRmixin* theOne;
00130
00131
00132 VRmixin (const VRmixin&);
00133 VRmixin& operator=(const VRmixin&);
00134
00135
00136 static int camDialogSockCallback(char *buf, int bytes);
00137
00138
00139 static int localDialogSockCallback(char *buf, int bytes);
00140
00141
00142 static int worldDialogSockCallback(char *buf, int bytes);
00143
00144 static void dialogCallback(char* buf, int bytes, std::string& incomplete,
00145 SketchSpace &SkS, ShapeSpace &ShS);
00146 };
00147
00148 }
00149
00150 #endif