traversability_generator3d
TravGenNode.hpp
Go to the documentation of this file.
1#pragma once
2#include <base/Eigen.hpp>
3#include <maps/grid/TraversabilityMap3d.hpp>
4#include <boost/serialization/serialization.hpp>
5#include <boost/serialization/version.hpp>
6#include <base/Angle.hpp>
7#include <cstdint>
8
10 template<class Archive>
11 inline void serialize(Archive & ar, base::AngleSegment & segment, const unsigned int version){
12 ar & segment.width;
13 ar & segment.startRad;
14 ar & segment.endRad;
15 }
16}
17
19{
20
33
49
52{
54 Eigen::Hyperplane<double, 3> plane;
55
57 double slope = 0.0;
58
60 Eigen::Vector3d slopeDirection = Eigen::Vector3d::Zero();
61
64 double slopeDirectionAtan2 = 0.0;
65
67 size_t id = 0;
68
71 std::vector<base::AngleSegment> allowedOrientations;
72
74
77
78 int cost = 0;
79
81 template<class Archive>
82 void serialize(Archive & ar, const unsigned int version)
83 {
84 ar & plane.offset();
85 ar & plane.normal().x();
86 ar & plane.normal().y();
87 ar & plane.normal().z();
88 ar & slope;
89 ar & slopeDirection.x();
90 ar & slopeDirection.y();
91 ar & slopeDirection.z();
93 ar & id;
95 ar & nodeType;
96 // obstacleCause was appended in class version 1; archives written
97 // before that must not try to read it.
98 if (version >= 1)
100 ar & cost;
101 }
102};
103
104// Inline operator<< to print NodeType as a string
105inline std::ostream& operator<<(std::ostream& os, NodeType type)
106{
107 switch (type)
108 {
109 case NodeType::OBSTACLE: os << "OBSTACLE"; break;
110 case NodeType::TRAVERSABLE: os << "TRAVERSABLE"; break;
111 case NodeType::FRONTIER: os << "FRONTIER"; break;
112 case NodeType::INFLATED_OBSTACLE: os << "INFLATED_OBSTACLE"; break;
113 case NodeType::INFLATED_FRONTIER: os << "INFLATED_FRONTIER"; break;
114 case NodeType::UNKNOWN: os << "UNKNOWN"; break;
115 case NodeType::HOLE: os << "HOLE"; break;
116 case NodeType::UNSET: os << "UNSET"; break;
117 case NodeType::PARTIALLY_TRAVERSABLE: os << "PARTIALLY_TRAVERSABLE"; break;
118 default: os << "INVALID_NODE_TYPE"; break;
119 }
120 return os;
121}
122
123// Inline operator== for NodeType
125{
126 return static_cast<int>(lhs) == static_cast<int>(rhs);
127}
128
129// Inline operator== for NodeType
130inline bool operator==(NodeType lhs, int rhs)
131{
132 return (static_cast<int>(lhs) == rhs);
133}
134
135typedef maps::grid::TraversabilityNode<TravGenTrackingData> TravGenNode;
136typedef maps::grid::TraversabilityMap3d<TravGenNode *> TravMap3d;
137
138}
139
CGAL::Polyhedron_3< K > Polyhedron_3
Definition TraversabilityGenerator3d.hpp:18
Definition TravGenNode.hpp:9
void serialize(Archive &ar, base::AngleSegment &segment, const unsigned int version)
Definition TravGenNode.hpp:11
Definition SoilNode.hpp:9
bool operator==(NodeType lhs, NodeType rhs)
Definition TravGenNode.hpp:124
maps::grid::TraversabilityMap3d< TravGenNode * > TravMap3d
Definition TravGenNode.hpp:136
std::ostream & operator<<(std::ostream &os, NodeType type)
Definition TravGenNode.hpp:105
maps::grid::TraversabilityNode< TravGenTrackingData > TravGenNode
Definition TravGenNode.hpp:135
ObstacleCause
Definition TravGenNode.hpp:40
@ STEP_HEIGHT
patch collides with the robot body volume
Definition TravGenNode.hpp:44
@ STEEP_SLOPE
fitted slope > maxSlope
Definition TravGenNode.hpp:43
@ CAUSE_NONE
node is not an obstacle
Definition TravGenNode.hpp:41
@ MAP_BOUNDARY
robot body volume leaves the mapped grid
Definition TravGenNode.hpp:47
@ UNMEASURED
ground-plane fit failed (no/too sparse data)
Definition TravGenNode.hpp:42
@ INCLINE_LIMIT
no allowed heading under incline limitting
Definition TravGenNode.hpp:45
@ NO_SAFE_YAW
obstacle inflation found no collision-free yaw
Definition TravGenNode.hpp:46
NodeType
Definition TravGenNode.hpp:22
@ INFLATED_OBSTACLE
Definition TravGenNode.hpp:26
@ OBSTACLE
Definition TravGenNode.hpp:23
@ UNSET
Definition TravGenNode.hpp:30
@ PARTIALLY_TRAVERSABLE
Definition TravGenNode.hpp:31
@ HOLE
Definition TravGenNode.hpp:29
@ TRAVERSABLE
Definition TravGenNode.hpp:24
@ FRONTIER
Definition TravGenNode.hpp:25
@ UNKNOWN
Definition TravGenNode.hpp:28
@ INFLATED_FRONTIER
Definition TravGenNode.hpp:27
double slopeDirectionAtan2
Definition TravGenNode.hpp:64
int cost
Definition TravGenNode.hpp:78
ObstacleCause obstacleCause
Definition TravGenNode.hpp:76
void serialize(Archive &ar, const unsigned int version)
Definition TravGenNode.hpp:82
size_t id
Definition TravGenNode.hpp:67
NodeType nodeType
Definition TravGenNode.hpp:73
double slope
Definition TravGenNode.hpp:57
Eigen::Hyperplane< double, 3 > plane
Definition TravGenNode.hpp:54
Eigen::Vector3d slopeDirection
Definition TravGenNode.hpp:60
std::vector< base::AngleSegment > allowedOrientations
Definition TravGenNode.hpp:71