00001 00002 #include "Component/ModelComponent.H" 00003 #include "Component/ModelParam.H" 00004 #include "Component/OptionManager.H" 00005 #include "Media/FrameSeries.H" 00006 #include "Transport/FrameInfo.H" 00007 #include "Raster/GenericFrame.H" 00008 #include "Image/Image.H" 00009 #include "GUI/XWinManaged.H" 00010 #include "GUI/ImageDisplayStream.H" 00011 #include "Image/Image.H" 00012 #include "Image/DrawOps.H" 00013 #include "Image/Pixels.H" 00014 #include "Robots/RobotBrain/RobotBrainComponent.H" 00015 00016 #include "Ice/RobotBrainObjects.ice.H" 00017 #include "Ice/IceImageUtils.H" 00018 #include "Ice/RobotSimEvents.ice.H" 00019 #include <IceUtil/Thread.h> 00020 00021 #ifndef VISIONBRAINCOMPONENTI_H 00022 #define VISIONBRAINCOMPONENTI_H 00023 00024 class VisionBrainComponentI : public RobotBrainComponent 00025 { 00026 public: 00027 00028 VisionBrainComponentI(OptionManager& mgr, 00029 const std::string& descrName = "VisionBrainComponent", 00030 const std::string& tagName = "VisionBrainComponent"); 00031 00032 ~VisionBrainComponentI(); 00033 00034 virtual void evolve(); 00035 00036 //!Get a message 00037 virtual void updateMessage(const RobotSimEvents::EventMessagePtr& eMsg, 00038 const Ice::Current&); 00039 00040 virtual void registerVisionTopics(); 00041 00042 virtual void registerVisionPublisher(const std::string& MessageTopic); 00043 00044 virtual bool publishVisionMsg(const::std::string& MessageTopic, RobotSimEvents::EventMessagePtr msg); 00045 00046 //Guys, let's just decide on a single updateFrame, and get rid of this one... --Rand 00047 //virtual void updateFrame(Image<PixRGB<byte> > img, bool isFwdCamera) {}; 00048 00049 virtual void updateFrame(Image<PixRGB<byte> > img, std::string cameraID) = 0; 00050 00051 std::string getCameraSourceName() { return itsCameraSource.getVal();}; 00052 00053 protected: 00054 nub::soft_ref<OutputFrameSeries> itsOfs; 00055 int itsFrameCount; 00056 00057 private: 00058 00059 OModelParam<std::string> itsCameraSource; 00060 00061 //nub::soft_ref<InputFrameSeries> itsIfs; 00062 Image<PixRGB<byte> > itsCurrentImg; 00063 bool itsCurrentImgFwdCam; 00064 std::string itsCurrentCameraID; 00065 00066 IceUtil::Mutex itsImgMutex; 00067 00068 int lastFrameCount; 00069 }; 00070 00071 #endif