Skip to content
Snippets Groups Projects
Commit c39b7a40 authored by René Schöne's avatar René Schöne
Browse files

new demo topics

parent 28f4dd83
Branches
No related tags found
No related merge requests found
...@@ -53,7 +53,7 @@ commands = { ...@@ -53,7 +53,7 @@ commands = {
# 'send-place-a-demo-objRed-red': ('place-a/demo/move/objectRed1/red', '1'), # 'send-place-a-demo-objRed-red': ('place-a/demo/move/objectRed1/red', '1'),
# 'send-place-b-demo-objRed-red': ('place-b/demo', 'objectRed1/red'), # 'send-place-b-demo-objRed-red': ('place-b/demo', 'objectRed1/red'),
'send-place-b-demo-initial_scene': ('place-b/demo', 'initial_scene'), 'send-place-b-demo-initial_scene': ('place-b/demo', 'scene:initial'),
# 'send-place-b-demo-arm1-moving': ('place-b/demo', 'arm1/moving'), # 'send-place-b-demo-arm1-moving': ('place-b/demo', 'arm1/moving'),
# 'send-place-b-demo-arm1-idle': ('place-b/demo', 'arm1/idle'), # 'send-place-b-demo-arm1-idle': ('place-b/demo', 'arm1/idle'),
# 'send-place-b-demo-arm2-moving': ('place-b/demo', 'arm2/moving'), # 'send-place-b-demo-arm2-moving': ('place-b/demo', 'arm2/moving'),
...@@ -221,15 +221,15 @@ app.layout = html.Div([ ...@@ -221,15 +221,15 @@ app.layout = html.Div([
# html.Button('big-blue-g1', id='send-place-b-demo-big-blue-g1', style=button_style_normal), # html.Button('big-blue-g1', id='send-place-b-demo-big-blue-g1', style=button_style_normal),
html.Div([ html.Div([
dcc.RadioItems(['arm1', 'arm2'], 'arm1', id='send-arm-state-robot', inline=True, style={"marginRight": "10px", "marginTop": "5px"}), dcc.RadioItems(['arm1', 'arm2'], 'arm1', id='send-arm-state-robot', inline=True, style={"marginRight": "10px", "marginTop": "5px"}),
dcc.RadioItems([{'label': 'Idle', 'value': 'STATE_IDLE'}, dcc.RadioItems([{'label': 'Idle', 'value': 'idle'},
{'label': 'Picking', 'value': 'STATE_PICKING'}, {'label': 'Picking', 'value': 'picking'},
{'label': 'Placing', 'value': 'STATE_PLACING'}, {'label': 'Placing', 'value': 'placing'},
{'label': 'Moving', 'value': 'STATE_MOVING'}] {'label': 'Moving', 'value': 'moving'}]
, 'STATE_MOVING', id='send-arm-state-state', inline=True, style={"marginRight": "10px", "marginTop": "5px"}), , 'moving', id='send-arm-state-state', inline=True, style={"marginRight": "10px", "marginTop": "5px"}),
html.Button('Send', id='send-arm-state', style=button_style_normal) html.Button('Send', id='send-arm-state', style=button_style_normal)
], className='row', style={"display":"flex", "border": "1px black solid", "border-radius": "5px", "marginTop": "5px"}), ], className='row', style={"display":"flex", "border": "1px black solid", "border-radius": "5px", "marginTop": "5px"}),
html.Div([ html.Div([
dcc.RadioItems(['blue1', 'green1'], 'blue1', dcc.RadioItems(['blue1', 'blue2', 'green1', 'green2'], 'blue1',
id='send-obj-pos-obj', inline=True, style={"marginRight": "10px", "marginTop": "5px"}), id='send-obj-pos-obj', inline=True, style={"marginRight": "10px", "marginTop": "5px"}),
dcc.RadioItems(['cz1', 'G1', 'G2', 'B1', 'B2'], 'cz1', dcc.RadioItems(['cz1', 'G1', 'G2', 'B1', 'B2'], 'cz1',
id='send-obj-pos-pos', inline=True, style={"marginRight": "10px", "marginTop": "5px"}), id='send-obj-pos-pos', inline=True, style={"marginRight": "10px", "marginTop": "5px"}),
...@@ -393,11 +393,11 @@ def send_complex(*_): ...@@ -393,11 +393,11 @@ def send_complex(*_):
if button_id == 'send-arm-state': if button_id == 'send-arm-state':
robot = ctx.states["send-arm-state-robot.value"] robot = ctx.states["send-arm-state-robot.value"]
state = ctx.states["send-arm-state-state.value"] state = ctx.states["send-arm-state-state.value"]
mqttc.publish(topic='place-b/demo', payload=robot + '/' + state[6:].lower()) mqttc.publish(topic='place-b/demo', payload=f'robot:{robot}/{state}')
elif button_id == 'send-obj-pos': elif button_id == 'send-obj-pos':
obj = ctx.states["send-obj-pos-obj.value"] obj = ctx.states["send-obj-pos-obj.value"]
pos = ctx.states["send-obj-pos-pos.value"] pos = ctx.states["send-obj-pos-pos.value"]
mqttc.publish(topic='place-b/demo', payload=obj + '/' + pos) mqttc.publish(topic='place-b/demo', payload=f'object:{obj}/{pos}')
else: else:
topic, state_id, protobuf_obj = complex_commands[button_id] topic, state_id, protobuf_obj = complex_commands[button_id]
json_content = ctx.states[state_id + ".value"] json_content = ctx.states[state_id + ".value"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment