随手笔记——ROS下joint_state_publisher、robot_state_publisher节点的简要说明
说明
简单记录一下joint_state_publisher、robot_state_publisher节点的功能及使用
笔记
1. 在launch文件中的使用方法
<!-- 运行joint_state_publisher节点,发布机器人的关节状态 -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" >
</node>
<!-- 运行robot_state_publisher节点,发布tf -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" output="screen" >
<param name="publish_frequency" type="double" value="50.0" />
</node>
2. joint_state_publisher
joint_state_publisher功能包为机器人发布sensor_msgs/JointState消息,该包从参数服务器读取robot_description参数,查找所有非固定关节,并发布定义了所有这些关节的JointState消息。
3. sensor_msgs/JointState消息
File: sensor_msgs/JointState.msg
Raw Message Definition
# This is a message that holds data to describe the state of a set of torque controlled joints.
#
# The state of each joint (revolute or prismatic) is defined by:
# * the position of the joint (rad or m),
# * the velocity of the joint (rad/s or m/s) and
# * the effort that is applied in the joint (Nm or N).
#
# Each joint is uniquely identified by its name
# The header specifies the time at which the joint states were recorded. All the joint states
# in one message have to be recorded at the same time.
#
# This message consists of a multiple arrays, one for each part of the joint state.
# The goal is to make each of the fields optional. When e.g. your joints have no
# effort associated with them, you can leave the effort array empty.
#
# All arrays in this message should have the same size, or be empty.
# This is the only way to uniquely associate the joint name with the correct
# states.
Header header
string[] name
float64[] position
float64[] velocity
float64[] effort
4.关于joint_state_publisher GUI的说明
GUI功能已经从joint_state_publisher包中分离出来,成为其名为joint_state_prublisher_GUI的包。joint_state_publisher中的use_gui参数已删除。
如果要使用GUI功能,joint_state_publisher_gui应作为<exec_depend>添加到package.xml中,并且应更新launch文件以启动joint_state_publisher_gui,而不是使用带有use_gui参数的joint_state_prublisher。
5. robot_state_publisher
robot_state_publisher使用参数robot_description指定的URDF和joint_states (sensor_msgs/JointState)话题中的关节位置来计算机器人的正向运动学,并通过tf发布结果。