Skip to content

Commit d2214c2

Browse files
Otpvondoiatsxiaoxiang781216
authored andcommitted
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]>
1 parent b28a4b4 commit d2214c2

File tree

15 files changed

+468
-5
lines changed

15 files changed

+468
-5
lines changed

system/uorb/sensor/accel.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ static const char sensor_accel_format[] =
4040

4141
ORB_DEFINE(sensor_accel, struct sensor_accel, sensor_accel_format);
4242
ORB_DEFINE(sensor_accel_uncal, struct sensor_accel, sensor_accel_format);
43+
ORB_DEFINE(sensor_linear_accel, struct sensor_accel, sensor_accel_format);
44+
ORB_DEFINE(sensor_linear_accel_uncal, struct sensor_accel,
45+
sensor_accel_format);

system/uorb/sensor/accel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,7 @@
3535

3636
ORB_DECLARE(sensor_accel);
3737
ORB_DECLARE(sensor_accel_uncal);
38+
ORB_DECLARE(sensor_linear_accel);
39+
ORB_DECLARE(sensor_linear_accel_uncal);
3840

3941
#endif

system/uorb/sensor/angle.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/****************************************************************************
2+
* apps/system/uorb/sensor/angle.c
3+
*
4+
* Licensed to the Apache Software Foundation (ASF) under one or more
5+
* contributor license agreements. See the NOTICE file distributed with
6+
* this work for additional information regarding copyright ownership. The
7+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance with the
9+
* License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
18+
*
19+
****************************************************************************/
20+
21+
/****************************************************************************
22+
* Included Files
23+
****************************************************************************/
24+
25+
#include <sensor/angle.h>
26+
27+
/****************************************************************************
28+
* Private Functions
29+
****************************************************************************/
30+
31+
#ifdef CONFIG_DEBUG_UORB
32+
static const char sensor_angle_format[] = "timestamp:%" PRIu64 ",angle:%hf";
33+
#endif
34+
35+
/****************************************************************************
36+
* Public Data
37+
****************************************************************************/
38+
39+
ORB_DEFINE(sensor_hinge_angle, struct sensor_angle, sensor_angle_format);

system/uorb/sensor/angle.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/****************************************************************************
2+
* apps/system/uorb/sensor/angle.h
3+
*
4+
* Licensed to the Apache Software Foundation (ASF) under one or more
5+
* contributor license agreements. See the NOTICE file distributed with
6+
* this work for additional information regarding copyright ownership. The
7+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance with the
9+
* License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
18+
*
19+
****************************************************************************/
20+
21+
#ifndef __APPS_SYSTEM_UORB_SENSOR_ANGLE_H
22+
#define __APPS_SYSTEM_UORB_SENSOR_ANGLE_H
23+
24+
/****************************************************************************
25+
* Included Files
26+
****************************************************************************/
27+
28+
#include <uORB/uORB.h>
29+
30+
/****************************************************************************
31+
* Public Data
32+
****************************************************************************/
33+
34+
/* register this as object request broker structure */
35+
36+
ORB_DECLARE(sensor_hinge_angle);
37+
38+
#endif

system/uorb/sensor/gesture.c

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,29 @@
2929
****************************************************************************/
3030

3131
#ifdef CONFIG_DEBUG_UORB
32-
static const char sensor_wake_gesture_format[] =
32+
static const char sensor_gesture_format[] =
3333
"timestamp:%" PRIu64 ",event:%" PRIu32 "";
3434
#endif
3535

3636
/****************************************************************************
3737
* Public Data
3838
****************************************************************************/
3939

40-
ORB_DEFINE(sensor_wake_gesture, struct sensor_wake_gesture,
41-
sensor_wake_gesture_format);
42-
ORB_DEFINE(sensor_wake_gesture_uncal, struct sensor_wake_gesture,
43-
sensor_wake_gesture_format);
40+
ORB_DEFINE(sensor_glance_gesture, struct sensor_event,
41+
sensor_gesture_format);
42+
ORB_DEFINE(sensor_glance_gesture_uncal, struct sensor_event,
43+
sensor_gesture_format);
44+
ORB_DEFINE(sensor_offbody_detector, struct sensor_event,
45+
sensor_gesture_format);
46+
ORB_DEFINE(sensor_offbody_detector_uncal, struct sensor_event,
47+
sensor_gesture_format);
48+
ORB_DEFINE(sensor_pickup_gesture, struct sensor_event,
49+
sensor_gesture_format);
50+
ORB_DEFINE(sensor_pickup_gesture_uncal, struct sensor_event,
51+
sensor_gesture_format);
52+
ORB_DEFINE(sensor_wrist_tilt, struct sensor_event, sensor_gesture_format);
53+
ORB_DEFINE(sensor_wrist_tilt_uncal, struct sensor_event,
54+
sensor_gesture_format);
55+
ORB_DEFINE(sensor_wake_gesture, struct sensor_event, sensor_gesture_format);
56+
ORB_DEFINE(sensor_wake_gesture_uncal, struct sensor_event,
57+
sensor_gesture_format);

system/uorb/sensor/gesture.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@
3333

3434
/* register this as object request broker structure */
3535

36+
ORB_DECLARE(sensor_glance_gesture);
37+
ORB_DECLARE(sensor_glance_gesture_uncal);
38+
ORB_DECLARE(sensor_offbody_detector);
39+
ORB_DECLARE(sensor_offbody_detector_uncal);
40+
ORB_DECLARE(sensor_pickup_gesture);
41+
ORB_DECLARE(sensor_pickup_gesture_uncal);
42+
ORB_DECLARE(sensor_wrist_tilt);
43+
ORB_DECLARE(sensor_wrist_tilt_uncal);
3644
ORB_DECLARE(sensor_wake_gesture);
3745
ORB_DECLARE(sensor_wake_gesture_uncal);
3846

system/uorb/sensor/motion.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/****************************************************************************
2+
* apps/system/uorb/sensor/motion.c
3+
*
4+
* Licensed to the Apache Software Foundation (ASF) under one or more
5+
* contributor license agreements. See the NOTICE file distributed with
6+
* this work for additional information regarding copyright ownership. The
7+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance with the
9+
* License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
18+
*
19+
****************************************************************************/
20+
21+
/****************************************************************************
22+
* Included Files
23+
****************************************************************************/
24+
25+
#include <sensor/motion.h>
26+
27+
/****************************************************************************
28+
* Private Functions
29+
****************************************************************************/
30+
31+
#ifdef CONFIG_DEBUG_UORB
32+
static const char sensor_event_format[] =
33+
"timestamp:%" PRIu64 ",event:%" PRIu32 "";
34+
#endif
35+
36+
/****************************************************************************
37+
* Public Data
38+
****************************************************************************/
39+
40+
ORB_DEFINE(sensor_motion_detect, struct sensor_event, sensor_event_format);
41+
ORB_DEFINE(sensor_significant_motion, struct sensor_event,
42+
sensor_event_format);
43+
ORB_DEFINE(sensor_step_detector, struct sensor_event, sensor_event_format);
44+
ORB_DEFINE(sensor_tilt_detector, struct sensor_event, sensor_event_format);
45+
ORB_DEFINE(sensor_tilt_detector_uncal, struct sensor_event,
46+
sensor_event_format);

system/uorb/sensor/motion.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/****************************************************************************
2+
* apps/system/uorb/sensor/motion.h
3+
*
4+
* Licensed to the Apache Software Foundation (ASF) under one or more
5+
* contributor license agreements. See the NOTICE file distributed with
6+
* this work for additional information regarding copyright ownership. The
7+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance with the
9+
* License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
18+
*
19+
****************************************************************************/
20+
21+
#ifndef __APPS_SYSTEM_UORB_SENSOR_MOTION_H
22+
#define __APPS_SYSTEM_UORB_SENSOR_MOTION_H
23+
24+
/****************************************************************************
25+
* Included Files
26+
****************************************************************************/
27+
28+
#include <uORB/uORB.h>
29+
30+
/****************************************************************************
31+
* Public Data
32+
****************************************************************************/
33+
34+
/* register this as object request broker structure */
35+
36+
ORB_DECLARE(sensor_motion_detect);
37+
ORB_DECLARE(sensor_significant_motion);
38+
ORB_DECLARE(sensor_step_detector);
39+
ORB_DECLARE(sensor_tilt_detector);
40+
ORB_DECLARE(sensor_tilt_detector_uncal);
41+
42+
#endif

system/uorb/sensor/pose_6dof.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/****************************************************************************
2+
* apps/system/uorb/sensor/pose_6dof.c
3+
*
4+
* Licensed to the Apache Software Foundation (ASF) under one or more
5+
* contributor license agreements. See the NOTICE file distributed with
6+
* this work for additional information regarding copyright ownership. The
7+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance with the
9+
* License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
18+
*
19+
****************************************************************************/
20+
21+
/****************************************************************************
22+
* Included Files
23+
****************************************************************************/
24+
25+
#include <sensor/pose_6dof.h>
26+
27+
/****************************************************************************
28+
* Private Functions
29+
****************************************************************************/
30+
31+
#ifdef CONFIG_DEBUG_UORB
32+
static const char sensor_pose_6dof_format[] =
33+
"timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,w:%hf,tx:%hf,ty:%hf,tz:%hf,"
34+
"dx:%hf,dy:%hf,dz:%hf,dw:%hf,dtx:%hf,dty:%hf,dtz:%hf,number:%" PRIu64 "";
35+
#endif
36+
37+
/****************************************************************************
38+
* Public Data
39+
****************************************************************************/
40+
41+
ORB_DEFINE(sensor_pose_6dof, struct sensor_pose_6dof,
42+
sensor_pose_6dof_format);

system/uorb/sensor/pose_6dof.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/****************************************************************************
2+
* apps/system/uorb/sensor/pose_6dof.h
3+
*
4+
* Licensed to the Apache Software Foundation (ASF) under one or more
5+
* contributor license agreements. See the NOTICE file distributed with
6+
* this work for additional information regarding copyright ownership. The
7+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance with the
9+
* License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
18+
*
19+
****************************************************************************/
20+
21+
#ifndef __APPS_SYSTEM_UORB_SENSOR_POSE_6DOF_H
22+
#define __APPS_SYSTEM_UORB_SENSOR_POSE_6DOF_H
23+
24+
/****************************************************************************
25+
* Included Files
26+
****************************************************************************/
27+
28+
#include <uORB/uORB.h>
29+
30+
/****************************************************************************
31+
* Public Data
32+
****************************************************************************/
33+
34+
/* register this as object request broker structure */
35+
36+
ORB_DECLARE(sensor_pose_6dof);
37+
38+
#endif

system/uorb/sensor/rotation.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/****************************************************************************
2+
* apps/system/uorb/sensor/rotation.c
3+
*
4+
* Licensed to the Apache Software Foundation (ASF) under one or more
5+
* contributor license agreements. See the NOTICE file distributed with
6+
* this work for additional information regarding copyright ownership. The
7+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance with the
9+
* License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
18+
*
19+
****************************************************************************/
20+
21+
/****************************************************************************
22+
* Included Files
23+
****************************************************************************/
24+
25+
#include <sensor/rotation.h>
26+
27+
/****************************************************************************
28+
* Private Functions
29+
****************************************************************************/
30+
31+
#ifdef CONFIG_DEBUG_UORB
32+
static const char sensor_rotation_format[] =
33+
"timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf";
34+
static const char sensor_orientation_format[] =
35+
"timestamp:%" PRIu64 ",x:%hf,y:%hf,z:%hf,w:%hf";
36+
#endif
37+
38+
/****************************************************************************
39+
* Public Data
40+
****************************************************************************/
41+
42+
ORB_DEFINE(sensor_rotation, struct sensor_rotation, sensor_rotation_format);
43+
ORB_DEFINE(sensor_orientation, struct sensor_orientation,
44+
sensor_orientation_format);
45+
ORB_DEFINE(sensor_device_orientation, struct sensor_orientation,
46+
sensor_orientation_format);

0 commit comments

Comments
 (0)