Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
JSH_Project7
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
이유진
2020-06-19 11:15:22 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1967e86fdd22aef074ad17f207d495c7041b1c27
1967e86f
1 parent
9e9dcfdb
수정
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
step3/step3.py
step3/step3.py
View file @
1967e86
...
...
@@ -26,18 +26,17 @@ def setHeight(_sHeight, _master):
def
main
():
master
=
CoDrone
.
CoDrone
()
master
.
connect
(
"None"
,
"COM
3
"
,
False
)
master
.
connect
(
"None"
,
"COM
7
"
,
False
)
slave
=
CoDrone
.
CoDrone
()
slave
.
connect
(
"None"
,
"COM5"
,
False
)
master
.
takeoff
()
#master 드론 이륙
slave
.
takeoff
()
#slave 드론 이륙
slave
.
hover
(
60
)
bHeight
=
slave
.
get_height
()
# bHeight = slave의 높이
# slave의 이전 좌표값(움직임 추적용) 초기화
bHeight
=
0
#
bHeight = 0
while
True
:
...
...
@@ -49,7 +48,17 @@ def main():
sHeight
=
slave
.
get_height
()
# slave고도
print
(
"master [x={} y={} z={}] slave [x={} y={} z={}]"
.
format
(
mPosition
.
X
,
mPosition
.
Y
,
mHeight
,
sPosition
.
X
,
sPosition
.
Y
,
sHeight
))
if
keyboard
.
is_pressed
(
'q'
):
# 키보드에서 'q'가 입력되면 while문 탈출
print
(
'[Keyboard input occur: Quit!]'
)
# 착륙에 성공할 때까지 LED 효과
master
.
arm_default_pattern
(
0
,
125
,
155
,
Mode
.
DOUBLE_BLINK
,
10
)
slave
.
arm_default_pattern
(
0
,
125
,
155
,
Mode
.
DOUBLE_BLINK
,
10
)
break
elif
not
slave
.
isConnected
():
# slave 연결이 끊기면 프로그램 종료
print
(
'[Slave Disconnected]'
)
return
# slave의 전 높이 대비 heightRange 만큼의 차이가 있으면 master가 움직이도록
if
abs
(
sHeight
-
bHeight
)
>
heightRange
:
print
(
'[height change!]'
)
...
...
Please
register
or
login
to post a comment