Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
November 2021 Blimp Competition
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Shahrul Kamil bin Hassan
November 2021 Blimp Competition
Commits
3517c8cc
Commit
3517c8cc
authored
4 years ago
by
Zhaoliang Zheng
Browse files
Options
Downloads
Patches
Plain Diff
test the decode function
parent
cac1a3f8
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/Control/Laptop_Code/Test_keyboard/keyboard.py
+15
-3
15 additions, 3 deletions
Code/Control/Laptop_Code/Test_keyboard/keyboard.py
with
15 additions
and
3 deletions
Code/Control/Laptop_Code/Test_keyboard/keyboard.py
+
15
−
3
View file @
3517c8cc
...
...
@@ -50,6 +50,17 @@ def manual_control(Ctl_com):
return
Ctl_com
# print("manual_control function")
def
decode_ctl
(
Ctl_com
):
pwm1
=
Ctl_com
[
0
]
pwm2
=
Ctl_com
[
1
]
pwm3
=
Ctl_com
[
2
]
pwm4
=
Ctl_com
[
3
]
dir1
=
Ctl_com
[
4
]
dir2
=
Ctl_com
[
5
]
dir3
=
Ctl_com
[
6
]
dir4
=
Ctl_com
[
7
]
return
pwm1
,
pwm2
,
pwm3
,
pwm4
,
dir1
,
dir2
,
dir3
,
dir4
def
dynamic_variable
(
str_name_v
):
global
kpx
,
kix
,
kdx
,
start_speed
...
...
@@ -71,7 +82,6 @@ def variables_change_once():
str_name
=
input
(
"
Enter your variable:
"
)
dynamic_variable
(
str_name
)
# print("variables_change function")
def
init
():
...
...
@@ -129,7 +139,8 @@ if __name__ == '__main__':
flag
=
2
while
(
flag
==
2
):
Ctl_command
=
manual_control
(
Ctl_com
)
print
(
"
Ctl_com:{}
"
.
format
(
Ctl_command
))
pwm1
,
pwm2
,
pwm3
,
pwm4
,
dir1
,
dir2
,
dir3
,
dir4
=
decode_ctl
(
Ctl_command
)
print
(
"
Ctl_com:{},{},{},{},{},{},{},{}
"
.
format
(
pwm1
,
pwm2
,
pwm3
,
pwm4
,
dir1
,
dir2
,
dir3
,
dir4
))
flag
,
print_count
=
keyboard_stop
(
flag
,
print_count
)
elif
get_key
(
'
v
'
):
...
...
@@ -139,7 +150,8 @@ if __name__ == '__main__':
flag
=
0
print_count
=
1
# flag, print_count = keyboard_stop(flag,print_count)
elif
get_key
(
'
k
'
):
elif
get_key
(
'
k
'
):
# kill the program
break
if
print_count
is
not
0
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment