0
$\begingroup$

Rosanswers logo

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-pkg/hector_slam

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?


Originally posted by IvyKK on ROS Answers with karma: 39 on 2018-10-03

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by gvdhoorn with karma: 86574 on 2018-10-03

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by IvyKK on 2018-10-03:
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.

Comment by gvdhoorn on 2018-10-03:
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).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.