ROS学习笔记,第一次发博,有点水水,嘿嘿

2019.4.16 ROS底层学习笔记
1.rosout是ROS中控制台日志报告机制的名称,这个节点用于收集和记录节点调试输出信息。*roslaunch目前还没有对节点的启动时间和顺序进行控制

2.导航功能包集配置:设上述所有需要的环境都已满足。机器人必须使用tf发布坐标帧,并从所有的传感器接收 sensor_msgs/LaserScan 或者 sensor_msgs/PointCloud 消息用于导航,同时需要使用 tf 和 nav_msgs/Odometry 消息发布导航消息,消息会以命令的形式下发给机器人底座。如果所需要的配置你都没有,请参见机器人配置。

问题汇总与解决:
1.map_server无法使用,直接用rosrun map_server map_server xx.ymal 测试一下 重装ros 先打开Linux的更新,然后删除与ROS相关的依赖项,重装ROS。

2.Timed out waiting for transform from base_link to map to become available before running costmap, tf error: canTransform: target_frame map does not exist. canTransform: source_frame base_link does not exist… canTransform returned after 0.100551 timeout was 0.1.通常是map节点和base_link节点没有链接起来 问题一般出在map_server.
古月居:在导航的时候map→odom→base_link这条tf的链必须是联通的,检查下tf是否有问题。

3.可视化的调试工具,可以生成pdf文件,来显示整棵tf树的信息。
$ rosrun tf view_frames
$ evince frames.pdf
 或使用rqt_tf_tree这是一个实时工具,观察在Ros上被发布的坐标系树,可用刷新按钮来更新树的内  容。与上一个工具的区别在于:上一个工具连续采样5s获得的树的内容,并存成一个图片;这个工具可以连续的观察树的内容,使用起来更方便。
$ rosrun rqt_tf_tree rqt_tf_tree

4.

5.launch文件中的前几行一般是参数变量,根据需要自行修改。

6.output=”screen”
带这个属性启动的节点会将标准输出信息显示在终端的窗口中,而不会保存在日志文件中。这也 解释了为什么这个带有output=”screen”的节点(node) 的日志文件在上面日志文件列表中丢失的原因。

7.1 launch文件中pkg 和 type 它们分别是:程序包名字和可执行文件的名字(文件名)
7.2 output = “screen”
Q: 如何将标准输出信息显示在终端(console)上?
A: 在 node 元素中使用 output 属性: output=”screen”
7.3 respawn=”true”
启动完所有请求启动的节点之后,roslaunch 监测每一个节点,让它们保持正常的运行状态。对于每一个节点,当它终止时,我们可以要求 roslaunch 重新启动它.
7.4 required=”true”
当一个必需的节点终止时,roslaunch会做出响应,终止其他所有的节点并退出它自己。
注意: 由于 required 属性和 respawn 属性的含义,所以如果你给单个的一个节点同时设置了这2个属性,roslaunch 命令会抱怨。所以不要这样设置。

  1. .rviz的文件是在rviz的配置文件,只要启动它,就不用每次在rviz添加 Model map这样的工具。 .rviz当然不是自己写的脚本,它是可以保存的

9.1启动机器人模型需要先启动这两个Node


9.2 然后导入robot_description的路径,即导入机器人urdf模型或者xacro模型

10.要建图必须启动建图的node节点 gmapping。

11.真正建图过程中这三个node之间的节点要建立正确才不会报错。



map-→odom-→base_link

12.启动gmapping 的时候要启动这两个节点(不包括打开rviz gazebo tf)

首先要启动机器人整体以及控制器
robot_state_publisher 启动Tf转化等
spawner 启动控制器
若要在rviz中看 则启动rviz节点
若要用键盘控制 则启动robot_teleop节点,用cpp文件
若要用gazebo 则启动 gazebo节点
不包括打开rviz gazebo tf

13.gmapping建出来的图是圆形(群里人回答的)
将算法里雷达最大测距改成比实际雷达测距小一点。在robot_gmapping.launch.xml中。不过没解决!

14.navigation包要启动map_server节点 amcl节点 move_base节点
首先要启动机器人整体以及控制器
robot_state_publisher 启动Tf转化等
spawner 启动控制器
若要在rviz中看 则启动rviz节点
若要用键盘控制 则启动robot_teleop节点,用cpp文件
若要用gazebo 则启动 gazebo节点
不包括打开rviz gazebo tf

和slam最大区别在mapserver、amcl、gmaping

15…The map that you created is a static map. This means that the map will always stay as it was when you created it.
The map that you created is a 2D Map. This means that, the obstacles that appear on the map don’t have height.
创建的地图是静态的并且是2D的,没有高度。

16.For the slam_gmapping node to work properly, you will need to provide 2 transforms:
laser -> base_link:
base_link -> odom
这三个frame的链接一点要正确,否则容易报错。

17…There are basically 2 ways of publishing a transform:
Use a static_transform_publisher
Use a transform broadcaster
In this Course, we’ll use the static_transform_publisher, since it’s the fastest way. The static_transform_publisher is a ready-to-use node that allows us to directly publish a transform by simply using the command line.

18.Laser Parameters
maxRange (float): Sets the maximum range of the laser. Set this value to something slightly higher than the real sensor’s maximum range.

19.第四节中有介绍如何让机器人 连续导航到3个位置。Exercise4.4

20.There exist 2 types of costmaps: global costmap and local costmap. The main difference between them is, basically, the way they are built:
The global costmap is created from a static map.
The local costmap is created from the robot’s sensor readings.
在地图在中放入新的物体,全局代价地图无法识别出新的物体,因为他是有map_server中的static_map提供的,而局部代价地图可以识别出,因为他是有laser的数据建立出来的。

21.local costmap does detect new objects that appear in the simulation, while the global costmap doesn’t.局部代价地图可以侦查出新物体,而全局地图不行。

22.在导航的包里面 我得关心用的是哪种 全局路径规划器和局部路径规划器
同时认真看一下代价地图的颜色和配置情况 layer的情况

23.Summarizing, this is how the whole path planning method goes:
After getting the current position of the robot, we can send a goal position to the move_base node. This node will then send this goal position to a global planner which will plan a path from the current robot position to the goal position. This plan is in respect to the global costmap, which is feeding from the map server.
The global planner will then send this path to the local planner, which executes each segment of the global plan. The local planner gets the odometry and the laser data values and finds a collision-free local plan for the robot. The local planner is associated with the local costmap, which can monitor the obstacle(s) around the robot. The local planner generates the velocity commands and sends them to the base controller. The robot base controller will then convert these commands into real robot movement.
If the robot is stuck somewhere, the recovery behavior nodes, such as the clear costmap recovery or rotate recovery, will be called.
Now everything makes more sense, right?

24.You can also change dynamic parameters by using the rqt_reconfigure tool.

25.AMCl整个图好好看看!

你可能感兴趣的:(ROS)