feat(2.5d): dua roll/pitch do tu IMU vao TF tren phan cung that

Nguyen tac 2.5D la pose SE(2) con roll/pitch thi DO. Nhung do nghieng do
duoc truoc gio chi den duoc octomap/costmap qua gravity_align_nodelet;
RTAB-Map dat anh depth bang TF phang nen ban do 3D khong duoc bu nghieng.

Cach lam: khai hai khop revolute base_roll_joint / base_pitch_joint, va
base_tilt_tf.py publish /joint_states. robot_state_publisher lo phan TF nen
van la NGUON DUY NHAT cua moi canh - khong tranh chap.

Nghiem thu tren nhanh phan cung (description.launch use_sim:=false):
    base_footprint -> base_roll_link   /tf 392 ban tin
    base_roll_link -> base_link        /tf 392 ban tin
    -> 2 canh, moi canh mot nguon
    TF  roll 5.057 pitch -8.637  vs  IMU bom vao 5.000 / -8.670  -> lech 0.057

⚠️ Chi bat khi use_sim=false. Trong Gazebo giu khop fixed nhu cu: san phang
nen pitch do duoc chi 0.0006 do, khop revolute khong mang lai gi ma Gazebo
lai mo phong vat ly no. Da kiem: URDF sinh ra khi use_sim=true GIONG HET
TUNG BYTE ban truoc thay doi.

Da thu type="floating" truoc do va that bai, hai ly do doc lap:
  1. urdf2sdf huy luon link goc -> gazebo_ros_p3d FATAL, mat /scan va odom
  2. libkdl_parser doi floating thanh fixed -> RSP van phat, thanh hai nguon
Ca hai deu ghi lai trong robot.urdf.xacro de khong ai thu lai.

gravity_align_nodelet them param tilt_from_tf de KHONG bu hai lan; no buoc
theo use_sim trong perception.launch nen hai ben khong the lech nhau.
This commit is contained in:
trung09122002
2026-09-03 09:54:04 +07:00
parent 0100d4c871
commit b0d14d7206
9 changed files with 448 additions and 12 deletions

View File

@@ -22,6 +22,35 @@
publish joint_states cho banh xe -> bat fake de TF khong dut. -->
<arg name="publish_fake_joints" default="true"/>
<!--
============ DUA DO NGHIENG VAO TF ============
false (mac dinh) - base_joint la khop FIXED rpy="0 0 0".
Do nghieng do tu IMU chi den duoc octomap/costmap qua
gravity_align_nodelet. Ban do 3D cua RTAB-Map KHONG
duoc bu nghieng.
true - base_joint thanh FLOATING, base_tilt_tf.py phat canh
base_footprint -> base_link kem roll/pitch do tu IMU.
Moi thu doc TF deu nhan duoc, ke ca RTAB-Map.
⚠️ Mac dinh false vi ba ly do, xem khoi ghi chu trong robot.urdf.xacro:
LiDAR cung nghieng theo (laser_link la con cua base_link), mo phong
khong kiem chung duoc (san phang, pitch 0.0006°), va no them mot diem
hong don cho cay TF.
-->
<!--
Do nghieng vao TF. KHONG con la co rieng nua - no di theo use_sim:
use_sim=false (phan cung that) -> URDF dung hai khop revolute,
base_tilt_tf.py publish /joint_states
use_sim=true (Gazebo) -> URDF dung mot khop fixed, khong chay
node. Sim san phang nen do nghieng
luon ~0, khop revolute chi them rui ro.
Giu arg nay de khong pha giao dien cac launch goi vao day; no khong con
tac dung. Xem khoi ghi chu trong robot.urdf.xacro.
-->
<arg name="tilt_in_tf" default="false"/>
<param name="robot_description"
command="$(find xacro)/xacro $(find robot_bringup)/urdf/robot.urdf.xacro
use_sim:=$(arg use_sim)"/>
@@ -31,6 +60,37 @@
<node name="robot_state_publisher" pkg="robot_state_publisher"
type="robot_state_publisher" output="screen"/>
<!--
Khi tilt_in_tf=true, khop base_joint la FLOATING nen robot_state_publisher
KHONG phat canh base_footprint -> base_link nua. Node nay phat thay.
⚠️ respawn="true" la BAT BUOC, khong phai tuy chon: canh nay noi phan dinh
vi voi toan bo cam bien. Node chet ma khong hoi sinh la cay TF dut lam doi,
mat sach scan, cloud va localization.
-->
<!--
Chi chay tren PHAN CUNG THAT. Trong Gazebo, URDF dung mot khop `fixed` nen
robot_state_publisher da phat canh base_footprint -> base_link; bat node
nay len se thanh hai nguon tranh nhau.
respawn="true": node chet thi RSP khong con goc khop moi, canh TF dung yen
o gia tri cuoi va cloud se lech dan neu robot doi do nghieng.
-->
<node unless="$(arg use_sim)"
name="base_tilt_tf" pkg="robot_bringup" type="base_tilt_tf.py"
output="screen" respawn="true" respawn_delay="1">
<!-- ⚠️ PHAI khop ten khop trong robot.urdf.xacro. Sai ten thi RSP im lang
bo qua, khong bao loi, va canh TF dung nguyen o 0. -->
<param name="roll_joint" value="base_roll_joint"/>
<param name="pitch_joint" value="base_pitch_joint"/>
<param name="rate" value="50.0"/>
<param name="imu_topic" value="/imu/data_raw"/>
<!-- Giu khop gravity_align_nodelet de hai ben khong cho ra goc khac nhau -->
<param name="alpha" value="0.98"/>
<param name="accel_lpf_alpha" value="0.05"/>
<param name="accel_gate" value="0.5"/>
</node>
<!--
joint_states cho banh xe:
L0 (mot minh) -> joint_state_publisher gia lap

View File

@@ -21,6 +21,11 @@
-->
<launch>
<!-- Dua do nghieng do tu IMU vao canh TF base_footprint -> base_link.
Mac dinh false. Xem khoi ghi chu trong description.launch. -->
<arg name="tilt_in_tf" default="false"/>
<arg name="use_sim" default="true"/>
<arg name="world" default="restaurant"/>
<arg name="gui" default="true"/>
@@ -29,6 +34,7 @@
<!-- ============ L1: nguon cam bien ============ -->
<group if="$(arg use_sim)">
<include file="$(find robot_bringup)/launch/sim.launch">
<arg name="tilt_in_tf" value="$(arg tilt_in_tf)"/>
<arg name="world" value="$(arg world)"/>
<arg name="gui" value="$(arg gui)"/>
<arg name="rviz" value="$(arg rviz)"/>
@@ -39,6 +45,7 @@
<include file="$(find robot_bringup)/launch/description.launch">
<arg name="use_sim" value="false"/>
<arg name="rviz" value="$(arg rviz)"/>
<arg name="tilt_in_tf" value="$(arg tilt_in_tf)"/>
<!-- firmware MCU publish joint_states banh xe -->
<arg name="publish_fake_joints" value="false"/>
</include>

View File

@@ -19,6 +19,11 @@
-->
<launch>
<!-- Dua do nghieng do tu IMU vao canh TF base_footprint -> base_link.
Mac dinh false. Xem khoi ghi chu trong description.launch. -->
<arg name="tilt_in_tf" default="false"/>
<arg name="use_sim" default="true"/>
<arg name="world" default="restaurant"/>
<arg name="gui" default="true"/>
@@ -49,6 +54,7 @@
args="0 0 0 0 0 0 map odom"/>
<include file="$(find robot_bringup)/launch/odom.launch">
<arg name="tilt_in_tf" value="$(arg tilt_in_tf)"/>
<arg name="use_sim" value="$(arg use_sim)"/>
<arg name="world" value="$(arg world)"/>
<arg name="gui" value="$(arg gui)"/>
@@ -56,6 +62,10 @@
</include>
<include file="$(find perception_3d)/launch/perception_nodelets.launch">
<!-- Do nghieng nam trong TF chi khi chay phan cung that (URDF dung khop
revolute + base_tilt_tf.py). Trong Gazebo canh do phang nen nodelet
phai tu bu. Buoc theo use_sim de hai ben KHONG THE lech nhau. -->
<arg name="tilt_from_tf" value="$(eval not arg('use_sim'))"/>
<arg name="depth_image" value="$(arg depth_image)"/>
<arg name="depth_info" value="$(arg depth_info)"/>
<arg name="imu_topic" value="/imu/data_raw"/>

View File

@@ -17,6 +17,11 @@
-->
<launch>
<!-- Dua do nghieng do tu IMU vao canh TF base_footprint -> base_link.
Mac dinh false. Xem khoi ghi chu trong description.launch. -->
<arg name="tilt_in_tf" default="false"/>
<!-- restaurant | hotel_corridor | hospital | hospital_two_floors
| hospital_three_floors -->
<arg name="world" default="restaurant"/>
@@ -43,6 +48,7 @@
<!-- L0: URDF + TF. use_sim:=true de keo them plugin Gazebo vao URDF. -->
<include file="$(find robot_bringup)/launch/description.launch">
<arg name="tilt_in_tf" value="$(arg tilt_in_tf)"/>
<arg name="use_sim" value="true"/>
<arg name="rviz" value="$(arg rviz)"/>
<!-- Gazebo se publish joint_states banh xe -> tat fake -->