5 #define MAP_IDX(sx, i, j) ((sx) * (j) + (i)) 62 int current_height_level;
74 for (
int index_y = 0; index_y < (int)elevation_map.info.height; ++index_y)
76 for (
int index_x = 0; index_x < (int)elevation_map.info.width; ++index_x)
79 if(elevation_map.data[
MAP_IDX(elevation_map.info.width, index_x, index_y)] != (int16_t)-elevation_map.info.zero_elevation)
81 geometry_msgs::Point cube_center;
82 Eigen::Vector2f index_map(index_x, index_y);
85 cube_center.x = index_world(0);
86 cube_center.y = index_world(1);
87 cube_center.z = (elevation_map.data[
MAP_IDX(elevation_map.info.width, index_x, index_y)]-elevation_map.info.zero_elevation)*elevation_map.info.resolution_z;
102 std::stringstream ss;
145 nav_msgs::MapMetaData map_meta;
146 map_meta.resolution = elevation_map.info.resolution_xy;
147 map_meta.height = elevation_map.info.height;
148 map_meta.width = elevation_map.info.width;
149 map_meta.origin = elevation_map.info.origin;
164 ROS_DEBUG(
"sysMsgCallback, msg contents: %s",
string.data.c_str());
166 if (
string.data ==
"reset")
181 std_msgs::ColorRGBA color;
203 color.r = v; color.g = n; color.b = m;
206 color.r = n; color.g = v; color.b = m;
209 color.r = m; color.g = v; color.b = n;
212 color.r = m; color.g = n; color.b = v;
215 color.r = n; color.g = m; color.b = v;
218 color.r = v; color.g = m; color.b = n;
221 color.r = 1; color.g = 0.5; color.b = 0.5;
~ElevationVisualization()
Default deconstructor.
void publish(const boost::shared_ptr< M > &message) const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void map_callback(const hector_elevation_msgs::ElevationGrid &elevation_map)
map_callback get called if a new elevation map is avaible
dynamic_reconfigure::Server< hector_elevation_visualization::ElevationVisualizationConfig > dyn_rec_server_
ros::Subscriber sub_elevation_map
ROSCPP_DECL void spin(Spinner &spinner)
TFSIMD_FORCE_INLINE const tfScalar & z() const
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
#define MAP_IDX(sx, i, j)
std::string elevation_map_frame_id
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
uint32_t getNumSubscribers() const
visualization_msgs::MarkerArray map_marker_array_msg
void dynRecParamCallback(hector_elevation_visualization::ElevationVisualizationConfig &config, uint32_t level)
dynRecParamCallback This function get called if new parameters has been set with the dynamic reconfig...
void visualize_map(const hector_elevation_msgs::ElevationGrid &elevation_map, tf::StampedTransform local_map_transform)
visualize_map calculates visualization markers to vizualize the elevation map in rviz ...
std::string sys_msg_topic
ros::Subscriber sub_sys_message_callback
HectorMapTools::CoordinateTransformer< float > world_map_transform
ros::Publisher map_marker_array_publisher
ElevationVisualization()
Default constructor.
void sys_message_callback(const std_msgs::String &string)
sysMessageCallback This function listen to system messages
std_msgs::ColorRGBA marker_color
static std_msgs::ColorRGBA heightMapColor(double h)
heightMapColor calculates the marker color as a function of height