Go to the documentation of this file.
17 #ifndef GAZEBO_PHYSICS_HEIGHTMAPSHAPE_HH_
18 #define GAZEBO_PHYSICS_HEIGHTMAPSHAPE_HH_
22 #include <ignition/transport/Node.hh>
24 #include <ignition/math/Vector2.hh>
59 public:
virtual void Load(sdf::ElementPtr _sdf);
62 public:
virtual void Init();
66 public:
virtual void SetScale(
const ignition::math::Vector3d &_scale);
70 public: std::string GetURI()
const;
74 public: ignition::math::Vector3d Size()
const;
78 public: ignition::math::Vector3d Pos()
const;
84 public: ignition::math::Vector2i VertexCount()
const;
90 public:
HeightType GetHeight(
int _x,
int _y)
const;
96 public:
void FillMsg(msgs::Geometry &_msg);
100 public:
void FillHeights(msgs::Geometry &_msg)
const;
104 public:
virtual void ProcessMsg(
const msgs::Geometry &_msg);
107 public:
virtual double ComputeVolume()
const;
119 public:
int GetSubSampling()
const;
132 private:
int LoadTerrainFile(
const std::string &_filename);
136 private:
void OnRequest(ConstRequestPtr &_msg);
141 public:
void FillHeightfield(std::vector<float>& heights);
144 public:
void FillHeightfield(std::vector<double>& heights);
174 private: std::string fileFormat;
177 private: ignition::math::Vector3d heightmapSize;
188 private: ignition::transport::Node nodeIgn;
191 private: ignition::transport::Node::Publisher responsePubIgn;
Encapsulates a generic heightmap data file.
Definition: HeightmapData.hh:39
Forward declarations for the common classes.
Definition: Animation.hh:26
void FillHeightfield(std::vector< float > &heights)
Fills the heightmap data (float) into the vector by calling HeightmapData::FillHeightMap with heights...
float HeightType
height field type, float or double
Definition: HeightmapShape.hh:48
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
HeightmapShape(CollisionPtr _parent)
Constructor.
void FillHeights(msgs::Geometry &_msg) const
Fill a geometry message with this shape's height data.
Forward declarations for transport.
std::string GetURI() const
Get the URI of the heightmap image.
HeightType GetMaxHeight() const
Get the maximum height.
void FillMsg(msgs::Geometry &_msg)
Fill a geometry message with this shape's data.
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
virtual double ComputeVolume() const
Documentation inherited.
default namespace for gazebo
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
Encapsulates an image.
Definition: Image.hh:65
unsigned int vertSize
Size of the height lookup table.
Definition: HeightmapShape.hh:156
ignition::math::Vector2i VertexCount() const
Return the number of vertices, which equals the size of the image used to load the heightmap.
HeightType GetHeight(int _x, int _y) const
Get a height at a position.
HeightmapShape collision shape builds a heightmap from an image. The supplied image must be square wi...
Definition: HeightmapShape.hh:45
virtual ~HeightmapShape()
Destructor.
int subSampling
The amount of subsampling. Default is 2.
Definition: HeightmapShape.hh:162
ignition::math::Vector3d Size() const
Get the size in meters.
virtual void SetScale(const ignition::math::Vector3d &_scale)
Set the scale of the heightmap shape.
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
bool flipY
True to flip the heights along the y direction.
Definition: HeightmapShape.hh:159
common::Image GetImage() const
Return an image representation of the heightmap.
virtual void ProcessMsg(const msgs::Geometry &_msg)
Update the heightmap from a message.
common::HeightmapData * heightmapData
HeightmapData used to generate the heights.
Definition: HeightmapShape.hh:153
HeightType GetMinHeight() const
Get the minimum height.
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:114
virtual void Init()
Initialize the heightmap.
std::vector< HeightType > heights
Lookup table of heights.
Definition: HeightmapShape.hh:147
common::ImageHeightmap img
Image used to generate the heights.
Definition: HeightmapShape.hh:150
int GetSubSampling() const
Get the amount of subsampling.
ignition::math::Vector3d Pos() const
Get the origin in world coordinate frame.
Encapsulates an image that will be interpreted as a heightmap.
Definition: ImageHeightmap.hh:38
Base class for all shapes.
Definition: Shape.hh:39
virtual void Load(sdf::ElementPtr _sdf)
Load the heightmap.