完善双雷达仿真与自动上坡任务,更新使用文档
加入下置 MID360 前向补盲与双雷达融合,修复北侧走廊导航、坐标适配和数据时效处理。 实现接近坡脚、姿态辅助上坡与平台停车任务,增加独立快模式、命令仲裁及失效停车保护,保留测试与分阶段验收记录。 同步实车尺寸及雷达安装参数,调整 Gazebo 红方默认视角,完善根目录 README、仿真使用和实车迁移说明。
This commit is contained in:
@@ -239,7 +239,7 @@ class Sim(object):
|
||||
if value.isdigit() and self.owns(int(value)):
|
||||
self.known[int(value)] = _comm(int(value))
|
||||
|
||||
def start(self, gui=False, timeout=90.0, lidar=False, navigation=False, spawn=None, drive='planar', world=None, terrain=False, sensor_model='generic', localization=False, lio_navigation=False, sensor_profile='ideal', split=False):
|
||||
def start(self, gui=False, timeout=90.0, lidar=False, navigation=False, spawn=None, drive='planar', world=None, terrain=False, sensor_model='generic', localization=False, lio_navigation=False, sensor_profile='ideal', split=False, dual_lidar=False, mission=False, ramp_speed=.3, nav_speed=.3, aligned_start=False, crest_speed=.2, yaw_speed=.8, with_rviz=False, mission_profile='standard'):
|
||||
if port_open(port=11355):
|
||||
return False, 'master 端口 11355 已被占用;本工具不去动占用者,直接退出'
|
||||
if terrain and not navigation:
|
||||
@@ -252,16 +252,28 @@ class Sim(object):
|
||||
raise ValueError('MID360 is currently a separate sensor/localization entry')
|
||||
if sensor_profile not in ('ideal','mild','stress') or (split and not lio_navigation):
|
||||
raise ValueError('invalid noise profile or split without LIO navigation')
|
||||
entry = ('br_sim_bringup scan_lio_split.launch.py' if split else
|
||||
if dual_lidar and (not lio_navigation or split):
|
||||
raise ValueError('dual lidar acceptance requires the combined LIO entry')
|
||||
if mission and (not lio_navigation or not dual_lidar or terrain or split):raise ValueError('mission requires combined flat LIO with dual lidar')
|
||||
entry = ('br_sim_bringup ramp_mission.launch.py' if mission else
|
||||
'br_sim_bringup scan_lio_split.launch.py' if split else
|
||||
'br_sim_bringup '+('scan_lio_terrain.launch.py' if terrain else 'scan_lio.launch.py') if lio_navigation else
|
||||
'br_sim_bringup mid360_sim.launch.py' if localization else
|
||||
'br_sim_bringup '+('scan_terrain.launch.py' if terrain else 'scan_sim.launch.py') if navigation else
|
||||
'br_sim_bringup robot_sim.launch.py')
|
||||
options = ('gui:=%s' % ('true' if gui else 'false'))
|
||||
if dual_lidar:options += ' dual_lidar:=true'
|
||||
if mission:
|
||||
if mission_profile not in ('standard','fast'):raise ValueError('invalid mission profile')
|
||||
if not .1<=nav_speed<=(2.5 if mission_profile=='fast' else .6) or not .1<=ramp_speed<=(1.1 if mission_profile=='fast' else .7):raise ValueError('mission speed outside selected profile')
|
||||
options+=' autostart:=true profile:=%s ramp_speed:=%g nav_speed:=%g'%(mission_profile,ramp_speed,nav_speed)
|
||||
if not .03<=crest_speed<=min(.2,ramp_speed) or not .1<=yaw_speed<=(2. if mission_profile=='fast' else 1.):raise ValueError('invalid mission crest/yaw speeds')
|
||||
options+=' crest_speed:=%g yaw_speed:=%g'%(crest_speed,yaw_speed)
|
||||
options+=' aligned_start:='+('true' if aligned_start else 'false')
|
||||
if lio_navigation:
|
||||
options += ' sensor_profile:='+sensor_profile
|
||||
if not terrain and not split:
|
||||
options += ' with_rviz:=false'
|
||||
options += ' with_rviz:='+('true' if with_rviz else 'false')
|
||||
if split:options += ' terrain:='+('true' if terrain else 'false')
|
||||
elif localization:
|
||||
options += ' with_lio:=true sensor_profile:='+sensor_profile
|
||||
@@ -1244,13 +1256,14 @@ def sh_cmd(cmd, timeout=15):
|
||||
'err': (p.stderr or '').strip()[-400:]}
|
||||
|
||||
|
||||
def check_model_geometry(out, drive='planar'):
|
||||
def check_model_geometry(out, drive='planar', dual_lidar=False):
|
||||
"""从展开后的 SDF 模型计算外包络,与配置值对照(不依赖 Gazebo 运行时)。"""
|
||||
src = os.path.join(WS, 'src', 'r2027_robot_description', 'sdf',
|
||||
'r2027_omni_robot.sdf.xacro')
|
||||
expanded = os.path.join(out, 'model_expanded.sdf')
|
||||
xacro = shutil.which('xacro') or '/opt/ros/humble/bin/xacro'
|
||||
p = subprocess.run([xacro, src, 'drive:='+drive, '-o', expanded],
|
||||
mappings=['dual_lidar:=true','lidar:=true','sensor_model:=mid360'] if dual_lidar else []
|
||||
p = subprocess.run([xacro, src, 'drive:='+drive]+mappings+['-o', expanded],
|
||||
env=sim_env(), capture_output=True, text=True, timeout=60)
|
||||
if p.returncode != 0:
|
||||
return {'ok': False, 'error': p.stderr[-400:], 'path': expanded}
|
||||
|
||||
Reference in New Issue
Block a user