feat(robot_sensor_msgs): them message RouteGraph cho route graph (Voronoi) bien dich san tu map
Hand-written theo layout gencpp cua cac header robot_sensor_msgs khac (khong co .msg source). Producer (host) bien dich Voronoi tu static map, day vao qua BaseNavigation::addRouteGraph; consumer (global planner) dung graph khoanh vung search cho goal xa. map_hash + source de consumer xac minh graph khop static layer dang chay truoc khi dung.
This commit is contained in:
200
robot_sensor_msgs/include/robot_sensor_msgs/RouteGraph.h
Normal file
200
robot_sensor_msgs/include/robot_sensor_msgs/RouteGraph.h
Normal file
@@ -0,0 +1,200 @@
|
||||
// Hand-written in the gencpp layout of the other robot_sensor_msgs headers (no .msg source).
|
||||
//
|
||||
// robot_sensor_msgs/RouteGraph — a route graph compiled offline from a static map (e.g. the
|
||||
// generalized Voronoi diagram of the map image), handed from the host into the navigation core
|
||||
// next to the OccupancyGrid it was built from. Consumers (a global planner) use it to confine the
|
||||
// search to a corridor along the graph route; nothing in the core builds such a graph itself.
|
||||
//
|
||||
// Cell coordinates follow OccupancyGrid: x = column, y = row, row 0 = the map's lower-left row
|
||||
// (origin), the same (mx, my) a costmap uses. A producer that reads an image (row 0 = top) must
|
||||
// flip y before filling this message.
|
||||
//
|
||||
// `map_hash` + `source` let the consumer prove the graph belongs to the map it is running on:
|
||||
// `source` names the obstacle rule the producer used; the consumer rebuilds the same obstacle
|
||||
// mask from its own static layer under that rule, hashes it the same way and compares. A mismatch
|
||||
// (map edited, other floor with the same size, different rule) must reject the graph, never
|
||||
// "use it anyway".
|
||||
|
||||
#ifndef ROBOT_SENSOR_MSGS_MESSAGE_ROUTEGRAPH_H
|
||||
#define ROBOT_SENSOR_MSGS_MESSAGE_ROUTEGRAPH_H
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <robot_std_msgs/Header.h>
|
||||
|
||||
namespace robot_sensor_msgs
|
||||
{
|
||||
template <class ContainerAllocator>
|
||||
struct RouteGraph_
|
||||
{
|
||||
typedef RouteGraph_<ContainerAllocator> Type;
|
||||
|
||||
RouteGraph_()
|
||||
: header()
|
||||
, version(0)
|
||||
, source()
|
||||
, map_hash(0)
|
||||
, width(0)
|
||||
, height(0)
|
||||
, resolution(0.0)
|
||||
, origin_x(0.0)
|
||||
, origin_y(0.0)
|
||||
, origin_yaw(0.0)
|
||||
, node_x()
|
||||
, node_y()
|
||||
, edge_u()
|
||||
, edge_v()
|
||||
, edge_length_cells()
|
||||
, edge_min_clearance_cells()
|
||||
, edge_cell_offset()
|
||||
, cell_x()
|
||||
, cell_y() {
|
||||
}
|
||||
RouteGraph_(const ContainerAllocator& _alloc)
|
||||
: header(_alloc)
|
||||
, version(0)
|
||||
, source(_alloc)
|
||||
, map_hash(0)
|
||||
, width(0)
|
||||
, height(0)
|
||||
, resolution(0.0)
|
||||
, origin_x(0.0)
|
||||
, origin_y(0.0)
|
||||
, origin_yaw(0.0)
|
||||
, node_x(_alloc)
|
||||
, node_y(_alloc)
|
||||
, edge_u(_alloc)
|
||||
, edge_v(_alloc)
|
||||
, edge_length_cells(_alloc)
|
||||
, edge_min_clearance_cells(_alloc)
|
||||
, edge_cell_offset(_alloc)
|
||||
, cell_x(_alloc)
|
||||
, cell_y(_alloc) {
|
||||
(void)_alloc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
typedef ::robot_std_msgs::Header_<ContainerAllocator> _header_type;
|
||||
_header_type header;
|
||||
|
||||
/// Layout version of this message's arrays. Consumers reject anything they do not know.
|
||||
typedef uint32_t _version_type;
|
||||
_version_type version;
|
||||
|
||||
/// Obstacle rule the producer applied to the map, e.g.
|
||||
/// "costmap:lethal>=100;unknown_value=-1;track_unknown=1;trinary=1;unknown=traversable;roi=10".
|
||||
typedef std::basic_string<char, std::char_traits<char>, typename std::allocator_traits<ContainerAllocator>::template rebind_alloc<char>> _source_type;
|
||||
_source_type source;
|
||||
|
||||
/// FNV-1a 64 over the bit-packed obstacle mask (row 0 = TOP row of the map, i.e. image order),
|
||||
/// after the ROI of `source` was applied. See route_graph::hashObstacleMask.
|
||||
typedef uint64_t _map_hash_type;
|
||||
_map_hash_type map_hash;
|
||||
|
||||
/// Grid the graph was built on; must equal the static layer the consumer runs on.
|
||||
typedef uint32_t _width_type;
|
||||
_width_type width;
|
||||
|
||||
typedef uint32_t _height_type;
|
||||
_height_type height;
|
||||
|
||||
typedef double _resolution_type;
|
||||
_resolution_type resolution; ///< [m/cell]
|
||||
|
||||
typedef double _origin_x_type;
|
||||
_origin_x_type origin_x; ///< [m] lower-left corner, as OccupancyGrid.info.origin
|
||||
|
||||
typedef double _origin_y_type;
|
||||
_origin_y_type origin_y; ///< [m]
|
||||
|
||||
typedef double _origin_yaw_type;
|
||||
_origin_yaw_type origin_yaw; ///< [rad]
|
||||
|
||||
/// Nodes: junctions, dead ends and synthetic cycle nodes, one cell each.
|
||||
typedef std::vector<int32_t, typename std::allocator_traits<ContainerAllocator>::template rebind_alloc<int32_t>> _node_x_type;
|
||||
_node_x_type node_x;
|
||||
|
||||
typedef std::vector<int32_t, typename std::allocator_traits<ContainerAllocator>::template rebind_alloc<int32_t>> _node_y_type;
|
||||
_node_y_type node_y;
|
||||
|
||||
/// Edges: endpoints are node indices; u == v is a closed loop.
|
||||
typedef std::vector<int32_t, typename std::allocator_traits<ContainerAllocator>::template rebind_alloc<int32_t>> _edge_u_type;
|
||||
_edge_u_type edge_u;
|
||||
|
||||
typedef std::vector<int32_t, typename std::allocator_traits<ContainerAllocator>::template rebind_alloc<int32_t>> _edge_v_type;
|
||||
_edge_v_type edge_v;
|
||||
|
||||
/// [cells] 8-connected length of the edge polyline.
|
||||
typedef std::vector<float, typename std::allocator_traits<ContainerAllocator>::template rebind_alloc<float>> _edge_length_cells_type;
|
||||
_edge_length_cells_type edge_length_cells;
|
||||
|
||||
/// [cells] smallest distance to an obstacle along the edge — the narrowest point of that passage.
|
||||
typedef std::vector<float, typename std::allocator_traits<ContainerAllocator>::template rebind_alloc<float>> _edge_min_clearance_cells_type;
|
||||
_edge_min_clearance_cells_type edge_min_clearance_cells;
|
||||
|
||||
/// Edge i owns cells [edge_cell_offset[i], edge_cell_offset[i+1]) of cell_x/cell_y; size = edges + 1.
|
||||
typedef std::vector<uint32_t, typename std::allocator_traits<ContainerAllocator>::template rebind_alloc<uint32_t>> _edge_cell_offset_type;
|
||||
_edge_cell_offset_type edge_cell_offset;
|
||||
|
||||
/// All edge polylines concatenated, each starting at node u's cell and ending at node v's cell.
|
||||
typedef std::vector<int32_t, typename std::allocator_traits<ContainerAllocator>::template rebind_alloc<int32_t>> _cell_x_type;
|
||||
_cell_x_type cell_x;
|
||||
|
||||
typedef std::vector<int32_t, typename std::allocator_traits<ContainerAllocator>::template rebind_alloc<int32_t>> _cell_y_type;
|
||||
_cell_y_type cell_y;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef boost::shared_ptr< ::robot_sensor_msgs::RouteGraph_<ContainerAllocator> > Ptr;
|
||||
typedef boost::shared_ptr< ::robot_sensor_msgs::RouteGraph_<ContainerAllocator> const> ConstPtr;
|
||||
|
||||
}; // struct RouteGraph_
|
||||
|
||||
typedef ::robot_sensor_msgs::RouteGraph_<std::allocator<void> > RouteGraph;
|
||||
|
||||
typedef boost::shared_ptr< ::robot_sensor_msgs::RouteGraph > RouteGraphPtr;
|
||||
typedef boost::shared_ptr< ::robot_sensor_msgs::RouteGraph const> RouteGraphConstPtr;
|
||||
|
||||
// constants requiring out of line definition
|
||||
|
||||
template<typename ContainerAllocator1, typename ContainerAllocator2>
|
||||
bool operator==(const ::robot_sensor_msgs::RouteGraph_<ContainerAllocator1> & lhs, const ::robot_sensor_msgs::RouteGraph_<ContainerAllocator2> & rhs)
|
||||
{
|
||||
return lhs.header == rhs.header &&
|
||||
lhs.version == rhs.version &&
|
||||
lhs.source == rhs.source &&
|
||||
lhs.map_hash == rhs.map_hash &&
|
||||
lhs.width == rhs.width &&
|
||||
lhs.height == rhs.height &&
|
||||
lhs.resolution == rhs.resolution &&
|
||||
lhs.origin_x == rhs.origin_x &&
|
||||
lhs.origin_y == rhs.origin_y &&
|
||||
lhs.origin_yaw == rhs.origin_yaw &&
|
||||
lhs.node_x == rhs.node_x &&
|
||||
lhs.node_y == rhs.node_y &&
|
||||
lhs.edge_u == rhs.edge_u &&
|
||||
lhs.edge_v == rhs.edge_v &&
|
||||
lhs.edge_length_cells == rhs.edge_length_cells &&
|
||||
lhs.edge_min_clearance_cells == rhs.edge_min_clearance_cells &&
|
||||
lhs.edge_cell_offset == rhs.edge_cell_offset &&
|
||||
lhs.cell_x == rhs.cell_x &&
|
||||
lhs.cell_y == rhs.cell_y;
|
||||
}
|
||||
|
||||
template<typename ContainerAllocator1, typename ContainerAllocator2>
|
||||
bool operator!=(const ::robot_sensor_msgs::RouteGraph_<ContainerAllocator1> & lhs, const ::robot_sensor_msgs::RouteGraph_<ContainerAllocator2> & rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
} // namespace robot_sensor_msgs
|
||||
|
||||
#endif // ROBOT_SENSOR_MSGS_MESSAGE_ROUTEGRAPH_H
|
||||
Reference in New Issue
Block a user