fix: keep nearby MKMini Gazebo lidar returns
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
# Gazebo produces a clean 2D ray scan. Keep nearby simulated obstacles so the
|
||||
# displayed scan and SLAM map reflect the physical collision geometry.
|
||||
pointcloud_to_laserscan:
|
||||
ros__parameters:
|
||||
use_inf: true
|
||||
target_frame: os_lidar
|
||||
transform_tolerance: 2.0
|
||||
min_height: -0.46
|
||||
max_height: 0.10
|
||||
angle_min: -3.14159
|
||||
angle_max: 3.14159
|
||||
angle_increment: 0.0087
|
||||
range_min: 0.2
|
||||
range_max: 12.0
|
||||
qos_overrides./scan.subscriber.reliability: best_effort
|
||||
qos_overrides./scan.publisher.reliability: reliable
|
||||
@@ -20,15 +20,18 @@ from launch_ros.actions import Node
|
||||
|
||||
|
||||
ARGUMENTS = [
|
||||
DeclareLaunchArgument('robot', default_value='fr09', choices=['fr09', 'mkmini'])
|
||||
DeclareLaunchArgument('robot', default_value='fr09', choices=['fr09', 'mkmini']),
|
||||
DeclareLaunchArgument('sim_mode', default_value='false'),
|
||||
]
|
||||
|
||||
|
||||
def launch_setup(context, *args, **kwargs):
|
||||
robot = LaunchConfiguration('robot').perform(context)
|
||||
robot = LaunchConfiguration('robot').perform(context)
|
||||
sim_mode = LaunchConfiguration('sim_mode').perform(context).strip().lower() == 'true'
|
||||
|
||||
pkg_share = get_package_share_directory('perception2d_pkg')
|
||||
config_dir = os.path.join(pkg_share, 'config', f'perception_{robot}.yaml')
|
||||
pkg_share = get_package_share_directory('perception2d_pkg')
|
||||
config_name = 'perception_mkmini_gazebo.yaml' if sim_mode and robot == 'mkmini' else f'perception_{robot}.yaml'
|
||||
config_dir = os.path.join(pkg_share, 'config', config_name)
|
||||
|
||||
return [
|
||||
Node(
|
||||
@@ -38,7 +41,7 @@ def launch_setup(context, *args, **kwargs):
|
||||
output='screen',
|
||||
parameters=[
|
||||
config_dir,
|
||||
{'use_sim_time': True},
|
||||
{'use_sim_time': sim_mode},
|
||||
],
|
||||
remappings=[
|
||||
('cloud_in', '/raw/lidar'), # 추후에 config에서 바꿀 수 있도록 변경하는게 좋을 것 같음.
|
||||
|
||||
@@ -5,9 +5,10 @@ def build_perception_commands(config):
|
||||
cmds = []
|
||||
level = config.get("level")
|
||||
robot = config.get("robot", "")
|
||||
sim_mode = str(config.get("sim_mode", False)).lower()
|
||||
if level and level != "None":
|
||||
cmds.append(["ros2", "launch", f"perception{level}_pkg",
|
||||
"perception.launch.py", f"robot:={robot}"])
|
||||
"perception.launch.py", f"robot:={robot}", f"sim_mode:={sim_mode}"])
|
||||
for entry in config.get("perception") or []:
|
||||
package = entry.get("package")
|
||||
if not package:
|
||||
|
||||
@@ -2,8 +2,8 @@ from perception_pkg.launch_spec import build_perception_commands
|
||||
|
||||
|
||||
def test_level_only():
|
||||
cmds = build_perception_commands({"level": "3d", "robot": "mkmini"})
|
||||
assert ["ros2", "launch", "perception3d_pkg", "perception.launch.py", "robot:=mkmini"] in cmds
|
||||
cmds = build_perception_commands({"level": "3d", "robot": "mkmini", "sim_mode": True})
|
||||
assert ["ros2", "launch", "perception3d_pkg", "perception.launch.py", "robot:=mkmini", "sim_mode:=true"] in cmds
|
||||
assert len(cmds) == 1
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user