@@ -137,7 +137,7 @@ const std::map<int, LaneBoundary::Color> osi_lane_bdry_color_map = {
137
137
138
138
Duration osi_timestamp_to_time (const osi3::Timestamp& timestamp) {
139
139
return std::chrono::duration_cast<Duration >(std::chrono::seconds (timestamp.seconds ()) +
140
- std::chrono::nanoseconds (timestamp.nanos ()));
140
+ std::chrono::nanoseconds (timestamp.nanos ()));
141
141
}
142
142
143
143
Duration OsiMsgHandler::osi_timestamp_to_simtime (const osi3::Timestamp& timestamp) const {
@@ -355,8 +355,7 @@ void transform_obj_coord_from_osi_data(const Eigen::Isometry3d& sensor_pose,
355
355
}
356
356
357
357
template <typename T>
358
- void OsiMsgHandler::process_osi_msgs (const Sync& s, const bool & restart,
359
- Duration & osi_time) {
358
+ void OsiMsgHandler::process_osi_msgs (const Sync& s, const bool & restart, Duration & osi_time) {
360
359
this ->clear_cache ();
361
360
// Cycle until osi message has been received.
362
361
int n_msg{0 };
@@ -733,8 +732,7 @@ void OsiMsgHandler::convert_to_cloe_data(const bool has_eh,
733
732
break ;
734
733
}
735
734
case SensorMockLevel::OverwriteAll: {
736
- throw ModelError (
737
- " OSI SensorMockLevel::OverwriteAll not available for DetectedMovingObject" );
735
+ throw ModelError (" OSI SensorMockLevel::OverwriteAll not available for DetectedMovingObject" );
738
736
break ;
739
737
}
740
738
}
@@ -766,13 +764,41 @@ void OsiMsgHandler::convert_to_cloe_data(const bool has_eh,
766
764
store_object (obj);
767
765
}
768
766
767
+ template <typename TOsiObject>
768
+ bool skip_polygonal_objects (const TOsiObject& obj) {
769
+ // TODO: Implement support for polygonal objects.
770
+ //
771
+ // At the moment, we expect objects to be represented as bounding boxes,
772
+ // since we don't have a use for higher fidelity object representation.
773
+ //
774
+ // OSI allows objects to take different forms:
775
+ //
776
+ // https://opensimulationinterface.github.io/osi-antora-generator/asamosi/V3.5.0/gen/structosi3_1_1BaseStationary.html
777
+ //
778
+ // If you need support for Polygons please create an issue so we can plan this:
779
+ //
780
+ // https://github.com/eclipse/cloe/issues/new
781
+ //
782
+ if (!obj.base ().has_orientation () && !obj.base ().base_polygon ().empty ()) {
783
+ osi_logger ()->warn (
784
+ " OsiMsgHandler: Objects defined by polygon are not supported yet. Skipping object "
785
+ " {}." ,
786
+ osi_identifier (obj.id ()));
787
+ return true ;
788
+ }
789
+ return false ;
790
+ }
791
+
769
792
void OsiMsgHandler::detected_moving_objects_from_ground_truth () {
770
793
const auto & osi_gt = ground_truth_->get_gt ();
771
794
// Set moving object data.
772
795
for (const auto & osi_obj : osi_gt.moving_object ()) {
773
796
osi_require (" GroundTruth-MovingObject::id" , osi_obj.has_id ());
774
797
int id = osi_identifier (osi_obj.id ());
775
798
if (id != static_cast <int >(owner_id_)) {
799
+ if (skip_polygonal_objects (osi_obj)) {
800
+ continue ;
801
+ }
776
802
auto obj = std::make_shared<Object>();
777
803
// Set existence probability.
778
804
obj->exist_prob = 1.0 ;
@@ -852,6 +878,10 @@ void OsiMsgHandler::detected_static_objects_from_ground_truth() {
852
878
// Set static object data.
853
879
for (const auto & osi_obj : osi_gt.stationary_object ()) {
854
880
osi_require (" GroundTruth-StationaryObject::id" , osi_obj.has_id ());
881
+ if (skip_polygonal_objects (osi_obj)) {
882
+ continue ;
883
+ }
884
+
855
885
auto obj = std::make_shared<Object>();
856
886
// Set existence probability.
857
887
obj->exist_prob = 1.0 ;
0 commit comments