Skip to content

Commit 06b91a0

Browse files
committed
Fix Rotation return value
A really weird quirk of Flipper build system, or something...
1 parent 9d4f47b commit 06b91a0

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

tracking/orientation_tracker.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Vector4 OrientationTracker::OnGyroscopeData(const GyroscopeData& event)
8989

9090
sensor_fusion_->ProcessGyroscopeSample(data);
9191

92-
return OrientationTracker::GetPose(data.sensor_timestamp_ns + sampling_period_ns_);
92+
return GetPose(data.sensor_timestamp_ns + sampling_period_ns_);
9393
}
9494

9595
} // namespace cardboard

tracking/sensors/sensor_fusion_ekf.cc

+8-5
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,14 @@ namespace {
5959
// angle = norm(a)
6060
// axis = a.normalized()
6161
// If norm(a) == 0, it returns an identity rotation.
62-
static inline Rotation RotationFromVector(const Vector3& a)
62+
static inline void RotationFromVector(const Vector3& a, Rotation& r)
6363
{
6464
const double norm_a = Length(a);
6565
if (norm_a < kEpsilon) {
66-
return Rotation::Identity();
66+
r = Rotation::Identity();
67+
return;
6768
}
68-
return Rotation::FromAxisAndAngle(a / norm_a, norm_a);
69+
r = Rotation::FromAxisAndAngle(a / norm_a, norm_a);
6970
}
7071

7172
} // namespace
@@ -199,7 +200,8 @@ void SensorFusionEkf::ComputeMeasurementJacobian()
199200
Vector3 delta = Vector3::Zero();
200201
delta[dof] = kFiniteDifferencingEpsilon;
201202

202-
const Rotation epsilon_rotation = RotationFromVector(delta);
203+
Rotation epsilon_rotation;
204+
RotationFromVector(delta, epsilon_rotation);
203205
const Vector3 delta_rotation
204206
= ComputeInnovation(epsilon_rotation * current_state_.sensor_from_start_rotation);
205207

@@ -263,7 +265,8 @@ void SensorFusionEkf::ProcessAccelerometerSample(const AccelerometerData& sample
263265
* state_covariance_;
264266

265267
// Updates pose and associate covariance matrix.
266-
const Rotation rotation_from_state_update = RotationFromVector(state_update_);
268+
Rotation rotation_from_state_update;
269+
RotationFromVector(state_update_, rotation_from_state_update);
267270

268271
current_state_.sensor_from_start_rotation
269272
= rotation_from_state_update * current_state_.sensor_from_start_rotation;

0 commit comments

Comments
 (0)