初学URDF总结

link.png

看图理解很重要!

写URDF分步骤:

打开:http://wiki.ros.org/urdf/Tutorials/Create%20your%20own%20urdf%20file

1,描述最基本的:robot name,link,joint,以及joint的parent和child;

2,添加jiont的origin坐标——平移加旋转:每个link有自己的坐标系,jiont平移坐标为该joint相对于parent  link的坐标,旋转坐标为child  link相对于parent link坐标系的旋转,逆时针为正;

针对jiont2    ## rpy="0 0 1.57"表示绕Z轴逆时针旋转90度

3,添加joint的旋转轴axis,单位化的旋转轴向量,相对于child link坐标系的旋转;

针对jiont1    ##单位化的旋转轴向量


解析自己设计的.urdf文件

打开: http://wiki.ros.org/urdf/Tutorials/Parse%20a%20urdf%20file

urdf::Model model;   ## urdf::Model is a class containing robot model data structure.
model.initFile(urdf_file)  ##返回解析成功或失败

纠错:

$ catkin_make
$ ./parser my_robot.urdf
# ./devel/lib/robot_description/parser /src/robot_description/urdf/my_robot.urdf (for example)   !!!!!这句改为
# ./devel/lib/robot_description/parser  src/robot_description/urdf/my_robot.urdf (for example)
 
  

codeapi

The URDF parser API contains the following methods:

  • Parse and build tree from XML: urdf::Model::initXml
  • Parse and build tree from File: urdf::Model::initFile
  • Parse and build tree from String: urdf::Model::initString
  • Get Root Link: urdf::Model::getRoot
  • Get Link by name urdf::Model::getLink
  • Get all Link's urdf::Model::getLinks
  • Get Joint by name urdf::Model::getJoint

机器人状态发布器:

链接: http://wiki.ros.org/robot_state_publisher/Tutorials/Using%20the%20robot%20state%20publisher%20on%20your%20own%20robot

robot state publisher以节点方式使用:



 
##robot_state_publisher默认使用robot_description参数

或者








robot state publisher以库函数使用:

包含头文件

#include 
  // publish moving joints
  void publishTransforms(const std::map& joint_positions,
                         const ros::Time& time);

  // publish fixed joints
  void publishFixedTransforms();




REFERENCE:ROS WIKI

你可能感兴趣的:(ROS)