laser_scan_matcher 的 tos tf 设置 vrep/scan 和 slam
tos tf setting for laser_scan_matcher with vrep/scan and slam
我正在我的环境中尝试这个。
我得到了一个模拟环境:
主题:vrep/scan
使用 TF:base_link -> laser_link
那我就用laser_scan_matcher
我得到了 TF:地图 -> 奥多姆。
我需要来自 odom 的 TF -> laser_link 用于 gmapping SLAM。
但我没有弄清楚如何创建这样的link。
我的启动文件如下:
<launch>
<node pkg="laser_scan_matcher" type="laser_scan_matcher_node"
name="laser_scan_matcher_node" output="screen">
<param name="scan" value = "/vrep/scan"/>
<param name="fixed_frame" value = "odom"/>
<param name="use_alpha_beta" value="true"/>
<param name="max_iterations" value="10"/>
</node>
<node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
<param name="scan" value = "/vrep/scan"/>
<param name="map_udpate_interval" value="1.0"/>
<param name="delta" value="0.02"/>
</node>
</launch>
我读了这个,但我还是想不通。
https://answers.ros.org/question/10909/combining-laser_scan_matcher-with-gmapping/
或者我的问题实际上是如何使用正确的启动文件将 odom 连接到 baselink?
非常感谢提示。
roslaunch
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://ros-vm:38189/
SUMMARY
========
PARAMETERS
* /laser_scan_matcher_node/fixed_frame: odom
* /laser_scan_matcher_node/max_iterations: 10
* /laser_scan_matcher_node/publish_odom: True
* /laser_scan_matcher_node/scan: /vrep/scan
* /laser_scan_matcher_node/use_alpha_beta: True
* /laser_scan_matcher_node/use_odom: True
* /rosdistro: melodic
* /rosversion: 1.14.5
* /slam_gmapping/delta: 0.02
* /slam_gmapping/map_udpate_interval: 1.0
* /slam_gmapping/scan: /vrep/scan
NODES
/
laser_scan_matcher_node (laser_scan_matcher/laser_scan_matcher_node)
slam_gmapping (gmapping/slam_gmapping)
ROS_MASTER_URI=http://localhost:11311
process[laser_scan_matcher_node-1]: started with pid [7540]
process[slam_gmapping-2]: started with pid [7545]
[ INFO] [1589974736.966492078]: Starting LaserScanMatcher
日志:
rosnode info laser_scan_matcher_node
--------------------------------------------------------------------------------
Node [/laser_scan_matcher_node]
Publications:
* /pose2D [geometry_msgs/Pose2D]
* /rosout [rosgraph_msgs/Log]
* /tf [tf2_msgs/TFMessage]
Subscriptions:
* /clock [rosgraph_msgs/Clock]
* /imu/data [unknown type]
* /odom [unknown type]
* /scan [unknown type]
* /tf [tf2_msgs/TFMessage]
* /tf_static [unknown type]
Services:
* /laser_scan_matcher_node/get_loggers
* /laser_scan_matcher_node/set_logger_level
contacting node http://ros-vm:34349/ ...
Pid: 7062
Connections:
* topic: /rosout
* to: /rosout
* direction: outbound (35035 - 10.0.2.15:52152) [17]
* transport: TCPROS
* topic: /tf
* to: /laser_scan_matcher_node
* direction: outbound
* transport: INTRAPROCESS
* topic: /tf
* to: /rqt_gui_py_node_6989
* direction: outbound (35035 - 10.0.2.15:52134) [14]
* transport: TCPROS
* topic: /tf
* to: /slam_gmapping
* direction: outbound (35035 - 10.0.2.15:52164) [11]
* transport: TCPROS
* topic: /clock
* to: /vrep_ros_interface (http://ros-vm:35741/)
* direction: inbound (56132 - ros-vm:60019) [12]
* transport: TCPROS
* topic: /tf
* to: /laser_scan_matcher_node (http://ros-vm:34349/)
* direction: inbound
* transport: INTRAPROCESS
* topic: /tf
* to: /vrep_ros_interface (http://ros-vm:35741/)
* direction: inbound (56134 - ros-vm:60019) [18]
* transport: TCPROS
* topic: /tf
* to: /slam_gmapping (http://ros-vm:38313/)
* direction: inbound (60954 - ros-vm:54021) [10]
* transport: TCPROS
rostopic list -v
Published topics:
* /map_metadata [nav_msgs/MapMetaData] 1 publisher
* /vrep/image [sensor_msgs/Image] 1 publisher
* /vrep/scan [sensor_msgs/LaserScan] 1 publisher
* /pose2D [geometry_msgs/Pose2D] 1 publisher
* /rosout [rosgraph_msgs/Log] 4 publishers
* /tf [tf2_msgs/TFMessage] 3 publishers
* /clock [rosgraph_msgs/Clock] 1 publisher
* /rosout_agg [rosgraph_msgs/Log] 1 publisher
* /map [nav_msgs/OccupancyGrid] 1 publisher
* /slam_gmapping/entropy [std_msgs/Float64] 1 publisher
rosnode list
/laser_scan_matcher_node
/rosout
/rqt_gui_py_node_6989
/slam_gmapping
/vrep_ros_interface
从rosnode info laser_scan_matcher_node
可以看出,该节点订阅了主题scan
。
在 rostopic list -v
的输出中没有该主题的发布者。该命令还列出了您未包含在问题中的订阅者。您尝试在启动文件中设置的主题 /vrep/scan
有一个发布者。从理论上讲,可以使用参数来提供 input/output 主题,但这必须在节点中实现。通常这不是必需的,所以大多数节点可能不会这样做。
您需要在启动文件中使用 remap 标签而不是 param 标签来重新映射主题。 Roslaunch XML wiki.
你的启动文件应该是这样的,扫描参数替换为重新映射:
<launch>
<node pkg="laser_scan_matcher" type="laser_scan_matcher_node"
name="laser_scan_matcher_node" output="screen">
<remap from="scan" to="/vrep/scan"/>
<param name="fixed_frame" value = "odom"/>
<param name="use_alpha_beta" value="true"/>
<param name="max_iterations" value="10"/>
</node>
<node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
<remap from="scan" to="/vrep/scan"/>
<param name="map_udpate_interval" value="1.0"/>
<param name="delta" value="0.02"/>
</node>
</launch>
不确定这是否会解决您的所有问题。
此外 to="/vrep/scan"
中的前导 /
在重新映射主题时非常重要,需要一些时间来适应,我建议阅读 this page 以了解一些内容正在那里进行。 from="scan"
中缺失的前导 /
同样重要。
进行此更改后,检查 slam_gmapping
和 laser_scan_matcher_node
节点是否都订阅了 /vrep/scan
rosnode info ...
我正在我的环境中尝试这个。
我得到了一个模拟环境:
主题:vrep/scan
使用 TF:base_link -> laser_link
那我就用laser_scan_matcher
我得到了 TF:地图 -> 奥多姆。
我需要来自 odom 的 TF -> laser_link 用于 gmapping SLAM。
但我没有弄清楚如何创建这样的link。
我的启动文件如下:
<launch>
<node pkg="laser_scan_matcher" type="laser_scan_matcher_node"
name="laser_scan_matcher_node" output="screen">
<param name="scan" value = "/vrep/scan"/>
<param name="fixed_frame" value = "odom"/>
<param name="use_alpha_beta" value="true"/>
<param name="max_iterations" value="10"/>
</node>
<node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
<param name="scan" value = "/vrep/scan"/>
<param name="map_udpate_interval" value="1.0"/>
<param name="delta" value="0.02"/>
</node>
</launch>
我读了这个,但我还是想不通。 https://answers.ros.org/question/10909/combining-laser_scan_matcher-with-gmapping/
或者我的问题实际上是如何使用正确的启动文件将 odom 连接到 baselink?
roslaunch
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://ros-vm:38189/
SUMMARY
========
PARAMETERS
* /laser_scan_matcher_node/fixed_frame: odom
* /laser_scan_matcher_node/max_iterations: 10
* /laser_scan_matcher_node/publish_odom: True
* /laser_scan_matcher_node/scan: /vrep/scan
* /laser_scan_matcher_node/use_alpha_beta: True
* /laser_scan_matcher_node/use_odom: True
* /rosdistro: melodic
* /rosversion: 1.14.5
* /slam_gmapping/delta: 0.02
* /slam_gmapping/map_udpate_interval: 1.0
* /slam_gmapping/scan: /vrep/scan
NODES
/
laser_scan_matcher_node (laser_scan_matcher/laser_scan_matcher_node)
slam_gmapping (gmapping/slam_gmapping)
ROS_MASTER_URI=http://localhost:11311
process[laser_scan_matcher_node-1]: started with pid [7540]
process[slam_gmapping-2]: started with pid [7545]
[ INFO] [1589974736.966492078]: Starting LaserScanMatcher
日志:
rosnode info laser_scan_matcher_node
--------------------------------------------------------------------------------
Node [/laser_scan_matcher_node]
Publications:
* /pose2D [geometry_msgs/Pose2D]
* /rosout [rosgraph_msgs/Log]
* /tf [tf2_msgs/TFMessage]
Subscriptions:
* /clock [rosgraph_msgs/Clock]
* /imu/data [unknown type]
* /odom [unknown type]
* /scan [unknown type]
* /tf [tf2_msgs/TFMessage]
* /tf_static [unknown type]
Services:
* /laser_scan_matcher_node/get_loggers
* /laser_scan_matcher_node/set_logger_level
contacting node http://ros-vm:34349/ ...
Pid: 7062
Connections:
* topic: /rosout
* to: /rosout
* direction: outbound (35035 - 10.0.2.15:52152) [17]
* transport: TCPROS
* topic: /tf
* to: /laser_scan_matcher_node
* direction: outbound
* transport: INTRAPROCESS
* topic: /tf
* to: /rqt_gui_py_node_6989
* direction: outbound (35035 - 10.0.2.15:52134) [14]
* transport: TCPROS
* topic: /tf
* to: /slam_gmapping
* direction: outbound (35035 - 10.0.2.15:52164) [11]
* transport: TCPROS
* topic: /clock
* to: /vrep_ros_interface (http://ros-vm:35741/)
* direction: inbound (56132 - ros-vm:60019) [12]
* transport: TCPROS
* topic: /tf
* to: /laser_scan_matcher_node (http://ros-vm:34349/)
* direction: inbound
* transport: INTRAPROCESS
* topic: /tf
* to: /vrep_ros_interface (http://ros-vm:35741/)
* direction: inbound (56134 - ros-vm:60019) [18]
* transport: TCPROS
* topic: /tf
* to: /slam_gmapping (http://ros-vm:38313/)
* direction: inbound (60954 - ros-vm:54021) [10]
* transport: TCPROS
rostopic list -v
Published topics:
* /map_metadata [nav_msgs/MapMetaData] 1 publisher
* /vrep/image [sensor_msgs/Image] 1 publisher
* /vrep/scan [sensor_msgs/LaserScan] 1 publisher
* /pose2D [geometry_msgs/Pose2D] 1 publisher
* /rosout [rosgraph_msgs/Log] 4 publishers
* /tf [tf2_msgs/TFMessage] 3 publishers
* /clock [rosgraph_msgs/Clock] 1 publisher
* /rosout_agg [rosgraph_msgs/Log] 1 publisher
* /map [nav_msgs/OccupancyGrid] 1 publisher
* /slam_gmapping/entropy [std_msgs/Float64] 1 publisher
rosnode list
/laser_scan_matcher_node
/rosout
/rqt_gui_py_node_6989
/slam_gmapping
/vrep_ros_interface
从rosnode info laser_scan_matcher_node
可以看出,该节点订阅了主题scan
。
在 rostopic list -v
的输出中没有该主题的发布者。该命令还列出了您未包含在问题中的订阅者。您尝试在启动文件中设置的主题 /vrep/scan
有一个发布者。从理论上讲,可以使用参数来提供 input/output 主题,但这必须在节点中实现。通常这不是必需的,所以大多数节点可能不会这样做。
您需要在启动文件中使用 remap 标签而不是 param 标签来重新映射主题。 Roslaunch XML wiki.
你的启动文件应该是这样的,扫描参数替换为重新映射:
<launch>
<node pkg="laser_scan_matcher" type="laser_scan_matcher_node"
name="laser_scan_matcher_node" output="screen">
<remap from="scan" to="/vrep/scan"/>
<param name="fixed_frame" value = "odom"/>
<param name="use_alpha_beta" value="true"/>
<param name="max_iterations" value="10"/>
</node>
<node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
<remap from="scan" to="/vrep/scan"/>
<param name="map_udpate_interval" value="1.0"/>
<param name="delta" value="0.02"/>
</node>
</launch>
不确定这是否会解决您的所有问题。
此外 to="/vrep/scan"
中的前导 /
在重新映射主题时非常重要,需要一些时间来适应,我建议阅读 this page 以了解一些内容正在那里进行。 from="scan"
中缺失的前导 /
同样重要。
进行此更改后,检查 slam_gmapping
和 laser_scan_matcher_node
节点是否都订阅了 /vrep/scan
rosnode info ...