소스 정보
- 저장소
- MIUAV/vibe-coding-ros2
- 최근 소스 활동
- 2026년 4월 3일 16:37
- 감지된 SKILL.md 언어
- 중국어
- 스타
- 26
- 포크
- 2
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/MIUAV/vibe-coding-ros2 --skill lidar-ground-segmentation명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | lidar-ground-segmentation |
| description | 激光雷达地面分割技能 - 高度阈值、平面拟合、Ray casting、ROS2地面检测 |
| argument-hint | 地面分割 OR ground segmentation OR lidar OR 地面检测 |
| user-invocable | true |
点云地面检测与分割算法
当需要以下帮助时使用此技能:
import numpy as np
from scipy.spatial import ConvexHull
from sklearn.linear_model import RANSACRegressor
class GroundSegmenter:
def __init__(self):
self.ground_threshold = 0.3 # 地面高度阈值
self.angle_threshold = np.radians(15) # 角度阈值
def segment(self, points):
"""分割地面和障碍物"""
# 方法1: 简单高度阈值
ground_mask = points[:, 2] < self.ground_threshold
return points[ground_mask], points[~ground_mask]
class RANSACGroundSegmenter:
"""RANSAC 平面拟合"""
def __init__(self, distance_threshold=0.05):
self.distance_threshold = distance_threshold
def fit_plane(self, points):
"""拟合地面平面"""
# RANSAC 平面拟合
X = points[:, :2]
y = points[:, 2]
model = RANSACRegressor()
model.fit(X, y)
inliers = model.inliers_
# 平面方程: z = ax + by + c
a, b = model.coef_
c = model.intercept_
return a, b, c, inliers
def segment(self, points):
"""分割"""
a, b, c, inliers = self.fit_plane(points)
ground_points = points[inliers]
obstacle_points = points[~inliers]
return ground_points, obstacle_points
class PatchBasedGroundSegmenter:
"""基于 Patch 的地面分割"""
def __init__(self, patch_size=0.5, threshold=0.1):
self.patch_size = patch_size
self.threshold = threshold
def segment(self, points):
"""划分 Patch 进行分割"""
# 计算网格索引
x_bins = (points[:, 0] / self.patch_size).astype(int)
y_bins = (points[:, 1] / self.patch_size).astype(int)
ground_mask = np.zeros(len(points), dtype=bool)
for x in np.unique(x_bins):
for y in np.unique(y_bins):
mask = (x_bins == x) & (y_bins == y)
patch_points = points[mask]
if len(patch_points) < 5:
continue
# 最小二乘拟合
z_mean = patch_points[:, 2].mean()
z_std = patch_points[:, 2].std()
# 判断是否为地面
if z_std < self.threshold:
ground_mask[mask] = True
return points[ground_mask], points[~ground_mask]
import rclpy
from rclpy.node import Node
from sensor_msgs.msg import PointCloud2
from sensor_msgs.msg import LaserScan
from std_msgs.msg import Header
class GroundSegmentationNode(Node):
def __init__(self):
super().__init__('ground_segmentation')
self.sub = self.create_subscription(
PointCloud2, '/lidar_points', self.callback, 10)
self.ground_pub = self.create_publisher(
PointCloud2, '/ground_points', 10)
self.obstacle_pub = self.create_publisher(
PointCloud2, '/obstacle_points', 10)
self.segmenter = PatchBasedGroundSegmenter()
def callback(self, msg):
points = self.parse_pointcloud(msg)
ground, obstacle = self.segmenter.segment(points)
# 发布
self.ground_pub.publish(self.pointcloud_to_msg(ground, msg.header))
self.obstacle_pub.publish(self.pointcloud_to_msg(obstacle, msg.header))
def ():
points = []
i (, (msg.data), msg.point_step):
x = msg.data[i:i+]
points.append([x[], x[], x[]])
np.array(points, dtype=np.float32)
():
msg = PointCloud2()
msg.header = header
msg.height =
msg.width = (points)
msg.point_step =
msg.row_step = * (points)
msg.data = points.tobytes()
msg