学习journal(二)0515更新
rviz加载模型背景学习自定义urdf模型并在rviz展示但我写好launch脚本运行后在rviz界面无法加载我的模型下面针对这个问题给出解决办法上下文就不提供了主要记录学习过程遇到问题以及怎么解决的以后有类似的还能看看Q1roottina-Inspiron-5580:/workspace/ros2_ws# ros2 launch urdf_demo rviz_view.launch.py [INFO] [launch]: All log files can be found below /root/.ros/log/2026-05-15-04-21-39-970084-tina-Inspiron-5580-1875445 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [robot_state_publisher-1]: process started with pid [1875488] [INFO] [joint_state_publisher-2]: process started with pid [1875490] [INFO] [rviz2-3]: process started with pid [1875492] [robot_state_publisher-1] [INFO] [1778818900.233833435] [robot_state_publisher]: got segment base_link [robot_state_publisher-1] [INFO] [1778818900.234034460] [robot_state_publisher]: got segment left_leg [robot_state_publisher-1] [INFO] [1778818900.234052116] [robot_state_publisher]: got segment right_leg [joint_state_publisher-2] [INFO] [1778818900.549869740] [joint_state_publisher]: Waiting for robot_description to be published on the robot_description topic... [rviz2-3] [INFO] [1778818900.801854816] [rviz2]: Stereo is NOT SUPPORTED [rviz2-3] [INFO] [1778818900.802029856] [rviz2]: OpenGl version: 4.5 (GLSL 4.5) [rviz2-3] [INFO] [1778818900.885196187] [rviz2]: Stereo is NOT SUPPORTED launch起了rviz但无法选择robotmodel在rviz展示我的urdf模型A1两个事在 humble 容器里干① 建 rviz/urdf.rviz 预置配置 ② 重新构建。launch 文件加入 -d rviz/urdf.rviz下一步需要在容器里把 rviz 配置文件创建出来进容器docker exec -it humble bash然后一次性执行直接 heredoc 写入不用 nanomkdir -p /workspace/ros2_ws/src/urdf_demo/rviz cat /workspace/ros2_ws/src/urdf_demo/rviz/urdf.rviz EOF Panels: - Class: rviz_common/Displays Name: Displays - Class: rviz_common/Selection Name: Selection - Class: rviz_common/Tool Properties Name: Tool Properties - Class: rviz_common/Views Name: Views Visualization Manager: Class: Displays: - Alpha: 0.5 Cell Size: 1 Class: rviz_default_plugins/Grid Color: 160; 160; 164 Enabled: true Line Style: Line Width: 0.03 Value: Lines Name: Grid Normal Cell Count: 0 Offset: {X: 0, Y: 0, Z: 0} Plane: XY Plane Cell Count: 10 Reference Frame: Fixed Frame Value: true - Class: rviz_default_plugins/TF Enabled: true Frame Timeout: 15 Frames: {All Enabled: true} Marker Scale: 0.5 Name: TF Show Arrows: true Show Axes: true Show Names: true Update Interval: 0 Value: true - Alpha: 1 Class: rviz_default_plugins/RobotModel Collision Enabled: false Description File: Description Source: Topic Description Topic: Depth: 5 Durability Policy: Volatile History Policy: Keep Last Reliability Policy: Reliable Value: /robot_description Enabled: true Mass Properties: {Inertia: false, Mass: false} Name: RobotModel TF Prefix: Update Interval: 0 Value: true Visual Enabled: true Enabled: true Global Options: Background Color: 48; 48; 48 Fixed Frame: base_link Frame Rate: 30 Name: root Tools: - Class: rviz_default_plugins/Interact - Class: rviz_default_plugins/MoveCamera - Class: rviz_default_plugins/Select - Class: rviz_default_plugins/FocusCamera - Class: rviz_default_plugins/Measure Transformation: Current: {Class: rviz_default_plugins/TF} Value: true Views: Current: Class: rviz_default_plugins/Orbit Distance: 3 Focal Point: {X: 0, Y: 0, Z: 0} Name: Current View Near Clip Distance: 0.01 Pitch: 0.5 Target Frame: Fixed Frame Value: Orbit (rviz_default_plugins) Yaw: 0.785 Saved: ~ Window Geometry: Height: 800 Width: 1200 X: 100 Y: 100 EOF然后构建 跑cd /workspace/ros2_ws source /opt/ros/humble/setup.bash colcon build --packages-select urdf_demo source install/setup.bash ros2 launch urdf_demo rviz_view.launch.py启动后 RViz 应当直接显示蓝色圆柱 两条腿总结RViz 空白的原因不是节点错误是默认 Fixed Framemap、且没添加 RobotModel 显示项。文档让手动 Add → RobotModel → Description Topic/robot_description这里把它做成预置 rviz 配置让 launch 用 -d 直接加载免得每次都点