第9章机器人仿真 入门篇 第3节
-
你好,我在学习第9章入门篇第3节,在 gazebo中加载机器人模型,第4部分,将启动gazebo和生产fishbot写成launch文件。直接复制了你的代码,编译完成后,运行,报错,显示 "gazebo_world_path"没有定义。请问怎么解决?
复制的gazebo.launch.py代码如下:
import os from launch import LaunchDescription from launch.actions import ExecuteProcess from launch_ros.actions import Node from launch_ros.substitutions import FindPackageShare def generate_launch_description(): robot_name_in_model = 'fishbot' package_name = 'fishbot_description' urdf_name = "fishbot_gazebo.urdf" ld = LaunchDescription() pkg_share = FindPackageShare(package=package_name).find(package_name) urdf_model_path = os.path.join(pkg_share, f'urdf/{urdf_name}') # Start Gazebo server start_gazebo_cmd = ExecuteProcess( cmd=['gazebo', '--verbose','-s', 'libgazebo_ros_init.so', '-s', 'libgazebo_ros_factory.so',gazebo_world_path], output='screen') # Launch the robot spawn_entity_cmd = Node( package='gazebo_ros', executable='spawn_entity.py', arguments=['-entity', robot_name_in_model, '-file', urdf_model_path ], output='screen') ld.add_action(start_gazebo_cmd) ld.add_action(spawn_entity_cmd) return ld
-
@849282206 在 第9章机器人仿真 入门篇 第3节 中说:
cmd=['gazebo', '--verbose','-s', 'libgazebo_ros_init.so', '-s', 'libgazebo_ros_factory.so',gazebo_world_path],
删掉这句话中的
,gazebo_world_path
-
@小鱼 请问下为什么删除掉就可以了呢,大佬能讲一下原理吗