Remove direct unsafe access to matrix internal data

This commit is contained in:
Julian Kent
2019-09-18 08:42:58 +02:00
committed by Lorenz Meier
parent c446ee444a
commit 8d60f8ba8f
3 changed files with 12 additions and 14 deletions
+8 -3
View File
@@ -227,21 +227,26 @@ public:
// return the amount the local horizontal position changed in the last reset and the number of reset events
void get_posNE_reset(float delta[2], uint8_t *counter)
{
memcpy(delta, &_state_reset_status.posNE_change._data[0], sizeof(_state_reset_status.posNE_change._data));
delta[0] = _state_reset_status.posNE_change(0);
delta[1] = _state_reset_status.posNE_change(1);
*counter = _state_reset_status.posNE_counter;
}
// return the amount the local horizontal velocity changed in the last reset and the number of reset events
void get_velNE_reset(float delta[2], uint8_t *counter)
{
memcpy(delta, &_state_reset_status.velNE_change._data[0], sizeof(_state_reset_status.velNE_change._data));
delta[0] = _state_reset_status.velNE_change(0);
delta[1] = _state_reset_status.velNE_change(1);
*counter = _state_reset_status.velNE_counter;
}
// return the amount the quaternion has changed in the last reset and the number of reset events
void get_quat_reset(float delta_quat[4], uint8_t *counter)
{
memcpy(delta_quat, &_state_reset_status.quat_change._data[0], sizeof(_state_reset_status.quat_change._data));
for (size_t i = 0; i < 4; i++)
{
delta_quat[i] = _state_reset_status.quat_change(i);
}
*counter = _state_reset_status.quat_counter;
}
-7
View File
@@ -277,13 +277,6 @@ public:
// return true if the local position estimate is valid
bool local_position_is_valid();
void copy_quaternion(float *quat)
{
for (unsigned i = 0; i < 4; i++) {
quat[i] = _output_new.quat_nominal(i);
}
}
const matrix::Quatf &get_quaternion() const { return _output_new.quat_nominal; }
// return the quaternion defining the rotation from the EKF to the External Vision reference frame