求助啊大佬们
-
在用launch方法生成gazebo启动项和导入urdf文件时出现以下错误:
spawn_entity.py-2] [INFO] [spawn_entity]: Spawn Entity started
[spawn_entity.py-2] [INFO] [spawn_entity]: Loading entity XML from file /home/outerman1/fishbot_ws/install/fishbot_description/share/fishbot_description/urdf/fishbot_gazebo.urdf
[spawn_entity.py-2] Traceback (most recent call last):
[spawn_entity.py-2] File "/opt/ros/eloquent/lib/gazebo_ros/spawn_entity.py", line 362, in <module>
[spawn_entity.py-2] main()
[spawn_entity.py-2] File "/opt/ros/eloquent/lib/gazebo_ros/spawn_entity.py", line 357, in main
[spawn_entity.py-2] exit_code = spawn_entity_node.run()
[spawn_entity.py-2] File "/opt/ros/eloquent/lib/gazebo_ros/spawn_entity.py", line 140, in run
[spawn_entity.py-2] self.get_logger().error('Error: specified file %s does not exist', self.args.file)
[spawn_entity.py-2] TypeError: error() takes 2 positional arguments but 3 were given
[ERROR] [spawn_entity.py-2]: process has died [pid 40742, exit code 1, cmd '/opt/ros/eloquent/lib/gazebo_ros/spawn_entity.py -entity fishbot -file /home/outerman1/fishbot_ws/install/fishbot_description/share/fishbot_description/urdf/fishbot_gazebo.urdf --ros-args'].
launch文件如下:
import os
from launch import LaunchDescription
from launch.actions import ExecuteProcess
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageSharedef 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'], output='screen') # Launch the robot spawn_entity_cmd = Node( package='gazebo_ros', node_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
结果是:gazebo启动成功,但是未导入文件
-
已解决,urdf的名称写错了
-
@3568485143 请问应该如何修改呀
-
@1165420875
gazebo.launch.py文件中那个urdf_name中的gazebo_base.urdf改成fishbot_base.urdf就可以了,我是这样的 -
此回复已被删除!