一、问题描述:
joes@joes-PC:~/jiao/ROS_Projects/05_aotexueyuan_Project$ roslaunch ros23_urdf02_gazebo demo01_helloworld.launch
... logging to /home/joes/.ros/log/194743e4-922e-11ec-a5c5-84a938321ff7/roslaunch-joes-PC-6862.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://joes-PC:45837/
SUMMARY
========
PARAMETERS
* /gazebo/enable_ros_network: True
* /robot_description: <robot name="my_c...
* /rosdistro: melodic
* /rosversion: 1.14.12
* /use_sim_time: True
NODES
/
gazebo (gazebo_ros/gzserver)
gazebo_gui (gazebo_ros/gzclient)
spawn_model1 (gazebo_ros/spawn_model)
auto-starting new master
process[master]: started with pid [6872]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to 194743e4-922e-11ec-a5c5-84a938321ff7
process[rosout-1]: started with pid [6884]
started core service [/rosout]
process[gazebo-2]: started with pid [6891]
process[gazebo_gui-3]: started with pid [6908]
process[spawn_model1-4]: started with pid [6923]
the rosdep view is empty: call 'sudo rosdep init' and 'rosdep update'
[ INFO] [1645348724.337832150]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1645348724.339012949]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
[ INFO] [1645348724.422424183]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1645348724.423308018]: waitForService: Service [/gazebo_gui/set_physics_properties] has not been advertised, waiting...
Traceback (most recent call last):
File "/opt/ros/melodic/lib/gazebo_ros/spawn_model", line 239, in <module>
exit_code = sm.run()
File "/opt/ros/melodic/lib/gazebo_ros/spawn_model", line 149, in run
xml_parsed = xml.etree.ElementTree.fromstring(model_xml)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1311, in XML
parser.feed(text)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1657, in feed
self._parser.Parse(data, 0)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 58-60: ordinal not in range(128)
[ INFO] [1645348724.584020193]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[spawn_model1-4] process has died [pid 6923, exit code 1, cmd /opt/ros/melodic/lib/gazebo_ros/spawn_model -urdf -model car -param robot_description __name:=spawn_model1 __log:=/home/joes/.ros/log/194743e4-922e-11ec-a5c5-84a938321ff7/spawn_model1-4.log].
log file: /home/joes/.ros/log/194743e4-922e-11ec-a5c5-84a938321ff7/spawn_model1-4*.log
[ INFO] [1645348724.602820002, 0.004000000]: Physics dynamic reconfigure ready.
二、解决:
sudo gedit /usr/lib/python2.7/xml/etree/ElementTree.py
加入以下代码:
reload(sys)
sys.setdefaultencoding("utf-8")