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
9a1614a5
Commit
9a1614a5
authored
3 years ago
by
Zhiying Li
Browse files
Options
Downloads
Patches
Plain Diff
upgrade the distance and send it all together
parent
cf5f85cc
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/Ball_Detection/PyTorch_with_ESPCAM/feed-to-ESP32-Tx.py
+26
-2
26 additions, 2 deletions
Code/Ball_Detection/PyTorch_with_ESPCAM/feed-to-ESP32-Tx.py
with
26 additions
and
2 deletions
Code/Ball_Detection/PyTorch_with_ESPCAM/feed-to-ESP32-Tx.py
+
26
−
2
View file @
9a1614a5
...
...
@@ -9,6 +9,8 @@ serial_port.open()
gbx
=
0
gby
=
0
dist
=
0
gbc
=
0
### Declare Varables and Constants
device
=
'
cuda
'
...
...
@@ -26,9 +28,10 @@ waitTime = 0.1
while
True
:
## Testing (using Live Streaming)
gbx
,
gby
=
live_feed
.
detectLive
(
model
)
gbx
,
gby
,
dist
=
live_feed
.
detectLive
(
model
)
intDist
=
int
(
dist
)
# cm
if
gbx
!=
-
1
and
gby
!=
-
1
:
"""
value =
'
gbx
'
+ str(gbx) +
'
\n
'
print( value , end =
''
)
serial_port.write(value.encode())
...
...
@@ -38,6 +41,27 @@ while True:
print( value)
serial_port.write(value.encode())
time.sleep(waitTime)
"""
if
gbx
<
100
:
strgbx
=
'
0
'
+
str
(
gbx
)
else
:
strgbx
=
str
(
gbx
)
if
gby
<
100
:
strgby
=
'
0
'
+
str
(
gby
)
else
:
strgby
=
str
(
gby
)
if
intDist
<
100
:
strdist
=
'
0
'
+
str
(
intDist
)
else
:
strdist
=
str
(
intDist
)
value
=
'
gbc
'
+
strgbx
+
strgby
+
strdist
+
'
\n
'
# value = 'gbc' + str(dist) + '\n'
print
(
value
)
serial_port
.
write
(
value
.
encode
())
time
.
sleep
(
waitTime
)
else
:
value
=
'
gbx-1
\n
'
serial_port
.
write
(
value
.
encode
())
...
...
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