Nav2 Navigation Stack - humble  humble
ROS 2 Navigation Stack
constants.hpp
1 // Copyright (c) 2020, Samsung Research America
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License. Reserved.
14 
15 #ifndef NAV2_SMAC_PLANNER__CONSTANTS_HPP_
16 #define NAV2_SMAC_PLANNER__CONSTANTS_HPP_
17 
18 #include <string>
19 
20 namespace nav2_smac_planner
21 {
22 enum class MotionModel
23 {
24  UNKNOWN = 0,
25  TWOD = 1,
26  DUBIN = 2,
27  REEDS_SHEPP = 3,
28  STATE_LATTICE = 4,
29 };
30 
31 inline std::string toString(const MotionModel & n)
32 {
33  switch (n) {
34  case MotionModel::TWOD:
35  return "2D";
36  case MotionModel::DUBIN:
37  return "Dubin";
38  case MotionModel::REEDS_SHEPP:
39  return "Reeds-Shepp";
40  case MotionModel::STATE_LATTICE:
41  return "State Lattice";
42  default:
43  return "Unknown";
44  }
45 }
46 
47 inline MotionModel fromString(const std::string & n)
48 {
49  if (n == "2D") {
50  return MotionModel::TWOD;
51  } else if (n == "DUBIN") {
52  return MotionModel::DUBIN;
53  } else if (n == "REEDS_SHEPP") {
54  return MotionModel::REEDS_SHEPP;
55  } else if (n == "STATE_LATTICE") {
56  return MotionModel::STATE_LATTICE;
57  } else {
58  return MotionModel::UNKNOWN;
59  }
60 }
61 
62 const float UNKNOWN = 255.0;
63 const float OCCUPIED = 254.0;
64 const float INSCRIBED = 253.0;
65 const float MAX_NON_OBSTACLE = 252.0;
66 const float FREE = 0;
67 
68 } // namespace nav2_smac_planner
69 
70 #endif // NAV2_SMAC_PLANNER__CONSTANTS_HPP_