add move wheel control btn

This commit is contained in:
NuoDaJia02
2025-11-10 11:00:27 +08:00
parent ff8ef766c1
commit af72e8302d

View File

@@ -321,26 +321,6 @@ def build_ui(node: CtrlGuiNode) -> None:
move_home_
)).classes('self-end')
#move waist
with ui.column():
with ui.row():
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
def move_waist_() -> None:
node.file_logger.info('Running move_waist_...')
action_name = "MoveWaist"
text = f"move_pitch_degree: {move_waist_input_move_pitch_degree.value}\nmove_yaw_degree: {move_waist_input_move_yaw_degree.value}\n"
# send_action_package(action_name, text)
rebuild_now("Remote", action_name, text)
ui.button('Move Waist', on_click=lambda: show_confirm_dialog(
f'Confirm Move Waist operation?\nmove_pitch_degree: {move_waist_input_move_pitch_degree.value}\nmove_yaw_degree: {move_waist_input_move_yaw_degree.value}',
move_waist_
)).classes('self-end')
#move wheel
with ui.column():
with ui.row():
@@ -361,6 +341,43 @@ def build_ui(node: CtrlGuiNode) -> None:
move_wheel_
)).classes('self-end')
#小幅度移动
with ui.column():
with ui.row():
pass
def move_wheel_joy_(distance, angle) -> None:
node.file_logger.info('Running move_wheel_...')
action_name = "MoveWheel"
text = f"move_distance: {distance}\nmove_angle: {angle}\n"
# send_action_package(action_name, text)
print("MoveWheel: " + text)
rebuild_now("Remote", action_name, text)
ui.button('左转1度', on_click=lambda: move_wheel_joy_(0, 1))
ui.button('左转3度', on_click=lambda: move_wheel_joy_(0, 3))
ui.button('右转1度', on_click=lambda: move_wheel_joy_(0, -1))
ui.button('右转3度', on_click=lambda: move_wheel_joy_(0, -3))
####
with ui.column():
with ui.row():
pass
def move_wheel_joy_(distance, angle) -> None:
node.file_logger.info('Running move_wheel_...')
action_name = "MoveWheel"
text = f"move_distance: {distance}\nmove_angle: {angle}\n"
# send_action_package(action_name, text)
print("MoveWheel: " + text)
rebuild_now("Remote", action_name, text)
ui.button('往前0.1', on_click=lambda: move_wheel_joy_(0.1, 0))
ui.button('往前0.3', on_click=lambda: move_wheel_joy_(0.3, 0))
ui.button('往后0.1', on_click=lambda: move_wheel_joy_(-0.1, 0))
ui.button('往后0.3', on_click=lambda: move_wheel_joy_(-0.3, 0))
#move leg
# with ui.column():
# with ui.row():
@@ -380,6 +397,26 @@ def build_ui(node: CtrlGuiNode) -> None:
# move_leg_
# )).classes('self-end')
#move waist
with ui.column():
with ui.row():
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
def move_waist_() -> None:
node.file_logger.info('Running move_waist_...')
action_name = "MoveWaist"
text = f"move_pitch_degree: {move_waist_input_move_pitch_degree.value}\nmove_yaw_degree: {move_waist_input_move_yaw_degree.value}\n"
# send_action_package(action_name, text)
rebuild_now("Remote", action_name, text)
ui.button('Move Waist', on_click=lambda: show_confirm_dialog(
f'Confirm Move Waist operation?\nmove_pitch_degree: {move_waist_input_move_pitch_degree.value}\nmove_yaw_degree: {move_waist_input_move_yaw_degree.value}',
move_waist_
)).classes('self-end')
# LED control
with ui.column():
with ui.row():