Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
web-ros3rag
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
JastAdd
web-ros3rag
Commits
ccd9be7e
Commit
ccd9be7e
authored
3 years ago
by
René Schöne
Browse files
Options
Downloads
Patches
Plain Diff
WIP: updated protobuf, working on correct robot position handling
parent
a79fe71e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.py
+27
-16
27 additions, 16 deletions
main.py
with
27 additions
and
16 deletions
main.py
+
27
−
16
View file @
ccd9be7e
...
...
@@ -24,8 +24,8 @@ fixed_svg_filename = "2022-05-04T10-19-30-9155.svg"
image_directory
=
'
/data/git/jastadd/ros3rag/ros3rag.placeB/images/
'
static_image_route
=
'
/static/
'
MQTT_SERVER
=
'
192.168.0.122
'
#
MQTT_SERVER = 'localhost'
#
MQTT_SERVER = '192.168.0.122'
MQTT_SERVER
=
'
localhost
'
mqttc
=
mqtt
.
Client
()
# mqtt client connected?
...
...
@@ -51,15 +51,15 @@ commands = {
'
send-place-b-exit
'
:
(
'
place-b/exit
'
,
'
1
'
),
# 'send-place-a-demo-objRed-blue': ('place-a/demo/move/objectRed1/blue', '1'),
# 'send-place-a-demo-objRed-red': ('place-a/demo/move/objectRed1/red', '1'),
# 'send-place-b-demo-objRed-red': ('place-b/demo
/move/
objectRed1/red'
, '1'
),
# 'send-place-b-demo-objRed-red': ('place-b/demo
', '
objectRed1/red'),
'
send-place-b-demo-initial_scene
'
:
(
'
demo/
initial_scene
'
,
'
1
'
),
'
send-place-b-demo-arm1-
active
'
:
(
'
demo/arm1/active
'
,
'
1
'
),
'
send-place-b-demo-arm1-i
nactive
'
:
(
'
demo/arm1/inactive
'
,
'
1
'
),
'
send-place-b-demo-arm2-
active
'
:
(
'
demo/arm2/active
'
,
'
1
'
),
'
send-place-b-demo-arm2-i
nactive
'
:
(
'
demo/arm2/inactive
'
,
'
1
'
),
'
send-place-b-demo-big-blue-cz
'
:
(
'
demo/
big-blue/cz
'
,
'
1
'
),
'
send-place-b-demo-big-blue-g1
'
:
(
'
demo/
big-blue/g1
'
,
'
1
'
),
'
send-place-b-demo-initial_scene
'
:
(
'
place-b/demo
'
,
'
initial_scene
'
),
'
send-place-b-demo-arm1-
moving
'
:
(
'
place-b/demo
'
,
'
arm1/moving
'
),
'
send-place-b-demo-arm1-i
dle
'
:
(
'
place-b/demo
'
,
'
arm1/idle
'
),
'
send-place-b-demo-arm2-
moving
'
:
(
'
place-b/demo
'
,
'
arm2/moving
'
),
'
send-place-b-demo-arm2-i
dle
'
:
(
'
place-b/demo
'
,
'
arm2/idle
'
),
'
send-place-b-demo-big-blue-cz
'
:
(
'
place-b/demo
'
,
'
big-blue/cz
'
),
'
send-place-b-demo-big-blue-g1
'
:
(
'
place-b/demo
'
,
'
big-blue/g1
'
),
'
send-coordinator-model
'
:
(
'
coordinator/model
'
,
'
1
'
),
'
send-coordinator-model-details
'
:
(
'
coordinator/model
'
,
'
details
'
),
...
...
@@ -105,6 +105,14 @@ conversion_topics = {
bytes_topics
=
[
]
topics_enabled_once_seen
=
[
"
coordinating/rag-a/status
"
,
"
coordinating/rag-b/status
"
,
"
place-b/model/svg/path
"
,
"
place-b/arm1/position
"
,
"
place-b/arm2/position
"
]
svg_image_topic
=
'
place-b/model/svg/path
'
button_style_normal
=
{
"
marginRight
"
:
"
15px
"
}
...
...
@@ -200,10 +208,10 @@ app.layout = html.Div([
html
.
Button
(
'
Exit
'
,
id
=
'
send-place-b-exit
'
,
style
=
button_style_exit
),
# html.Button('obj-Red -> Red', id='send-place-b-demo-objRed-red', style=button_style_normal),
html
.
Button
(
'
initial_scene
'
,
id
=
'
send-place-b-demo-initial_scene
'
,
style
=
button_style_normal
),
html
.
Button
(
'
arm1-
active
'
,
id
=
'
send-place-b-demo-arm1-
active
'
,
style
=
button_style_normal
),
html
.
Button
(
'
arm1-i
nactiv
e
'
,
id
=
'
send-place-b-demo-arm1-i
nactiv
e
'
,
style
=
button_style_normal
),
html
.
Button
(
'
arm2-
active
'
,
id
=
'
send-place-b-demo-arm2-
active
'
,
style
=
button_style_normal
),
html
.
Button
(
'
arm2-i
nactiv
e
'
,
id
=
'
send-place-b-demo-arm2-i
nactiv
e
'
,
style
=
button_style_normal
),
html
.
Button
(
'
arm1-
moving
'
,
id
=
'
send-place-b-demo-arm1-
moving
'
,
style
=
button_style_normal
),
html
.
Button
(
'
arm1-i
dl
e
'
,
id
=
'
send-place-b-demo-arm1-i
dl
e
'
,
style
=
button_style_normal
),
html
.
Button
(
'
arm2-
moving
'
,
id
=
'
send-place-b-demo-arm2-
moving
'
,
style
=
button_style_normal
),
html
.
Button
(
'
arm2-i
dl
e
'
,
id
=
'
send-place-b-demo-arm2-i
dl
e
'
,
style
=
button_style_normal
),
html
.
Button
(
'
big-blue-cz
'
,
id
=
'
send-place-b-demo-big-blue-cz
'
,
style
=
button_style_normal
),
html
.
Button
(
'
big-blue-g1
'
,
id
=
'
send-place-b-demo-big-blue-g1
'
,
style
=
button_style_normal
),
],
className
=
"
four columns
"
),
...
...
@@ -381,6 +389,7 @@ def check_connection(_n_intervals):
Output
(
'
mqtt-log
'
,
'
value
'
),
Output
(
'
javascriptLog
'
,
'
run
'
),
Output
(
'
topics-to-filter
'
,
'
options
'
),
Output
(
'
topics-to-filter
'
,
'
value
'
),
Output
(
'
model-b-svg-img
'
,
'
src
'
),
Input
(
'
every-1-second
'
,
'
n_intervals
'
),
Input
(
'
clear-mqtt-log
'
,
'
n_clicks
'
),
...
...
@@ -412,7 +421,7 @@ def append_to_mqtt_log(_n_intervals, clear_n_clicks, filter_options, topics_to_f
trigger_id
=
ctx
.
triggered
[
0
][
'
prop_id
'
].
split
(
'
.
'
)[
0
]
if
trigger_id
==
'
clear-mqtt-log
'
:
return
""
,
""
,
""
,
filter_options
,
new_svg_img_src
return
""
,
""
,
""
,
filter_options
,
topics_to_filter
,
new_svg_img_src
if
trigger_id
==
'
topics-to-filter
'
:
filtered_value
=
""
...
...
@@ -445,6 +454,8 @@ def append_to_mqtt_log(_n_intervals, clear_n_clicks, filter_options, topics_to_f
filtered_value
+=
msg
+
"
\n
"
if
topic
not
in
(
option
[
'
label
'
]
for
option
in
filter_options
):
filter_options
.
append
({
'
label
'
:
topic
,
'
value
'
:
topic
})
if
topic
in
topics_enabled_once_seen
:
topics_to_filter
.
append
(
topic
)
else
:
return
dash
.
no_update
log_cmd
=
'''
...
...
@@ -453,7 +464,7 @@ def append_to_mqtt_log(_n_intervals, clear_n_clicks, filter_options, topics_to_f
var textarea = document.getElementById(
'
mqtt-log
'
);
textarea.scrollTop = textarea.scrollHeight;
'''
if
should_scroll
else
""
return
filtered_value
,
value
,
log_cmd
,
filter_options
,
new_svg_img_src
return
filtered_value
,
value
,
log_cmd
,
filter_options
,
topics_to_filter
,
new_svg_img_src
@app.callback
(
...
...
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