mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 13:13:34 +08:00
Remove direct unsafe access to matrix internal data
This commit is contained in:
committed by
Lorenz Meier
parent
c446ee444a
commit
8d60f8ba8f
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user