$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 
24 #include <Eigen/Geometry> // for Isometry3d
25 
26 #include <cloe/component.hpp> // for Component
27 #include <cloe/component/frustum.hpp> // for Frustum
28 #include <cloe/component/lane_boundary.hpp> // for LaneBoundaries
29 #include <fable/utility/eigen.hpp> // for to_json
30 
31 namespace cloe {
32 
33 class LaneBoundarySensor : public Component {
34  public:
35  using Component::Component;
36  LaneBoundarySensor() : Component("lane_boundary_sensor") {}
37  virtual ~LaneBoundarySensor() noexcept = default;
38 
42  virtual const LaneBoundaries& sensed_lane_boundaries() const = 0;
43 
47  virtual const Frustum& frustum() const = 0;
48 
52  virtual const Eigen::Isometry3d& mount_pose() const = 0;
53 
54  fable::Json active_state() const override {
55  return fable::Json{
56  {"mount_pose", this->mount_pose()},
57  {"frustum", this->frustum()},
58  {"sensed_lane_boundaries", sensed_lane_boundaries()},
59  };
60  }
61 };
62 
64  public:
65  NopLaneSensor() : LaneBoundarySensor("nop_lane_sensor") {}
66  virtual ~NopLaneSensor() = default;
67  const LaneBoundaries& sensed_lane_boundaries() const override { return lane_boundaries_; }
68  const Frustum& frustum() const override { return frustum_; }
69  const Eigen::Isometry3d& mount_pose() const override { return mount_pose_; }
70 
71  private:
72  LaneBoundaries lane_boundaries_;
73  Frustum frustum_;
74  Eigen::Isometry3d mount_pose_;
75 };
76 
77 } // namespace cloe
Definition: component.hpp:144
Definition: lane_sensor.hpp:33
virtual const Eigen::Isometry3d & mount_pose() const =0
virtual const LaneBoundaries & sensed_lane_boundaries() const =0
virtual const Frustum & frustum() const =0
fable::Json active_state() const override
Definition: lane_sensor.hpp:54
Definition: lane_sensor.hpp:63
const Eigen::Isometry3d & mount_pose() const override
Definition: lane_sensor.hpp:69
const LaneBoundaries & sensed_lane_boundaries() const override
Definition: lane_sensor.hpp:67
const Frustum & frustum() const override
Definition: lane_sensor.hpp:68
nlohmann::json Json
Definition: fable_fwd.hpp:35
Definition: frustum.hpp:37