$darkmode
lane_boundary.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2020 Robert Bosch GmbH
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * SPDX-License-Identifier: Apache-2.0
17  */
23 #pragma once
24 
25 #include <map> // for map
26 #include <vector> // for vector
27 
28 #include <Eigen/Geometry> // for Vector3d
29 
30 #include <fable/confable.hpp> // for Confable
31 #include <fable/fable_fwd.hpp> // for Schema
32 #include <fable/enum.hpp> // for ENUM_SERIALIZATION
33 
34 namespace cloe {
35 
36 class LaneBoundary : public fable::Confable {
37  public:
41  enum class Type { Unknown, Solid, Dashed, Grass, Curb };
42  friend void to_json(fable::Json& j, const LaneBoundary::Type& t);
43  friend void from_json(const fable::Json& j, LaneBoundary::Type& t);
44 
48  enum class Color { Unknown, White, Yellow, Red, Green, Blue };
49  friend void to_json(fable::Json& j, const LaneBoundary::Color& t);
50  friend void from_json(const fable::Json& j, LaneBoundary::Color& t);
51 
52  public:
53  fable::Schema schema_impl() override;
54  void to_json(fable::Json& j) const override;
55 
56  CONFABLE_FRIENDS(LaneBoundary)
57 
58  public:
59  int id{-1};
60  int prev_id{-1};
61  int next_id{-1};
62  double dx_start{0};
63  double dy_start{0};
64  double heading_start{0};
65  double curv_hor_start{0};
66  double curv_hor_change{0};
67  double dx_end{0};
68  double exist_prob{0};
69  Type type{Type::Unknown};
70  Color color{Color::Unknown};
71 
72  std::vector<Eigen::Vector3d> points;
73 };
74 
75 using LaneBoundaries = std::map<int, LaneBoundary>;
76 void to_json(fable::Json& j, const LaneBoundaries& lbs);
77 
78 // clang-format off
80  {LaneBoundary::Type::Unknown, "unknown"},
81  {LaneBoundary::Type::Solid, "solid"},
82  {LaneBoundary::Type::Dashed, "dashed"},
83  {LaneBoundary::Type::Grass, "grass"},
84  {LaneBoundary::Type::Curb, "curb"},
85 }))
86 
87 ENUM_SERIALIZATION(LaneBoundary::Color, ({
88  {LaneBoundary::Color::Unknown, "unknown"},
89  {LaneBoundary::Color::White, "white"},
90  {LaneBoundary::Color::Yellow, "yellow"},
91  {LaneBoundary::Color::Red, "red"},
92  {LaneBoundary::Color::Green, "green"},
93  {LaneBoundary::Color::Blue, "blue"},
94 }))
95 // clang-format on
96 
97 } // namespace cloe
Definition: lane_boundary.hpp:36
Type
Definition: lane_boundary.hpp:41
Color
Definition: lane_boundary.hpp:48
fable::Schema schema_impl() override
Definition: lane_boundary.cpp:55
Definition: confable.hpp:98
Json to_json() const
Definition: confable.cpp:78
Definition: schema.hpp:173
#define ENUM_SERIALIZATION(xType, xMap)
Definition: enum.hpp:51
nlohmann::json Json
Definition: fable_fwd.hpp:35