uorb:Added 6dof motion and gesture related types. For details,see: https://developer.android.com/reference/android/hardware/SensorEvent#values

Signed-off-by: likun17 <likun17@xiaomi.com>
This commit is contained in:
likun17 2024-08-05 11:51:53 +08:00 committed by Xiang Xiao
parent 9ca75e2977
commit 729e1cad6e
15 changed files with 468 additions and 5 deletions

View File

@ -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);

View File

@ -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

View File

@ -0,0 +1,39 @@
/****************************************************************************
* 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
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <sensor/angle.h>
/****************************************************************************
* Private Functions
****************************************************************************/
#ifdef CONFIG_DEBUG_UORB
static const char sensor_angle_format[] = "timestamp:%" PRIu64 ",angle:%hf";
#endif
/****************************************************************************
* Public Data
****************************************************************************/
ORB_DEFINE(sensor_hinge_angle, struct sensor_angle, sensor_angle_format);

View File

@ -0,0 +1,38 @@
/****************************************************************************
* 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
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __APPS_SYSTEM_UORB_SENSOR_ANGLE_H
#define __APPS_SYSTEM_UORB_SENSOR_ANGLE_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <uORB/uORB.h>
/****************************************************************************
* Public Data
****************************************************************************/
/* register this as object request broker structure */
ORB_DECLARE(sensor_hinge_angle);
#endif

View File

@ -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);

View File

@ -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);

View File

@ -0,0 +1,46 @@
/****************************************************************************
* 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
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <sensor/motion.h>
/****************************************************************************
* Private Functions
****************************************************************************/
#ifdef CONFIG_DEBUG_UORB
static const char sensor_event_format[] =
"timestamp:%" PRIu64 ",event:%" PRIu32 "";
#endif
/****************************************************************************
* Public Data
****************************************************************************/
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);

View File

@ -0,0 +1,42 @@
/****************************************************************************
* 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
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __APPS_SYSTEM_UORB_SENSOR_MOTION_H
#define __APPS_SYSTEM_UORB_SENSOR_MOTION_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <uORB/uORB.h>
/****************************************************************************
* Public Data
****************************************************************************/
/* register this as object request broker structure */
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

View File

@ -0,0 +1,42 @@
/****************************************************************************
* 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
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <sensor/pose_6dof.h>
/****************************************************************************
* Private Functions
****************************************************************************/
#ifdef CONFIG_DEBUG_UORB
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_pose_6dof, struct sensor_pose_6dof,
sensor_pose_6dof_format);

View File

@ -0,0 +1,38 @@
/****************************************************************************
* 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
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __APPS_SYSTEM_UORB_SENSOR_POSE_6DOF_H
#define __APPS_SYSTEM_UORB_SENSOR_POSE_6DOF_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <uORB/uORB.h>
/****************************************************************************
* Public Data
****************************************************************************/
/* register this as object request broker structure */
ORB_DECLARE(sensor_pose_6dof);
#endif

View File

@ -0,0 +1,46 @@
/****************************************************************************
* 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
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <sensor/rotation.h>
/****************************************************************************
* Private Functions
****************************************************************************/
#ifdef CONFIG_DEBUG_UORB
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_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);

View File

@ -0,0 +1,40 @@
/****************************************************************************
* 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
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __APPS_SYSTEM_UORB_SENSOR_ROTATION_H
#define __APPS_SYSTEM_UORB_SENSOR_ROTATION_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <uORB/uORB.h>
/****************************************************************************
* Public Data
****************************************************************************/
/* register this as object request broker structure */
ORB_DECLARE(sensor_rotation);
ORB_DECLARE(sensor_orientation);
ORB_DECLARE(sensor_device_orientation);
#endif

View File

@ -0,0 +1,41 @@
/****************************************************************************
* 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
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <sensor/step_counter.h>
/****************************************************************************
* Private Functions
****************************************************************************/
#ifdef CONFIG_DEBUG_UORB
static const char sensor_step_counter_format[] =
"timestamp:%" PRIu64 ",event:%" PRIu32 ",cadence:%" PRIu32 "";
#endif
/****************************************************************************
* Public Data
****************************************************************************/
ORB_DEFINE(sensor_step_counter, struct sensor_step_counter,
sensor_step_counter_format);

View File

@ -0,0 +1,38 @@
/****************************************************************************
* 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
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __APPS_SYSTEM_UORB_SENSOR_STEP_COUNTER_H
#define __APPS_SYSTEM_UORB_SENSOR_STEP_COUNTER_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <uORB/uORB.h>
/****************************************************************************
* Public Data
****************************************************************************/
/* register this as object request broker structure */
ORB_DECLARE(sensor_step_counter);
#endif

View File

@ -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,
};