RTCHokuyoAist 3.0.0
|
00001 /* RTC:HokuyoAIST 00002 * 00003 * Header file for the component. 00004 * 00005 * Copyright 2010-2011 Geoffrey Biggs geoffrey.biggs@aist.go.jp 00006 * RT-Synthesis Research Group 00007 * Intelligent Systems Research Institute, 00008 * National Institute of Advanced Industrial Science and Technology (AIST), 00009 * Japan 00010 * All rights reserved. 00011 * 00012 * This file is part of HokuyoAIST. 00013 * 00014 * HokuyoAIST is free software; you can redistribute it and/or modify it 00015 * under the terms of the GNU Lesser General Public License as published 00016 * by the Free Software Foundation; either version 2.1 of the License, 00017 * or (at your option) any later version. 00018 * 00019 * HokuyoAIST is distributed in the hope that it will be useful, but 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00022 * Lesser General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU Lesser General Public 00025 * License along with HokuyoAIST. If not, see 00026 * <http://www.gnu.org/licenses/>. 00027 */ 00028 00029 00030 #ifndef RTC_H__ 00031 #define RTC_H__ 00032 00033 #include <hokuyoaist/hokuyoaist.h> 00034 #include <rtm/Manager.h> 00035 #include <rtm/DataFlowComponentBase.h> 00036 #include <rtm/OutPort.h> 00037 #include <rtm/CorbaPort.h> 00038 #include <time.h> 00039 00040 #include "ranger_impl.h" 00041 #include "hokuyoaist_impl.h" 00042 00043 using namespace RTC; 00044 00045 00046 class RTCHokuyoAIST 00047 : public RTC::DataFlowComponentBase 00048 { 00049 public: 00050 RTCHokuyoAIST(RTC::Manager* manager); 00051 ~RTCHokuyoAIST(); 00052 00053 virtual RTC::ReturnCode_t onInitialize(); 00054 virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id); 00055 virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id); 00056 virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id); 00057 00058 // Functions used by the services 00059 RTC::RangerGeometry get_geometry() const { return sensor_geom_; } 00060 void set_power(bool enable); 00061 void enable_intensity_data(bool enable); 00062 RTC::RangerConfig get_config() const { return sensor_config_; } 00063 void set_config(RTC::RangerConfig const& config); 00064 void request_scan(); 00065 00066 protected: 00067 // Ports 00068 RTC::RangeData ranges_; 00069 RTC::OutPort<RTC::RangeData> ranges_port_; 00070 RTC::IntensityData intensities_; 00071 RTC::OutPort<RTC::IntensityData> intensities_port_; 00072 RTCHokuyoAist::RangerProvider svc_prov_; 00073 RTCHokuyoAist::HokuyoAistProvider specialist_prov_; 00074 RTC::CorbaPort svc_port_; 00075 00076 // Configurable settings 00077 std::string port_opts_; 00078 double start_angle_, end_angle_; 00079 unsigned int cluster_count_; 00080 bool enable_intns_; 00081 bool high_sens_; 00082 bool pull_mode_; 00083 bool new_data_mode_; 00084 bool verbose_; 00085 time_t error_time_; 00086 double x_, y_, z_, roll_, pitch_, yaw_; 00087 00088 hokuyoaist::Sensor laser_; 00089 hokuyoaist::ScanData scan_data_; 00090 RTC::RangerGeometry sensor_geom_; 00091 RTC::RangerConfig sensor_config_; 00092 00093 coil::Mutex mutex_; 00094 double base_ang_res_; 00095 time_t last_error_time_; 00096 00097 void open_laser(); 00098 void close_laser(); 00099 void reset_laser(); 00100 void get_scan(); 00101 void write_scan(); 00102 }; 00103 00104 00105 extern "C" 00106 { 00107 DLL_EXPORT void rtc_init(RTC::Manager* manager); 00108 }; 00109 00110 #endif // RTC_H__ 00111