MultiRayShape.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 #ifndef MULTIRAYGEOM_HH
00018 #define MULTIRAYGEOM_HH
00019 
00020 #include <vector>
00021 
00022 #include "common/Exception.hh"
00023 #include "common/Console.hh"
00024 #include "math/Vector3.hh"
00025 #include "math/Angle.hh"
00026 
00027 #include "physics/Collision.hh"
00028 #include "physics/Shape.hh"
00029 #include "physics/RayShape.hh"
00030 
00031 namespace gazebo
00032 {
00033   namespace msgs
00034   {
00035     class Visual;
00036   }
00037 
00038     namespace physics
00039   {
00042 
00045     class MultiRayShape : public Shape
00046     {
00048       public: MultiRayShape(CollisionPtr parent);
00049     
00051       public: virtual ~MultiRayShape();
00052   
00054       public: virtual void Load( sdf::ElementPtr &_sdf );
00055  
00057       public: virtual void Init();
00058               
00059       public: void SetDisplayType(const std::string &type);
00060     
00063       public: double GetRange(int index);
00064     
00066       public: double GetRetro(int index);
00067     
00069       public: int GetFiducial(int index);
00070   
00072       public: double GetMinRange() const;
00073   
00075       public: double GetMaxRange() const;
00076 
00078       public: double GetResRange() const;
00079 
00080 
00082       public: int GetSampleCount() const;
00083   
00085       public: double GetScanResolution() const;
00086   
00088       public: math::Angle GetMinAngle() const;
00089               
00091       public: math::Angle GetMaxAngle() const;
00092 
00093 
00094 
00095   
00097       public: int GetVerticalSampleCount() const;
00098   
00100       public: double GetVerticalScanResolution() const;
00101   
00103       public: math::Angle GetVerticalMinAngle() const;
00104   
00106       public: math::Angle GetVerticalMaxAngle() const;
00107   
00109       public: void Update();
00110     
00111       public: void FillShapeMsg(msgs::Geometry &) {}
00112 
00113       public: virtual void ProcessMsg(const msgs::Geometry &) {}
00114 
00116       protected: virtual void UpdateRays() = 0;
00117     
00119       protected: virtual void AddRay(const math::Vector3 &start, 
00120                                      const math::Vector3 &end );
00121     
00123       protected: std::vector< RayShapePtr > rays;
00124   
00125       protected: math::Vector3 offset;
00126       protected: sdf::ElementPtr rayElem;
00127       protected: sdf::ElementPtr scanElem;
00128       protected: sdf::ElementPtr horzElem;
00129       protected: sdf::ElementPtr vertElem;
00130       protected: sdf::ElementPtr rangeElem;
00131     };
00133   
00134   }
00135 
00136 }
00137 #endif