simplify webpage

This commit is contained in:
2025-10-31 14:18:27 +08:00
parent 246c0eb1e4
commit b903b27578

View File

@@ -292,27 +292,27 @@ def build_ui(node: CtrlGuiNode) -> None:
ui.button('Switch Schedule', on_click=lambda: show_confirm_dialog('Confirm Switch Schedule?', rebuild)).classes('self-end')
#move home
with ui.column():
with ui.row():
pass
def move_home_() -> None:
node.file_logger.info('Running move_home_...')
action_name = "MoveHome"
text = ""
# send_action_package(action_name, text)
rebuild_now("Remote", action_name, text)
# with ui.column():
# with ui.row():
# pass
# def move_home_() -> None:
# node.file_logger.info('Running move_home_...')
# action_name = "MoveHome"
# text = ""
# # send_action_package(action_name, text)
# rebuild_now("Remote", action_name, text)
ui.element().style('height: 40px')
ui.button('Move Home', on_click=lambda: show_confirm_dialog(
f'Confirm Move Home operation?\n',
move_home_
)).classes('self-end')
# ui.element().style('height: 40px')
# ui.button('Move Home', on_click=lambda: show_confirm_dialog(
# f'Confirm Move Home operation?\n',
# move_home_
# )).classes('self-end')
#move waist
with ui.column():
with ui.row():
move_waist_input_move_pitch_degree = ui.input('pitch degree', value='0').style('width: 100px')
move_waist_input_move_yaw_degree = ui.input('yaw degree', value='0').style('width: 100px')
move_waist_input_move_pitch_degree = ui.input('pitch(-30°~30°)', value='0').style('width: 100px')
move_waist_input_move_yaw_degree = ui.input('yaw(-180°~180°)', value='0').style('width: 100px')
# TODO check input data
@@ -349,23 +349,23 @@ def build_ui(node: CtrlGuiNode) -> None:
)).classes('self-end')
#move leg
with ui.column():
with ui.row():
move_leg_input_move_distance = ui.input('distance', value='0').style('width: 100px')
# with ui.column():
# with ui.row():
# move_leg_input_move_distance = ui.input('distance', value='0').style('width: 100px')
# TODO check input data
# # TODO check input data
def move_leg_() -> None:
node.file_logger.info('Running move_leg_...')
action_name = "MoveLeg"
text = f"move_up_distance: {move_leg_input_move_distance.value}\n"
# send_action_package(action_name, text)
rebuild_now("Remote", action_name, text)
# def move_leg_() -> None:
# node.file_logger.info('Running move_leg_...')
# action_name = "MoveLeg"
# text = f"move_up_distance: {move_leg_input_move_distance.value}\n"
# # send_action_package(action_name, text)
# rebuild_now("Remote", action_name, text)
ui.button('Move Leg', on_click=lambda: show_confirm_dialog(
f'Confirm Move Leg operation?\nmove_up_distance: {move_leg_input_move_distance.value}',
move_leg_
)).classes('self-end')
# ui.button('Move Leg', on_click=lambda: show_confirm_dialog(
# f'Confirm Move Leg operation?\nmove_up_distance: {move_leg_input_move_distance.value}',
# move_leg_
# )).classes('self-end')
# LED control
with ui.column():
@@ -438,9 +438,9 @@ def build_ui(node: CtrlGuiNode) -> None:
# Add statistics display
# ui.separator()
ui.label('Node Statistics').classes('text-xl')
with ui.card().classes('w-full card-container'):
stats_label = ui.label()
# ui.label('Node Statistics').classes('text-xl')
# with ui.card().classes('w-full card-container'):
# stats_label = ui.label()
# Display area for incoming /robot_work_info messages
# ui.separator()
@@ -448,7 +448,7 @@ def build_ui(node: CtrlGuiNode) -> None:
# Create labels for all RobotWorkInfo fields
with ui.card().classes('w-full card-container'):
ui.label('Basic Information').classes('text-lg font-bold')
ui.label('Basic Info').classes('text-lg font-bold')
with ui.grid(columns=2).classes('w-full'):
msg_id_label = ui.label()
working_state_label = ui.label()
@@ -459,7 +459,7 @@ def build_ui(node: CtrlGuiNode) -> None:
expt_completion_time_label = ui.label()
work_log_label = ui.label().classes('col-span-2')
ui.label('Task Information').classes('text-lg font-bold')
ui.label('Task Info').classes('text-lg font-bold')
with ui.grid(columns=3).classes('w-full'):
last_task_label = ui.label('Last Task: ')
current_task_label = ui.label('Current Task: ')
@@ -467,7 +467,7 @@ def build_ui(node: CtrlGuiNode) -> None:
left_arm_joint_label = ui.label('Left Arm Joint: ')
right_arm_joint_label = ui.label('Right Arm Joint: ')
ui.label('Skill Information').classes('text-lg font-bold')
ui.label('Skill Info').classes('text-lg font-bold')
with ui.grid(columns=2).classes('w-full'):
skill_label = ui.label()
action_name_label = ui.label()
@@ -480,22 +480,22 @@ def build_ui(node: CtrlGuiNode) -> None:
msg = node.last_work_info
# Update statistics
stats = node.get_stats()
stats_text = f"""
- System Time: {str(datetime.datetime.now())}
- Start Time: {str(stats['start_time'])}
- Uptime: {str(stats['uptime'])}
- Messages Sent: {str(stats['messages_sent'])}
- Messages Received: {str(stats['messages_received'])}
- Rebuild Requests: {str(stats['rebuild_requests'])}
"""
stats_label.set_text(stats_text)
# stats = node.get_stats()
# stats_text = f"""
# - System Time: {str(datetime.datetime.now())}
# - Start Time: {str(stats['start_time'])}
# - Uptime: {str(stats['uptime'])}
# - Messages Sent: {str(stats['messages_sent'])}
# - Messages Received: {str(stats['messages_received'])}
# - Rebuild Requests: {str(stats['rebuild_requests'])}
# """
# stats_label.set_text(stats_text)
# Basic Information
msg_id_label.set_text(f'Message ID: {str(msg.msg_id)}')
working_state_label.set_text(f'Working State: {str(msg.working_state)}')
battery_capacity_label.set_text(f'Battery Capacity: {str(msg.battery_capacity)}%')
working_time_label.set_text(f'Working Time: {msg.working_time:.6f} h')
working_time_label.set_text(f'Working Time: {msg.working_time:.3f} h')
nav_state_label.set_text(f'Navigation State: {str(msg.nav_state)}')
comm_quality_label.set_text(f'Communication Quality: {str(msg.comm_quality)}')
expt_completion_time_label.set_text(f'Expected Completion Time: {str(msg.expt_completion_time)}')