This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit cd997bdf2fdb0d1ac195c65d8d6cfbc1f2e63d65 Author: likun17 <[email protected]> AuthorDate: Tue Feb 11 22:07:23 2025 +0800 system/uorb: Use uncalibrated structs for uncalibrated topics. sensor_accel_uncal, sensor_linear_accel_uncal, sensor_gyro_uncal and sensor_mag_uncal are defined with the calibrated structures and format strings. Their samples are published as struct sensor_accel_uncal, struct sensor_gyro_uncal and struct sensor_mag_uncal, which also carry the x/y/z bias, so the topic size does not match the data and the listener prints the wrong fields. Define the four topics with the uncalibrated structures and add format strings that include the bias members. Signed-off-by: likun17 <[email protected]> --- system/uorb/sensor/accel.c | 11 +++++++---- system/uorb/sensor/gyro.c | 6 +++++- system/uorb/sensor/mag.c | 6 +++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/system/uorb/sensor/accel.c b/system/uorb/sensor/accel.c index b71839bbb..c80412790 100644 --- a/system/uorb/sensor/accel.c +++ b/system/uorb/sensor/accel.c @@ -33,7 +33,9 @@ #ifdef CONFIG_UORB_FORMAT static const char sensor_accel_format[] = "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,temperature:%hf"; - +static const char sensor_accel_uncal_format[] = + "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,x_bias:%hf,y_bias:%hf," + "z_bias:%hf,temperature:%hf"; #endif /**************************************************************************** @@ -41,7 +43,8 @@ static const char sensor_accel_format[] = ****************************************************************************/ ORB_DEFINE(sensor_accel, struct sensor_accel, sensor_accel_format); -ORB_DEFINE(sensor_accel_uncal, struct sensor_accel, sensor_accel_format); +ORB_DEFINE(sensor_accel_uncal, struct sensor_accel_uncal, + sensor_accel_uncal_format); ORB_DEFINE(sensor_linear_accel, struct sensor_accel, sensor_accel_format); -ORB_DEFINE(sensor_linear_accel_uncal, struct sensor_accel, - sensor_accel_format); +ORB_DEFINE(sensor_linear_accel_uncal, struct sensor_accel_uncal, + sensor_accel_uncal_format); diff --git a/system/uorb/sensor/gyro.c b/system/uorb/sensor/gyro.c index ba45d4d71..3976d161e 100644 --- a/system/uorb/sensor/gyro.c +++ b/system/uorb/sensor/gyro.c @@ -33,6 +33,9 @@ #ifdef CONFIG_UORB_FORMAT static const char sensor_gyro_format[] = "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,temperature:%hf"; +static const char sensor_gyro_uncal_format[] = + "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,x_bias:%hf,y_bias:%hf," + "z_bias:%hf,temperature:%hf"; #endif /**************************************************************************** @@ -40,4 +43,5 @@ static const char sensor_gyro_format[] = ****************************************************************************/ ORB_DEFINE(sensor_gyro, struct sensor_gyro, sensor_gyro_format); -ORB_DEFINE(sensor_gyro_uncal, struct sensor_gyro, sensor_gyro_format); +ORB_DEFINE(sensor_gyro_uncal, struct sensor_gyro_uncal, + sensor_gyro_uncal_format); diff --git a/system/uorb/sensor/mag.c b/system/uorb/sensor/mag.c index aa16dd08d..c35c42afb 100644 --- a/system/uorb/sensor/mag.c +++ b/system/uorb/sensor/mag.c @@ -34,6 +34,9 @@ static const char sensor_mag_format[] = "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,temperature:%hf," "status:%" PRId32 ""; +static const char sensor_mag_uncal_format[] = + "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,x_bias:%hf,y_bias:%hf," + "z_bias:%hf,temperature:%hf,status:%" PRId32 ""; #endif /**************************************************************************** @@ -41,4 +44,5 @@ static const char sensor_mag_format[] = ****************************************************************************/ ORB_DEFINE(sensor_mag, struct sensor_mag, sensor_mag_format); -ORB_DEFINE(sensor_mag_uncal, struct sensor_mag, sensor_mag_format); +ORB_DEFINE(sensor_mag_uncal, struct sensor_mag_uncal, + sensor_mag_uncal_format);
