Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lu Xu
slapos
Commits
0e9402eb
Commit
0e9402eb
authored
Oct 26, 2023
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/js-drone: handle first websocket message
parent
d94ee240
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
10 deletions
+7
-10
software/js-drone/buildout.hash.cfg
software/js-drone/buildout.hash.cfg
+1
-1
software/js-drone/drone-scripts/worker.js.jinja2
software/js-drone/drone-scripts/worker.js.jinja2
+0
-3
software/js-drone/test/test.py
software/js-drone/test/test.py
+6
-6
No files found.
software/js-drone/buildout.hash.cfg
View file @
0e9402eb
...
@@ -42,4 +42,4 @@ md5sum = dfa140d70d8a9cadc6cee865be4e8c26
...
@@ -42,4 +42,4 @@ md5sum = dfa140d70d8a9cadc6cee865be4e8c26
[worker]
[worker]
_update_hash_filename_ = drone-scripts/worker.js.jinja2
_update_hash_filename_ = drone-scripts/worker.js.jinja2
md5sum =
a12788ec0d9972fc30c19c1f6db12da3
md5sum =
5e642dc35d86b7d7636532ffc9cc2bdb
software/js-drone/drone-scripts/worker.js.jinja2
View file @
0e9402eb
...
@@ -150,9 +150,6 @@ import { evalScript, fdopen, loadFile, open } from "std";
...
@@ -150,9 +150,6 @@ import { evalScript, fdopen, loadFile, open } from "std";
handleWebSocketMessage = function () {
handleWebSocketMessage = function () {
var message = readMessage(gwsocket_r_pipe_fd).data;
var message = readMessage(gwsocket_r_pipe_fd).data;
if (message.includes(configuration.websocketIp)) {
return;
}
onMessage(message);
onMessage(message);
};
};
user_me.writeWebsocketMessage = function (message) {
user_me.writeWebsocketMessage = function (message) {
...
...
software/js-drone/test/test.py
View file @
0e9402eb
...
@@ -282,7 +282,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
...
@@ -282,7 +282,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
# Check if first message is 'Unknown instruction IP' where IP is client IPv6 address
# Check if first message is 'Unknown instruction IP' where IP is client IPv6 address
self
.
assertIn
(
self
.
assertIn
(
b'Unknown instruction %s'
%
ws
.
sock
.
getsockname
()[
0
].
encode
(),
b'Unknown instruction %s'
%
ws
.
sock
.
getsockname
()[
0
].
encode
(),
ws
.
recv_frame
().
data
ws
.
recv_frame
().
data
,
)
)
self
.
assertIn
(
self
.
assertIn
(
b'
\
\
u001b[32minfo/userland
\
\
u001b[0m
\
\
tfieldsSize 3
\
\
n"}'
,
b'
\
\
u001b[32minfo/userland
\
\
u001b[0m
\
\
tfieldsSize 3
\
\
n"}'
,
...
@@ -295,7 +295,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
...
@@ -295,7 +295,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
b'"%.6f","longitude":"%.6f","altitude":"%.2f",'
%
(
0
,
0
,
0
),
b'"%.6f","longitude":"%.6f","altitude":"%.2f",'
%
(
0
,
0
,
0
),
b'"yaw":"%.2f","speed":"%.2f","climbRate":"%.2f",'
%
(
0
,
0
,
0
),
b'"yaw":"%.2f","speed":"%.2f","climbRate":"%.2f",'
%
(
0
,
0
,
0
),
b'"timestamp":%d}}}'
%
0
,
b'"timestamp":%d}}}'
%
0
,
))
))
,
)
)
self
.
assertIn
(
self
.
assertIn
(
b'
\
\
u001b[32minfo/client
\
\
u001b[0m
\
\
tReceived position of drone 0: %.6f ? %.6f ? %.2f m %.2f m
\
\
n"}'
%
(
0
,
0
,
0
,
0
),
b'
\
\
u001b[32minfo/client
\
\
u001b[0m
\
\
tReceived position of drone 0: %.6f ? %.6f ? %.2f m %.2f m
\
\
n"}'
%
(
0
,
0
,
0
,
0
),
...
@@ -308,7 +308,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
...
@@ -308,7 +308,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
b'"%.6f","longitude":"%.6f","altitude":"%.2f",'
%
(
0
,
0
,
0
),
b'"%.6f","longitude":"%.6f","altitude":"%.2f",'
%
(
0
,
0
,
0
),
b'"yaw":"%.2f","speed":"%.2f","climbRate":"%.2f",'
%
(
0
,
0
,
0
),
b'"yaw":"%.2f","speed":"%.2f","climbRate":"%.2f",'
%
(
0
,
0
,
0
),
b'"timestamp":%d}}}'
%
0
,
b'"timestamp":%d}}}'
%
0
,
))
))
,
)
)
self
.
assertIn
(
self
.
assertIn
(
b'
\
\
u001b[32minfo/client
\
\
u001b[0m
\
\
tReceived speed of drone 0: %.2f ? %.2f m/s %.2f m/s
\
\
n"}'
%
(
0
,
0
,
0
),
b'
\
\
u001b[32minfo/client
\
\
u001b[0m
\
\
tReceived speed of drone 0: %.2f ? %.2f m/s %.2f m/s
\
\
n"}'
%
(
0
,
0
,
0
),
...
@@ -321,7 +321,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
...
@@ -321,7 +321,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
b'"%.6f","longitude":"%.6f","altitude":"%.2f",'
%
(
0
,
0
,
0
),
b'"%.6f","longitude":"%.6f","altitude":"%.2f",'
%
(
0
,
0
,
0
),
b'"yaw":"%.2f","speed":"%.2f","climbRate":"%.2f",'
%
(
0
,
0
,
0
),
b'"yaw":"%.2f","speed":"%.2f","climbRate":"%.2f",'
%
(
0
,
0
,
0
),
b'"timestamp":%d}}}'
%
0
,
b'"timestamp":%d}}}'
%
0
,
))
))
,
)
)
self
.
assertIn
(
self
.
assertIn
(
b'
\
\
u001b[32minfo/userland
\
\
u001b[0m
\
\
tfieldsSize 1
\
\
n"}'
,
b'
\
\
u001b[32minfo/userland
\
\
u001b[0m
\
\
tfieldsSize 1
\
\
n"}'
,
...
@@ -334,7 +334,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
...
@@ -334,7 +334,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
b'"%.6f","longitude":"%.6f","altitude":"%.2f",'
%
(
0
,
0
,
0
),
b'"%.6f","longitude":"%.6f","altitude":"%.2f",'
%
(
0
,
0
,
0
),
b'"yaw":"%.2f","speed":"%.2f","climbRate":"%.2f",'
%
(
0
,
0
,
0
),
b'"yaw":"%.2f","speed":"%.2f","climbRate":"%.2f",'
%
(
0
,
0
,
0
),
b'"timestamp":%d}}}'
%
0
,
b'"timestamp":%d}}}'
%
0
,
))
))
,
)
)
self
.
send_ua_networkMessage
()
self
.
send_ua_networkMessage
()
time
.
sleep
(
0.1
)
time
.
sleep
(
0.1
)
...
@@ -350,7 +350,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
...
@@ -350,7 +350,7 @@ class SubscriberTestCase(SlapOSInstanceTestCase):
b'"%.6f","longitude":"%.6f","altitude":"%.2f",'
%
POSITION_ARRAY_OUTPUT_VALUES
[:
-
1
],
b'"%.6f","longitude":"%.6f","altitude":"%.2f",'
%
POSITION_ARRAY_OUTPUT_VALUES
[:
-
1
],
b'"yaw":"%.2f","speed":"%.2f","climbRate":"%.2f",'
%
SPEED_ARRAY_VALUES
,
b'"yaw":"%.2f","speed":"%.2f","climbRate":"%.2f",'
%
SPEED_ARRAY_VALUES
,
b'"timestamp":%d}}}'
%
POSITION_ARRAY_INPUT_VALUES
[
-
1
],
b'"timestamp":%d}}}'
%
POSITION_ARRAY_INPUT_VALUES
[
-
1
],
))
))
,
)
)
self
.
assertIn
(
self
.
assertIn
(
b'
\
\
u001b[32minfo/client
\
\
u001b[0m
\
\
tReceived speed of drone 0: %.2f ? %.2f m/s %.2f m/s
\
\
n"}'
%
SPEED_ARRAY_VALUES
,
b'
\
\
u001b[32minfo/client
\
\
u001b[0m
\
\
tReceived speed of drone 0: %.2f ? %.2f m/s %.2f m/s
\
\
n"}'
%
SPEED_ARRAY_VALUES
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment