RayShape.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: A ray
00018  * Author: Nate Keonig
00019  * Date: 14 Oct 2009
00020 */
00021 
00022 #ifndef RAYSHAPE_HH
00023 #define RAYSHAPE_HH
00024 
00025 #include <float.h>
00026 
00027 #include "physics/PhysicsTypes.hh"
00028 #include "physics/Shape.hh"
00029 
00030 namespace gazebo
00031 {
00032     namespace physics
00033   {
00036 
00038     class RayShape : public Shape
00039     {
00041       public: RayShape(PhysicsEnginePtr _physicsEngine);
00042 
00047       public: RayShape(CollisionPtr parent, bool displayRays);
00048     
00050       public: virtual ~RayShape();
00051   
00056       public: virtual void SetPoints(const math::Vector3 &posStart, 
00057                                      const math::Vector3 &posEnd);
00058               
00059     
00063       public: virtual void GetRelativePoints(math::Vector3 &posA, 
00064                                              math::Vector3 &posB);
00065   
00069       public: virtual void GetGlobalPoints(math::Vector3 &posA,
00070                                            math::Vector3 &posB);
00071   
00074       public: virtual void SetLength( double len );
00075   
00077       public: double GetLength() const;
00078   
00080       public: virtual void Update() = 0;
00081    
00083       public: virtual void GetIntersection(double &_dist,
00084                                            std::string &_entity) = 0;
00085 
00087       public: void SetRetro( float retro );
00088     
00090       public: float GetRetro() const;
00091   
00093       public: void SetFiducial( int fid );
00094   
00096       public: int GetFiducial() const;
00097   
00099       public: virtual void Load( sdf::ElementPtr &_sdf );
00100 
00102       public: virtual void Init();
00103               
00104       public: void FillShapeMsg(msgs::Geometry &) {}
00105   
00106       public: virtual void ProcessMsg(const msgs::Geometry &) {}
00107 
00110       protected: double contactLen;
00111       protected: double contactRetro;
00112       protected: int contactFiducial;
00113     
00115       protected: math::Vector3 relativeStartPos;
00116       protected: math::Vector3 relativeEndPos;
00117     
00119       protected: math::Vector3 globalStartPos;
00120       protected: math::Vector3 globalEndPos;
00121     };
00123   }
00124 }
00125 #endif