Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VISCA Over IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Amalio Coron
VISCA Over IP
Commits
72a2d41f
Commit
72a2d41f
authored
6 years ago
by
Amalio Coron
Browse files
Options
Downloads
Patches
Plain Diff
le post nano
parent
844ca368
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
viscaoveriplib/Test camera file.py
+0
-0
0 additions, 0 deletions
viscaoveriplib/Test camera file.py
viscaoveriplib/camera.py
+7
-6
7 additions, 6 deletions
viscaoveriplib/camera.py
with
7 additions
and
6 deletions
viscaoveriplib/Test camera file.py
0 → 100644
+
0
−
0
View file @
72a2d41f
This diff is collapsed.
Click to expand it.
viscaoveriplib/camera.py
+
7
−
6
View file @
72a2d41f
import
socket
#Both protocols (input and outpout are UDB
"
192.168.0.100
"
UDP_PORT
=
52381
class
Camera
:
def
__init__
(
self
,
UDP_IP
,
UDP_PORT
,
VV
=
"
09
"
,
WW
=
"
09
"
,
seq_num
:
hex
=
"
0
"
,
debug
=
False
,
virtualcam
=
False
):
def
__init__
(
self
,
UDP_IP
,
UDP_PORT
=
UDP_PORT
,
VV
=
"
09
"
,
WW
=
"
09
"
,
seq_num
:
hex
=
"
0
"
,
debug
=
False
,
virtualcam
=
False
):
"""
Création d
'
une caméra avec
:param UDP_IP: IP de la caméra (192.168.0.100 par défaut)
...
...
@@ -16,8 +16,9 @@ class Camera:
self
.
seq_num
=
seq_num
# erreur du capteur UWB (p pour précision...) WTF ce commentaire ???
self
.
VV
=
VV
self
.
WW
=
WW
self
.
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
# UDP
self
.
UDP_IP
=
UDP_IP
self
.
camera_sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
# UDP
self
.
CAMERA_IP
=
UDP_IP
self
.
CAMERA_PORT
=
UDP_PORT
self
.
debug
=
debug
self
.
virtualcam
=
virtualcam
...
...
@@ -27,7 +28,7 @@ class Camera:
:param message: message str[
'
hex
'
]
"""
if
(
not
(
self
.
virtualcam
)):
#Si la cam n'est pas virtuel, on envoie le paquet
self
.
sock
.
sendto
(
bytes
.
fromhex
(
message
.
replace
(
'
'
,
''
)),
(
self
.
UDP
_IP
,
self
.
UDP_PORT
))
self
.
camera_
sock
.
sendto
(
bytes
.
fromhex
(
message
.
replace
(
'
'
,
''
)),
(
self
.
CAMERA
_IP
,
self
.
UDP_PORT
))
self
.
seq_num
+=
1
# ballec de l'hexa pour l'instant
if
(
self
.
debug
or
self
.
virtualcam
):
#Si la cam est virtuelle ou on debug, on envoie
print
(
"
Commande n°{} envoyée : {}
\n
"
.
format
(
self
.
seq_num
,
message
))
...
...
@@ -35,7 +36,7 @@ class Camera:
def
send_payload
(
self
,
payloadtype
,
payload
):
message
=
payloadtype
+
'
'
+
self
.
payload2header
(
payload
)
+
payload
if
(
not
(
self
.
virtualcam
)):
#Si la cam n'est pas virtuel, on envoie le paquet
self
.
sock
.
sendto
(
bytes
.
fromhex
(
message
.
replace
(
'
'
,
''
)),
(
self
.
UDP
_IP
,
self
.
UDP_PORT
))
self
.
camera_
sock
.
sendto
(
bytes
.
fromhex
(
message
.
replace
(
'
'
,
''
)),
(
self
.
CAMERA
_IP
,
self
.
UDP_PORT
))
self
.
seq_num
+=
1
# ballec de l'hexa pour l'instant
if
(
self
.
debug
or
self
.
virtualcam
):
#Si la cam est virtuelle ou on debug, on envoie
print
(
"
Commande n°{} envoyée : {}
\n
"
.
format
(
self
.
seq_num
,
message
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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