Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design2
/
2014104077
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Wonseok Kwak
2021-06-13 05:27:59 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4d0089eccc7733a05392a1b1b171900ae05e5a9b
4d0089ec
1 parent
99a4012d
Update : IMU Serial logging 및 monitoring을 위한 소스
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
source/DroneControl/getAccel.py
source/DroneControl/getAccel.py
View file @
4d0089e
...
...
@@ -4,13 +4,9 @@ import math
ac_x
=
0
ac_y
=
0
ac_z
=
0
normal_x
=
0
normal_y
=
0
normal_z
=
0
deltha_x
=
[
0
,
0
,
0
]
deltha_y
=
[
0
,
0
,
0
]
deltha_z
=
[
0
,
0
,
0
]
deltha
=
0
def
map
(
x
,
input_min
,
input_max
,
output_min
,
output_max
):
return
(
x
-
input_min
)
*
(
output_max
-
output_min
)
/
(
input_max
-
input_min
)
+
output_min
...
...
@@ -31,8 +27,6 @@ def main():
deltha_x
[
i
]
=
0
deltha_y
[
i
]
=
0
deltha_z
[
i
]
=
0
angle
=
0
angle_value
=
0
...
...
@@ -45,16 +39,18 @@ def main():
ac_y
=
acceleration
.
Y
ac_z
=
acceleration
.
Z
normal_x
=
map
(
ac_x
,
-
32768
,
32767
,
-
5000
,
5
000
)
normal_y
=
map
(
ac_y
,
-
32768
,
32767
,
-
5000
,
5
000
)
normal_x
=
map
(
ac_x
,
-
32768
,
32767
,
-
10000
,
10
000
)
normal_y
=
map
(
ac_y
,
-
32768
,
32767
,
-
10000
,
10
000
)
normal_z
=
map
(
ac_z
,
-
32768
,
32767
,
-
5000
,
5000
)
deltha_x
[
1
]
=
deltha_x
[
1
]
+
(
normal_x
)
deltha_y
[
1
]
=
deltha_y
[
1
]
+
(
normal_y
)
deltha_z
[
1
]
=
deltha_z
[
1
]
+
(
normal_z
)
deltha_x
[
1
]
=
int
(
deltha_x
[
1
]
/
4
)
deltha_y
[
1
]
=
int
(
deltha_y
[
1
]
/
4
)
deltha_z
[
1
]
=
int
(
deltha_z
[
1
]
/
4
)
deltha_x
[
1
]
=
int
(
deltha_x
[
1
]
/
4
)
deltha_y
[
1
]
=
int
(
deltha_y
[
1
]
/
4
)
deltha_z
[
1
]
=
int
(
deltha_z
[
1
]
/
4
)
...
...
@@ -67,9 +63,11 @@ def main():
ac_y
=
acceleration
.
Y
ac_z
=
acceleration
.
Z
normal_x
=
map
(
ac_x
,
-
32768
,
32767
,
-
5000
,
5
000
)
normal_y
=
map
(
ac_y
,
-
32768
,
32767
,
-
5000
,
5
000
)
normal_x
=
map
(
ac_x
,
-
32768
,
32767
,
-
10000
,
10
000
)
normal_y
=
map
(
ac_y
,
-
32768
,
32767
,
-
10000
,
10
000
)
normal_z
=
map
(
ac_z
,
-
32768
,
32767
,
-
5000
,
5000
)
deltha_x
[
2
]
=
deltha_x
[
2
]
+
(
normal_x
)
deltha_y
[
2
]
=
deltha_y
[
2
]
+
(
normal_y
)
deltha_z
[
2
]
=
deltha_z
[
2
]
+
(
normal_z
)
...
...
@@ -82,7 +80,7 @@ def main():
deltha_y
[
0
]
=
abs
(
deltha_y
[
1
]
-
deltha_y
[
2
])
deltha_z
[
0
]
=
abs
(
deltha_z
[
1
]
-
deltha_z
[
2
])
deltha
=
deltha_x
[
0
]
+
deltha_y
[
0
]
+
deltha_z
[
0
]
print
(
"AcX : "
,
deltha_x
[
0
],
"AcY : "
,
deltha_y
[
0
],
"AcZ : "
,
deltha_z
[
0
]
-
230
,
"Total : "
,
deltha
)
print
(
"AcX : "
,
deltha_x
[
0
],
"AcY : "
,
deltha_y
[
0
],
"AcZ : "
,
deltha_z
[
0
],
"Total : "
,
deltha
)
if
__name__
==
'__main__'
:
...
...
Please
register
or
login
to post a comment