[ROS2] "colon" building turtlesim package failed
Hi, guys,
I am learning about ROS2 on Windows 10 today.
The "colon" building turtlesim package failed as the tutorial, 5 Build the workspace with colcon.
Specifically, in the step 5 -- 5 Build the workspace with colcon,
run the command colcon build --merge-install
,
then an error appeared as,
Starting >>> turtlesim
[Processing: turtlesim]
Failed <<< turtlesim [ Exited with code 1 ]
Summary: 0 packages finished [35.5s]
1 package failed: turtlesim
In order to get the error information,
I run the command colcon build --event-handlers console_cohesion+ --merge-install
, and got the information,
Starting >>> turtlesim
[31.534s] colcon.colconcore.eventreactor ERROR Exception in event handler extension 'consolecohesion': 'utf-8' codec can't decode byte 0xd3 in position 2253: invalid continuation byte
Traceback (most recent call last):
File "c:\python37\lib\site-packages\colconcore\eventreactor.py", line 78, in _notifyobservers retval = observer(event)
File "c:\python37\lib\site-packages\colconoutput\eventhandler\consolecohesion.py", line 53, in _call__ self._lines[job]).decode() + <br> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd3 in position 2253: invalid continuation byteFailed <<< turtlesim [ Exited with code 1 ]
Summary: 0 packages finished [29.4s]
1 package failed: turtlesim
Could you please tell me how to fix this?
You answer and idea will be appreciated!
Asked by songyuc on 2020-05-06 07:06:26 UTC
Answers
Regarding the colcon.colcon_core.event_reactor: You can use the following pull request in the official colcon-ouput repo: Fix missing encoding for Windows with non-utf-8 code page, it solves the specified issue.
Alternatively, you can change the code page on your machine by navigating to Control Panel - Region - Administrative (tab) - Language for non-Unicode programs and setting it to English (United States). (This option, however, may cause some character displaying problems in other applications).
Asked by anion0278 on 2023-05-10 06:19:34 UTC
Comments
Hi @christophebedard, here is the new question.
Asked by songyuc on 2020-05-06 07:18:38 UTC
does it work if you run the command without
--event-handlers console_cohesion+
?Asked by christophebedard on 2020-05-06 07:54:35 UTC
and did you do
call C:\dev\ros2\local_setup.bat
?Asked by christophebedard on 2020-05-06 07:55:27 UTC
No, it doesn't.
In the first information, I have shown the result as: run the command
colcon build --merge-install
, then an error appeared as,Asked by songyuc on 2020-05-06 08:01:57 UTC
oh, I see.
Asked by christophebedard on 2020-05-06 08:02:49 UTC
And yes, I have done the
call
command.Asked by songyuc on 2020-05-06 08:03:02 UTC
I infer it, from my previous experience, that Windows CMD script doesn't accept the '' symbol for string, but the "" symbol. Such as,
ros2 topic pub --once /turtle1/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.8}}"
works right,instead of
ros2 topic pub --once /turtle1/cmd_vel geometry_msgs/msg/Twist '{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.8}}'
.Asked by songyuc on 2020-05-06 08:07:24 UTC
the error points to this line which doesn't seem to specify any encoding, so perhaps that's why it fails on Windows (encoding/decoding is a very platform-dependant thing as far as I understand)
Asked by christophebedard on 2020-05-06 09:02:06 UTC
Yes!
I think change the '' symbol into "" may help, because this is the way how I have successfully run the command
ros2 topic pub --once /turtle1/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.8}}"
Asked by songyuc on 2020-05-06 09:24:42 UTC
I tried building everything from source on Windows (following this) and it worked fine
Asked by christophebedard on 2020-05-09 18:03:30 UTC