ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

UnicodeEncodeError while running roslaunch (kinetic)

asked 2018-10-03 02:18:12 -0600

IvyKK gravatar image

Hi there, I'm very new to ROS.

I'm trying to connect my lidar (EAI ydlidar X4) with hector mapping, and downloaded from git clone https://github.com/tu-darmstadt-ros-p...

I've created a launch file (from tutorial online):

<?xml version="1.0"?>
<launch>

  <include file="$(find ydlidar)/launch/lidar_view.launch" />

  <node pkg="tf" type="static_transform_publisher" name="map_to_odom" args="0.0 0.0 0.0 0.0 0.0 0.0 /odom /base_link 40" />

  <node pkg="tf" type="static_transform_publisher" name="base_frame_to_laser" args="0 0 0 0 0 0 /base_link /laser_frame 40" />

  <!--<node pkg="rviz" type="rviz" name="rviz" args="-d $(find hector_slam_launch)/rviz_cfg/mapping_demo.rviz"/>-->

  <include file="$(find hector_mapping)/launch/mapping_default.launch" />
  <node pkg="rviz" type="rviz" name="rviz" args="-d $(find ydlidar)/launch/lidar.rviz" />
  <include file="$(find hector_geotiff)/launch/geotiff_mapper.launch" />
</launch>

however, when I roslaunch it, I got:

Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

'ascii' codec can't encode character u'\xa0' in position 0: ordinal not in range(128)
The traceback for the exception was written to the log file

and in the log:

.......
File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 365, in resolve_args
resolved = _resolve_args(arg_str, context, resolve_anon, commands)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 376, in _resolve_args
for a in _collect_args(arg_str):
File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 434, in _collect_args
buff.write(c)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 0: ordinal not in range(128)

[rospy.core][INFO] 2018-10-03 12:28:17,248: signal_shutdown [atexit]

Anyone knows how to solve this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-10-03 02:49:26 -0600

gvdhoorn gravatar image

updated 2018-10-03 05:30:35 -0600

According to Python: Removing \xa0 from string?, ordinal \xa0 is a "non breaking space".

That is indeed a unicode character, not an ascii one.

If you copied your example from a website, those can include non-breaking spaces (as those are often used on websites to make sure the browser doesn't affect code example rendering).

I would advise you to rewrite your launch file.

Suspicuous characters are:

  • whitespace (ie: spaces)
  • (double) quotes (ie: ' and ")
  • question marks (ie: ?)

the latter may be surprising, but I've been in situations where it was not a question mark from the ascii range (ie: the "normal" question mark), but a slightly different version, from a unicode table.

Just replace all of those with a text editor and try again.

If your editor supports encoding transformations (ie: wholesale conversion from UTF to ASCII) then you could try those.

edit flag offensive delete link more

Comments

Thank you so much! I tried that out and the error is gone. Unfortunately, got another error when re-attempting... Skipped loading plugin with error: XML Document '/opt/ros/kinetic/share/hector_worldmodel_geotiff_plugins/hector_geotiff_plugins.xml' has no Root Element.

IvyKK gravatar image IvyKK  ( 2018-10-03 04:33:13 -0600 )edit

Well, that looks like a different problem, so that deserves its own question (but do first search for your current problem, as we don't need more duplicates).

gvdhoorn gravatar image gvdhoorn  ( 2018-10-03 05:30:08 -0600 )edit

Question Tools

Stats

Asked: 2018-10-03 02:18:12 -0600

Seen: 1,105 times

Last updated: Oct 03 '18