Skip to content

Commit

Permalink
uorb:Added 6dof motion and gesture related types.
Browse files Browse the repository at this point in the history
For details,see: https://developer.android.com/reference/android/hardware/SensorEvent#values

Signed-off-by: likun17 <likun17@xiaomi.com>
  • Loading branch information
Otpvondoiats authored and xiaoxiang781216 committed Sep 27, 2024
1 parent b28a4b4 commit d2214c2
Show file tree
Hide file tree
Showing 15 changed files with 468 additions and 5 deletions.
3 changes: 3 additions & 0 deletions system/uorb/sensor/accel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
2 changes: 2 additions & 0 deletions system/uorb/sensor/accel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
39 changes: 39 additions & 0 deletions system/uorb/sensor/angle.c
Original file line number Diff line number Diff line change
@@ -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);
38 changes: 38 additions & 0 deletions system/uorb/sensor/angle.h
Original file line number Diff line number Diff line change
@@ -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
24 changes: 19 additions & 5 deletions system/uorb/sensor/gesture.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,29 @@
****************************************************************************/

#ifdef CONFIG_DEBUG_UORB
static const char sensor_wake_gesture_format[] =
static const char sensor_gesture_format[] =
"timestamp:%" PRIu64 ",event:%" PRIu32 "";
#endif

/****************************************************************************
* 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);
8 changes: 8 additions & 0 deletions system/uorb/sensor/gesture.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
46 changes: 46 additions & 0 deletions system/uorb/sensor/motion.c
Original file line number Diff line number Diff line change
@@ -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);
42 changes: 42 additions & 0 deletions system/uorb/sensor/motion.h
Original file line number Diff line number Diff line change
@@ -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
42 changes: 42 additions & 0 deletions system/uorb/sensor/pose_6dof.c
Original file line number Diff line number Diff line change
@@ -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);
38 changes: 38 additions & 0 deletions system/uorb/sensor/pose_6dof.h
Original file line number Diff line number Diff line change
@@ -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
46 changes: 46 additions & 0 deletions system/uorb/sensor/rotation.c
Original file line number Diff line number Diff line change
@@ -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);
Loading

0 comments on commit d2214c2

Please sign in to comment.