Open OuyangJunyuan opened 3 years ago
问题1:使用rosrun qrt_tf_tree qrt_tf_tree 查看tf树是否正确。gmapping需要用户指定scan-base_link-odom,然后根据scan的信息,做slam后mapping然后发布odom相对于map的dynamic_tf。所以还需要指定正确tf树即可。可以通过代码指定也可以用launch文件来指定。具体查看其他issue或如下:
<node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="0.20 0 0 0 0 0 base_link laser 50" />
```c++
geometry_msgs::TransformStamped static_transformStamped;
static_transformStamped.header.stamp = ros::Time::now();
static_transformStamped.header.frame_id = "odom";
static_transformStamped.child_frame_id = "base_link";
static_transformStamped.transform.translation.x = 0;
static_transformStamped.transform.translation.y = 0;
static_transformStamped.transform.translation.z = 0;
tf2::Quaternion quat;
quat.setRPY(0,0,0);
static_transformStamped.transform.rotation.x = quat.x();
static_transformStamped.transform.rotation.y = quat.y();
static_transformStamped.transform.rotation.z = quat.z();
static_transformStamped.transform.rotation.w = quat.w();
static_broadcaster.sendTransform(static_transformStamped);
static_transformStamped.header.stamp = ros::Time::now();
static_transformStamped.header.frame_id = "base_link";
static_transformStamped.child_frame_id = "TricycleSensor/Hokuyo_URG_04LX";
static_broadcaster.sendTransform(static_transformStamped);
```
rosrun gmapping slam_gmapping scan:=/TricycleSensor/Hokuyo_URG_04LX/laser_scan/layer0 _linearUpdata:=0 _angularUpdate:=0
问题2:只有第一帧地图,是因为gmapping只进行了初始化后的第一次建图,没有后续迭代。原因是,默认参数中linearUpdata和angularUpdate用来判定机器人运动的阈值,两帧之间运动达到阈值后,才判定进行下一次迭代建图。因此可以把这两个值设置成合理的值,比如小一点,否则机器人动了很多或者地图变化很大了才建图。或者直接设置成0,意味着一直进行建图
问题1:现象是启动rosrun gmapping slam_gmapping 后没有什么现象,或者说按提示输出debug信息或直接显示 odom还是target 有问题。 问题2:启动后初始化成功,但是只有第一帧地图,机器人动后没有后续地图更新