参考《ROS by Example _ Hydro _ Vol1》书中所述,实现到“7.5 Sending Twist Messages to a Real Robot”
中间的过程就按书中来进行即可。涉及到的比如设备驱动、ROS网络配置 等内容可参考本博客前的相关文章。
这里调用的顺序是什么?启动了哪些nodes? 参数是如何设置的?
我们运行了-v 选项的 roslaunch 命令以后,得到如下的状态打印:一行行来分析
$ roslaunch -v rbx1_bringup turtlebot_minimal_create.launch ... logging to /home/exbot/.ros/log/d0c59c34-8dba-11e5-a599-a021b74eea2b/roslaunch-my_robot1-10296.log //这是加载日志文件 Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB. ... loading XML file [/opt/ros/hydro/etc/ros/roscore.xml] //第一个加载的xml文件,是运行roscore, 略过。 ... executing command param [rosversion roslaunch] Added parameter [/rosversion] ... executing command param [rosversion -d] Added parameter [/rosdistro] // 前面这几行都是获取 ROS 的版本 = hydro Added core node of type [rosout/rosout] in namespace [/] ... loading XML file [/home/exbot/catkin_ws/src/rbx1/rbx1_bringup/launch/turtlebot_minimal_create.launch] //1.从这里开始加载launch文件了 Added parameter [/use_sim_time] //上一个文件的第8行“<param name="/use_sim_time" value="$(arg simulation)"/>”,开始设置参数值。 ... loading XML file [/opt/ros/hydro/share/turtlebot_bringup/launch/includes/robot.launch.xml] // 2.加载robot.launch.xml 文件 ... loading XML file [/opt/ros/hydro/share/turtlebot_bringup/launch/includes/description.launch.xml] // 3.加载description.launch.xml文件 ... executing command param [/opt/ros/hydro/share/xacro/xacro.py '/opt/ros/hydro/share/turtlebot_description/robots/create_circles_kinect.urdf.xacro'] Added parameter [/robot_description] ... done importing include file [/opt/ros/hydro/share/turtlebot_bringup/launch/includes/description.launch.xml] Added parameter [/robot/name] //来自:【loading XML file [/opt/ros/hydro/share/turtlebot_bringup/launch/includes/robot.launch.xml]】 Added parameter [/robot/type] //来自:【loading XML file [/opt/ros/hydro/share/turtlebot_bringup/launch/includes/robot.launch.xml]】 Added parameter [/robot_state_publisher/publish_frequency] Added node of type [robot_state_publisher/robot_state_publisher] in namespace [/] //在【launch/includes/robot.launch.xml】文件中启动node:[robot_state_publisher] Added parameter [/diagnostic_aggregator/analyzers/digital_io/path] //【载入pkg=diagnostic_aggregator nodename=diagnostic_aggregator,载入参数文件/opt/ros/hydro/share/turtlebot_bringup/param/create/diagnostics.yaml】 Added parameter [/diagnostic_aggregator/analyzers/digital_io/type]//1【参数文件中path,type,timeout,startswitch】 Added parameter [/diagnostic_aggregator/analyzers/digital_io/timeout] Added parameter [/diagnostic_aggregator/analyzers/digital_io/startswith] Added parameter [/diagnostic_aggregator/analyzers/sensors/path] //2【参数文件中path,type,timeout,startswitch】 Added parameter [/diagnostic_aggregator/analyzers/sensors/type] Added parameter [/diagnostic_aggregator/analyzers/sensors/timeout] Added parameter [/diagnostic_aggregator/analyzers/sensors/startswith] Added parameter [/diagnostic_aggregator/analyzers/nodes/path] //3【参数文件中path,type,timeout,CONTAINS】 Added parameter [/diagnostic_aggregator/analyzers/nodes/contains] Added parameter [/diagnostic_aggregator/analyzers/nodes/type] Added parameter [/diagnostic_aggregator/analyzers/nodes/timeout] Added parameter [/diagnostic_aggregator/analyzers/power/path] //4【参数文件中path,type,timeout,startswitch】 Added parameter [/diagnostic_aggregator/analyzers/power/type] Added parameter [/diagnostic_aggregator/analyzers/power/timeout] Added parameter [/diagnostic_aggregator/analyzers/power/startswith] Added parameter [/diagnostic_aggregator/analyzers/mode/path] //5【参数文件中path,type,timeout,startswitch】 Added parameter [/diagnostic_aggregator/analyzers/mode/type] Added parameter [/diagnostic_aggregator/analyzers/mode/timeout] Added parameter [/diagnostic_aggregator/analyzers/mode/startswith] Added parameter [/diagnostic_aggregator/pub_rate] //6【参数文件中pub_rate,base_path,timeout,CONTAINS】 Added parameter [/diagnostic_aggregator/base_path] Added node of type [diagnostic_aggregator/aggregator_node] in namespace [/] //相关参数载入完成,在【launch/includes/robot.launch.xml】文件中启动node:[diagnostic_aggregator] ... done importing include file [/opt/ros/hydro/share/turtlebot_bringup/launch/includes/robot.launch.xml] //完成:【loading XML file [/opt/ros/hydro/share/turtlebot_bringup/launch/includes/robot.launch.xml]】完成载入 //进入:【loading XML file [/home/exbot/catkin_ws/src/rbx1/rbx1_bringup/launch/includes/tb_create_mobile_base.launch.xml]】 ... loading XML file [/home/exbot/catkin_ws/src/rbx1/rbx1_bringup/launch/includes/tb_create_mobile_base.launch.xml] Added parameter [/turtlebot_node/bonus] Added parameter [/turtlebot_node/update_rate] Added parameter [/turtlebot_node/port] Added node of type [create_node/turtlebot_node.py] in namespace [/] //相关参数载入完成,在【tb_create_mobile_base.launch.xml】文件中启动node:[create_node/turtlebot_node.py] Added node of type [create_node/kinect_breaker_enabler.py] in namespace [/] // 载入 node: kinect_breaker_enabler.py Added parameter [/robot_pose_ekf/freq] Added parameter [/robot_pose_ekf/sensor_timeout] Added parameter [/robot_pose_ekf/publish_tf] Added parameter [/robot_pose_ekf/odom_used] Added parameter [/robot_pose_ekf/imu_used] Added parameter [/robot_pose_ekf/vo_used] Added parameter [/robot_pose_ekf/output_frame] Added node of type [robot_pose_ekf/robot_pose_ekf] in namespace [/] //【载入node】: pkg="robot_pose_ekf" type="robot_pose_ekf" name="robot_pose_ekf" Added node of type [nodelet/nodelet] in namespace [/] //【载入node】//node pkg="nodelet" type="nodelet" name="mobile_base_nodelet_manager" args="manager" Added parameter [/cmd_vel_mux/yaml_cfg_file] //[param name="yaml_cfg_file" value="$(find turtlebot_bringup)/param/mux.yaml"] //# Configuration for subscribers to multiple cmd_vel sources. //filepath: /opt/ros/hydro/share/turtlebot_bringup/param/mux.yaml Added node of type [nodelet/nodelet] in namespace [/] //【载入node】pkg="nodelet" type="nodelet" name="cmd_vel_mux" ... done importing include file [/home/exbot/catkin_ws/src/rbx1/rbx1_bringup/launch/includes/tb_create_mobile_base.launch.xml] ... loading XML file [/opt/ros/hydro/share/turtlebot_bringup/launch/includes/netbook.launch.xml] //【进入[netbook.launch.xml]文件】 Added parameter [/turtlebot_laptop_battery/acpi_path] Added node of type [linux_hardware/laptop_battery.py] in namespace [/] //【载入node】pkg="linux_hardware" type="laptop_battery.py" name="turtlebot_laptop_battery" ... done importing include file [/opt/ros/hydro/share/turtlebot_bringup/launch/includes/netbook.launch.xml] started roslaunch server http://my_robot1:58659/ SUMMARY ======== PARAMETERS * /cmd_vel_mux/yaml_cfg_file * /diagnostic_aggregator/analyzers/digital_io/path * /diagnostic_aggregator/analyzers/digital_io/startswith * /diagnostic_aggregator/analyzers/digital_io/timeout * /diagnostic_aggregator/analyzers/digital_io/type * /diagnostic_aggregator/analyzers/mode/path * /diagnostic_aggregator/analyzers/mode/startswith * /diagnostic_aggregator/analyzers/mode/timeout * /diagnostic_aggregator/analyzers/mode/type * /diagnostic_aggregator/analyzers/nodes/contains * /diagnostic_aggregator/analyzers/nodes/path * /diagnostic_aggregator/analyzers/nodes/timeout * /diagnostic_aggregator/analyzers/nodes/type * /diagnostic_aggregator/analyzers/power/path * /diagnostic_aggregator/analyzers/power/startswith * /diagnostic_aggregator/analyzers/power/timeout * /diagnostic_aggregator/analyzers/power/type * /diagnostic_aggregator/analyzers/sensors/path * /diagnostic_aggregator/analyzers/sensors/startswith * /diagnostic_aggregator/analyzers/sensors/timeout * /diagnostic_aggregator/analyzers/sensors/type * /diagnostic_aggregator/base_path * /diagnostic_aggregator/pub_rate * /robot/name * /robot/type * /robot_description * /robot_pose_ekf/freq * /robot_pose_ekf/imu_used * /robot_pose_ekf/odom_used * /robot_pose_ekf/output_frame * /robot_pose_ekf/publish_tf * /robot_pose_ekf/sensor_timeout * /robot_pose_ekf/vo_used * /robot_state_publisher/publish_frequency * /rosdistro * /rosversion * /turtlebot_laptop_battery/acpi_path * /turtlebot_node/bonus * /turtlebot_node/port * /turtlebot_node/update_rate * /use_sim_time NODES / cmd_vel_mux (nodelet/nodelet) diagnostic_aggregator (diagnostic_aggregator/aggregator_node) kinect_breaker_enabler (create_node/kinect_breaker_enabler.py) mobile_base_nodelet_manager (nodelet/nodelet) robot_pose_ekf (robot_pose_ekf/robot_pose_ekf) robot_state_publisher (robot_state_publisher/robot_state_publisher) turtlebot_laptop_battery (linux_hardware/laptop_battery.py) turtlebot_node (create_node/turtlebot_node.py) auto-starting new master process[master]: started with pid [10313] ROS_MASTER_URI=http://my_robot1:11311 setting /run_id to d0c59c34-8dba-11e5-a599-a021b74eea2b process[rosout-1]: started with pid [10326] started core service [/rosout] process[robot_state_publisher-2]: started with pid [10339] process[diagnostic_aggregator-3]: started with pid [10360] process[turtlebot_node-4]: started with pid [10379] process[kinect_breaker_enabler-5]: started with pid [10443] process[robot_pose_ekf-6]: started with pid [10447] process[mobile_base_nodelet_manager-7]: started with pid [10487] process[cmd_vel_mux-8]: started with pid [10508] process[turtlebot_laptop_battery-9]: started with pid [10541]
这里我逐层来分析launch 文件:
【turtlebot_minimal_create.launch】 <arg name="base" default="create"/> <!-- create, rhoomba --> <arg name="battery" default="$(optenv TURTLEBOT_BATTERY /proc/acpi/battery/BAT0)"/> <!-- /proc/acpi/battery/BAT0 --> <arg name="stacks" default="circles"/> <!-- circles, hexagons --> <arg name="3d_sensor" default="kinect"/> <!-- kinect, asus_xtion_pro --> <arg name="simulation" default="$(optenv TURTLEBOT_SIMULATION false)"/> <param name="/use_sim_time" value="$(arg simulation)"/> <include file="$(find turtlebot_bringup)/launch/includes/robot.launch.xml"> <arg name="base" value="$(arg base)" /> <arg name="stacks" value="$(arg stacks)" /> <arg name="3d_sensor" value="$(arg 3d_sensor)" /> </include> 【loading XML file [/opt/ros/hydro/share/turtlebot_bringup/launch/includes/robot.launch.xml]】 <arg name="base"/> <arg name="stacks"/> <arg name="3d_sensor"/> <include file="$(find turtlebot_bringup)/launch/includes/description.launch.xml"> <arg name="base" value="$(arg base)" /> <arg name="stacks" value="$(arg stacks)" /> <arg name="3d_sensor" value="$(arg 3d_sensor)" /> </include> 【loading XML file [/opt/ros/hydro/share/turtlebot_bringup/launch/includes/description.launch.xml]】 <arg name="base"/> <arg name="stacks"/> <arg name="3d_sensor"/> <arg name="urdf_file" default="$(find xacro)/xacro.py '$(find turtlebot_description)/robots/$(arg base)_$(arg stacks)_$(arg 3d_sensor).urdf.xacro'" /> <param name="robot_description" command="$(arg urdf_file)" /> 【[/opt/ros/hydro/share/xacro/xacro.py '/opt/ros/hydro/share/turtlebot_description/robots/create_circles_kinect.urdf.xacro']】 用Xacro 来清空 urdf文件。 Using Xacro to Clean Up a URDF File - ROS ... 【/opt/ros/hydro/share/xacro/xacro.py】 【/opt/ros/hydro/share/turtlebot_description/robots/create_circles_kinect.urdf.xacro】 <?xml version="1.0"?> <!-- - Base : create - Stacks : circles - 3d Sensor : kinect --> <robot name="turtlebot" xmlns:xacro="http://ros.org/wiki/xacro"> <xacro:include filename="$(find turtlebot_description)/urdf/turtlebot_library.urdf.xacro" /> <create/> <stack_circles parent="base_link"/> <sensor_kinect parent="base_link"/> </robot> 【/opt/ros/hydro/share/turtlebot_description/urdf/turtlebot_library.urdf.xacro】 <?xml version="1.0"?> <!-- The complete turtlebot library of xacros for easy reference --> <robot xmlns:xacro="http://ros.org/wiki/xacro"> <!-- General --> <xacro:include filename="$(find turtlebot_description)/urdf/common_properties.urdf.xacro"/> <xacro:include filename="$(find turtlebot_description)/urdf/turtlebot_properties.urdf.xacro"/> <!-- Bases --> <xacro:include filename="$(find create_description)/urdf/create.urdf.xacro"/> <xacro:include filename="$(find kobuki_description)/urdf/kobuki.urdf.xacro" /> <!-- Stacks --> <xacro:include filename="$(find turtlebot_description)/urdf/stacks/circles.urdf.xacro"/> <xacro:include filename="$(find turtlebot_description)/urdf/stacks/hexagons.urdf.xacro"/> <!-- 3D Sensors --> <xacro:include filename="$(find turtlebot_description)/urdf/sensors/kinect.urdf.xacro"/> <xacro:include filename="$(find turtlebot_description)/urdf/sensors/asus_xtion_pro.urdf.xacro"/> </robot> 这样走下去发现越来越深了,参考这个教程:http://wiki.ros.org/urdf/Tutorials/Using%20Xacro%20to%20Clean%20Up%20a%20URDF%20File 里面说,xacro就是拿来生成urdf的方便工具。 这里我挑一个urdf.xacro出来,看看是神马东东: 【/opt/ros/hydro/share/turtlebot_description/urdf/sensors/kinect.urdf.xacro】 里面出现了大量的joint link inertial标签。我觉得可以终止了。 回到【loading XML file [/opt/ros/hydro/share/turtlebot_bringup/launch/includes/robot.launch.xml]】 <!-- important generally, but specifically utilised by the current app manager --> <param name="robot/name" value="$(optenv ROBOT turtlebot)"/> <param name="robot/type" value="turtlebot"/> <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher"> <param name="publish_frequency" type="double" value="5.0" /> </node> <node pkg="diagnostic_aggregator" type="aggregator_node" name="diagnostic_aggregator" > <rosparam command="load" file="$(find turtlebot_bringup)/param/$(arg base)/diagnostics.yaml" /> 【loading yaml file:[ /opt/ros/hydro/share/turtlebot_bringup/param/create/diagnostics.yaml]】 pub_rate: 1.0 # Optional path: '' # Optional, prepended to all diagnostic output analyzers: nodes: type: diagnostic_aggregator/GenericAnalyzer path: 'Nodes' timeout: 5.0 contains: ['Node'] mode: type: diagnostic_aggregator/GenericAnalyzer path: 'Mode' timeout: 5.0 startswith: ['Operating Mode'] sensors: type: GenericAnalyzer path: 'Sensors' timeout: 5.0 startswith: ['Cliff Sensor', 'Wall Sensor', 'Gyro Sensor'] power: type: diagnostic_aggregator/GenericAnalyzer path: 'Power System' timeout: 5.0 startswith: ['Battery', 'Charging Sources', 'Laptop Battery'] digital_io: type: diagnostic_aggregator/GenericAnalyzer path: 'Digital IO' timeout: 5.0 startswith: ['Digital Outputs'] </node> 【至此$(find turtlebot_bringup)/launch/includes/robot.launch.xml 文件结束】 回到【turtlebot_minimal_create.launch 文件】 <include file="$(find rbx1_bringup)/launch/includes/tb_create_mobile_base.launch.xml" /> 进入【[ /home/exbot/catkin_ws/src/rbx1/rbx1_bringup/launch/includes/tb_create_mobile_base.launch.xml]】 <launch> <!-- Turtlebot Driver 驱动文件--> <node pkg="create_node" type="turtlebot_node.py" name="turtlebot_node" respawn="true" args="--respawnable"> <param name="bonus" value="false" /> <param name="update_rate" value="30.0" /> <param name="port" value="/dev/ttyUSB0" /> <remap from="cmd_vel" to="mobile_base/commands/velocity" /> <remap from="turtlebot_node/sensor_state" to="mobile_base/sensors/core" /> <remap from="imu/data" to="mobile_base/sensors/imu_data" /> <remap from="imu/raw" to="mobile_base/sensors/imu_data_raw" /> </node> <!-- Enable breaker 1 for the kinect --> <node pkg="create_node" type="kinect_breaker_enabler.py" name="kinect_breaker_enabler"/> <!-- The odometry estimator --> <node pkg="robot_pose_ekf" type="robot_pose_ekf" name="robot_pose_ekf"> <remap from="imu_data" to="mobile_base/sensors/imu_data"/> <remap from="robot_pose_ekf/odom" to="odom_combined"/> <param name="freq" value="10.0"/> <param name="sensor_timeout" value="1.0"/> <param name="publish_tf" value="true"/> <param name="odom_used" value="true"/> <param name="imu_used" value="true"/> <param name="vo_used" value="false"/> <param name="output_frame" value="odom"/> </node> <!-- velocity commands multiplexer --> <node pkg="nodelet" type="nodelet" name="mobile_base_nodelet_manager" args="manager"/> <node pkg="nodelet" type="nodelet" name="cmd_vel_mux" args="load yocs_cmd_vel_mux/CmdVelMuxNodelet mobile_base_nodelet_manager"> <param name="yaml_cfg_file" value="$(find turtlebot_bringup)/param/mux.yaml"/> <remap from="cmd_vel_mux/output" to="mobile_base/commands/velocity"/> <remap from="cmd_vel_mux/input/navi" to="cmd_vel"/> </node> </launch> 【回到】【turtlebot_minimal_create.launch 文件】 <include file="$(find turtlebot_bringup)/launch/includes/netbook.launch.xml"> <arg name="battery" value="$(arg battery)" /> 【进入[/opt/ros/hydro/share/turtlebot_bringup/launch/includes/netbook.launch.xml]文件】 <launch> <arg name="battery"/> <node pkg="linux_hardware" type="laptop_battery.py" name="turtlebot_laptop_battery"> <param name="acpi_path" type="string" value="$(arg battery)" /> </node> </launch> 【离开[/opt/ros/hydro/share/turtlebot_bringup/launch/includes/netbook.launch.xml]文件】 </include> </launch> 【至此,我们就分析完了turtlebot_minimal_create.launch 文件,下面分别分解里面的功能。】从roslaunch -v 的状态打印来看,系统主要做了两方面的工作:
<launch> <arg name="simulation" default="$(optenv TURTLEBOT_SIMULATION false)"/><!-- For param "/use_sim_time" --> <!--Next three lines are for .../launch/includes/robot.launch.xml--> <arg name="base" default="roomba"/> <!-- create, roomba, kobuki --> <arg name="stacks" default="circles"/> <!-- circles, hexagons --> <arg name="3d_sensor" default="asus_xtion_pro"/> <!-- kinect, asus_xtion_pro --> <!--Next line is for .../launch/includes/netbook.launch.xml--> <arg name="battery" default="$(optenv TURTLEBOT_BATTERY /proc/acpi/battery/BAT0)"/> <!-- /proc/acpi/battery/BAT0 --> <param name="/use_sim_time" value="$(arg simulation)"/> <!--Added parameter /use_sim_time--> <include file="$(find turtlebot_bringup)/launch/includes/robot.launch.xml"> <arg name="base" value="$(arg base)" /> <!--Plugged in three arguments:base; stacks; 3d_sensor--> <arg name="stacks" value="$(arg stacks)" /> <arg name="3d_sensor" value="$(arg 3d_sensor)" /> </include> <!--Below: Turtlebot Driver/ breaker1for kinect/ odometry estimator/ vel_com_multiplexer--> <include file="$(find rbx1_bringup)/launch/includes/tb_create_mobile_base.launch.xml" /> <!--Netbook battery monitor--> <include file="$(find turtlebot_bringup)/launch/includes/netbook.launch.xml"> <arg name="battery" value="$(arg battery)" /> </include> </launch>Conclusion: This launch file defined 1 argument "simulation", 3 args "base","stacks","3d_sensor" for robot description, 1 arg "battery" for netbook.xml as battery monitor.(I didn't use netbook.) , Called three .launch.xml files to finish work:
I'll first look into the 2nd, tb_create_mobile_base.launch.xml to set the parameters as my turtlebot's real situation. And see how it works.
<launch> <!-- Turtlebot Driver --> <node pkg="create_node" type="turtlebot_node.py" name="turtlebot_node" respawn="true" args="--respawnable"> <param name="bonus" value="false" /> <param name="update_rate" value="30.0" /> <param name="port" value="/dev/ttyUSB0" /> <remap from="cmd_vel" to="mobile_base/commands/velocity" /> <remap from="turtlebot_node/sensor_state" to="mobile_base/sensors/core" /> <remap from="imu/data" to="mobile_base/sensors/imu_data" /> <remap from="imu/raw" to="mobile_base/sensors/imu_data_raw" /> </node> <!-- Enable breaker 1 for the kinect --> <node pkg="create_node" type="kinect_breaker_enabler.py" name="kinect_breaker_enabler"/> <!-- The odometry estimator --> <node pkg="robot_pose_ekf" type="robot_pose_ekf" name="robot_pose_ekf"> <remap from="imu_data" to="mobile_base/sensors/imu_data"/> <remap from="robot_pose_ekf/odom" to="odom_combined"/> <param name="freq" value="10.0"/> <param name="sensor_timeout" value="1.0"/> <param name="publish_tf" value="true"/> <param name="odom_used" value="true"/> <param name="imu_used" value="true"/> <param name="vo_used" value="false"/> <param name="output_frame" value="odom"/> </node> <!-- velocity commands multiplexer --> <node pkg="nodelet" type="nodelet" name="mobile_base_nodelet_manager" args="manager"/> <node pkg="nodelet" type="nodelet" name="cmd_vel_mux" args="load yocs_cmd_vel_mux/CmdVelMuxNodelet mobile_base_nodelet_manager"> <param name="yaml_cfg_file" value="$(find turtlebot_bringup)/param/mux.yaml"/> <remap from="cmd_vel_mux/output" to="mobile_base/commands/velocity"/> <remap from="cmd_vel_mux/input/navi" to="cmd_vel"/> </node> </launch>第一部分:
<!-- Turtlebot Driver --> <node pkg="create_node" type="turtlebot_node.py" name="turtlebot_node" respawn="true" args="--respawnable"> <param name="bonus" value="false" /> <param name="update_rate" value="30.0" /> <param name="port" value="/dev/ttyUSB0" /> <remap from="cmd_vel" to="mobile_base/commands/velocity" /> <remap from="turtlebot_node/sensor_state" to="mobile_base/sensors/core" /> <remap from="imu/data" to="mobile_base/sensors/imu_data" /> <remap from="imu/raw" to="mobile_base/sensors/imu_data_raw" /> </node>这里先为node = turtlebot_node.py 定义了三个parameter: bonus/ update_rate/ port , 然后 remap 了4个消息名。最后启动 turtlebot_node.py ,实际是个底盘驱动。
第二部分:
<!-- Enable breaker 1 for the kinect --> <node pkg="create_node" type="kinect_breaker_enabler.py" name="kinect_breaker_enabler"/>查一下 kinect_breaker_enabler.py 是个什么东东?
进入到 kinect_breaker_enabler.py 代码里面发现是 Set_to_full_Mode ,看来是个设置底板模式的功能。别的涉及到proxy, server啥的,看不懂。~_~
2016年5月6日17:05:39补充一大牛的回复:orangeheadlxm:
第三部分:
<!-- The odometry estimator --> <node pkg="robot_pose_ekf" type="robot_pose_ekf" name="robot_pose_ekf"> <remap from="imu_data" to="mobile_base/sensors/imu_data"/> <remap from="robot_pose_ekf/odom" to="odom_combined"/> <param name="freq" value="10.0"/> <param name="sensor_timeout" value="1.0"/> <param name="publish_tf" value="true"/> <param name="odom_used" value="true"/> <!-- Sonictl Set as false --> <param name="imu_used" value="true"/> <!-- Sonictl Set as false --> <param name="vo_used" value="false"/> <param name="output_frame" value="odom"/> </node>这里要根据我的情况修改几个参数设置了。我没有IMU的 ekf 功能,没有搭载 accelerometer, 也不知道怎么搭载。所以就把某些值设为false.再保存到tb_create_mobile_base.launch_me.xml 中
第四部分:
<!-- velocity commands multiplexer --> <node pkg="nodelet" type="nodelet" name="mobile_base_nodelet_manager" args="manager"/> <node pkg="nodelet" type="nodelet" name="cmd_vel_mux" args="load yocs_cmd_vel_mux/CmdVelMuxNodelet mobile_base_nodelet_manager"> <param name="yaml_cfg_file" value="$(find turtlebot_bringup)/param/mux.yaml"/> <!-- filepath: /opt/ros/hydro/share/turtlebot_bringup/param/mux.yaml --> <remap from="cmd_vel_mux/output" to="mobile_base/commands/velocity"/> <remap from="cmd_vel_mux/input/navi" to="cmd_vel"/> </node>这一部分是 多cmd_vel消息来了时候,进行multiplexer多路转换器,的功能。 这里先设置了一个parameter: yaml_cfg_file配置文件,设置到【/opt/ros/hydro/share/turtlebot_bringup/param/mux.yaml】,然后开了俩node:nodelet/mobile_base_nodelet_manager & nodelet/cmd_vel_mux , 都分别带了参数args.
# Created on: Oct 29, 2012 # Author: jorge # Configuration for subscribers to multiple cmd_vel sources. # # Individual subscriber configuration: # name: Source name # topic: The topic that provides cmd_vel messages # timeout: Time in seconds without incoming messages to consider this topic inactive # priority: Priority: an UNIQUE unsigned integer from 0 (lowest) to MAX_INT # short_desc: Short description (optional) subscribers: - name: "Safe reactive controller" topic: "input/safety_controller" timeout: 0.2 priority: 10 - name: "Teleoperation" topic: "input/teleop" timeout: 1.0 priority: 7 - name: "Navigation" topic: "input/navi" timeout: 1.0 priority: 5可见是设置了三个源的优先级。文件开头也写了: Configuration for subscribers to multiple cmd_vel sources.
至此,我们就细看完了 tb_create_mobile_base.launch.xml 这个文件,一个驱动、一个odometry estimator配置,一个velocity commands multiplexer选择器。
完成了驱动,我们有几个问题没有解决: