Updating build in ROS msgs for controller_manager_msgs with rosgenmsg fails in Matlab21b

1 回表示 (過去 30 日間)
Alice
Alice 2024 年 3 月 15 日
回答済み: Alice 2024 年 4 月 8 日
Hi,
I need to update the build in ROS msgs of the package controller_manager_msgs in Matlab21b to the newest version available at https://github.com/ros-controls/ros_control/tree/melodic-devel/controller_manager_msgs since my robot is working with the newer msgs definitions. Main difference can be found in the definition of the ControllerState.msg which uses the HardwareInterfaceResources.msg in the newer version, which is not used in the build in msgs. Unfortunately the build fails with the error found below. Can someone help me on how to fix this? (I tried this on Windows and on a Linux Ubuntu 18.04 computer)
Identifying message files in folder 'M:/80_WN_Roboter/30_ROS_Simulink/01_Custom_Msgs_Srvs_Actions/01_Laptop'..Done.
Validating message files in folder 'M:/80_WN_Roboter/30_ROS_Simulink/01_Custom_Msgs_Srvs_Actions/01_Laptop'..Done.
[4/4] Generating MATLAB interfaces for custom message packages... Done.
Running catkin build in folder 'M:/80_WN_Roboter/30_ROS_Simulink/01_Custom_Msgs_Srvs_Actions/01_Laptop/matlab_msg_gen_ros1/win64'.
Build in progress. This may take several minutes...Error using ros.internal.ROSProjectBuilder/buildPackage (line 552)
Error building package: build log.
Error in rosgenmsg (line 483)
buildPackage(builder, [], 'install', catkinMakeArgs); %other messages might need to be present in the same directory
Error in createCustomMsgsSrvsActions (line 13)
rosgenmsg(folderpath)
With the following errors in the log file:
Building CXX object controller_manager_msgs\CMakeFiles\controller_manager_msgs_matlab.dir\src\controller_manager_msgs_ControllerState_message.cpp.obj
FAILED: controller_manager_msgs/CMakeFiles/controller_manager_msgs_matlab.dir/src/controller_manager_msgs_ControllerState_message.cpp.obj
C:\PROGRA~2\MICROS~2\2017\ENTERP~1\VC\Tools\MSVC\1416~1.270\bin\Hostx86\x64\cl.exe /nologo /TP -DBOOST_ALL_DYN_LINK -DBOOST_ALL_NO_LIB -DCONTROLLER_MANAGER_MSGS_BUILDING_LIBRARY -DNOMINMAX -DNO_STRICT -DQ_NOWINSTRICT -DROS1_USES_ROS2_CLASS_LOADER -DROS_BUILD_SHARED_LIBS=1 -DROS_PACKAGE_NAME=\"controller_manager_msgs\" -DWIN32_LEAN_AND_MEAN -D_USE_MATH_DEFINES -Dcontroller_manager_msgs_matlab_EXPORTS -IM:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\devel\include -IM:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\src\controller_manager_msgs\include -IM:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\src\controller_manager_msgs -I"C:\Program Files\MATLAB\R2021b\sys\ros1\win64\ros1\include" -I"C:\Program Files\MATLAB\R2021b\sys\ros1\win64\ros1\boost\include\boost-1_72" -I"C:\Program Files\MATLAB\R2021b\sys\ros1\win64\ros1\console_bridge\include" -I"C:\Program Files\MATLAB\R2021b\sys\ros1\win64\ros1\share\xmlrpcpp\cmake\..\..\..\include\xmlrpcpp" -I"C:\Program Files\MATLAB\R2021b\extern\include" -I"C:\Program Files\MATLAB\R2021b\extern\include\MatlabDataArray" -I"C:\Program Files\MATLAB\R2021b\toolbox\ros\include\ros1" -I"C:\Program Files\MATLAB\R2021b\sys\ros2\win64\ros2\include\class_loader" -I"C:\Program Files\MATLAB\R2021b\toolbox\ros\mlroscpp\custom_messages\include" -I"C:\Program Files\MATLAB\R2021b\sys\ros1\win64\ros1\bzip2\include" -I"C:\Program Files\MATLAB\R2021b\sys\ros1\win64\ros1\lz4\include" -IM:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\src\controller_manager_msgs\include\controller_manager_msgs /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MD /Od /Ob2 /DNDEBUG -std:c++14 /Zc:__cplusplus /showIncludes /Focontroller_manager_msgs\CMakeFiles\controller_manager_msgs_matlab.dir\src\controller_manager_msgs_ControllerState_message.cpp.obj /Fdcontroller_manager_msgs\CMakeFiles\controller_manager_msgs_matlab.dir\ /FS -c M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\src\controller_manager_msgs\src\controller_manager_msgs_ControllerState_message.cpp
M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\src\controller_manager_msgs\src\controller_manager_msgs_ControllerState_message.cpp(70): error C2039: "hardware_interface": Ist kein Element von "controller_manager_msgs::ControllerState_<std::allocator<void>>"
M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\devel\include\controller_manager_msgs/ControllerState.h(64): note: Siehe Deklaration von "controller_manager_msgs::ControllerState_<std::allocator<void>>"
M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\src\controller_manager_msgs\src\controller_manager_msgs_ControllerState_message.cpp(82): error C2039: "resources": Ist kein Element von "controller_manager_msgs::ControllerState_<std::allocator<void>>"
M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\devel\include\controller_manager_msgs/ControllerState.h(64): note: Siehe Deklaration von "controller_manager_msgs::ControllerState_<std::allocator<void>>"
M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\src\controller_manager_msgs\src\controller_manager_msgs_ControllerState_message.cpp(106): error C2039: "hardware_interface": Ist kein Element von "controller_manager_msgs::ControllerState_<std::allocator<void>>"
M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\devel\include\controller_manager_msgs/ControllerState.h(64): note: Siehe Deklaration von "controller_manager_msgs::ControllerState_<std::allocator<void>>"
M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\src\controller_manager_msgs\src\controller_manager_msgs_ControllerState_message.cpp(107): error C3536: "currentElement_hardware_interface": Kann nicht verwendet werden, bevor es initialisiert wurde.
M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\src\controller_manager_msgs\src\controller_manager_msgs_ControllerState_message.cpp(107): error C2664: "matlab::data::CharArray matlab::data::ArrayFactory::createCharArray(const std::string &)" : Konvertierung von Argument 1 von "int" in "matlab::data::String" nicht m”glich
M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\src\controller_manager_msgs\src\controller_manager_msgs_ControllerState_message.cpp(107): note: Quelltyp konnte von keinem Konstruktor angenommen werden, oder die šberladungsaufl”sung des Konstruktors ist mehrdeutig
M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\src\controller_manager_msgs\src\controller_manager_msgs_ControllerState_message.cpp(109): error C2039: "resources": Ist kein Element von "controller_manager_msgs::ControllerState_<std::allocator<void>>"
M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\devel\include\controller_manager_msgs/ControllerState.h(64): note: Siehe Deklaration von "controller_manager_msgs::ControllerState_<std::allocator<void>>"
M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\src\controller_manager_msgs\src\controller_manager_msgs_ControllerState_message.cpp(110): error C3536: "currentElement_resources": Kann nicht verwendet werden, bevor es initialisiert wurde.
M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\src\controller_manager_msgs\src\controller_manager_msgs_ControllerState_message.cpp(112): error C2109: Index erfordert ein Array oder einen Zeigertyp
[83/117] Generating C++ code from ur_dashboard_msgs/SetModeGoal.msg
[84/117] Generating C++ code from ur_dashboard_msgs/SetModeFeedback.msg
[85/117] Building CXX object controller_manager_msgs\CMakeFiles\controller_manager_msgs_matlab.dir\src\controller_manager_msgs_HardwareInterfaceResources_message.cpp.obj
[86/117] Building CXX object ur_msgs\CMakeFiles\ur_msgs_matlab.dir\src\ur_msgs_SetSpeedSliderFraction_service.cpp.obj
[87/117] Building CXX object controller_manager_msgs\CMakeFiles\controller_manager_msgs_matlab.dir\src\controller_manager_msgs_UnloadController_service.cpp.obj
[88/117] Building CXX object controller_manager_msgs\CMakeFiles\controller_manager_msgs_matlab.dir\src\controller_manager_msgs_LoadController_service.cpp.obj
[89/117] Building CXX object controller_manager_msgs\CMakeFiles\controller_manager_msgs_matlab.dir\src\controller_manager_msgs_ReloadControllerLibraries_service.cpp.obj
[90/117] Building CXX object controller_manager_msgs\CMakeFiles\controller_manager_msgs_matlab.dir\src\controller_manager_msgs_SwitchController_service.cpp.obj
[91/117] Building CXX object controller_manager_msgs\CMakeFiles\controller_manager_msgs_matlab.dir\src\controller_manager_msgs_ListControllerTypes_service.cpp.obj
[92/117] Building CXX object myown_msgs\CMakeFiles\myown_msgs_matlab.dir\src\myown_msgs_getOCP_service.cpp.obj
[93/117] Building CXX object controller_manager_msgs\CMakeFiles\controller_manager_msgs_matlab.dir\src\controller_manager_msgs_ListControllers_service.cpp.obj
ninja: build stopped: subcommand failed.
Base path: M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64
Source space: M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\src
Build space: M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\build
Devel space: M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\devel
Install space: M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\install
####
#### Running command: "ninja build.ninja" in "M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\build"
####
####
#### Running command: "ninja install install -j12 -l12" in "M:\80_WN_Roboter\30_ROS_Simulink\01_Custom_Msgs_Srvs_Actions\01_Laptop\matlab_msg_gen_ros1\win64\build"
####
Invoking "ninja install install -j12 -l12" failed

採用された回答

Alice
Alice 2024 年 4 月 8 日
Hi,
the technical support team from Matlab was able to provide a workaround which solved the issue. The workaround is:
"We suggest taking a backup of "controller_manager_msgs" folder under <matlabroot>\toolbox\ros\mlroscpp\custom_messages\share and delete the <matlabroot>\toolbox\ros\mlroscpp\custom_messages\share\controller_manager_msgs folder and try "rosgenmsg" again."
After that, the build was successful and I was able to call the services. The only odd thing is that when doing "rosmsg list", I get every message definition from the controller_manager_msgs package twice. But this does not have any negative effect on the usage of the message definitions.

その他の回答 (1 件)

Debadipto
Debadipto 2024 年 3 月 28 日
Hi @Alice,
The error you're encountering during the build process seems to be related to the C++ code generated by MATLAB from the ROS message definitions not matching the expected structure of the ControllerState message, specifically with respect to the hardware_interface and resources fields. This suggests that there might be an issue with how the newer message definitions are being interpreted or with missing dependencies during the code generation process.
Please make sure that all dependencies required by the controller_manager_msgs package are present in your MATLAB environment. This includes the HardwareInterfaceResources.msg and any other new messages or services that the updated ControllerState.msg depends on. Also, verify that MATLAB is looking in the correct directories for the ROS message definitions.
  1 件のコメント
Alice
Alice 2024 年 3 月 28 日
thanks for your answer. The HardwareInterfaceResources.msg is in the same folder as the ControllerState.msg as you can see in the attached "controller_manager_msgs" package. Matlab seems to have a problem with the order in which the messages are generated, since it first generates the ControllerState.msg without knowing the HardwareInterfaceResources.msg. Is there any way to tell Matlab to first generate the HardwareInterfaceResources.msg and then the ControllerState.msg?
I tried generating only the HardwareInterfaceResources.msg (which works) and then adding all other message definitions to the package and regenerate it, but the same error occurs....

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSpecialized Messages についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by