RaySensor.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: RaySensor proximity sensor
00018  * Author: Nate Koenig
00019  * Date: 23 february 2004
00020  * SVN: $Id$
00021 */
00022 
00023 #ifndef RAYSENSOR_HH
00024 #define RAYSENSOR_HH
00025 
00026 #include <vector>
00027 
00028 #include "math/Angle.hh"
00029 #include "math/Pose.hh"
00030 #include "transport/TransportTypes.hh"
00031 #include "sensors/Sensor.hh"
00032 
00033 namespace gazebo
00034 {
00035   class OgreDynamicLines;
00036   class Collision;
00037   class MultiRayShape;
00038 
00039   namespace sensors
00040   {
00041 
00044     
00050     class RaySensor: public Sensor
00051     {
00053       public: RaySensor();
00054     
00056       public: virtual ~RaySensor();
00057     
00060       public: virtual void Load( sdf::ElementPtr &_sdf );
00061       public: virtual void Load( );
00062     
00064       public: virtual void Init();
00065     
00067       protected: virtual void UpdateImpl(bool _force);
00068  
00070       protected: virtual void Fini();
00071     
00074       public: math::Angle GetAngleMin() const;
00075     
00078       public: math::Angle GetAngleMax() const;
00079    
00081       public: double GetAngleResolution() const;
00082 
00085       public: double GetRangeMin() const;
00086     
00089       public: double GetRangeMax() const;
00090     
00092       public: double GetRangeResolution() const;
00093     
00096       public: int GetRayCount() const;
00097     
00100       public: int GetRangeCount() const;
00101     
00104       public: int GetVerticalRayCount() const;
00105     
00108       public: int GetVerticalRangeCount() const;
00109     
00112       public: math::Angle GetVerticalAngleMin() const;
00113     
00116       public: math::Angle GetVerticalAngleMax() const;
00117 
00120       public: double GetRange(int index);   
00121     
00123       public: double GetRetro(int index);   
00124     
00126       public: int GetFiducial(int index);   
00127     
00128       private: physics::LinkPtr link;
00129       private: physics::CollisionPtr laserCollision;
00130       private: physics::MultiRayShapePtr laserShape;
00131 
00132       private: transport::NodePtr node;
00133       private: transport::PublisherPtr scanPub;
00134     };
00136   }
00137 }
00138 
00139 #endif