PCDLoader.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00010 #ifndef PCD_LOADER_H
00011 #define PCD_LOADER_H
00012 
00013 #include <rtm/idl/BasicDataType.hh>
00014 #include "hrpsys/idl/pointcloud.hh"
00015 #include "hrpsys/idl/PCDLoaderService.hh"
00016 #include <rtm/Manager.h>
00017 #include <rtm/DataFlowComponentBase.h>
00018 #include <rtm/CorbaPort.h>
00019 #include <rtm/DataInPort.h>
00020 #include <rtm/DataOutPort.h>
00021 #include <rtm/idl/BasicDataTypeSkel.h>
00022 #include <pcl/io/pcd_io.h>
00023 #include <boost/unordered_map.hpp>
00024 #include <hrpUtil/Eigen3d.h>
00025 #include "PCDLoaderService_impl.h"
00026 
00027 // Service implementation headers
00028 // <rtc-template block="service_impl_h">
00029 
00030 // </rtc-template>
00031 
00032 // Service Consumer stub headers
00033 // <rtc-template block="consumer_stub_h">
00034 
00035 // </rtc-template>
00036 
00037 using namespace RTC;
00038 
00042 class PCDLoader
00043   : public RTC::DataFlowComponentBase
00044 {
00045  public:
00050   PCDLoader(RTC::Manager* manager);
00054   virtual ~PCDLoader();
00055 
00056   // The initialize action (on CREATED->ALIVE transition)
00057   // formaer rtc_init_entry()
00058   virtual RTC::ReturnCode_t onInitialize();
00059 
00060   // The finalize action (on ALIVE->END transition)
00061   // formaer rtc_exiting_entry()
00062   // virtual RTC::ReturnCode_t onFinalize();
00063 
00064   // The startup action when ExecutionContext startup
00065   // former rtc_starting_entry()
00066   // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id);
00067 
00068   // The shutdown action when ExecutionContext stop
00069   // former rtc_stopping_entry()
00070   // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id);
00071 
00072   // The activated action (Active state entry action)
00073   // former rtc_active_entry()
00074   virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
00075 
00076   // The deactivated action (Active state exit action)
00077   // former rtc_active_exit()
00078   virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
00079 
00080   // The execution action that is invoked periodically
00081   // former rtc_active_do()
00082   virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
00083 
00084   // The aborting action when main logic error occurred.
00085   // former rtc_aborting_entry()
00086   // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id);
00087 
00088   // The error action in ERROR state
00089   // former rtc_error_do()
00090   // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id);
00091 
00092   // The reset action that is invoked resetting
00093   // This is same but different the former rtc_init_entry()
00094   // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id);
00095 
00096   // The state update action that is invoked after onExecute() action
00097   // no corresponding operation exists in OpenRTm-aist-0.2.0
00098   // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id);
00099 
00100   // The action that is invoked when execution context's rate is changed
00101   // no corresponding operation exists in OpenRTm-aist-0.2.0
00102   // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id);
00103   
00104     bool load(const std::string& filename, const std::string& label);
00105     
00106 protected:
00107   // Configuration variable declaration
00108   // <rtc-template block="config_declare">
00109   
00110   // </rtc-template>
00111     
00112   PointCloudTypes::PointCloud m_cloud;
00113   OpenHRP::PCDOffsetSeq m_offset;
00114   RTC::TimedBoolean m_isOutput;
00115   
00116   // DataInPort declaration
00117   // <rtc-template block="inport_declare">
00118   
00119   InPort<OpenHRP::PCDOffsetSeq> m_offsetIn;
00120   
00121   // </rtc-template>
00122   
00123   // DataOutPort declaration
00124   // <rtc-template block="outport_declare">
00125   OutPort<PointCloudTypes::PointCloud> m_cloudOut;
00126   OutPort<RTC::TimedBoolean> m_isOutputOut;
00127   
00128   // </rtc-template>
00129 
00130   // CORBA Port declaration
00131   // <rtc-template block="corbaport_declare">
00132   RTC::CorbaPort m_PCDLoaderServicePort;
00133   
00134   // </rtc-template>
00135 
00136   // Service declaration
00137   // <rtc-template block="service_declare">
00138   PCDLoaderService_impl m_service0;
00139   
00140   // </rtc-template>
00141 
00142   // Consumer declaration
00143   // <rtc-template block="consumer_declare">
00144   
00145   // </rtc-template>
00146 
00147   void setCloudXYZ(PointCloudTypes::PointCloud& cloud, const pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_raw);
00148   
00149   void setCloudXYZRGB(PointCloudTypes::PointCloud& cloud, const pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud_raw);
00150   
00151   void updateOffsetToCloudXYZ(void);
00152   
00153   void updateOffsetToCloudXYZRGB(void);
00154   
00155  private:
00156   std::string m_path, m_fields;
00157   int dummy;
00158   boost::unordered_map<std::string, pcl::PointCloud<pcl::PointXYZ>::Ptr> m_clouds_xyz;
00159   boost::unordered_map<std::string, pcl::PointCloud<pcl::PointXYZRGB>::Ptr> m_clouds_xyzrgb;
00160 };
00161 
00162 
00163 extern "C"
00164 {
00165   void PCDLoaderInit(RTC::Manager* manager);
00166 };
00167 
00168 #endif // PCD_LOADER_H


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Wed May 15 2019 05:02:18