Filter löschen
Filter löschen

rosgenmsg fails with encoding error

13 Ansichten (letzte 30 Tage)
Franz Albers
Franz Albers am 19 Apr. 2022
Kommentiert: Soulaimane Berkane am 16 Mär. 2023
Hello,
I want to generate some custom ROS messages in Matlab. I've followed the instructions stated here.
However, when executing rosgenmsg, I run into the error described below. The issue occurs with my own custom message package, as well as with two other custom message packages that are published on github (radar_msgs and kobuki_msgs).
According to the log, there seems to be some encoding issue with utf-8.
How can I fix the issue and build the custom messages?
rosgenmsg("C:\MATLAB\custom_messages")
Identifying message files in folder 'C:/MATLAB/custom_messages'..Done.
Validating message files in folder 'C:/MATLAB/custom_messages'..Done.
[1/1] Generating MATLAB interfaces for custom message packages... Done.
Running catkin build in folder 'C:/Matlab/custom_messages/matlab_msg_gen_ros1/win64'.
Build in progress. This may take several minutes...Error using ros.internal.ROSProjectBuilder/buildPackage
Error building package: build log.
Error in rosgenmsg (line 480)
buildPackage(builder, [], 'install', catkinMakeArgs); %other messages might need to be present in the same directory
The build log is given below:
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.11.12
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86_x64'
-- The C compiler identification is MSVC 19.29.30142.1
-- The CXX compiler identification is MSVC 19.29.30142.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: C:/Matlab/custom_messages/matlab_msg_gen_ros1/win64/devel
-- Using CMAKE_PREFIX_PATH: C:\Program Files\MATLAB\R2022a\sys\ros1\win64\ros1;C:/Program Files/MATLAB/R2022a/toolbox/ros/mlroscpp/custom_messages
-- This workspace overlays: C:/Program Files/MATLAB/R2022a/sys/ros1/win64/ros1;C:/Program Files/MATLAB/R2022a/toolbox/ros/mlroscpp/custom_messages
-- Found PythonInterp: C:/Users/Franz/AppData/Roaming/MathWorks/MATLAB/R2022a/ros1/win64/venv/Scripts/python.exe (found suitable version "3.9.12", minimum required is "3")
-- Using PYTHON_EXECUTABLE: C:/Users/Franz/AppData/Roaming/MathWorks/MATLAB/R2022a/ros1/win64/venv/Scripts/python.exe
-- Using default Python package layout
-- Found PY_em: C:\Users\Franz\AppData\Roaming\MATHWO~1\MATLAB\R2022a\ros1\win64\venv\lib\site-packages\em.py
-- Using empy: C:/Users/Franz/AppData/Roaming/MATHWO~1/MATLAB/R2022a/ros1/win64/venv/lib/site-packages/em.py
-- Using CATKIN_ENABLE_TESTING: off
-- catkin 0.8.10
-- BUILD_SHARED_LIBS is on
Das Sprungziel - GenerateTempFilename wurde nicht gefunden.
Traceback (most recent call last):
File "C:\Matlab\custom_messages\matlab_msg_gen_ros1\win64\build\catkin_generated\generate_cached_setup.py", line 22, in <module>
code = generate_environment_script('C:/Matlab/custom_messages/matlab_msg_gen_ros1/win64/devel/env.bat')
File "C:\PROGRA~1\MATLAB\R2022a\sys\ros1\win64\ros1\lib\site-packages\catkin\environment_cache.py", line 63, in generate_environment_script
env_after = ast.literal_eval(output.decode('utf-8'))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 3940: invalid continuation byte
CMake Error at C:/Program Files/MATLAB/R2022a/sys/ros1/win64/ros1/share/catkin/cmake/safe_execute_process.cmake:11 (message):
execute_process(C:/Users/Franz/AppData/Roaming/MathWorks/MATLAB/R2022a/ros1/win64/venv/Scripts/python.exe
"C:/Matlab/custom_messages/matlab_msg_gen_ros1/win64/build/catkin_generated/generate_cached_setup.py")
returned error code 1
Call Stack (most recent call first):
C:/Program Files/MATLAB/R2022a/sys/ros1/win64/ros1/share/catkin/cmake/all.cmake:208 (safe_execute_process)
C:/Program Files/MATLAB/R2022a/sys/ros1/win64/ros1/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:58 (find_package)
-- Configuring incomplete, errors occurred!
See also "C:/Matlab/custom_messages/matlab_msg_gen_ros1/win64/build/CMakeFiles/CMakeOutput.log".
Base path: C:\MATLAB\custom_messages\matlab_msg_gen_ros1\win64
Source space: C:\MATLAB\custom_messages\matlab_msg_gen_ros1\win64\src
Build space: C:\MATLAB\custom_messages\matlab_msg_gen_ros1\win64\build
Devel space: C:\MATLAB\custom_messages\matlab_msg_gen_ros1\win64\devel
Install space: C:\MATLAB\custom_messages\matlab_msg_gen_ros1\win64\install
Copying file from "C:\PROGRA~1\MATLAB\R2022a\sys\ros1\win64\ros1\share\catkin\cmake\toplevel.cmake" to "C:\MATLAB\custom_messages\matlab_msg_gen_ros1\win64\src\CMakeLists.txt"
####
#### Running command: "cmake C:\MATLAB\custom_messages\matlab_msg_gen_ros1\win64\src -DALIAS_ROS1_CLASS_LOADER=1 -DBoost_NAMESPACE=mwboost -DCATKIN_ENABLE_TESTING=off -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_C_COMPILER=cl.exe -DCMAKE_LINKER=link.exe -DMSVC_TOOLSET_VERSION=141 -DCMAKE_PREFIX_PATH=C:\Program Files\MATLAB\R2022a\sys\ros1\win64\ros1;C:/Program Files/MATLAB/R2022a/toolbox/ros/mlroscpp/custom_messages -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS_RELEASE=/MD /Od /Ob2 /DNDEBUG -DCATKIN_DEVEL_PREFIX=C:\MATLAB\custom_messages\matlab_msg_gen_ros1\win64\devel -DCMAKE_INSTALL_PREFIX=C:\MATLAB\custom_messages\matlab_msg_gen_ros1\win64\install -G Ninja" in "C:\MATLAB\custom_messages\matlab_msg_gen_ros1\win64\build"
####
Invoking "cmake" failed
  3 Kommentare
Franz Albers
Franz Albers am 20 Apr. 2022
Hey Hari,
thanks for the quick reply!
I don't think that the issue arises due to the package itself, as building our custom messages works on other computers and building the radar_msgs or kobuki_msgs does also not work in my setup. However, I've attached our custom message package.
I rather think that there might be a conflict with my system environment and lines 60-63 of environment_cache.py, where the error for some reason occurs on my system.
# fetch environment after calling setup
python_code = 'import os; print(dict(os.environ))'
output = subprocess.check_output([env_script, sys.executable, '-c', python_code])
# print(output)
env_after = ast.literal_eval(output.decode('utf8'))
I've also printed the output in the line before the error occurs (as commented in the code above) to the log file and attached the log file (see lines 16-19 of stdout_stderr.log.txt).
Greetings,
Franz
Soulaimane Berkane
Soulaimane Berkane am 16 Mär. 2023
Hello Franz,
I am facing a similar problem to yours. Did you figure out a solution? Thank you in advance.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jagadeesh Konakalla
Jagadeesh Konakalla am 21 Nov. 2022
Looks issue is with the environment as mentioned by Franz.

Kategorien

Mehr zu Custom Message Support finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by