urdf中文注释导致的字符问题

运行joint_state_publisher/joint_state_publisher_gui报错
错误如下:

[joint_state_publisher_gui-4] process has died [pid 97153, exit code 1, cmd /opt/ros/melodic/lib/joint_state_publisher_gui/joint_state_publisher_gui __name:=joint_state_publisher_gui __log:=/home/ros/.ros/log/4422783c-0504-11ee-8b5a-000c29b0c758/joint_state_publisher_gui-4.log].
log file: /home/ros/.ros/log/4422783c-0504-11ee-8b5a-000c29b0c758/joint_state_publisher_gui-4*.log

 



原因:一般均因为urdf內部含有中文字符

解决方案:

1.将urdf文件内部中文字符全部刪除;
2.修改joint_state_publisher和 joint_state_publisher_gui 配置
  cd /opt/ros/melodic/lib/joint_state_publisher (joint_state_publisher_gui类似)
  sudo gedit joint_state_publisher
  修改
  在import sys後面加

reload(sys)
sys.setdefaultencoding(“utf-8”)

 

若仍然報錯修改執行權限:

  cd /opt/ros/melodic/lib/joint_state_publisher

  chmod 777 joint_state_publisher

posted on 2023-12-07 11:10  NLazyo  阅读(132)  评论(0编辑  收藏  举报