167 {
168 if (!inited_) {
169 AERROR <<
"TransformWrapper not Initialized,"
170 << " unable to call GetSensor2worldTrans.";
171 return false;
172 }
173
174 if (sensor2novatel_extrinsics_ == nullptr) {
175 StampedTransform trans_sensor2novatel;
176 if (!
QueryTrans(timestamp, &trans_sensor2novatel,
177 sensor2novatel_tf2_frame_id_,
178 sensor2novatel_tf2_child_frame_id_)) {
179 return false;
180 }
181 sensor2novatel_extrinsics_.reset(new Eigen::Affine3d);
182 *sensor2novatel_extrinsics_ =
183 trans_sensor2novatel.translation * trans_sensor2novatel.rotation;
184 AINFO <<
"Get sensor2novatel extrinsics successfully.";
185 }
186
187 StampedTransform trans_novatel2world;
188 trans_novatel2world.timestamp =
timestamp;
189 Eigen::Affine3d novatel2world;
190
191 if (!
QueryTrans(timestamp, &trans_novatel2world, novatel2world_tf2_frame_id_,
192 novatel2world_tf2_child_frame_id_)) {
193 if (FLAGS_obs_enable_local_pose_extrapolation) {
195 timestamp, &trans_novatel2world,
196 FLAGS_obs_max_local_pose_extrapolation_latency)) {
197 return false;
198 }
199 } else {
200 return false;
201 }
202 } else if (FLAGS_obs_enable_local_pose_extrapolation) {
204 }
205
206 novatel2world =
207 trans_novatel2world.translation * trans_novatel2world.rotation;
208 *sensor2world_trans = novatel2world * (*sensor2novatel_extrinsics_);
209 if (novatel2world_trans != nullptr) {
210 *novatel2world_trans = novatel2world;
211 }
213 << (*sensor2world_trans).matrix();
214 return true;
215}