Skip to content
Snippets Groups Projects
Commit 0c31b374 authored by Christoph Kochendoerfer's avatar Christoph Kochendoerfer
Browse files

Extended vehicle and entity properties

parent 80e0ba31
No related branches found
No related tags found
1 merge request!13Extended vehicle and entity properties
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <MantleAPI/Common/vector.h> #include <MantleAPI/Common/vector.h>
#include <string> #include <string>
#include <map>
namespace mantle_api namespace mantle_api
{ {
...@@ -43,6 +44,7 @@ struct EntityProperties ...@@ -43,6 +44,7 @@ struct EntityProperties
BoundingBox bounding_box{Vec3d{}, Dimension3d{}}; BoundingBox bounding_box{Vec3d{}, Dimension3d{}};
EntityType type{EntityType::kOther}; EntityType type{EntityType::kOther};
std::string model{}; std::string model{};
std::map<std::string, std::string> properties{};
}; };
inline bool operator==(const EntityProperties& lhs, const EntityProperties& rhs) noexcept inline bool operator==(const EntityProperties& lhs, const EntityProperties& rhs) noexcept
...@@ -114,13 +116,52 @@ enum class ExternalControlState ...@@ -114,13 +116,52 @@ enum class ExternalControlState
kLongitudinalOnly = 3 kLongitudinalOnly = 3
}; };
struct Performance
{
// in m/s
double max_speed{0.0};
// in m/s²
double max_acceleration{0.0};
// in m/s²
double max_deceleration{0.0};
};
inline bool operator==(const Performance& lhs, const Performance& rhs) noexcept
{
return IsEqual(lhs.max_speed, rhs.max_speed) &&
IsEqual(lhs.max_acceleration, rhs.max_acceleration) &&
IsEqual(lhs.max_deceleration, rhs.max_deceleration);
}
struct Axle
{
// in radian
double max_steering{0.0};
// in m
double wheel_diameter{0.0};
// in m
double track_width{0.0};
// in m
Vec3d bb_center_to_axle_center{};
};
inline bool operator==(const Axle& lhs, const Axle& rhs) noexcept
{
return IsEqual(lhs.max_steering, rhs.max_steering) &&
IsEqual(lhs.wheel_diameter, rhs.wheel_diameter) &&
IsEqual(lhs.track_width, rhs.track_width) &&
lhs.bb_center_to_axle_center == rhs.bb_center_to_axle_center;
}
struct VehicleProperties : public EntityProperties struct VehicleProperties : public EntityProperties
{ {
VehicleClass classification{VehicleClass::kOther}; VehicleClass classification{VehicleClass::kOther};
Vec3d bb_center_to_front{};
Vec3d bb_center_to_rear{}; Performance performance{};
double front_wheel_diameter{0.0};
double rear_wheel_diameter{0.0}; Axle front_axle{};
Axle rear_axle{};
bool is_host{false}; bool is_host{false};
// TODO: remove, once external control for traffic is implemented through controllers // TODO: remove, once external control for traffic is implemented through controllers
bool is_controlled_externally{false}; bool is_controlled_externally{false};
...@@ -129,10 +170,9 @@ struct VehicleProperties : public EntityProperties ...@@ -129,10 +170,9 @@ struct VehicleProperties : public EntityProperties
inline bool operator==(const VehicleProperties& lhs, const VehicleProperties& rhs) noexcept inline bool operator==(const VehicleProperties& lhs, const VehicleProperties& rhs) noexcept
{ {
return lhs.bounding_box == rhs.bounding_box && lhs.type == rhs.type && lhs.model == rhs.model && return lhs.bounding_box == rhs.bounding_box && lhs.type == rhs.type && lhs.model == rhs.model &&
lhs.classification == rhs.classification && lhs.bb_center_to_front == rhs.bb_center_to_front && lhs.classification == rhs.classification && lhs.performance == rhs.performance &&
lhs.bb_center_to_rear == rhs.bb_center_to_rear && lhs.front_axle == rhs.front_axle && lhs.rear_axle == rhs.rear_axle &&
IsEqual(lhs.front_wheel_diameter, rhs.front_wheel_diameter) && lhs.is_host == rhs.is_host;
IsEqual(lhs.rear_wheel_diameter, rhs.rear_wheel_diameter) && lhs.is_host == rhs.is_host;
} }
struct PedestrianProperties : public EntityProperties struct PedestrianProperties : public EntityProperties
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment