This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch releases/12.7 in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 729e1cad6e853d5103b33d352ec555ea2875ad21 Author: likun17 <[email protected]> AuthorDate: Mon Aug 5 11:51:53 2024 +0800 uorb:Added 6dof motion and gesture related types. For details,see: https://developer.android.com/reference/android/hardware/SensorEvent#values Signed-off-by: likun17 <[email protected]> --- system/uorb/sensor/accel.c | 3 +++ system/uorb/sensor/accel.h | 2 ++ system/uorb/sensor/{accel.c => angle.c} | 11 ++++------- system/uorb/sensor/{accel.h => angle.h} | 9 ++++----- system/uorb/sensor/gesture.c | 24 +++++++++++++++++++----- system/uorb/sensor/gesture.h | 8 ++++++++ system/uorb/sensor/{gesture.c => motion.c} | 17 ++++++++++------- system/uorb/sensor/{accel.h => motion.h} | 13 ++++++++----- system/uorb/sensor/{accel.c => pose_6dof.c} | 14 +++++++------- system/uorb/sensor/{accel.h => pose_6dof.h} | 9 ++++----- system/uorb/sensor/{accel.c => rotation.c} | 18 +++++++++++------- system/uorb/sensor/{accel.h => rotation.h} | 11 ++++++----- system/uorb/sensor/{accel.c => step_counter.c} | 13 ++++++------- system/uorb/sensor/{accel.h => step_counter.h} | 9 ++++----- system/uorb/sensor/topics.c | 26 ++++++++++++++++++++++++++ 15 files changed, 122 insertions(+), 65 deletions(-) diff --git a/system/uorb/sensor/accel.c b/system/uorb/sensor/accel.c index be39b55af..6e3d31391 100644 --- a/system/uorb/sensor/accel.c +++ b/system/uorb/sensor/accel.c @@ -40,3 +40,6 @@ 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_linear_accel, struct sensor_accel, sensor_accel_format); +ORB_DEFINE(sensor_linear_accel_uncal, struct sensor_accel, + sensor_accel_format); diff --git a/system/uorb/sensor/accel.h b/system/uorb/sensor/accel.h index 43d22af48..d4ac1c4bb 100644 --- a/system/uorb/sensor/accel.h +++ b/system/uorb/sensor/accel.h @@ -35,5 +35,7 @@ ORB_DECLARE(sensor_accel); ORB_DECLARE(sensor_accel_uncal); +ORB_DECLARE(sensor_linear_accel); +ORB_DECLARE(sensor_linear_accel_uncal); #endif diff --git a/system/uorb/sensor/accel.c b/system/uorb/sensor/angle.c similarity index 83% copy from system/uorb/sensor/accel.c copy to system/uorb/sensor/angle.c index be39b55af..03cd5aff6 100644 --- a/system/uorb/sensor/accel.c +++ b/system/uorb/sensor/angle.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/system/uorb/sensor/accel.c + * apps/system/uorb/sensor/angle.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -22,21 +22,18 @@ * Included Files ****************************************************************************/ -#include <sensor/accel.h> +#include <sensor/angle.h> /**************************************************************************** * Private Functions ****************************************************************************/ #ifdef CONFIG_DEBUG_UORB -static const char sensor_accel_format[] = - "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,temperature:%hf"; - +static const char sensor_angle_format[] = "timestamp:%" PRIu64 ",angle:%hf"; #endif /**************************************************************************** * Public Data ****************************************************************************/ -ORB_DEFINE(sensor_accel, struct sensor_accel, sensor_accel_format); -ORB_DEFINE(sensor_accel_uncal, struct sensor_accel, sensor_accel_format); +ORB_DEFINE(sensor_hinge_angle, struct sensor_angle, sensor_angle_format); diff --git a/system/uorb/sensor/accel.h b/system/uorb/sensor/angle.h similarity index 88% copy from system/uorb/sensor/accel.h copy to system/uorb/sensor/angle.h index 43d22af48..cc7fd65fb 100644 --- a/system/uorb/sensor/accel.h +++ b/system/uorb/sensor/angle.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/system/uorb/sensor/accel.h + * apps/system/uorb/sensor/angle.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -18,8 +18,8 @@ * ****************************************************************************/ -#ifndef __APPS_SYSTEM_UORB_SENSOR_ACCEL_H -#define __APPS_SYSTEM_UORB_SENSOR_ACCEL_H +#ifndef __APPS_SYSTEM_UORB_SENSOR_ANGLE_H +#define __APPS_SYSTEM_UORB_SENSOR_ANGLE_H /**************************************************************************** * Included Files @@ -33,7 +33,6 @@ /* register this as object request broker structure */ -ORB_DECLARE(sensor_accel); -ORB_DECLARE(sensor_accel_uncal); +ORB_DECLARE(sensor_hinge_angle); #endif diff --git a/system/uorb/sensor/gesture.c b/system/uorb/sensor/gesture.c index f19a40a4b..5d50d42e1 100644 --- a/system/uorb/sensor/gesture.c +++ b/system/uorb/sensor/gesture.c @@ -29,7 +29,7 @@ ****************************************************************************/ #ifdef CONFIG_DEBUG_UORB -static const char sensor_wake_gesture_format[] = +static const char sensor_gesture_format[] = "timestamp:%" PRIu64 ",event:%" PRIu32 ""; #endif @@ -37,7 +37,21 @@ static const char sensor_wake_gesture_format[] = * Public Data ****************************************************************************/ -ORB_DEFINE(sensor_wake_gesture, struct sensor_wake_gesture, - sensor_wake_gesture_format); -ORB_DEFINE(sensor_wake_gesture_uncal, struct sensor_wake_gesture, - sensor_wake_gesture_format); +ORB_DEFINE(sensor_glance_gesture, struct sensor_event, + sensor_gesture_format); +ORB_DEFINE(sensor_glance_gesture_uncal, struct sensor_event, + sensor_gesture_format); +ORB_DEFINE(sensor_offbody_detector, struct sensor_event, + sensor_gesture_format); +ORB_DEFINE(sensor_offbody_detector_uncal, struct sensor_event, + sensor_gesture_format); +ORB_DEFINE(sensor_pickup_gesture, struct sensor_event, + sensor_gesture_format); +ORB_DEFINE(sensor_pickup_gesture_uncal, struct sensor_event, + sensor_gesture_format); +ORB_DEFINE(sensor_wrist_tilt, struct sensor_event, sensor_gesture_format); +ORB_DEFINE(sensor_wrist_tilt_uncal, struct sensor_event, + sensor_gesture_format); +ORB_DEFINE(sensor_wake_gesture, struct sensor_event, sensor_gesture_format); +ORB_DEFINE(sensor_wake_gesture_uncal, struct sensor_event, + sensor_gesture_format); diff --git a/system/uorb/sensor/gesture.h b/system/uorb/sensor/gesture.h index 521f7d8b3..8ea556885 100644 --- a/system/uorb/sensor/gesture.h +++ b/system/uorb/sensor/gesture.h @@ -33,6 +33,14 @@ /* register this as object request broker structure */ +ORB_DECLARE(sensor_glance_gesture); +ORB_DECLARE(sensor_glance_gesture_uncal); +ORB_DECLARE(sensor_offbody_detector); +ORB_DECLARE(sensor_offbody_detector_uncal); +ORB_DECLARE(sensor_pickup_gesture); +ORB_DECLARE(sensor_pickup_gesture_uncal); +ORB_DECLARE(sensor_wrist_tilt); +ORB_DECLARE(sensor_wrist_tilt_uncal); ORB_DECLARE(sensor_wake_gesture); ORB_DECLARE(sensor_wake_gesture_uncal); diff --git a/system/uorb/sensor/gesture.c b/system/uorb/sensor/motion.c similarity index 75% copy from system/uorb/sensor/gesture.c copy to system/uorb/sensor/motion.c index f19a40a4b..fedaca04c 100644 --- a/system/uorb/sensor/gesture.c +++ b/system/uorb/sensor/motion.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/system/uorb/sensor/gesture.c + * apps/system/uorb/sensor/motion.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -22,14 +22,14 @@ * Included Files ****************************************************************************/ -#include <sensor/gesture.h> +#include <sensor/motion.h> /**************************************************************************** * Private Functions ****************************************************************************/ #ifdef CONFIG_DEBUG_UORB -static const char sensor_wake_gesture_format[] = +static const char sensor_event_format[] = "timestamp:%" PRIu64 ",event:%" PRIu32 ""; #endif @@ -37,7 +37,10 @@ static const char sensor_wake_gesture_format[] = * Public Data ****************************************************************************/ -ORB_DEFINE(sensor_wake_gesture, struct sensor_wake_gesture, - sensor_wake_gesture_format); -ORB_DEFINE(sensor_wake_gesture_uncal, struct sensor_wake_gesture, - sensor_wake_gesture_format); +ORB_DEFINE(sensor_motion_detect, struct sensor_event, sensor_event_format); +ORB_DEFINE(sensor_significant_motion, struct sensor_event, + sensor_event_format); +ORB_DEFINE(sensor_step_detector, struct sensor_event, sensor_event_format); +ORB_DEFINE(sensor_tilt_detector, struct sensor_event, sensor_event_format); +ORB_DEFINE(sensor_tilt_detector_uncal, struct sensor_event, + sensor_event_format); diff --git a/system/uorb/sensor/accel.h b/system/uorb/sensor/motion.h similarity index 81% copy from system/uorb/sensor/accel.h copy to system/uorb/sensor/motion.h index 43d22af48..313e9f578 100644 --- a/system/uorb/sensor/accel.h +++ b/system/uorb/sensor/motion.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/system/uorb/sensor/accel.h + * apps/system/uorb/sensor/motion.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -18,8 +18,8 @@ * ****************************************************************************/ -#ifndef __APPS_SYSTEM_UORB_SENSOR_ACCEL_H -#define __APPS_SYSTEM_UORB_SENSOR_ACCEL_H +#ifndef __APPS_SYSTEM_UORB_SENSOR_MOTION_H +#define __APPS_SYSTEM_UORB_SENSOR_MOTION_H /**************************************************************************** * Included Files @@ -33,7 +33,10 @@ /* register this as object request broker structure */ -ORB_DECLARE(sensor_accel); -ORB_DECLARE(sensor_accel_uncal); +ORB_DECLARE(sensor_motion_detect); +ORB_DECLARE(sensor_significant_motion); +ORB_DECLARE(sensor_step_detector); +ORB_DECLARE(sensor_tilt_detector); +ORB_DECLARE(sensor_tilt_detector_uncal); #endif diff --git a/system/uorb/sensor/accel.c b/system/uorb/sensor/pose_6dof.c similarity index 81% copy from system/uorb/sensor/accel.c copy to system/uorb/sensor/pose_6dof.c index be39b55af..2e1741f12 100644 --- a/system/uorb/sensor/accel.c +++ b/system/uorb/sensor/pose_6dof.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/system/uorb/sensor/accel.c + * apps/system/uorb/sensor/pose_6dof.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -22,21 +22,21 @@ * Included Files ****************************************************************************/ -#include <sensor/accel.h> +#include <sensor/pose_6dof.h> /**************************************************************************** * Private Functions ****************************************************************************/ #ifdef CONFIG_DEBUG_UORB -static const char sensor_accel_format[] = - "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,temperature:%hf"; - +static const char sensor_pose_6dof_format[] = + "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,w:%hf,tx:%hf,ty:%hf,tz:%hf," + "dx:%hf,dy:%hf,dz:%hf,dw:%hf,dtx:%hf,dty:%hf,dtz:%hf,number:%" PRIu64 ""; #endif /**************************************************************************** * Public Data ****************************************************************************/ -ORB_DEFINE(sensor_accel, struct sensor_accel, sensor_accel_format); -ORB_DEFINE(sensor_accel_uncal, struct sensor_accel, sensor_accel_format); +ORB_DEFINE(sensor_pose_6dof, struct sensor_pose_6dof, + sensor_pose_6dof_format); diff --git a/system/uorb/sensor/accel.h b/system/uorb/sensor/pose_6dof.h similarity index 88% copy from system/uorb/sensor/accel.h copy to system/uorb/sensor/pose_6dof.h index 43d22af48..4601b927e 100644 --- a/system/uorb/sensor/accel.h +++ b/system/uorb/sensor/pose_6dof.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/system/uorb/sensor/accel.h + * apps/system/uorb/sensor/pose_6dof.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -18,8 +18,8 @@ * ****************************************************************************/ -#ifndef __APPS_SYSTEM_UORB_SENSOR_ACCEL_H -#define __APPS_SYSTEM_UORB_SENSOR_ACCEL_H +#ifndef __APPS_SYSTEM_UORB_SENSOR_POSE_6DOF_H +#define __APPS_SYSTEM_UORB_SENSOR_POSE_6DOF_H /**************************************************************************** * Included Files @@ -33,7 +33,6 @@ /* register this as object request broker structure */ -ORB_DECLARE(sensor_accel); -ORB_DECLARE(sensor_accel_uncal); +ORB_DECLARE(sensor_pose_6dof); #endif diff --git a/system/uorb/sensor/accel.c b/system/uorb/sensor/rotation.c similarity index 74% copy from system/uorb/sensor/accel.c copy to system/uorb/sensor/rotation.c index be39b55af..05777b8f1 100644 --- a/system/uorb/sensor/accel.c +++ b/system/uorb/sensor/rotation.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/system/uorb/sensor/accel.c + * apps/system/uorb/sensor/rotation.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -22,21 +22,25 @@ * Included Files ****************************************************************************/ -#include <sensor/accel.h> +#include <sensor/rotation.h> /**************************************************************************** * Private Functions ****************************************************************************/ #ifdef CONFIG_DEBUG_UORB -static const char sensor_accel_format[] = - "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,temperature:%hf"; - +static const char sensor_rotation_format[] = + "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf"; +static const char sensor_orientation_format[] = + "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,w:%hf"; #endif /**************************************************************************** * Public Data ****************************************************************************/ -ORB_DEFINE(sensor_accel, struct sensor_accel, sensor_accel_format); -ORB_DEFINE(sensor_accel_uncal, struct sensor_accel, sensor_accel_format); +ORB_DEFINE(sensor_rotation, struct sensor_rotation, sensor_rotation_format); +ORB_DEFINE(sensor_orientation, struct sensor_orientation, + sensor_orientation_format); +ORB_DEFINE(sensor_device_orientation, struct sensor_orientation, + sensor_orientation_format); diff --git a/system/uorb/sensor/accel.h b/system/uorb/sensor/rotation.h similarity index 85% copy from system/uorb/sensor/accel.h copy to system/uorb/sensor/rotation.h index 43d22af48..e660beb60 100644 --- a/system/uorb/sensor/accel.h +++ b/system/uorb/sensor/rotation.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/system/uorb/sensor/accel.h + * apps/system/uorb/sensor/rotation.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -18,8 +18,8 @@ * ****************************************************************************/ -#ifndef __APPS_SYSTEM_UORB_SENSOR_ACCEL_H -#define __APPS_SYSTEM_UORB_SENSOR_ACCEL_H +#ifndef __APPS_SYSTEM_UORB_SENSOR_ROTATION_H +#define __APPS_SYSTEM_UORB_SENSOR_ROTATION_H /**************************************************************************** * Included Files @@ -33,7 +33,8 @@ /* register this as object request broker structure */ -ORB_DECLARE(sensor_accel); -ORB_DECLARE(sensor_accel_uncal); +ORB_DECLARE(sensor_rotation); +ORB_DECLARE(sensor_orientation); +ORB_DECLARE(sensor_device_orientation); #endif diff --git a/system/uorb/sensor/accel.c b/system/uorb/sensor/step_counter.c similarity index 83% copy from system/uorb/sensor/accel.c copy to system/uorb/sensor/step_counter.c index be39b55af..360922547 100644 --- a/system/uorb/sensor/accel.c +++ b/system/uorb/sensor/step_counter.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/system/uorb/sensor/accel.c + * apps/system/uorb/sensor/step_counter.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -22,21 +22,20 @@ * Included Files ****************************************************************************/ -#include <sensor/accel.h> +#include <sensor/step_counter.h> /**************************************************************************** * Private Functions ****************************************************************************/ #ifdef CONFIG_DEBUG_UORB -static const char sensor_accel_format[] = - "timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,temperature:%hf"; - +static const char sensor_step_counter_format[] = + "timestamp:%" PRIu64 ",event:%" PRIu32 ",cadence:%" PRIu32 ""; #endif /**************************************************************************** * Public Data ****************************************************************************/ -ORB_DEFINE(sensor_accel, struct sensor_accel, sensor_accel_format); -ORB_DEFINE(sensor_accel_uncal, struct sensor_accel, sensor_accel_format); +ORB_DEFINE(sensor_step_counter, struct sensor_step_counter, + sensor_step_counter_format); diff --git a/system/uorb/sensor/accel.h b/system/uorb/sensor/step_counter.h similarity index 88% copy from system/uorb/sensor/accel.h copy to system/uorb/sensor/step_counter.h index 43d22af48..2e14a48ef 100644 --- a/system/uorb/sensor/accel.h +++ b/system/uorb/sensor/step_counter.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/system/uorb/sensor/accel.h + * apps/system/uorb/sensor/step_counter.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -18,8 +18,8 @@ * ****************************************************************************/ -#ifndef __APPS_SYSTEM_UORB_SENSOR_ACCEL_H -#define __APPS_SYSTEM_UORB_SENSOR_ACCEL_H +#ifndef __APPS_SYSTEM_UORB_SENSOR_STEP_COUNTER_H +#define __APPS_SYSTEM_UORB_SENSOR_STEP_COUNTER_H /**************************************************************************** * Included Files @@ -33,7 +33,6 @@ /* register this as object request broker structure */ -ORB_DECLARE(sensor_accel); -ORB_DECLARE(sensor_accel_uncal); +ORB_DECLARE(sensor_step_counter); #endif diff --git a/system/uorb/sensor/topics.c b/system/uorb/sensor/topics.c index d7e5523f4..7c66569ae 100644 --- a/system/uorb/sensor/topics.c +++ b/system/uorb/sensor/topics.c @@ -32,6 +32,7 @@ #include <unistd.h> #include <sensor/accel.h> +#include <sensor/angle.h> #include <sensor/baro.h> #include <sensor/cap.h> #include <sensor/co2.h> @@ -51,16 +52,20 @@ #include <sensor/ir.h> #include <sensor/light.h> #include <sensor/mag.h> +#include <sensor/motion.h> #include <sensor/noise.h> #include <sensor/ots.h> #include <sensor/ph.h> #include <sensor/pm25.h> #include <sensor/pm1p0.h> #include <sensor/pm10.h> +#include <sensor/pose_6dof.h> #include <sensor/ppgd.h> #include <sensor/ppgq.h> #include <sensor/prox.h> #include <sensor/rgb.h> +#include <sensor/rotation.h> +#include <sensor/step_counter.h> #include <sensor/temp.h> #include <sensor/tvoc.h> #include <sensor/uv.h> @@ -75,13 +80,17 @@ static FAR const struct orb_metadata *g_sensor_list[] = { ORB_ID(sensor_accel), ORB_ID(sensor_accel_uncal), + ORB_ID(sensor_hinge_angle), ORB_ID(sensor_baro), ORB_ID(sensor_cap), ORB_ID(sensor_co2), + ORB_ID(sensor_device_orientation), ORB_ID(sensor_dust), ORB_ID(sensor_ecg), ORB_ID(sensor_force), ORB_ID(sensor_gas), + ORB_ID(sensor_glance_gesture), + ORB_ID(sensor_glance_gesture_uncal), ORB_ID(sensor_gnss), ORB_ID(sensor_gnss_clock), ORB_ID(sensor_gnss_geofence_event), @@ -98,23 +107,40 @@ static FAR const struct orb_metadata *g_sensor_list[] = ORB_ID(sensor_ir), ORB_ID(sensor_light), ORB_ID(sensor_light_uncal), + ORB_ID(sensor_linear_accel), + ORB_ID(sensor_linear_accel_uncal), ORB_ID(sensor_mag), ORB_ID(sensor_mag_uncal), + ORB_ID(sensor_motion_detect), ORB_ID(sensor_noise), + ORB_ID(sensor_offbody_detector), + ORB_ID(sensor_offbody_detector_uncal), + ORB_ID(sensor_orientation), ORB_ID(sensor_ots), ORB_ID(sensor_ph), + ORB_ID(sensor_pickup_gesture), + ORB_ID(sensor_pickup_gesture_uncal), ORB_ID(sensor_pm10), ORB_ID(sensor_pm1p0), ORB_ID(sensor_pm25), + ORB_ID(sensor_pose_6dof), ORB_ID(sensor_ppgd), ORB_ID(sensor_ppgq), ORB_ID(sensor_prox), ORB_ID(sensor_rgb), + ORB_ID(sensor_rotation), + ORB_ID(sensor_significant_motion), + ORB_ID(sensor_step_counter), + ORB_ID(sensor_step_detector), ORB_ID(sensor_temp), + ORB_ID(sensor_tilt_detector), + ORB_ID(sensor_tilt_detector_uncal), ORB_ID(sensor_tvoc), ORB_ID(sensor_uv), ORB_ID(sensor_wake_gesture), ORB_ID(sensor_wake_gesture_uncal), + ORB_ID(sensor_wrist_tilt), + ORB_ID(sensor_wrist_tilt_uncal), NULL, };
