更新日志文件,添加横向边缘检测结果和原始图像保存信息;删除不再使用的步态参数文件 Gait_Params_up_full.toml;修正黄色赛道检测演示程序中的输入路径和函数调用。
This commit is contained in:
parent
7b106c03dc
commit
0af26d8c70
@ -28,3 +28,36 @@
|
||||
2025-05-26 00:25:13 | INFO | utils.log_helper - ℹ️ 保存原始图像到: logs/image/original_20250526_002513_050661.jpg
|
||||
2025-05-26 00:25:13 | INFO | utils.log_helper - ℹ️ 保存左侧轨迹线检测结果图像到: logs/image/left_track_20250526_002513_050661.jpg
|
||||
2025-05-26 00:25:13 | INFO | utils.log_helper - ℹ️ 左侧轨迹线检测结果: {'timestamp': '20250526_002513_050661', 'tracking_point': (549, 1071), 'ground_intersection': (543, 1080), 'distance_to_left': 584.5, 'slope': -1.619718309859155, 'line_mid_x': 584.5}
|
||||
2025-05-26 14:57:53 | INFO | utils.log_helper - ℹ️ 保存原始图像到: logs/image/origin_horizontal_edge_20250526_145753_084929.jpg
|
||||
2025-05-26 14:57:53 | INFO | utils.log_helper - ℹ️ 保存原始图像到: logs/image/origin_horizontal_edge_20250526_145753_163732.jpg
|
||||
2025-05-26 14:57:53 | INFO | utils.log_helper - ℹ️ 保存横向边缘检测结果图像到: logs/image/horizontal_edge_20250526_145753_163732.jpg
|
||||
2025-05-26 14:57:53 | INFO | utils.log_helper - ℹ️ 横向边缘检测结果: {'timestamp': '20250526_145753_163732', 'edge_point': (1040, 790), 'distance_to_center': 80, 'slope': -0.03763440860215054, 'distance_to_bottom': 286.98924731182797, 'intersection_point': (960, 793), 'score': 0.5265099443030505, 'valid': False, 'reason': '边缘点y坐标超出有效范围; ', 'is_upper_line': False}
|
||||
2025-05-26 14:58:23 | INFO | utils.log_helper - ℹ️ 保存原始图像到: logs/image/origin_horizontal_edge_20250526_145823_169420.jpg
|
||||
2025-05-26 14:58:23 | INFO | utils.log_helper - ℹ️ 保存原始图像到: logs/image/origin_horizontal_edge_20250526_145823_249269.jpg
|
||||
2025-05-26 14:58:23 | INFO | utils.log_helper - ℹ️ 保存横向边缘检测结果图像到: logs/image/horizontal_edge_20250526_145823_249269.jpg
|
||||
2025-05-26 14:58:23 | INFO | utils.log_helper - ℹ️ 横向边缘检测结果: {'timestamp': '20250526_145823_249269', 'edge_point': (973, 960), 'distance_to_center': 13, 'slope': -0.07112526539278131, 'distance_to_bottom': 119.07537154989382, 'intersection_point': (960, 960), 'score': 0.38712268929341453, 'valid': False, 'reason': '边缘点y坐标超出有效范围; ', 'is_upper_line': False}
|
||||
2025-05-26 14:58:33 | INFO | utils.log_helper - ℹ️ 保存原始图像到: logs/image/origin_horizontal_edge_20250526_145833_166005.jpg
|
||||
2025-05-26 14:58:33 | INFO | utils.log_helper - ℹ️ 保存原始图像到: logs/image/origin_horizontal_edge_20250526_145833_219478.jpg
|
||||
2025-05-26 14:58:33 | INFO | utils.log_helper - ℹ️ 保存横向边缘检测结果图像到: logs/image/horizontal_edge_20250526_145833_219478.jpg
|
||||
2025-05-26 14:58:33 | INFO | utils.log_helper - ℹ️ 横向边缘检测结果: {'timestamp': '20250526_145833_219478', 'edge_point': (973, 960), 'distance_to_center': 13, 'slope': -0.07112526539278131, 'distance_to_bottom': 119.07537154989382, 'intersection_point': (960, 960), 'score': 0.38712268929341453, 'valid': False, 'reason': '边缘点y坐标超出有效范围; ', 'is_upper_line': False}
|
||||
2025-05-26 14:58:37 | INFO | utils.log_helper - ℹ️ 保存原始图像到: logs/image/origin_horizontal_edge_20250526_145837_344953.jpg
|
||||
2025-05-26 14:58:37 | INFO | utils.log_helper - ℹ️ 保存原始图像到: logs/image/origin_horizontal_edge_20250526_145837_397536.jpg
|
||||
2025-05-26 14:58:37 | INFO | utils.log_helper - ℹ️ 保存横向边缘检测结果图像到: logs/image/horizontal_edge_20250526_145837_397536.jpg
|
||||
2025-05-26 14:58:37 | INFO | utils.log_helper - ℹ️ 横向边缘检测结果: {'timestamp': '20250526_145837_397536', 'edge_point': (973, 960), 'distance_to_center': 13, 'slope': -0.07112526539278131, 'distance_to_bottom': 119.07537154989382, 'intersection_point': (960, 960), 'score': 0.38712268929341453, 'valid': False, 'reason': '边缘点y坐标超出有效范围; ', 'is_upper_line': False}
|
||||
2025-05-26 14:58:43 | DEBUG | utils.log_helper - 🐞 步骤1: 原始图像已加载
|
||||
2025-05-26 14:58:44 | DEBUG | utils.log_helper - 🐞 步骤2: 创建黄色掩码
|
||||
2025-05-26 14:58:45 | DEBUG | utils.log_helper - 🐞 步骤3: 提取黄色部分
|
||||
2025-05-26 14:58:46 | DEBUG | utils.log_helper - 🐞 正在处理底部边缘点
|
||||
2025-05-26 14:58:47 | DEBUG | utils.log_helper - 🐞 显示拟合线段
|
||||
2025-05-26 14:58:48 | DEBUG | utils.log_helper - 👁️ 步骤5: 找到边缘点 (320, 1009)
|
||||
2025-05-26 14:58:48 | DEBUG | utils.log_helper - 🐞 显示边缘斜率和中线交点
|
||||
2025-05-26 14:58:49 | INFO | utils.log_helper - ℹ️ 保存原始图像到: logs/image/origin_horizontal_edge_20250526_145849_764575.jpg
|
||||
2025-05-26 14:58:49 | INFO | utils.log_helper - ℹ️ 保存横向边缘检测结果图像到: logs/image/horizontal_edge_20250526_145849_764575.jpg
|
||||
2025-05-26 14:58:49 | INFO | utils.log_helper - ℹ️ 横向边缘检测结果: {'timestamp': '20250526_145849_764575', 'edge_point': (320, 1009), 'distance_to_center': -640, 'slope': -0.07331047777324741, 'distance_to_bottom': 117.91870577487839, 'intersection_point': (960, 962)}
|
||||
2025-05-26 14:59:08 | DEBUG | utils.log_helper - 🐞 步骤1: 创建黄色掩码
|
||||
2025-05-26 14:59:09 | DEBUG | utils.log_helper - 🐞 步骤1.5: 底部区域掩码
|
||||
2025-05-26 14:59:10 | DEBUG | utils.log_helper - 🐞 步骤2: 边缘检测
|
||||
2025-05-26 14:59:11 | DEBUG | utils.log_helper - 🐞 步骤3: 检测到 65 条直线
|
||||
2025-05-26 14:59:12 | DEBUG | utils.log_helper - 🐞 步骤4: 找到 8 条垂直线
|
||||
2025-05-26 14:59:14 | INFO | utils.log_helper - ℹ️ 保存双轨迹线检测结果图像到: logs/image/dual_track_20250526_145914_870232.jpg
|
||||
2025-05-26 14:59:14 | INFO | utils.log_helper - ℹ️ 双轨迹线检测结果: {'timestamp': '20250526_145914_870232', 'center_point': (834, 1080), 'deviation': -126, 'left_track_mid_x': 397.0, 'right_track_mid_x': 1351.5, 'track_width': 954.5, 'center_slope': -2.8529411764705883}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
44
task_3/Usergait_List.toml
Normal file
44
task_3/Usergait_List.toml
Normal file
@ -0,0 +1,44 @@
|
||||
[[step]]
|
||||
acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
|
||||
contact = 0
|
||||
ctrl_point = [0.0, 0.0, 0.0]
|
||||
duration = 0 # Expected execution time of Position interpolation control, For recovery stand need > 5.0S
|
||||
foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
|
||||
gait_id = 0
|
||||
life_count = 0 #Fake value
|
||||
mode = 12
|
||||
pos_des = [0.0, 0.0, 0.0]
|
||||
rpy_des = [0.0, 0.0, 0.0]
|
||||
step_height = [0.0, 0.0]
|
||||
value = 0
|
||||
vel_des = [0.0, 0.0, 0.0]
|
||||
|
||||
[[step]]
|
||||
acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
|
||||
contact = 15
|
||||
ctrl_point = [0.0, 0.0, 0.0]
|
||||
duration = 0
|
||||
foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
|
||||
gait_id = 110
|
||||
life_count = 0
|
||||
mode = 62 # User define gait
|
||||
pos_des = [0.0, 0.0, 0.0]
|
||||
rpy_des = [0.0, 0.0, 0.0]
|
||||
step_height = [0.0, 0.0]
|
||||
value = 0
|
||||
vel_des = [0.0, 0.0, 0.0] # velocity of x y yaw
|
||||
|
||||
# [[step]]
|
||||
# acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
|
||||
# contact = 0
|
||||
# ctrl_point = [0.0, 0.0, 0.0]
|
||||
# duration = 1000
|
||||
# foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
|
||||
# gait_id = 1 #采用受控趴下
|
||||
# life_count = 0
|
||||
# mode = 7 #Puredamper
|
||||
# pos_des = [0.0, 0.0, 0.0]
|
||||
# rpy_des = [0.0, 0.0, 0.0]
|
||||
# step_height = [0.0, 0.0]
|
||||
# value = 0
|
||||
# vel_des = [0.0, 0.0, 0.0]
|
||||
113
task_3/main copy.py
Executable file
113
task_3/main copy.py
Executable file
@ -0,0 +1,113 @@
|
||||
'''
|
||||
This demo show the communication interface of MR813 motion control board based on Lcm
|
||||
- robot_control_cmd_lcmt.py
|
||||
- file_send_lcmt.py
|
||||
- Gait_Def_moonwalk.toml
|
||||
- Gait_Params_moonwalk.toml
|
||||
- Usergait_List.toml
|
||||
'''
|
||||
import lcm
|
||||
import sys
|
||||
import time
|
||||
import toml
|
||||
import copy
|
||||
import math
|
||||
from robot_control_cmd_lcmt import robot_control_cmd_lcmt
|
||||
from file_send_lcmt import file_send_lcmt
|
||||
|
||||
robot_cmd = {
|
||||
'mode':0, 'gait_id':0, 'contact':0, 'life_count':0,
|
||||
'vel_des':[0.0, 0.0, 0.0],
|
||||
'rpy_des':[0.0, 0.0, 0.0],
|
||||
'pos_des':[0.0, 0.0, 0.0],
|
||||
'acc_des':[0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
|
||||
'ctrl_point':[0.0, 0.0, 0.0],
|
||||
'foot_pose':[0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
|
||||
'step_height':[0.0, 0.0],
|
||||
'value':0, 'duration':0
|
||||
}
|
||||
|
||||
def 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("Gait_Params_up.toml")
|
||||
full_steps = {'step':[robot_cmd]}
|
||||
k =0
|
||||
for i in steps['step']:
|
||||
cmd = copy.deepcopy(robot_cmd)
|
||||
cmd['duration'] = i['duration']
|
||||
if i['type'] == 'usergait':
|
||||
cmd['mode'] = 11 # LOCOMOTION
|
||||
cmd['gait_id'] = 110 # USERGAIT
|
||||
cmd['vel_des'] = i['body_vel_des']
|
||||
cmd['rpy_des'] = i['body_pos_des'][0:3]
|
||||
cmd['pos_des'] = i['body_pos_des'][3:6]
|
||||
cmd['foot_pose'][0:2] = i['landing_pos_des'][0:2]
|
||||
cmd['foot_pose'][2:4] = i['landing_pos_des'][3:5]
|
||||
cmd['foot_pose'][4:6] = i['landing_pos_des'][6:8]
|
||||
cmd['ctrl_point'][0:2] = i['landing_pos_des'][9:11]
|
||||
cmd['step_height'][0] = math.ceil(i['step_height'][0] * 1e3) + math.ceil(i['step_height'][1] * 1e3) * 1e3
|
||||
cmd['step_height'][1] = math.ceil(i['step_height'][2] * 1e3) + math.ceil(i['step_height'][3] * 1e3) * 1e3
|
||||
cmd['acc_des'] = i['weight']
|
||||
cmd['value'] = i['use_mpc_traj']
|
||||
cmd['contact'] = math.floor(i['landing_gain'] * 1e1)
|
||||
cmd['ctrl_point'][2] = i['mu']
|
||||
if k == 0:
|
||||
full_steps['step'] = [cmd]
|
||||
else:
|
||||
full_steps['step'].append(cmd)
|
||||
k=k+1
|
||||
f = open("Gait_Params_up_full.toml", 'w')
|
||||
f.write("# Gait Params\n")
|
||||
f.writelines(toml.dumps(full_steps))
|
||||
f.close()
|
||||
|
||||
file_obj_gait_def = open("Gait_Def_up.toml",'r')
|
||||
file_obj_gait_params = open("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)
|
||||
usergait_msg.data = file_obj_gait_params.read()
|
||||
lcm_usergait.publish("user_gait_file",usergait_msg.encode())
|
||||
time.sleep(0.1)
|
||||
file_obj_gait_def.close()
|
||||
file_obj_gait_params.close()
|
||||
|
||||
user_gait_list = open("Usergait_List.toml",'r')
|
||||
steps = toml.load(user_gait_list)
|
||||
for step in steps['step']:
|
||||
cmd_msg.mode = step['mode']
|
||||
cmd_msg.value = step['value']
|
||||
cmd_msg.contact = step['contact']
|
||||
cmd_msg.gait_id = step['gait_id']
|
||||
cmd_msg.duration = step['duration']
|
||||
cmd_msg.life_count += 1
|
||||
for i in range(3):
|
||||
cmd_msg.vel_des[i] = step['vel_des'][i]
|
||||
cmd_msg.rpy_des[i] = step['rpy_des'][i]
|
||||
cmd_msg.pos_des[i] = step['pos_des'][i]
|
||||
cmd_msg.acc_des[i] = step['acc_des'][i]
|
||||
cmd_msg.acc_des[i+3] = step['acc_des'][i+3]
|
||||
cmd_msg.foot_pose[i] = step['foot_pose'][i]
|
||||
cmd_msg.ctrl_point[i] = step['ctrl_point'][i]
|
||||
for i in range(2):
|
||||
cmd_msg.step_height[i] = step['step_height'][i]
|
||||
lcm_cmd.publish("robot_control_cmd",cmd_msg.encode())
|
||||
time.sleep( 0.1 )
|
||||
for i in range(325): #15s Heat beat It is used to maintain the heartbeat when life count is not updated
|
||||
lcm_cmd.publish("robot_control_cmd",cmd_msg.encode())
|
||||
time.sleep( 0.2 )
|
||||
except KeyboardInterrupt:
|
||||
cmd_msg.mode = 7 #PureDamper before KeyboardInterrupt:
|
||||
cmd_msg.gait_id = 0
|
||||
cmd_msg.duration = 0
|
||||
cmd_msg.life_count += 1
|
||||
lcm_cmd.publish("robot_control_cmd",cmd_msg.encode())
|
||||
pass
|
||||
sys.exit()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
149
task_3/robot_control_cmd_lcmt copy.py
Executable file
149
task_3/robot_control_cmd_lcmt copy.py
Executable file
@ -0,0 +1,149 @@
|
||||
# LCM type definitions This file automatically generated by lcm.
|
||||
try:
|
||||
import cStringIO.StringIO as BytesIO
|
||||
except ImportError:
|
||||
from io import BytesIO
|
||||
import struct
|
||||
|
||||
class robot_control_cmd_lcmt(object):
|
||||
__slots__ = ["mode", "gait_id", "contact", "life_count", "vel_des", "rpy_des", "pos_des", "acc_des", "ctrl_point", "foot_pose", "step_height", "value", "duration"]
|
||||
|
||||
__typenames__ = ["int8_t", "int8_t", "int8_t", "int8_t", "float", "float", "float", "float", "float", "float", "float", "int32_t", "int32_t"]
|
||||
|
||||
__dimensions__ = [None, None, None, None, [3], [3], [3], [6], [3], [6], [2], None, None]
|
||||
|
||||
def __init__(self):
|
||||
self.mode = 0
|
||||
self.gait_id = 0
|
||||
self.contact = 0
|
||||
self.life_count = 0
|
||||
self.vel_des = [ 0.0 for dim0 in range(3) ]
|
||||
self.rpy_des = [ 0.0 for dim0 in range(3) ]
|
||||
self.pos_des = [ 0.0 for dim0 in range(3) ]
|
||||
self.acc_des = [ 0.0 for dim0 in range(6) ]
|
||||
self.ctrl_point = [ 0.0 for dim0 in range(3) ]
|
||||
self.foot_pose = [ 0.0 for dim0 in range(6) ]
|
||||
self.step_height = [ 0.0 for dim0 in range(2) ]
|
||||
self.value = 0
|
||||
self.duration = 0
|
||||
|
||||
def encode(self):
|
||||
buf = BytesIO()
|
||||
buf.write(robot_control_cmd_lcmt._get_packed_fingerprint())
|
||||
self._encode_one(buf)
|
||||
return buf.getvalue()
|
||||
|
||||
def _encode_one(self, buf):
|
||||
buf.write(struct.pack(">bbbb", self.mode, self.gait_id, self.contact, self.life_count))
|
||||
buf.write(struct.pack('>3f', *self.vel_des[:3]))
|
||||
buf.write(struct.pack('>3f', *self.rpy_des[:3]))
|
||||
buf.write(struct.pack('>3f', *self.pos_des[:3]))
|
||||
buf.write(struct.pack('>6f', *self.acc_des[:6]))
|
||||
buf.write(struct.pack('>3f', *self.ctrl_point[:3]))
|
||||
buf.write(struct.pack('>6f', *self.foot_pose[:6]))
|
||||
buf.write(struct.pack('>2f', *self.step_height[:2]))
|
||||
buf.write(struct.pack(">ii", self.value, self.duration))
|
||||
|
||||
def decode(data):
|
||||
if hasattr(data, 'read'):
|
||||
buf = data
|
||||
else:
|
||||
buf = BytesIO(data)
|
||||
if buf.read(8) != robot_control_cmd_lcmt._get_packed_fingerprint():
|
||||
raise ValueError("Decode error")
|
||||
return robot_control_cmd_lcmt._decode_one(buf)
|
||||
decode = staticmethod(decode)
|
||||
|
||||
def _decode_one(buf):
|
||||
self = robot_control_cmd_lcmt()
|
||||
self.mode, self.gait_id, self.contact, self.life_count = struct.unpack(">bbbb", buf.read(4))
|
||||
self.vel_des = struct.unpack('>3f', buf.read(12))
|
||||
self.rpy_des = struct.unpack('>3f', buf.read(12))
|
||||
self.pos_des = struct.unpack('>3f', buf.read(12))
|
||||
self.acc_des = struct.unpack('>6f', buf.read(24))
|
||||
self.ctrl_point = struct.unpack('>3f', buf.read(12))
|
||||
self.foot_pose = struct.unpack('>6f', buf.read(24))
|
||||
self.step_height = struct.unpack('>2f', buf.read(8))
|
||||
self.value, self.duration = struct.unpack(">ii", buf.read(8))
|
||||
return self
|
||||
_decode_one = staticmethod(_decode_one)
|
||||
|
||||
def _get_hash_recursive(parents):
|
||||
if robot_control_cmd_lcmt in parents: return 0
|
||||
tmphash = (0x476b61e296af96f5) & 0xffffffffffffffff
|
||||
tmphash = (((tmphash<<1)&0xffffffffffffffff) + (tmphash>>63)) & 0xffffffffffffffff
|
||||
return tmphash
|
||||
_get_hash_recursive = staticmethod(_get_hash_recursive)
|
||||
_packed_fingerprint = None
|
||||
|
||||
def _get_packed_fingerprint():
|
||||
if robot_control_cmd_lcmt._packed_fingerprint is None:
|
||||
robot_control_cmd_lcmt._packed_fingerprint = struct.pack(">Q", robot_control_cmd_lcmt._get_hash_recursive([]))
|
||||
return robot_control_cmd_lcmt._packed_fingerprint
|
||||
_get_packed_fingerprint = staticmethod(_get_packed_fingerprint)
|
||||
|
||||
def get_hash(self):
|
||||
"""Get the LCM hash of the struct"""
|
||||
return struct.unpack(">Q", robot_control_cmd_lcmt._get_packed_fingerprint())[0]
|
||||
|
||||
class robot_control_response_lcmt(object):
|
||||
__slots__ = ["mode", "gait_id", "contact", "order_process_bar", "switch_status", "ori_error", "footpos_error", "motor_error"]
|
||||
|
||||
__typenames__ = ["int8_t", "int8_t", "int8_t", "int8_t", "int8_t", "int8_t", "int16_t", "int32_t"]
|
||||
|
||||
__dimensions__ = [None, None, None, None, None, None, None, [12]]
|
||||
|
||||
def __init__(self):
|
||||
self.mode = 0
|
||||
self.gait_id = 0
|
||||
self.contact = 0
|
||||
self.order_process_bar = 0
|
||||
self.switch_status = 0
|
||||
self.ori_error = 0
|
||||
self.footpos_error = 0
|
||||
self.motor_error = [ 0 for dim0 in range(12) ]
|
||||
|
||||
def encode(self):
|
||||
buf = BytesIO()
|
||||
buf.write(robot_control_response_lcmt._get_packed_fingerprint())
|
||||
self._encode_one(buf)
|
||||
return buf.getvalue()
|
||||
|
||||
def _encode_one(self, buf):
|
||||
buf.write(struct.pack(">bbbbbbh", self.mode, self.gait_id, self.contact, self.order_process_bar, self.switch_status, self.ori_error, self.footpos_error))
|
||||
buf.write(struct.pack('>12i', *self.motor_error[:12]))
|
||||
|
||||
def decode(data):
|
||||
if hasattr(data, 'read'):
|
||||
buf = data
|
||||
else:
|
||||
buf = BytesIO(data)
|
||||
if buf.read(8) != robot_control_response_lcmt._get_packed_fingerprint():
|
||||
raise ValueError("Decode error")
|
||||
return robot_control_response_lcmt._decode_one(buf)
|
||||
decode = staticmethod(decode)
|
||||
|
||||
def _decode_one(buf):
|
||||
self = robot_control_response_lcmt()
|
||||
self.mode, self.gait_id, self.contact, self.order_process_bar, self.switch_status, self.ori_error, self.footpos_error = struct.unpack(">bbbbbbh", buf.read(8))
|
||||
self.motor_error = struct.unpack('>12i', buf.read(48))
|
||||
return self
|
||||
_decode_one = staticmethod(_decode_one)
|
||||
|
||||
def _get_hash_recursive(parents):
|
||||
if robot_control_response_lcmt in parents: return 0
|
||||
tmphash = (0x485da98216eda8c7) & 0xffffffffffffffff
|
||||
tmphash = (((tmphash<<1)&0xffffffffffffffff) + (tmphash>>63)) & 0xffffffffffffffff
|
||||
return tmphash
|
||||
_get_hash_recursive = staticmethod(_get_hash_recursive)
|
||||
_packed_fingerprint = None
|
||||
|
||||
def _get_packed_fingerprint():
|
||||
if robot_control_response_lcmt._packed_fingerprint is None:
|
||||
robot_control_response_lcmt._packed_fingerprint = struct.pack(">Q", robot_control_response_lcmt._get_hash_recursive([]))
|
||||
return robot_control_response_lcmt._packed_fingerprint
|
||||
_get_packed_fingerprint = staticmethod(_get_packed_fingerprint)
|
||||
|
||||
def get_hash(self):
|
||||
"""Get the LCM hash of the struct"""
|
||||
return struct.unpack(">Q", robot_control_response_lcmt._get_packed_fingerprint())[0]
|
||||
@ -17,7 +17,7 @@ def process_image(image_path, save_dir=None, show_steps=False):
|
||||
|
||||
# 检测赛道并估算距离
|
||||
start_time = time.time()
|
||||
edge_point, edge_info = detect_horizontal_track_edge_v2(image_path, observe=show_steps, save_log=True, delay=800)
|
||||
edge_point, edge_info = detect_horizontal_track_edge(image_path, observe=show_steps, save_log=True, delay=800)
|
||||
processing_time = time.time() - start_time
|
||||
|
||||
# 输出结果
|
||||
@ -44,7 +44,7 @@ def process_image(image_path, save_dir=None, show_steps=False):
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='黄色赛道检测演示程序')
|
||||
parser.add_argument('--input', type=str, default='res/path/test-1.jpg', help='输入图像或视频的路径')
|
||||
parser.add_argument('--input', type=str, default='res/path/image_20250513_162556.png', help='输入图像或视频的路径')
|
||||
parser.add_argument('--output', type=str, default='res/path/test-v2/2-end.jpg', help='输出结果的保存路径')
|
||||
parser.add_argument('--type', type=str, choices=['image', 'video'], help='输入类型,不指定会自动检测')
|
||||
parser.add_argument('--show', default=True, action='store_true', help='显示处理步骤')
|
||||
|
||||
@ -19,7 +19,7 @@ def detect_horizontal_track_edge(image, observe=False, delay=1000, save_log=True
|
||||
edge_point: 赛道前方边缘点的坐标 (x, y)
|
||||
edge_info: 边缘信息字典
|
||||
"""
|
||||
observe = False # TEST
|
||||
# observe = False # TEST
|
||||
# 如果输入是字符串(文件路径),则加载图像
|
||||
if isinstance(image, str):
|
||||
img = cv2.imread(image)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user