Sensor.hh
00001 /* 00002 * Copyright 2011 Nate Koenig & Andrew Howard 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 * 00016 */ 00017 /* Desc: Base class for all sensors 00018 * Author: Nathan Koenig 00019 * Date: 25 May 2007 00020 */ 00021 00022 #ifndef SENSOR_HH 00023 #define SENSOR_HH 00024 00025 #include <vector> 00026 #include <boost/enable_shared_from_this.hpp> 00027 00028 #include "sdf/sdf.h" 00029 00030 #include "physics/PhysicsTypes.hh" 00031 00032 #include "msgs/msgs.h" 00033 #include "common/Events.hh" 00034 #include "common/Time.hh" 00035 #include "math/Pose.hh" 00036 #include "transport/TransportTypes.hh" 00037 00038 namespace gazebo 00039 { 00040 namespace sensors 00041 { 00044 00046 class Sensor : public boost::enable_shared_from_this<Sensor> 00047 { 00049 public: Sensor(); 00050 00052 public: virtual ~Sensor(); 00053 00056 public: virtual void Load( sdf::ElementPtr &_sdf ); 00057 00059 public: virtual void Load(); 00060 00062 public: virtual void Init(); 00063 00065 public: virtual void SetParent( const std::string &_name ); 00066 00067 public: std::string GetParentName() const; 00068 00070 public: void Update(bool _force); 00071 protected: virtual void UpdateImpl(bool /*_force*/) {} 00072 00074 public: void SetUpdateRate(double _hz); 00075 00077 public: virtual void Fini(); 00078 00080 public: std::string GetName() const; 00081 00083 public: virtual math::Pose GetPose() const; 00084 00086 public: virtual void SetActive(bool value); 00087 00088 public: bool IsActive(); 00089 00091 public: std::string GetType() const; 00092 00094 public: common::Time GetLastUpdateTime(); 00095 00096 public: bool GetVisualize() const; 00097 00098 public: std::string GetTopic() const; 00099 00100 public: void FillMsg(msgs::Sensor &_msg); 00101 00104 private: void LoadPlugin( sdf::ElementPtr &_sdf ); 00105 00107 protected: bool active; 00108 protected: sdf::ElementPtr sdf; 00109 protected: math::Pose pose; 00110 protected: std::vector<event::ConnectionPtr> connections; 00111 protected: transport::NodePtr node; 00112 protected: transport::SubscriberPtr poseSub; 00113 00114 protected: std::string parentName; 00115 protected: std::vector<SensorPluginPtr> plugins; 00116 00117 protected: gazebo::physics::WorldPtr world; 00118 protected: common::Time updatePeriod; 00119 protected: common::Time lastUpdateTime; 00120 00121 }; 00123 } 00124 } 00125 #endif

1.7.5.1