Nav2 Navigation Stack - jazzy  jazzy
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  OMNI = 5,
30 };
31 
32 inline std::string toString(const MotionModel & n)
33 {
34  switch (n) {
35  case MotionModel::TWOD:
36  return "2D";
37  case MotionModel::DUBIN:
38  return "Dubin";
39  case MotionModel::REEDS_SHEPP:
40  return "Reeds-Shepp";
41  case MotionModel::STATE_LATTICE:
42  return "State Lattice";
43  default:
44  return "Unknown";
45  }
46 }
47 
48 inline MotionModel fromString(const std::string & n)
49 {
50  if (n == "2D") {
51  return MotionModel::TWOD;
52  } else if (n == "DUBIN") {
53  return MotionModel::DUBIN;
54  } else if (n == "REEDS_SHEPP") {
55  return MotionModel::REEDS_SHEPP;
56  } else if (n == "STATE_LATTICE") {
57  return MotionModel::STATE_LATTICE;
58  } else {
59  return MotionModel::UNKNOWN;
60  }
61 }
62 
63 const float UNKNOWN = 255.0;
64 const float OCCUPIED = 254.0;
65 const float INSCRIBED = 253.0;
66 const float MAX_NON_OBSTACLE = 252.0;
67 const float FREE = 0;
68 
69 } // namespace nav2_smac_planner
70 
71 #endif // NAV2_SMAC_PLANNER__CONSTANTS_HPP_