안녕하세요. Go2 edu를 사용중인데 앱이 아닌 ROS2 환경에서 실시간 mapping과 slam을 진행하고 싶습니다. Go2 내장 LiDAR와 MID-360 각각 진행해보고 싶은데 자세한 방법을 알 수 있을까요?
안녕하세요, 위고로보틱스입니다.
Go2 EDU에서 ROS2 환경으로 실시간 매핑 및 SLAM을 진행하는 방법을 안내드립니다.
1. ROS2 Nav2 기반 매핑/SLAM 개요
Go2 EDU의 내장 LiDAR든 외장 MID-360이든, 기본적으로 ROS2의 Nav2(Navigation2) 스택을 활용하시면 됩니다. SLAM에는 slam_toolbox 패키지를 사용하여 실시간으로 지도를 생성하고, 생성된 지도 기반으로 nav2_amcl을 통해 자기위치추정(Localization)을 수행할 수 있습니다.
기본 흐름은 다음과 같습니다:
LiDAR → /scan 토픽 (LaserScan) → slam_toolbox (매핑) → /map 토픽 생성 → Nav2 (경로 계획 및 주행)
slam_toolbox는 apt install ros-humble-slam-toolbox로 설치 가능하며, Nav2 전체 스택은 apt install ros-humble-navigation2로 설치하실 수 있습니다.
2. 3D LiDAR PointCloud를 2D LaserScan으로 변환하는 방법
Go2 내장 LiDAR와 MID-360 모두 3D 포인트클라우드(sensor_msgs/msg/PointCloud2)를 출력합니다. Nav2의 slam_toolbox나 nav2_amcl은 2D LaserScan 메시지를 입력으로 받기 때문에, 3D→2D 변환이 필요합니다.
이를 위해 ROS2 공식 패키지인 pointcloud_to_laserscan을 사용합니다:
- GitHub: GitHub - ros-perception/pointcloud_to_laserscan: Converts a 3D Point Cloud into a 2D laser scan. · GitHub
- 설치:
apt install ros-humble-pointcloud-to-laserscan
주요 파라미터는 다음과 같습니다:
min_height/max_height: 포인트클라우드에서 2D 스캔으로 추출할 높이 범위(m). 예를 들어 바닥 노이즈를 제거하려면min_height: 0.1, 로봇 위 불필요한 데이터를 제거하려면max_height: 1.0정도로 설정합니다.target_frame: 포인트클라우드를 변환할 TF 프레임. 로봇의base_link로 설정하면 로봇 기준 좌표로 변환됩니다.angle_min/angle_max: 스캔 각도 범위 (기본 -π ~ π, 즉 360도)
launch 파일에서 다음과 같이 노드를 추가하시면 됩니다:
Node(
package='pointcloud_to_laserscan',
executable='pointcloud_to_laserscan_node',
name='pointcloud_to_laserscan',
remappings=[
('cloud_in', '/your_pointcloud_topic'),
('scan', '/scan'),
],
parameters=[{
'min_height': 0.1,
'max_height': 1.0,
'target_frame': 'base_link',
'angle_increment': 0.00872, # ~0.5도
'transform_tolerance': 0.01,
'use_inf': True,
}],
)
Go2 내장 LiDAR의 경우 포인트클라우드 토픽명을, MID-360의 경우 /livox/lidar 토픽을 cloud_in에 remap해주시면 됩니다.
3. MID-360 ROS2 드라이버 및 Nav2 연동 참고자료
MID-360을 ROS2에서 사용하려면 Livox 공식 ROS2 드라이버인 livox_ros_driver2를 사용해야 합니다 (이전 버전인 livox_ros2_driver는 MID-360을 지원하지 않으므로 주의해주세요).
참고 링크:
- Livox ROS Driver 2 (공식): GitHub - Livox-SDK/livox_ros_driver2: Livox device driver under Ros(Compatible with ros and ros2), support Lidar HAP and Mid-360. · GitHub
- ROS2 Humble/Foxy 지원,
/livox/lidar(PointCloud2) 및/livox/imu(IMU) 토픽 발행
- ROS2 Humble/Foxy 지원,
- Livox SDK2 (필수 선행 설치): GitHub - Livox-SDK/Livox-SDK2: Drivers for receiving LiDAR data and controlling lidar, support Lidar HAP and Mid-360. · GitHub
- MID-360 ROS2 연동 위키 (Seeed Studio): Mid360 with ROS | Seeed Studio Wiki
- IP 설정, config 파일 수정, 네트워크 구성 등 초기 셋업 가이드
- MID-360 IMU 데이터 활용 가이드: How to use the built-in IMU in the 3D-LiDAR MID-360 with ROS2 | NEXTY Electronics, an electronic components and semiconductor trading company
- IMU 가속도 단위 변환(g → m/s²) 및 FAST-LIO 연동 시 주의사항
MID-360의 기본 IP는 192.168.1.1XX (XX = 시리얼 번호 끝 두 자리)이므로, 호스트 PC의 이더넷을 같은 서브넷(예: 192.168.1.50)으로 설정하신 후 config 파일에서 IP를 맞춰주셔야 합니다.
추가 문의사항이 있으시면 편하게 말씀해주세요.
감사합니다.
위고로보틱스 기술지원팀