Cartographer建图提示Filter dropping message: frame 'laser_link' 解决方案
-
问题描述:使用ROS2 Cartographer进行仿真建图的时候出现的错误,RVIZ2中图正常,但是map和base_footprint姿态差距非常大。
同时终端提示以下内容:
[rviz2]: Message Filter dropping message: frame 'laser_link' at time 322.559 for reason 'Unknown'
系统信息如下:
- Ubuntu20.04
- foxy
- cartographer: foxy分支
- cartographer: dashing分支
- Gazebo11
URDF:
<?xml version="1.0"?> <robot name="fishbot"> <!-- Robot Footprint --> <link name="base_footprint"/> <joint name="base_joint" type="fixed"> <parent link="base_footprint"/> <child link="base_link"/> <origin xyz="0.0 0.0 0.076" rpy="0 0 0"/> </joint> <!-- base link --> <link name="base_link"> <visual> <origin xyz="0 0 0.0" rpy="0 0 0"/> <geometry> <cylinder length="0.12" radius="0.10"/> </geometry> <material name="blue"> <color rgba="0.1 0.1 1.0 0.5" /> </material> </visual> <collision> <origin xyz="0 0 0.0" rpy="0 0 0"/> <geometry> <cylinder length="0.12" radius="0.10"/> </geometry> <material name="blue"> <color rgba="0.1 0.1 1.0 0.5" /> </material> </collision> <inertial> <mass value="0.2"/> <inertia ixx="0.0122666" ixy="0" ixz="0" iyy="0.0122666" iyz="0" izz="0.02"/> </inertial> </link> <!-- laser link --> <link name="laser_link"> <visual> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <cylinder length="0.02" radius="0.02"/> </geometry> <material name="black"> <color rgba="0.0 0.0 0.0 0.5" /> </material> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <cylinder length="0.02" radius="0.02"/> </geometry> <material name="black"> <color rgba="0.0 0.0 0.0 0.5" /> </material> </collision> <inertial> <mass value="0.1"/> <inertia ixx="0.000190416666667" ixy="0" ixz="0" iyy="0.0001904" iyz="0" izz="0.00036"/> </inertial> </link> <!-- laser joint --> <joint name="laser_joint" type="fixed"> <parent link="base_link" /> <child link="laser_link" /> <origin xyz="0 0 0.075" /> </joint> <link name="imu_link"> <visual> <origin xyz="0 0 0.0" rpy="0 0 0"/> <geometry> <box size="0.02 0.02 0.02"/> </geometry> </visual> <collision> <origin xyz="0 0 0.0" rpy="0 0 0"/> <geometry> <box size="0.02 0.02 0.02"/> </geometry> </collision> <inertial> <mass value="0.1"/> <inertia ixx="0.000190416666667" ixy="0" ixz="0" iyy="0.0001904" iyz="0" izz="0.00036"/> </inertial> </link> <!-- imu joint --> <joint name="imu_joint" type="fixed"> <parent link="base_link" /> <child link="imu_link" /> <origin xyz="0 0 0.02" /> </joint> <link name="left_wheel_link"> <visual> <origin xyz="0 0 0" rpy="1.57079 0 0"/> <geometry> <cylinder length="0.04" radius="0.032"/> </geometry> <material name="black"> <color rgba="0.0 0.0 0.0 0.5" /> </material> </visual> <collision> <origin xyz="0 0 0" rpy="1.57079 0 0"/> <geometry> <cylinder length="0.04" radius="0.032"/> </geometry> <material name="black"> <color rgba="0.0 0.0 0.0 0.5" /> </material> </collision> <inertial> <mass value="0.2"/> <inertia ixx="0.000190416666667" ixy="0" ixz="0" iyy="0.0001904" iyz="0" izz="0.00036"/> </inertial> </link> <link name="right_wheel_link"> <visual> <origin xyz="0 0 0" rpy="1.57079 0 0"/> <geometry> <cylinder length="0.04" radius="0.032"/> </geometry> <material name="black"> <color rgba="0.0 0.0 0.0 0.5" /> </material> </visual> <collision> <origin xyz="0 0 0" rpy="1.57079 0 0"/> <geometry> <cylinder length="0.04" radius="0.032"/> </geometry> <material name="black"> <color rgba="0.0 0.0 0.0 0.5" /> </material> </collision> <inertial> <mass value="0.2"/> <inertia ixx="0.000190416666667" ixy="0" ixz="0" iyy="0.0001904" iyz="0" izz="0.00036"/> </inertial> </link> <joint name="left_wheel_joint" type="continuous"> <parent link="base_link" /> <child link="left_wheel_link" /> <origin xyz="-0.02 0.10 -0.06" /> <axis xyz="0 1 0" /> </joint> <joint name="right_wheel_joint" type="continuous"> <parent link="base_link" /> <child link="right_wheel_link" /> <origin xyz="-0.02 -0.10 -0.06" /> <axis xyz="0 1 0" /> </joint> <link name="caster_link"> <visual> <origin xyz="0 0 0" rpy="1.57079 0 0"/> <geometry> <sphere radius="0.016"/> </geometry> <material name="black"> <color rgba="0.0 0.0 0.0 0.5" /> </material> </visual> <collision> <origin xyz="0 0 0" rpy="1.57079 0 0"/> <geometry> <sphere radius="0.016"/> </geometry> <material name="black"> <color rgba="0.0 0.0 0.0 0.5" /> </material> </collision> <inertial> <mass value="0.02"/> <inertia ixx="0.000190416666667" ixy="0" ixz="0" iyy="0.0001904" iyz="0" izz="0.00036"/> </inertial> </link> <joint name="caster_joint" type="fixed"> <parent link="base_link" /> <child link="caster_link" /> <origin xyz="0.06 0.0 -0.076" /> <axis xyz="0 1 0" /> </joint> <gazebo reference="caster_link"> <material>Gazebo/Black</material> </gazebo> <gazebo reference="caster_link"> <mu1 value="0.0"/> <mu2 value="0.0"/> <kp value="1000000.0" /> <kd value="10.0" /> <!-- <fdir1 value="0 0 1"/> --> </gazebo> <gazebo> <plugin name='diff_drive' filename='libgazebo_ros_diff_drive.so'> <ros> <namespace>/</namespace> <remapping>cmd_vel:=cmd_vel</remapping> <remapping>odom:=odom</remapping> </ros> <update_rate>30</update_rate> <!-- wheels --> <!-- <left_joint>left_wheel_joint</left_joint> --> <!-- <right_joint>right_wheel_joint</right_joint> --> <left_joint>left_wheel_joint</left_joint> <right_joint>right_wheel_joint</right_joint> <!-- kinematics --> <wheel_separation>0.2</wheel_separation> <wheel_diameter>0.065</wheel_diameter> <!-- limits --> <max_wheel_torque>20</max_wheel_torque> <max_wheel_acceleration>1.0</max_wheel_acceleration> <!-- output --> <publish_odom>true</publish_odom> <publish_odom_tf>true</publish_odom_tf> <publish_wheel_tf>false</publish_wheel_tf> <odometry_frame>odom</odometry_frame> <robot_base_frame>base_footprint</robot_base_frame> </plugin> <plugin name="fishbot_joint_state" filename="libgazebo_ros_joint_state_publisher.so"> <ros> <remapping>~/out:=joint_states</remapping> </ros> <update_rate>30</update_rate> <joint_name>right_wheel_joint</joint_name> <joint_name>left_wheel_joint</joint_name> </plugin> </gazebo> <gazebo reference="laser_link"> <material>Gazebo/Black</material> </gazebo> <gazebo reference="imu_link"> <sensor name="imu_sensor" type="imu"> <plugin filename="libgazebo_ros_imu_sensor.so" name="imu_plugin"> <ros> <namespace>/</namespace> <remapping>~/out:=imu</remapping> </ros> <initial_orientation_as_reference>false</initial_orientation_as_reference> </plugin> <always_on>true</always_on> <update_rate>100</update_rate> <visualize>true</visualize> <imu> <angular_velocity> <x> <noise type="gaussian"> <mean>0.0</mean> <stddev>2e-4</stddev> <bias_mean>0.0000075</bias_mean> <bias_stddev>0.0000008</bias_stddev> </noise> </x> <y> <noise type="gaussian"> <mean>0.0</mean> <stddev>2e-4</stddev> <bias_mean>0.0000075</bias_mean> <bias_stddev>0.0000008</bias_stddev> </noise> </y> <z> <noise type="gaussian"> <mean>0.0</mean> <stddev>2e-4</stddev> <bias_mean>0.0000075</bias_mean> <bias_stddev>0.0000008</bias_stddev> </noise> </z> </angular_velocity> <linear_acceleration> <x> <noise type="gaussian"> <mean>0.0</mean> <stddev>1.7e-2</stddev> <bias_mean>0.1</bias_mean> <bias_stddev>0.001</bias_stddev> </noise> </x> <y> <noise type="gaussian"> <mean>0.0</mean> <stddev>1.7e-2</stddev> <bias_mean>0.1</bias_mean> <bias_stddev>0.001</bias_stddev> </noise> </y> <z> <noise type="gaussian"> <mean>0.0</mean> <stddev>1.7e-2</stddev> <bias_mean>0.1</bias_mean> <bias_stddev>0.001</bias_stddev> </noise> </z> </linear_acceleration> </imu> </sensor> </gazebo> <gazebo reference="laser_link"> <sensor name="laser_sensor" type="ray"> <always_on>true</always_on> <visualize>true</visualize> <update_rate>5</update_rate> <pose>0 0 0.075 0 0 0</pose> <ray> <scan> <horizontal> <samples>360</samples> <resolution>1.000000</resolution> <min_angle>0.000000</min_angle> <max_angle>6.280000</max_angle> </horizontal> </scan> <range> <min>0.120000</min> <max>3.5</max> <resolution>0.015000</resolution> </range> <noise> <type>gaussian</type> <mean>0.0</mean> <stddev>0.01</stddev> </noise> </ray> <plugin name="laserscan" filename="libgazebo_ros_ray_sensor.so"> <ros> <!-- <namespace>/tb3</namespace> --> <remapping>~/out:=scan</remapping> </ros> <output_type>sensor_msgs/LaserScan</output_type> <frame_name>laser_link</frame_name> </plugin> </sensor> </gazebo> </robot>
-
@小鱼 问题定位与解决方案:
使用rqt_tf_tree查看tf是否正常,发现map到base_footprint之间时间差距非常大。
问题原因:cartographer启动时为设置use_sim_time为True。
解决方案:
在launch后增加use_sim_time设置使用仿真时间源。
use_sim_time:=True
正确的TF如下:
-
-