在go_to_xy.py中添加go_to_y_v2函数,支持机器人移动到指定的y坐标位置,优化了移动控制的精确性和灵活性。
This commit is contained in:
parent
b4956329db
commit
c7ab681c2a
@ -541,6 +541,7 @@ def go_to_xy_v2(ctrl, msg, target_x, target_y, speed=0.5, precision=True, observ
|
|||||||
warning(f"未能精确到达目标点,误差: {final_distance:.3f}米", "警告")
|
warning(f"未能精确到达目标点,误差: {final_distance:.3f}米", "警告")
|
||||||
|
|
||||||
return nav_success
|
return nav_success
|
||||||
|
|
||||||
def go_to_xy_with_correction_v2(ctrl, msg, target_x, target_y, speed=0.5, precision=True,
|
def go_to_xy_with_correction_v2(ctrl, msg, target_x, target_y, speed=0.5, precision=True,
|
||||||
max_attempts=2, observe=False):
|
max_attempts=2, observe=False):
|
||||||
"""
|
"""
|
||||||
@ -623,3 +624,16 @@ def go_to_xy_with_correction_v2(ctrl, msg, target_x, target_y, speed=0.5, precis
|
|||||||
error(f"多次尝试后仍未能达到目标点,最终误差: {final_distance:.3f}米", "失败")
|
error(f"多次尝试后仍未能达到目标点,最终误差: {final_distance:.3f}米", "失败")
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def go_to_y_v2(ctrl, msg, target_y, speed=0.5, precision=True, observe=False):
|
||||||
|
"""
|
||||||
|
控制机器人移动到指定的y坐标位置,使用直接y速度控制
|
||||||
|
|
||||||
|
参数:
|
||||||
|
ctrl: Robot_Ctrl 对象,包含里程计信息
|
||||||
|
msg: robot_control_cmd_lcmt 对象,用于发送命令
|
||||||
|
target_y: 目标Y坐标(米)
|
||||||
|
speed: 行走速度(米/秒),范围0.1~1.0,默认为0.5
|
||||||
|
"""
|
||||||
|
target_x = ctrl.odo_msg.xyz[0]
|
||||||
|
return go_to_xy_v2(ctrl, msg, target_x, target_y, speed, precision, observe)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user