$darkmode
lane_sensor.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  */
22 #pragma once
23 #ifndef CLOE_COMPONENT_LANE_SENSOR_HPP_
24 #define CLOE_COMPONENT_LANE_SENSOR_HPP_
25 
26 #include <Eigen/Geometry> // for Isometry3d
27 #include <fable/json/with_eigen.hpp> // for to_json
28 
29 #include <cloe/component.hpp> // for Component
30 #include <cloe/component/frustum.hpp> // for Frustum
31 #include <cloe/component/lane_boundary.hpp> // for LaneBoundaries
32 
33 namespace cloe {
34 
35 class LaneBoundarySensor : public Component {
36  public:
37  using Component::Component;
38  LaneBoundarySensor() : Component("lane_boundary_sensor") {}
39  virtual ~LaneBoundarySensor() noexcept = default;
40 
44  virtual const LaneBoundaries& sensed_lane_boundaries() const = 0;
45 
49  virtual const Frustum& frustum() const = 0;
50 
54  virtual const Eigen::Isometry3d& mount_pose() const = 0;
55 
56  Json active_state() const override {
57  return Json{
58  {"mount_pose", this->mount_pose()},
59  {"frustum", this->frustum()},
60  {"sensed_lane_boundaries", sensed_lane_boundaries()},
61  };
62  }
63 };
64 
66  public:
67  NopLaneSensor() : LaneBoundarySensor("nop_lane_sensor") {}
68  virtual ~NopLaneSensor() = default;
69  const LaneBoundaries& sensed_lane_boundaries() const override { return lane_boundaries_; }
70  const Frustum& frustum() const override { return frustum_; }
71  const Eigen::Isometry3d& mount_pose() const override { return mount_pose_; }
72 
73  private:
74  LaneBoundaries lane_boundaries_;
75  Frustum frustum_;
76  Eigen::Isometry3d mount_pose_;
77 };
78 
79 } // namespace cloe
80 
81 #endif // CLOE_COMPONENT_LANE_SENSOR_HPP_
Definition: lane_sensor.hpp:35
virtual const Frustum & frustum() const =0
const Eigen::Isometry3d & mount_pose() const override
Definition: lane_sensor.hpp:71
virtual const LaneBoundaries & sensed_lane_boundaries() const =0
Json active_state() const override
Definition: lane_sensor.hpp:56
Definition: lane_sensor.hpp:65
const LaneBoundaries & sensed_lane_boundaries() const override
Definition: lane_sensor.hpp:69
Definition: frustum.hpp:37
Definition: coordinator.hpp:36
const Frustum & frustum() const override
Definition: lane_sensor.hpp:70
virtual const Eigen::Isometry3d & mount_pose() const =0
Definition: component.hpp:144