ros学习笔记(cartographer系列)

 

如何进行多机的网络设置

网络设置

http://wiki.ros.org/ROS/NetworkSetup

http://wiki.ros.org/ROS/Tutorials/MultipleMachines

一般来说,我们把ROS Master设置在机器人上。

需要在机器人的.bashrc文件中加入

export ROS_MASTER_URI=http://localhost:11311

export ROS_IP=192.168.xxx.xxx

或者用正则表达

export ROS_IP=`hostname -I`

在有IPv6的情况下,需要用

export ROS_IP=`hostname -I | cut -d " " -f 1`

可以将``中的内容放在终端下测试。

因为localhost是127.0.0.1,并不能作为在roscore上注册的地址,外部机器不能访问该IP。

在自己电脑上的.bashrc需要配置

如果路由器可以解析的话

export ROS_MASTER_URI=http://<hostname>:11311

比较安全的做法,查看机器人的IP (有的机器人会把端口号设置成其他的端口,但是这种不常见)

export ROS_MASTER_URI=http://192.168.xxx.xxx:11311

ROS_IP的设置同机器人,常用写法是

export ROS_IP=`hostname -I`

 

HectorSLAM的launch文件配置

 

 

depthimage_to_laserscan的调用

 

cartographer

https://google-cartographer.readthedocs.io/en/latest/

https://google-cartographer-ros.readthedocs.io/en/latest/

 

安装

#原ceres-solver下载需要科学上网

git: {local-name: ceres-solver, uri: 'https://ceres-solver.googlesource.com/ceres-solver.git', version: '1.12.0'}

#可以更改为

git: {local-name: ceres-solver, uri: 'https://github.com/ceres-solver/ceres-solver', version: '1.12.0'}

 

数据包

德意志博物馆Demo的bag文件

链接:https://pan.baidu.com/s/1A3zhKvk4TTxlvp6EBdburw 密码:4q22

 

 

launch文件样例

<launch>

  <param name="/use_sim_time" value="false" />

  <node name="cartographer_node" pkg="cartographer_ros"

      type="cartographer_node" args="

          -configuration_directory $(find bobac_map)/configuration_files

          -configuration_basename bobac_map.lua"

      output="screen">

    <remap from="/odom" to="/odom"/>

<remap from="/scan" to="/scan"/>

  </node>

  <node name="cartographer_occupancy_grid_node" pkg="cartographer_ros"

      type="cartographer_occupancy_grid_node" args="-resolution 0.05" />

  <node name="rviz" pkg="rviz" type="rviz" required="true"

      args="-d $(find bobac_map)/configuration_files/demo_2d.rviz" />

</launch>

 

lua脚本样例

include "map_builder.lua"

include "trajectory_builder.lua"

options = {

  map_builder = MAP_BUILDER,

  trajectory_builder = TRAJECTORY_BUILDER,

  map_frame = "map",

  tracking_frame = "base_link", -- 可以是base_link或者base_footprint

  published_frame = "base_footprint",

  odom_frame = "odom",

  provide_odom_frame = true,

  publish_frame_projected_to_2d = false,

  use_odometry = true,

  use_nav_sat = false,

  use_landmarks = false,

  num_laser_scans = 1,

  num_multi_echo_laser_scans = 0,

  num_subdivisions_per_laser_scan = 1,

  num_point_clouds = 0,

  lookup_transform_timeout_sec = 0.2,

  submap_publish_period_sec = 0.3,

  pose_publish_period_sec = 5e-3,

  trajectory_publish_period_sec = 30e-3,

  rangefinder_sampling_ratio = 1.,

  odometry_sampling_ratio = 1.,

  fixed_frame_pose_sampling_ratio = 1.,

  imu_sampling_ratio = 1.,

  landmarks_sampling_ratio = 1.,

}

MAP_BUILDER.use_trajectory_builder_2d = true

TRAJECTORY_BUILDER_2D.submaps.num_range_data = 35

TRAJECTORY_BUILDER_2D.min_range = 0.3

TRAJECTORY_BUILDER_2D.max_range = 9.6

TRAJECTORY_BUILDER_2D.missing_data_ray_length = 1.

TRAJECTORY_BUILDER_2D.use_imu_data = false

TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true

TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.linear_search_window = 0.1

TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.translation_delta_cost_weight = 10.

TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.rotation_delta_cost_weight = 1e-1

POSE_GRAPH.optimization_problem.huber_scale = 1e2

POSE_GRAPH.optimize_every_n_nodes = 35

POSE_GRAPH.constraint_builder.min_score = 0.65

return options

 

保存地图

下载 kinetic-devel 分支下的 map_server。编译后遮蔽原 map_server功能包

cd ~/catkin_ws/src

svn checkout https://github.com/ros-planning/navigation/branches/kinetic-devel/map_server

cd ..

catkin_make

地图建立完成后

rosrun map_server map_saver --occ 51 --free 49 -f test_carto_map

在当前目录下会生成

test_carto_map.yaml和test_carto_map.pgm

 

导航配置与参数调整

局部规划器的替换

需要将参数/move_base/base_local_planner设置为:

轨迹展开法:

base_local_planner/TrajectoryPlannerROS

时间弹性带法

teb_local_planner/TebLocalPlannerROS

动态窗口法:

dwa_local_planner/DWAPlannerROS

参数描述以及关键参数

猜你喜欢

转载自blog.csdn.net/qq_42145185/article/details/81712625