https://blog.csdn.net/weixin_36965307/article/details/104945052
robot state publisher
http://wiki.ros.org/robot_state_publisher
This package allows you to publish the state of a robot to tf. Once the state gets published, it is available to all components in the system that also use tf. The package takes the joint angles of the robot as input and publishes the 3D poses of the robot links, using a kinematic tree model of the robot. The package can both be used as a library and as a ROS node. This package has been well tested and the code is stable. No major changes are planned in the near future.
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
<param name="publish_frequency" type="double" value="50.0" />
<param name="tf_prefix" type="string" value="" />
</node>
/gazebo —— /joint states—— /robot state publisher
joint state publisher
http://wiki.ros.org/joint_state_publisher
This package contains a tool for setting and publishing joint state values for a given URDF。
This package publishes sensor_msgs/JointState messages for a robot. The package reads the robot_description parameter from the parameter server, finds all of the non-fixed joints and publishes a JointState message with all those joints defined.
This package can be used in conjunction with the robot_state_publisher node to also publish transforms for all joint states.
<node pkg="joint_state_publisher" type="joint_state_publisher" name="joint_state_publisher" output="screen" />
<param name="use_gui" value="$(arg gui)"/>
<!-- We do not have a robot connected, so publish fake joint states -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
<param name="use_gui" value="$(arg use_gui)"/>
<rosparam param="source_list">[move_group/fake_controller_joint_states]</rosparam>
</node>
joint state controller
Publishes the state of all resources registered to a hardware_interface::JointStateInterface to a topic of type sensor_msgs/JointState.
joint_state_controller
https://blog.csdn.net/lovedarling/article/details/78291508
需要加载yaml文件:
joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 50
<!-- joint_state_controller -->
<rosparam file="$(find ur_gazebo)/controller/joint_state_controller.yaml" command="load"/>
<node name="joint_state_controller_spawner" pkg="controller_manager" type="controller_manager" args="spawn joint_state_controller" respawn="false" output="screen"/>
总结
主要在gazebo中用到了两个接口,
一个joint trajectory contreller (gazebo)就是轨迹生成器,在硬件接口中的实现
一个joint state controller(gazebo) 发布与硬件接口相关的资源状态
一般性在controller trils.launch中提供了robot state publisher 以及 joins state controller。
joint trajectory controller
轨迹控制部分单独写:
<!-- start this controller -->
<rosparam file="$(find ur_gazebo)/controller/arm_controller_ur3.yaml" command="load"/>
<node name="arm_controller_spawner" pkg="controller_manager" type="controller_manager" args="spawn arm_controller" respawn="false" output="screen"/>