MPPI planner + fence-line localization + scan obstacles

- Lightweight MPPI (200 trajectories, 15 steps, endpoint path_align)
- adaptive exploration (more random when stuck)
- fence-line Hough detection + geometric correction
- scan hit points marked at 255 immediately
- forward half-step pre-check for obstacle avoidance
- Ackermann constraint |wz| <= |vx|/min_turn_r
- XORshift RNG (stdlib broken on ARM)
This commit is contained in:
cyy
2026-07-02 21:29:41 +00:00
commit 5156a8d766
26 changed files with 2292 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.conditions import IfCondition
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
def generate_launch_description():
# ── origincar_bridge params ──
declare_http_host = DeclareLaunchArgument(
"http_host", default_value="192.168.64.1",
description="simulation host IP (macOS)")
declare_http_port = DeclareLaunchArgument(
"http_port", default_value="8765")
# ── car_nav_lite params ──
declare_map_file = DeclareLaunchArgument(
"map_file", default_value="/home/cyy/sim_map.pgm")
declare_lookahead = DeclareLaunchArgument(
"lookahead", default_value="0.8")
declare_test_mode = DeclareLaunchArgument(
"test_mode", default_value="false")
declare_foxglove = DeclareLaunchArgument(
"foxglove", default_value="true",
description="also launch foxglove_bridge")
return LaunchDescription([
declare_http_host, declare_http_port,
declare_map_file, declare_lookahead, declare_test_mode, declare_foxglove,
# ── 1. HTTP→ROS2 bridge (sim ↔ nav) ──
Node(
package="origincar_bridge",
executable="bridge_node",
name="origincar_bridge",
output="screen",
parameters=[{
"http_host": LaunchConfiguration("http_host"),
"http_port": LaunchConfiguration("http_port"),
}],
),
# ── 2. Static TF: base_link → laser ──
Node(
package="tf2_ros",
executable="static_transform_publisher",
name="tf_laser",
arguments=["0", "0", "0.12", "0", "0", "0", "base_link", "laser"],
),
# ── 3. Main navigation node ──
Node(
package="car_nav_lite",
executable="nav_lite_node",
name="nav_lite_node",
output="screen",
parameters=[{
"map_file": LaunchConfiguration("map_file"),
"lookahead": LaunchConfiguration("lookahead"),
"test_mode": LaunchConfiguration("test_mode"),
}],
),
# ── 4. Foxglove bridge (for visualization) ──
Node(
package="foxglove_bridge",
executable="foxglove_bridge",
name="foxglove_bridge",
output="screen",
parameters=[{"port": 8766}],
condition=IfCondition(LaunchConfiguration("foxglove")),
),
])

31
launch/nav_lite.launch.py Normal file
View File

@@ -0,0 +1,31 @@
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
def generate_launch_description():
return LaunchDescription([
DeclareLaunchArgument("map_file", default_value="/home/cyy/sim_map.pgm"),
DeclareLaunchArgument("lookahead", default_value="0.8"),
DeclareLaunchArgument("test_mode", default_value="false"),
# Static TF: base_link → laser
Node(
package="tf2_ros", executable="static_transform_publisher",
name="tf_laser",
arguments=["0","0","0.12","0","0","0","base_link","laser"],
),
# Main navigation node
Node(
package="car_nav_lite",
executable="nav_lite_node",
name="nav_lite_node",
output="screen",
parameters=[{
"map_file": LaunchConfiguration("map_file"),
"lookahead": LaunchConfiguration("lookahead"),
"test_mode": LaunchConfiguration("test_mode"),
}],
),
])