Skip to content

Commit 8e25a97

Browse files
tobifalkcassava
authored andcommitted
models: Add existence probability to lane boundary and object
1 parent db93f33 commit 8e25a97

File tree

3 files changed

+53
-53
lines changed

3 files changed

+53
-53
lines changed

models/include/cloe/component/lane_boundary.hpp

+20
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class LaneBoundary : public Confable {
6565
double curv_hor_start;
6666
double curv_hor_change;
6767
double dx_end;
68+
double exist_prob;
6869
Type type;
6970
Color color;
7071

@@ -74,6 +75,25 @@ class LaneBoundary : public Confable {
7475
using LaneBoundaries = std::map<int, LaneBoundary>;
7576
void to_json(Json& j, const LaneBoundaries& lbs);
7677

78+
// clang-format off
79+
ENUM_SERIALIZATION(LaneBoundary::Type, ({
80+
{LaneBoundary::Type::Unknown, "unknown"},
81+
{LaneBoundary::Type::Solid, "solid"},
82+
{LaneBoundary::Type::Dashed, "dashed"},
83+
{LaneBoundary::Type::Grass, "grass"},
84+
{LaneBoundary::Type::Curb, "curb"},
85+
}))
86+
87+
ENUM_SERIALIZATION(LaneBoundary::Color, ({
88+
{LaneBoundary::Color::Unknown, "unknown"},
89+
{LaneBoundary::Color::White, "white"},
90+
{LaneBoundary::Color::Yellow, "yellow"},
91+
{LaneBoundary::Color::Red, "red"},
92+
{LaneBoundary::Color::Green, "green"},
93+
{LaneBoundary::Color::Blue, "blue"},
94+
}))
95+
// clang-format on
96+
7797
} // namespace cloe
7898

7999
#endif // CLOE_COMPONENT_LANE_BOUNDARY_HPP_

models/include/cloe/component/object.hpp

+23-28
Original file line numberDiff line numberDiff line change
@@ -53,47 +53,42 @@ struct Object {
5353

5454
enum class Class { Unknown, Pedestrian, Bike, Motorbike, Car, Truck, Trailer };
5555

56-
/// ID of object, should be unique
57-
int id;
56+
/// ID of object, should be unique.
57+
int id{-1};
5858

59-
/// Type of object
60-
Type type;
59+
/// Object existence probability.
60+
double exist_prob{1.0};
6161

62-
/// Classification of object
63-
Class classification;
62+
/// Type of object.
63+
Type type{Type::Unknown};
6464

65-
/// Pose in [m] and [rad]
66-
Eigen::Isometry3d pose;
65+
/// Classification of object.
66+
Class classification{Class::Unknown};
6767

68-
/// Dimensions in [m]
69-
Eigen::Vector3d dimensions;
68+
/// Pose in [m] and [rad].
69+
Eigen::Isometry3d pose{Eigen::Isometry3d()};
7070

71-
/// Center of geometry offset in [m]
72-
Eigen::Vector3d cog_offset;
71+
/// Dimensions in [m].
72+
Eigen::Vector3d dimensions{Eigen::Vector3d::Zero()};
7373

74-
/// Absolute velocity in [m/s]
75-
Eigen::Vector3d velocity;
74+
/// Center of geometry offset in [m].
75+
Eigen::Vector3d cog_offset{Eigen::Vector3d::Zero()};
7676

77-
/// Absolute acceleration in [m/(s*s)]
78-
Eigen::Vector3d acceleration;
77+
/// Absolute velocity in [m/s].
78+
Eigen::Vector3d velocity{Eigen::Vector3d::Zero()};
7979

80-
/// Angular velocity in [rad/s]
81-
Eigen::Vector3d angular_velocity;
80+
/// Absolute acceleration in [m/(s*s)].
81+
Eigen::Vector3d acceleration{Eigen::Vector3d::Zero()};
8282

83-
Object()
84-
: id(-1)
85-
, type(Type::Unknown)
86-
, classification(Class::Unknown)
87-
, pose(Eigen::Isometry3d())
88-
, dimensions(Eigen::Vector3d::Zero())
89-
, cog_offset(Eigen::Vector3d::Zero())
90-
, velocity(Eigen::Vector3d::Zero())
91-
, acceleration(Eigen::Vector3d::Zero())
92-
, angular_velocity(Eigen::Vector3d::Zero()) {}
83+
/// Angular velocity in [rad/s].
84+
Eigen::Vector3d angular_velocity{Eigen::Vector3d::Zero()};
85+
86+
Object() = default;
9387

9488
friend void to_json(Json& j, const Object& o) {
9589
j = Json{
9690
{"id", o.id},
91+
{"exist_prob", o.exist_prob},
9792
{"type", o.type},
9893
{"class", o.classification},
9994
{"pose", o.pose},

models/src/cloe/component/lane_boundary.cpp

+10-25
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,6 @@
3333

3434
namespace cloe {
3535

36-
// clang-format off
37-
ENUM_SERIALIZATION(LaneBoundary::Type, ({
38-
{LaneBoundary::Type::Unknown, "unknown"},
39-
{LaneBoundary::Type::Solid, "solid"},
40-
{LaneBoundary::Type::Dashed, "dashed"},
41-
{LaneBoundary::Type::Grass, "grass"},
42-
{LaneBoundary::Type::Curb, "curb"},
43-
}))
44-
45-
ENUM_SERIALIZATION(LaneBoundary::Color, ({
46-
{LaneBoundary::Color::Unknown, "unknown"},
47-
{LaneBoundary::Color::White, "white"},
48-
{LaneBoundary::Color::Yellow, "yellow"},
49-
{LaneBoundary::Color::Red, "red"},
50-
{LaneBoundary::Color::Green, "green"},
51-
{LaneBoundary::Color::Blue, "blue"},
52-
}))
53-
// clang-format on
54-
5536
void LaneBoundary::to_json(Json& j) const {
5637
j = Json{
5738
{"id", id},
@@ -63,6 +44,7 @@ void LaneBoundary::to_json(Json& j) const {
6344
{"curv_hor_start", curv_hor_start},
6445
{"curv_hor_change", curv_hor_change},
6546
{"dx_end", dx_end},
47+
{"exist_prob", exist_prob},
6648
{"type", type},
6749
{"color", color},
6850
{"points", points},
@@ -71,17 +53,20 @@ void LaneBoundary::to_json(Json& j) const {
7153

7254
Schema LaneBoundary::schema_impl() {
7355
return schema::Struct{
56+
// clang-format off
7457
{"id", Schema(&id, "unique identifier in scene graph")},
7558
{"prev_id", Schema(&prev_id, "previous identifier")},
7659
{"next_id", Schema(&next_id, "next identifier")},
77-
{"dx_start", Schema(&dx_start, "")},
78-
{"dy_start", Schema(&dy_start, "")},
79-
{"heading_start", Schema(&heading_start, "")},
80-
{"curv_hor_start", Schema(&curv_hor_start, "")},
81-
{"curv_hor_change", Schema(&curv_hor_change, "")},
82-
{"dx_end", Schema(&dx_end, "")},
60+
{"dx_start", Schema(&dx_start, "start of lane boundary in ego x-direction [m]")},
61+
{"dy_start", Schema(&dy_start, "lateral distance to ego vehicle reference point [m]")},
62+
{"heading_start", Schema(&heading_start, "yaw angle relative to ego x-direction [rad]")},
63+
{"curv_hor_start", Schema(&curv_hor_start, "horizontal curvature at lane boundary start [1/m]")},
64+
{"curv_hor_change", Schema(&curv_hor_change, "change of horizontal curvature at lane boundary start [1/m^2]")},
65+
{"dx_end", Schema(&dx_end, "end of lane boundary in ego x-direction [m]")},
66+
{"exist_prob", Schema(&exist_prob, "existence probability")},
8367
{"type", Schema(&type, "lane boundary type")},
8468
{"color", Schema(&color, "lane boundary color")},
69+
// clang-format on
8570
}
8671
.require_all();
8772
}

0 commit comments

Comments
 (0)