fix to check q

Signed-off-by: dirksavage88 <dirksavage88@gmail.com>
This commit is contained in:
dirksavage88 2025-12-15 10:12:25 -05:00 committed by Matthias Grob
parent 11bf3cffde
commit 3e290695ef
2 changed files with 7 additions and 2 deletions

View File

@ -84,7 +84,11 @@ void PX4Rangefinder::update(const hrt_abstime &timestamp_sample, const float dis
}
// Update the quaternion in the sample update
memcpy(report.q, q, sizeof(float) * q_len);
if (q != nullptr) {
memcpy(report.q, q, sizeof(float) * q_len);
}
_distance_sensor_pub.update();
}

View File

@ -63,7 +63,8 @@ public:
void set_mode(const uint8_t mode) { _distance_sensor_pub.get().mode = mode; }
// update with quaterion sensor orientation with respect to the vehicle body frame
void update(const hrt_abstime &timestamp_sample, const float distance, const int8_t quality = -1, const float *q = nullptr, uint8_t q_len = 4);
void update(const hrt_abstime &timestamp_sample, const float distance, const int8_t quality = -1, const float *q = nullptr,
uint8_t q_len = 4);
int get_instance() { return _distance_sensor_pub.get_instance(); };
uint32_t get_device_id() { return _distance_sensor_pub.get().device_id; };