From 92b2d408264ef393079b5f59c57243ed44b6fbbf Mon Sep 17 00:00:00 2001 From: Havoc <2993167370@qq.com> Date: Wed, 28 May 2025 11:45:55 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84task=5F3=E7=9A=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=B7=AF=E5=BE=84=E5=A4=84=E7=90=86=EF=BC=8C=E7=A7=BB?= =?UTF-8?q?=E9=99=A4file=5Fdir=E5=8F=82=E6=95=B0=EF=BC=8C=E7=AE=80?= =?UTF-8?q?=E5=8C=96=E6=96=87=E4=BB=B6=E8=AF=BB=E5=8F=96=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E3=80=82=E6=9B=B4=E6=96=B0Gait=5FParams=5Fup.toml=E5=92=8CGait?= =?UTF-8?q?=5FDef=5Fup.toml=E7=9A=84=E8=B7=AF=E5=BE=84=E4=B8=BA=E7=9B=B8?= =?UTF-8?q?=E5=AF=B9=E8=B7=AF=E5=BE=84=EF=BC=8C=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=8F=AF=E8=AF=BB=E6=80=A7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- task_3/main_ori.py | 12 ++++++------ task_3/task_3.py | 6 ------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/task_3/main_ori.py b/task_3/main_ori.py index d1b1764..5ce7056 100755 --- a/task_3/main_ori.py +++ b/task_3/main_ori.py @@ -27,13 +27,13 @@ robot_cmd = { 'value':0, 'duration':0 } -def task_3_main(file_dir=""): +def task_3_main(): lcm_cmd = lcm.LCM("udpm://239.255.76.67:7671?ttl=255") lcm_usergait = lcm.LCM("udpm://239.255.76.67:7671?ttl=255") usergait_msg = file_send_lcmt() cmd_msg = robot_control_cmd_lcmt() try: - steps = toml.load(f"{file_dir}/Gait_Params_up.toml") + steps = toml.load(f"Gait_Params_up.toml") full_steps = {'step':[robot_cmd]} k =0 for i in steps['step']: @@ -60,13 +60,13 @@ def task_3_main(file_dir=""): else: full_steps['step'].append(cmd) k=k+1 - f = open(f"{file_dir}/Gait_Params_up_full.toml", 'w') + f = open(f"Gait_Params_up_full.toml", 'w') f.write("# Gait Params\n") f.writelines(toml.dumps(full_steps)) f.close() - file_obj_gait_def = open(f"{file_dir}/Gait_Def_up.toml",'r') - file_obj_gait_params = open(f"{file_dir}/Gait_Params_up_full.toml",'r') + file_obj_gait_def = open(f"Gait_Def_up.toml",'r') + file_obj_gait_params = open(f"Gait_Params_up_full.toml",'r') usergait_msg.data = file_obj_gait_def.read() lcm_usergait.publish("user_gait_file",usergait_msg.encode()) time.sleep(0.5) @@ -76,7 +76,7 @@ def task_3_main(file_dir=""): file_obj_gait_def.close() file_obj_gait_params.close() - user_gait_list = open(f"{file_dir}/Usergait_List.toml",'r') + user_gait_list = open(f"Usergait_List.toml",'r') steps = toml.load(user_gait_list) for step in steps['step']: cmd_msg.mode = step['mode'] diff --git a/task_3/task_3.py b/task_3/task_3.py index 203c071..fe19131 100644 --- a/task_3/task_3.py +++ b/task_3/task_3.py @@ -87,12 +87,6 @@ def run_task_3(ctrl, msg): file_obj_gait_def.close() file_obj_gait_params.close() - file_obj_gait_params = open("./task_3/Gait_Params_up_full.toml",'r') - usergait_msg.data = file_obj_gait_params.read() - lcm_usergait.publish("user_gait_file", usergait_msg.encode()) - time.sleep(0.5) - file_obj_gait_params.close() - msg.mode = 62 msg.value = 0 msg.contact = 15