From f0ab5b58927000610ec458c144bd018cae5aa7e0 Mon Sep 17 00:00:00 2001 From: Franco Cipollone Date: Fri, 3 Nov 2023 15:13:03 -0300 Subject: [PATCH] Workaround for the bug on the frame ids when using clang. Signed-off-by: Franco Cipollone --- src/backend/geometry_utilities.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/backend/geometry_utilities.h b/src/backend/geometry_utilities.h index ae26799a..3f9096d5 100644 --- a/src/backend/geometry_utilities.h +++ b/src/backend/geometry_utilities.h @@ -106,6 +106,15 @@ const drake::systems::InputPort& WirePriusGeometry(const std::string& frame_r const Translation3 kPriusCarToChassisTranslation(0., 0., 0.69785); const Quaternion kPriusCarToChassisRotation{Quaternion::Identity()}; + // Here we make a explicit call to get_new_id() to ensure that the static variable in + // drake::common::Identifier (underlying type of drake::geometry::FrameId) is initialized. + // If we don't do this here, each get_new_id() call used in RegisterFrame method will attach + // the same id to all the frames. This is a bug in Drake that is raised only when using clang compiler. + // See https://github.com/maliput/delphyne_demos/issues/60 + // + // TODO(https://github.com/maliput/delphyne_demos/issues/60): Remove this when a new version of Drake is used. + FrameId::get_new_id(); + // Registers a source for the given scene graph. const SourceId source_id = scene_graph->RegisterSource(frame_root); // Registers the Prius car frame.