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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Amalio Coron
VISCA Over IP
Commits
9d050079
Commit
9d050079
authored
6 years ago
by
Pierre Minssen
Browse files
Options
Downloads
Patches
Plain Diff
Comentaire de fonction de 3h30 du mat post nano
parent
e179d781
Branches
master
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
cam_poo.py
+27
-4
27 additions, 4 deletions
cam_poo.py
with
27 additions
and
4 deletions
cam_poo.py
+
27
−
4
View file @
9d050079
...
...
@@ -19,10 +19,16 @@ class Camera:
self
.
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
# UDP
self
.
UDP_IP
=
UDP_IP
def
move_to_absolute_position
(
YCoordinates
,
ZCoordinates
):
def
move_to_absolute_position
(
self
,
YCoordinates
,
ZCoordinates
):
"""
command of absolute position mouvement
:param YCoordinates: YYYY from to
:param ZCoordinates: ZZZZ from to
:return:
"""
payload
=
"
81 01 06 02
"
# Absolute position moove
payload
=
payload
+
self
.
VV
+
self
.
WW
# add move speed
for
i
in
LYZ
:
# add position
for
i
in
[
YCoordinates
,
ZCoordinates
]
:
# add position
for
j
in
i
:
payload
=
payload
+
"
0
"
+
j
payload
=
payload
+
"
FF
"
# end byte
...
...
@@ -31,7 +37,13 @@ class Camera:
message
=
payloadtype
+
header
+
payload
return
message
def
payload2header
(
self
,
payload
:
str
)
->
str
:
# hex
def
payload2header
(
self
,
payload
:
str
)
->
str
:
"""
take the payload, calculate the payload lenght and add the sequence number
:param payload:
:return: header = payloadlenght + seq_num
"""
lenght
=
hex
(
len
(
payload
.
replace
(
'
'
,
''
)))
payloadlenght
=
lenght
[
2
:]
if
len
(
lenght
)
==
1
:
...
...
@@ -42,6 +54,11 @@ class Camera:
return
header
def
send
(
self
,
message
:
str
)
->
bool
:
"""
Envoie le message à la cam
:param message: message str[
'
hex
'
]
:return: True si c
'
est bien passé
"""
self
.
sock
.
sendto
(
bytes
.
fromhex
(
message
.
replace
(
'
'
,
''
)),
(
self
.
UDP_IP
,
self
.
UDP_PORT
))
self
.
seq_num
+=
1
# ballec de l'hexa pour l'instant
print
(
"
fait
"
+
self
.
seq_num
)
...
...
@@ -74,7 +91,13 @@ class Camera:
message
=
payloadtype
+
header
+
payload
return
message
def
focus
(
self
,
b
:
bool
)
->
str
:
# hex #focus2payload(0) = autofocus
def
focus
(
self
,
b
:
bool
)
->
str
:
"""
Command the focus auto or manual
:param b: bool = 1 : autofocus ; bool = 0 : manualfocus
:return: commande
"""
# hex #focus2payload(0) = autofocus
if
b
:
payload
=
"
81 01 04 38 02 FF
"
# autofocus
else
:
...
...
This diff is collapsed.
Click to expand it.
Amalio Coron
@2018corona
·
6 years ago
Owner
bravo, très bon commit
bravo, très bon commit
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