i_entity.h 4.05 KB
Newer Older
Arun Das's avatar
Arun Das committed
1
/*******************************************************************************
Arun Das's avatar
Arun Das committed
2
3
4
5
6
7
8
9
 * Copyright (c) 2021, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
 *
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *******************************************************************************/
Arun Das's avatar
Arun Das committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

//-----------------------------------------------------------------------------
/** @file  i_entity.h */
//-----------------------------------------------------------------------------

#ifndef MANTLEAPI_TRAFFIC_IENTITY_H
#define MANTLEAPI_TRAFFIC_IENTITY_H

#include <MantleAPI/Common/bounding_box.h>
#include <MantleAPI/Common/i_identifiable.h>
#include <MantleAPI/Common/pose.h>
#include <MantleAPI/Traffic/entity_properties.h>
#include <MantleAPI/Traffic/i_controller_config.h>

#include <memory>
#include <vector>

namespace mantle_api
{
29
30
31

struct EntityVisibilityConfig
{
32
    /// The "graphics" flag determines, if the entity shall be shown in visualizations of the simulated environment
33
    bool graphics{true};
34
35
    /// The "traffic" flag determines, if the entity is contained in the common simulator output (e.g. OSI Ground Truth)
    /// for all traffic participants
36
    bool traffic{true};
37
38
39
40
41
42
43
44
45
46
47
    /// The "sensors" flag can be used to simulate sensor errors (false positives / false negatives). For this the
    /// "sensors" flag value has to diverge from the "traffic" flag value (e.g. false positive: traffic=false,
    /// sensors=true)
    bool sensors{true};
    /// - Sensor errors can be specified for single sensors only. E.g. a false positive for a radar sensor would be
    /// specified with traffic="false", sensors="true", sensor_names={"radar"}.
    /// - For the other not named sensors implicitly the opposite applies. So in the above example e.g. for a camera
    /// sensor the entity would be not visible / not contained in its OSI Sensor View.
    /// - When "sensor_names" is not specified (empty vector) then the "sensors" flag applies to
    /// all sensors.
    std::vector<std::string> sensor_names{};
48
49
};

Arun Das's avatar
Arun Das committed
50
51
52
53
54
55
56
57
58
59
60
61
62
/// Base interface for all static and dynamic scenario entities.
class IEntity : public IIdentifiable
{
  public:
    virtual void SetPosition(const Vec3d& inert_pos) = 0;
    virtual Vec3d GetPosition() const = 0;

    virtual void SetVelocity(const Vec3d& velocity) = 0;
    virtual Vec3d GetVelocity() const = 0;

    virtual void SetAcceleration(const Vec3d& acceleration) = 0;
    virtual Vec3d GetAcceleration() const = 0;

Arun Das's avatar
Arun Das committed
63
64
65
66
67
68
69
70
71
    virtual void SetOrientation(const Orientation3d& orientation) = 0;
    virtual Orientation3d GetOrientation() const = 0;

    virtual void SetOrientationRate(const Orientation3d& orientation_rate) = 0;
    virtual Orientation3d GetOrientationRate() const = 0;

    virtual void SetOrientationAcceleration(const Orientation3d& orientation_acceleration) = 0;
    virtual Orientation3d GetOrientationAcceleration() const = 0;

Arun Das's avatar
Arun Das committed
72
    virtual void SetProperties(std::unique_ptr<mantle_api::EntityProperties> properties) = 0;
Matthias Greuter's avatar
Matthias Greuter committed
73

Arun Das's avatar
Arun Das committed
74
75
76
77
    virtual EntityProperties* GetProperties() const = 0;

    virtual void SetAssignedLaneIds(const std::vector<std::uint64_t>& assigned_lane_ids) = 0;
    virtual std::vector<std::uint64_t> GetAssignedLaneIds() const = 0;
78

79
80
    virtual void SetVisibility(const EntityVisibilityConfig& visibility) = 0;
    virtual EntityVisibilityConfig GetVisibility() const = 0;
Arun Das's avatar
Arun Das committed
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
};

class IVehicle : public virtual IEntity
{
  public:
    virtual VehicleProperties* GetProperties() const = 0;

    virtual void SetIndicatorState(IndicatorState state) = 0;
    virtual IndicatorState GetIndicatorState() const = 0;

    //    virtual bool IsHost() const = 0;
    //    virtual void SetHost() = 0;
};

class IPedestrian : public virtual IEntity
{
  public:
    virtual PedestrianProperties* GetProperties() const = 0;
};

class IStaticObject : public virtual IEntity
{
  public:
    virtual StaticObjectProperties* GetProperties() const = 0;
};

}  // namespace mantle_api

#endif  // MANTLEAPI_TRAFFIC_IENTITY_H