@@ -106,6 +106,9 @@ class ignition::sensors::SensorPrivate
106
106
// / A map is used so that a single sensor can have multiple sensor
107
107
// / streams each with a sequence counter.
108
108
public: std::map<std::string, uint64_t > sequences;
109
+
110
+ // / \brief frame id
111
+ public: std::string frame_id;
109
112
};
110
113
111
114
SensorId SensorPrivate::idCounter = 0 ;
@@ -136,6 +139,19 @@ bool SensorPrivate::PopulateFromSDF(const sdf::Sensor &_sdf)
136
139
return false ;
137
140
}
138
141
142
+ sdf::ElementPtr element = _sdf.Element ();
143
+ if (element)
144
+ {
145
+ if (element->HasElement (" ignition_frame_id" ))
146
+ {
147
+ this ->frame_id = element->Get <std::string>(" ignition_frame_id" );
148
+ }
149
+ else
150
+ {
151
+ this ->frame_id = this ->name ;
152
+ }
153
+ }
154
+
139
155
// Try resolving the pose first, and only use the raw pose if that fails
140
156
auto semPose = _sdf.SemanticPose ();
141
157
sdf::Errors errors = semPose.Resolve (this ->pose );
@@ -226,6 +242,18 @@ std::string Sensor::Name() const
226
242
return this ->dataPtr ->name ;
227
243
}
228
244
245
+ // ////////////////////////////////////////////////
246
+ std::string Sensor::FrameId () const
247
+ {
248
+ return this ->dataPtr ->frame_id ;
249
+ }
250
+
251
+ // ////////////////////////////////////////////////
252
+ void Sensor::SetFrameId (const std::string &_frameId)
253
+ {
254
+ this ->dataPtr ->frame_id = _frameId;
255
+ }
256
+
229
257
// ////////////////////////////////////////////////
230
258
std::string Sensor::Topic () const
231
259
{
0 commit comments