$darkmode
esmini_sensor_components.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2023 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 #include <cloe/component/ego_sensor.hpp> // for EgoSensor
23 #include <cloe/component/lane_sensor.hpp> // for LaneBoundarySensor
24 #include <cloe/component/object_sensor.hpp> // for ObjectSensor
25 
26 #include "esmini_world_data.hpp" // for ESMiniEnvData
27 
28 namespace cloe_esmini {
29 
31  public:
32  ESMiniEgoSensor(uint64_t id, std::shared_ptr<ESMiniEnvData> data)
33  : EgoSensor("esmini/ego_sensor"), id_(id), env_data_{data} {}
34  virtual ~ESMiniEgoSensor() = default;
35 
36  const cloe::Object& sensed_state() const override { return env_data_->get_ego_object(); }
37  double wheel_steering_angle() const override { return env_data_->get_ego_steering_angle(); }
38  virtual double steering_wheel_speed() const override {
39  throw cloe::ModelError("ESMiniEgoSensor: steering wheel speed not available from ESMini.");
40  return 0.0;
41  }
42 
43  private:
44  uint64_t id_;
45  std::shared_ptr<ESMiniEnvData> env_data_;
46 };
47 
49  public:
50  explicit ESMiniObjectSensor(std::shared_ptr<ESMiniEnvData> data)
51  : ObjectSensor("esmini/object_sensor"), env_data_{data} {}
52  virtual ~ESMiniObjectSensor() = default;
53 
54  const cloe::Objects& sensed_objects() const override { return env_data_->get_world_objects(); }
55  const cloe::Frustum& frustum() const override { return env_data_->get_frustum(); }
56  const Eigen::Isometry3d& mount_pose() const override { return env_data_->get_mount_pose(); }
57 
58  private:
59  std::shared_ptr<ESMiniEnvData> env_data_;
60 };
61 
63  public:
64  explicit ESMiniLaneBoundarySensor(std::shared_ptr<ESMiniEnvData> data)
65  : LaneBoundarySensor("esmini/lane_boundary_sensor"), env_data_{data} {}
66  virtual ~ESMiniLaneBoundarySensor() = default;
67 
68  const cloe::LaneBoundaries& sensed_lane_boundaries() const override {
69  return env_data_->get_lane_boundaries();
70  }
71  const cloe::Frustum& frustum() const override { return env_data_->get_frustum(); }
72  const Eigen::Isometry3d& mount_pose() const override { return env_data_->get_mount_pose(); }
73 
74  private:
75  std::shared_ptr<ESMiniEnvData> env_data_;
76 };
77 
78 } // namespace esmini
Definition: ego_sensor.hpp:31
Definition: lane_sensor.hpp:33
Definition: model.hpp:62
Definition: object_sensor.hpp:33
Definition: esmini_sensor_components.hpp:30
double wheel_steering_angle() const override
Definition: esmini_sensor_components.hpp:37
const cloe::Object & sensed_state() const override
Definition: esmini_sensor_components.hpp:36
virtual double steering_wheel_speed() const override
Definition: esmini_sensor_components.hpp:38
Definition: esmini_sensor_components.hpp:62
const Eigen::Isometry3d & mount_pose() const override
Definition: esmini_sensor_components.hpp:72
const cloe::Frustum & frustum() const override
Definition: esmini_sensor_components.hpp:71
const cloe::LaneBoundaries & sensed_lane_boundaries() const override
Definition: esmini_sensor_components.hpp:68
Definition: esmini_sensor_components.hpp:48
const cloe::Frustum & frustum() const override
Definition: esmini_sensor_components.hpp:55
const cloe::Objects & sensed_objects() const override
Definition: esmini_sensor_components.hpp:54
const Eigen::Isometry3d & mount_pose() const override
Definition: esmini_sensor_components.hpp:56
std::vector< std::shared_ptr< Object > > Objects
Definition: object.hpp:128
Definition: frustum.hpp:37
Definition: object.hpp:51