Ubuntu18.04运行gazebo的launch文件[model-4] process has died报错

启动gazebo仿真环境报错[model-4] process has died

[model-4] process has died [pid 2059, exit code 1, cmd /opt/ros/melodic/lib/gazebo_ros/spawn_model -urdf -model mycar -param robot_description __name:=model __log:=/root/.ros/log/8842dc14-877c-11ee-a9d9-0242ac110002/model-4.log].
log file: /root/.ros/log/8842dc14-877c-11ee-a9d9-0242ac110002/model-4*.log

出现报错原因:

ubuntu18.04版本在launch文件中添加中文注释有可能导致这个错误。

解决方法:

主要是编码老问题,找到上面出现的/usr/lib/python2.7/xml/etree/ElementTree.py文件,使用vim文本编辑器打开,终端命令是

sudo vim /usr/lib/python2.7/xml/etree/ElementTree.py

加入以下代码

reload(sys) 
sys.setdefaultencoding("utf-8")

加入之后的程序格式如下:

你可能感兴趣的:(机器人,linux)