##

MultiRayShape.hh
Go to the documentation of this file.
/*
* Copyright (C) 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_PHYSICS_MULTIRAYSHAPE_HH_
#define GAZEBO_PHYSICS_MULTIRAYSHAPE_HH_
#include <vector>
#include <string>
#include <ignition/math/Angle.hh>
#include "gazebo/physics/Collision.hh"
#include "gazebo/physics/Shape.hh"
#include "gazebo/physics/RayShape.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace physics
{
class GZ_PHYSICS_VISIBLE MultiRayShape : public Shape
{
public: explicit MultiRayShape(CollisionPtr _parent);
public: explicit MultiRayShape(PhysicsEnginePtr _physicsEngine);
public: virtual ~MultiRayShape();
public: virtual void Init();
public: virtual void SetScale(const ignition::math::Vector3d &_scale);
public: double GetRange(unsigned int _index);
public: double GetRetro(unsigned int _index);
public: int GetFiducial(unsigned int _index);
public: double GetMinRange() const;
public: double GetMaxRange() const;
public: double GetResRange() const;
public: int GetSampleCount() const;
public: double GetScanResolution() const;
public: ignition::math::Angle MinAngle() const;
public: ignition::math::Angle MaxAngle() const;
public: int GetVerticalSampleCount() const;
public: double GetVerticalScanResolution() const;
public: ignition::math::Angle VerticalMinAngle() const;
public: ignition::math::Angle VerticalMaxAngle() const;
public: void Update();
public: void FillMsg(msgs::Geometry &_msg);
public: virtual void ProcessMsg(const msgs::Geometry &_msg);
public: virtual double ComputeVolume() const;
public: template<typename T>
event::ConnectionPtr ConnectNewLaserScans(T _subscriber)
{return this->newLaserScans.Connect(_subscriber);}
public: virtual void UpdateRays() = 0;
public: virtual void AddRay(const ignition::math::Vector3d &_start,
const ignition::math::Vector3d &_end);
public: bool SetRay(const unsigned int _rayIndex,
const ignition::math::Vector3d &_start,
const ignition::math::Vector3d &_end);
public: unsigned int RayCount() const;
public: RayShapePtr Ray(const unsigned int _rayIndex) const;
protected: std::vector<RayShapePtr> rays;
protected: ignition::math::Pose3d offset;
protected: sdf::ElementPtr rayElem;
protected: sdf::ElementPtr scanElem;
protected: sdf::ElementPtr horzElem;
protected: sdf::ElementPtr vertElem;
protected: sdf::ElementPtr rangeElem;
protected: event::EventT<void()> newLaserScans;
private: double minRange = 0;
private: double maxRange = 1000;
};
}
}
#endif
gazebo::physics::MultiRayShape::ConnectNewLaserScans
event::ConnectionPtr ConnectNewLaserScans(T _subscriber)
Connect a to the new laser scan signal.
Definition: MultiRayShape.hh:147
gazebo::physics::MultiRayShape::Init
virtual void Init()
Init the shape.
gazebo::physics::MultiRayShape::GetMinRange
double GetMinRange() const
Get the minimum range.
gazebo::physics::MultiRayShape::FillMsg
void FillMsg(msgs::Geometry &_msg)
\TODO This function is not implemented.
gazebo::physics::MultiRayShape::GetFiducial
int GetFiducial(unsigned int _index)
Get detected fiducial value for a ray.
gazebo::physics::MultiRayShape::newLaserScans
event::EventT< void()> newLaserScans
New laser scans event.
Definition: MultiRayShape.hh:204
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
Collision.hh
gazebo::physics::MultiRayShape::MaxAngle
ignition::math::Angle MaxAngle() const
Get the maximum angle.
gazebo::physics::MultiRayShape::ComputeVolume
virtual double ComputeVolume() const
Documentation inherited.
gazebo::physics::MultiRayShape::AddRay
virtual void AddRay(const ignition::math::Vector3d &_start, const ignition::math::Vector3d &_end)
Add a ray to the collision.
gazebo::physics::MultiRayShape::VerticalMinAngle
ignition::math::Angle VerticalMinAngle() const
Get the vertical min angle.
gazebo::physics::MultiRayShape::vertElem
sdf::ElementPtr vertElem
Vertical SDF element pointer.
Definition: MultiRayShape.hh:198
system.hh
gazebo::physics::MultiRayShape::rangeElem
sdf::ElementPtr rangeElem
Range SDF element pointer.
Definition: MultiRayShape.hh:201
gazebo::physics::MultiRayShape::rays
std::vector< RayShapePtr > rays
Ray data.
Definition: MultiRayShape.hh:183
gazebo::physics::MultiRayShape::GetResRange
double GetResRange() const
Get the range resolution.
gazebo::physics::MultiRayShape::GetScanResolution
double GetScanResolution() const
Get the horizontal resolution.
gazebo::physics::MultiRayShape::SetRay
bool SetRay(const unsigned int _rayIndex, const ignition::math::Vector3d &_start, const ignition::math::Vector3d &_end)
Set the points of a ray.
gazebo::physics::MultiRayShape::Ray
RayShapePtr Ray(const unsigned int _rayIndex) const
Get a pointer to a ray.
gazebo::event::EventT
A class for event processing.
Definition: Event.hh:97
gazebo::physics::MultiRayShape
Laser collision contains a set of ray-collisions, structured to simulate a laser range scanner.
Definition: MultiRayShape.hh:39
gazebo::physics::MultiRayShape::VerticalMaxAngle
ignition::math::Angle VerticalMaxAngle() const
Get the vertical max angle.
gazebo::physics::MultiRayShape::GetMaxRange
double GetMaxRange() const
Get the maximum range.
gazebo::physics::MultiRayShape::rayElem
sdf::ElementPtr rayElem
Ray SDF element pointer.
Definition: MultiRayShape.hh:189
gazebo::physics::MultiRayShape::GetSampleCount
int GetSampleCount() const
Get the horizontal sample count.
gazebo::physics::MultiRayShape::horzElem
sdf::ElementPtr horzElem
Horizontal SDF element pointer.
Definition: MultiRayShape.hh:195
gazebo::physics::MultiRayShape::GetVerticalSampleCount
int GetVerticalSampleCount() const
Get the vertical sample count.
gazebo::event::EventT::Connect
ConnectionPtr Connect(const std::function< T > &_subscriber)
Connect a callback to this event.
Definition: Event.hh:558
Shape.hh
RayShape.hh
gazebo::event::ConnectionPtr
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
gazebo::physics::MultiRayShape::MultiRayShape
MultiRayShape(CollisionPtr _parent)
Constructor.
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
gazebo::physics::MultiRayShape::SetScale
virtual void SetScale(const ignition::math::Vector3d &_scale)
Set the scale of the multi ray shape.
gazebo::physics::MultiRayShape::GetRetro
double GetRetro(unsigned int _index)
Get detected retro (intensity) value for a ray.
gazebo::physics::MultiRayShape::offset
ignition::math::Pose3d offset
Pose offset of all the rays.
Definition: MultiRayShape.hh:186
gazebo::physics::MultiRayShape::GetRange
double GetRange(unsigned int _index)
Get detected range for a ray.
gazebo::physics::MultiRayShape::ProcessMsg
virtual void ProcessMsg(const msgs::Geometry &_msg)
\TODO This function is not implemented.
gazebo::physics::PhysicsEnginePtr
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition: PhysicsTypes.hh:125
gazebo::physics::CollisionPtr
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:113
gazebo::physics::MultiRayShape::~MultiRayShape
virtual ~MultiRayShape()
Destructor.
gazebo::physics::MultiRayShape::UpdateRays
virtual void UpdateRays()=0
Method for updating the rays.
gazebo::physics::MultiRayShape::MinAngle
ignition::math::Angle MinAngle() const
Get the minimum angle.
gazebo::physics::RayShapePtr
boost::shared_ptr< RayShape > RayShapePtr
Definition: PhysicsTypes.hh:145
gazebo::physics::MultiRayShape::Update
void Update()
Update the ray collisions.
gazebo::physics::MultiRayShape::GetVerticalScanResolution
double GetVerticalScanResolution() const
Get the vertical range resolution.
gazebo::physics::MultiRayShape::RayCount
unsigned int RayCount() const
Get the number of rays.
gazebo::physics::Shape
Base class for all shapes.
Definition: Shape.hh:39
gazebo::physics::MultiRayShape::scanElem
sdf::ElementPtr scanElem
Scan SDF element pointer.
Definition: MultiRayShape.hh:192