RobCo:如何为你的机器人生成 URDF?

按照我们关于如何安装 RobCo 的 ROS2 绑定的说明操作后,执行以下步骤导出 URDF。

第一个终端:运行 view_model.launch.py

此步骤不一定需要 GUI,使用 SSH 访问即可。

run_view_model.sh
cd robco_ws
source install/local_setup.sh
ros2 launch robco_description view_model.launch.py

保持此终端运行,直到 URDF 导出完成

示例输出

view_model_output.txt
$ ros2 launch robco_description view_model.launch.py
[INFO] [launch]: All log files can be found below /home/uli/.ros/log/2026-04-27-21-04-19-855503-mypc03-927172
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [927193]
[INFO] [joint_state_publisher_gui-2]: process started with pid [927194]
[INFO] [rviz2-3]: process started with pid [927195]
[robot_state_publisher-1] [WARN] [1777316660.046560018] [kdl_parser]: The root link joint0 has an inertia specified in the URDF, but KDL does not support a root link with an inertia.  As a workaround, you can add an extra dummy link to your URDF.
[robot_state_publisher-1] [INFO] [1777316660.046728648] [robot_state_publisher]: Robot initialized
[rviz2-3] qt.qpa.xcb: could not connect to display
[rviz2-3] qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
[rviz2-3] This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
[rviz2-3]
[rviz2-3] Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
[rviz2-3]
[joint_state_publisher_gui-2] qt.qpa.xcb: could not connect to display
[joint_state_publisher_gui-2] qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
[joint_state_publisher_gui-2] This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
[joint_state_publisher_gui-2]
[joint_state_publisher_gui-2] Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
[joint_state_publisher_gui-2]
[ERROR] [rviz2-3]: process has died [pid 927195, exit code -6, cmd '/opt/ros/jazzy/lib/rviz2/rviz2 --display-config /home/uli/robco_ws/install/robco_description/share/robco_description/rviz/view_model.rviz --ros-args -r __node:=rviz2'].
[ERROR] [joint_state_publisher_gui-2]: process has died [pid 927194, exit code -6, cmd '/opt/ros/jazzy/lib/joint_state_publisher_gui/joint_state_publisher_gui --ros-args -r __node:=joint_state_publisher_gui']

第二个终端:导出 URDF

export_urdf.sh
cd robco_ws
source install/setup.sh
ros2 param get /robot_state_publisher robot_description > MyRobCo.urdf

此命令没有输出,会将完整的 URDF 导出到当前目录下名为 MyRobCo.urdf 的文件中。你可以根据需要更改文件名。在内部,它会从 xacro 文件生成 URDF。


Check out similar posts by category: Robotics