Creating custom ROS2 Message in Simulink using ROS2 Foxy

Hello,
I am currently working on implementing a CACC-controller in ROS2 and I would like to use custom messages. However I run into some errors when I try to execute the ros2genmsg command.
I am using ROS2 Foxy on Ubuntu 20.04 and Matlab Release 2021a. I managed to make the DDS connection work by using Cyclone DDS and setting everything up with Python3.7 and cmake.
The current project code I am working on can be found here: https://github.com/HarunTeper/CMRCE
The message I want to generate can be found in the /src/ros_its_msgs/msg folder.
First before I start matlab, I execute the following command in terminal to have cmake support:
export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libcurl.so"
To generate the message, I use the following code, after I moved the ros_its_msgs folder to a "custom" folder on my drive:
clc; clear all;
pyenv('Version','/usr/bin/python3.7');
setenv('PATH', strcat('/usr/bin', pathsep, getenv('PATH')));
ros2genmsg("/home/harun/custom")
Then I get the following output and error:
ans =
PythonEnvironment with properties:
Version: "3.7"
Executable: "/usr/bin/python3.7"
Library: "libpython3.7m.so.1.0"
Home: "/usr"
Status: NotLoaded
ExecutionMode: InProcess
Identifying message files in folder '/home/harun/custom'..Done.
Validating message files in folder '/home/harun/custom'..Done.
[1/1] Generating MATLAB interfaces for custom message packages... Done.
Running colcon build in folder '/home/harun/custom/matlab_msg_gen/glnxa64'.
Build in progress. This may take several minutes...Error using ros.internal.ROSProjectBuilder/buildPackage (line 534)
Error building package: build log.
Error in ros2genmsg (line 241)
buildPackage(builder, [], ' --merge-install', colconMakeArgs); %other messages might need to be present in the same directory
Error in ros_cacc (line 25)
ros2genmsg("/home/harun/custom")
After looking at some other threads, I also took a look at the stderr.log file for further information:
In file included from /opt/ros/foxy/include/rclcpp/node_interfaces/node_topics_interface.hpp:32,
from /opt/ros/foxy/include/rclcpp/node.hpp:55,
from /opt/ros/foxy/include/rclcpp/executors/single_threaded_executor.hpp:28,
from /opt/ros/foxy/include/rclcpp/executors.hpp:22,
from /opt/ros/foxy/include/rclcpp/rclcpp.hpp:146,
from /home/harun/custom/matlab_msg_gen/glnxa64/src/ros_its_msgs/src/ros_its_msgs_PlatoonDist_message.cpp:22:
/opt/ros/foxy/include/rclcpp/subscription_factory.hpp: In instantiation of ‘rclcpp::SubscriptionFactory rclcpp::create_subscription_factory(CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr, std::shared_ptr<rclcpp::topic_statistics::SubscriptionTopicStatistics<CallbackMessageT> >) [with MessageT = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; CallbackT = ROS2SubscriberImpl<RosMessageType, CommonType>::createSubscription(const string&, const rclcpp::QoS&, rclcpp::Node::SharedPtr, void*, SendDataToMATLABFunc_T, bool) [with RosMessageType = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; CommonType = ros_its_msgs_msg_PlatoonDist_common; intptr_t = long int; std::string = std::__cxx11::basic_string<char>; rclcpp::Node::SharedPtr = std::shared_ptr<rclcpp::Node>; SendDataToMATLABFunc_T = bool (*)(void*, const std::vector<matlab::data::Array>&)]::<lambda(std::shared_ptr<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> > >, const rmw_message_info_t&)>&; AllocatorT = std::allocator<void>; CallbackMessageT = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; SubscriptionT = rclcpp::Subscription<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void>, rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> >; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> > >]:
/opt/ros/foxy/include/rclcpp/create_subscription.hpp:144:63: required from ‘std::shared_ptr<SubscriptionT> rclcpp::create_subscription(NodeT&&, const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr) [with MessageT = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; CallbackT = ROS2SubscriberImpl<RosMessageType, CommonType>::createSubscription(const string&, const rclcpp::QoS&, rclcpp::Node::SharedPtr, void*, SendDataToMATLABFunc_T, bool) [with RosMessageType = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; CommonType = ros_its_msgs_msg_PlatoonDist_common; intptr_t = long int; std::string = std::__cxx11::basic_string<char>; rclcpp::Node::SharedPtr = std::shared_ptr<rclcpp::Node>; SendDataToMATLABFunc_T = bool (*)(void*, const std::vector<matlab::data::Array>&)]::<lambda(std::shared_ptr<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> > >, const rmw_message_info_t&)>&; AllocatorT = std::allocator<void>; CallbackMessageT = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; SubscriptionT = rclcpp::Subscription<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void>, rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> >; NodeT = rclcpp::Node&; std::string = std::__cxx11::basic_string<char>; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> > >]
/opt/ros/foxy/include/rclcpp/node_impl.hpp:98:47: required from ‘std::shared_ptr<SubscriptionT> rclcpp::Node::create_subscription(const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr) [with MessageT = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; CallbackT = ROS2SubscriberImpl<RosMessageType, CommonType>::createSubscription(const string&, const rclcpp::QoS&, rclcpp::Node::SharedPtr, void*, SendDataToMATLABFunc_T, bool) [with RosMessageType = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; CommonType = ros_its_msgs_msg_PlatoonDist_common; intptr_t = long int; std::string = std::__cxx11::basic_string<char>; rclcpp::Node::SharedPtr = std::shared_ptr<rclcpp::Node>; SendDataToMATLABFunc_T = bool (*)(void*, const std::vector<matlab::data::Array>&)]::<lambda(std::shared_ptr<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> > >, const rmw_message_info_t&)>&; AllocatorT = std::allocator<void>; CallbackMessageT = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; SubscriptionT = rclcpp::Subscription<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void>, rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> >; std::string = std::__cxx11::basic_string<char>; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> > >]
/usr/local/MATLAB/R2021a/toolbox/ros/include/ros2/ROS2PubSubTemplates.hpp:81:14: required from ‘intptr_t ROS2SubscriberImpl<RosMessageType, CommonType>::createSubscription(const string&, const rclcpp::QoS&, rclcpp::Node::SharedPtr, void*, SendDataToMATLABFunc_T, bool) [with RosMessageType = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; CommonType = ros_its_msgs_msg_PlatoonDist_common; intptr_t = long int; std::string = std::__cxx11::basic_string<char>; rclcpp::Node::SharedPtr = std::shared_ptr<rclcpp::Node>; SendDataToMATLABFunc_T = bool (*)(void*, const std::vector<matlab::data::Array>&)]
/usr/local/MATLAB/R2021a/toolbox/ros/include/ros2/ROS2PubSubTemplates.hpp:61:22: required from here
/opt/ros/foxy/include/rclcpp/subscription_factory.hpp:97:3: error: no matching function for call to ‘rclcpp::AnySubscriptionCallback<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> >::set(ROS2SubscriberImpl<RosMessageType, CommonType>::createSubscription(const string&, const rclcpp::QoS&, rclcpp::Node::SharedPtr, void*, SendDataToMATLABFunc_T, bool) [with RosMessageType = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; CommonType = ros_its_msgs_msg_PlatoonDist_common; intptr_t = long int; std::string = std::__cxx11::basic_string<char>; rclcpp::Node::SharedPtr = std::shared_ptr<rclcpp::Node>; SendDataToMATLABFunc_T = bool (*)(void*, const std::vector<matlab::data::Array>&)]::<lambda(std::shared_ptr<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> > >, const rmw_message_info_t&)>&)
97 | any_subscription_callback.set(std::forward<CallbackT>(callback));
| ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/ros/foxy/include/rclcpp/subscription_base.hpp:29,
from /opt/ros/foxy/include/rclcpp/callback_group.hpp:26,
from /opt/ros/foxy/include/rclcpp/any_executable.hpp:20,
from /opt/ros/foxy/include/rclcpp/memory_strategy.hpp:24,
from /opt/ros/foxy/include/rclcpp/memory_strategies.hpp:18,
from /opt/ros/foxy/include/rclcpp/executor_options.hpp:20,
from /opt/ros/foxy/include/rclcpp/executor.hpp:33,
from /opt/ros/foxy/include/rclcpp/executors/multi_threaded_executor.hpp:25,
from /opt/ros/foxy/include/rclcpp/executors.hpp:21,
from /opt/ros/foxy/include/rclcpp/rclcpp.hpp:146,
from /home/harun/custom/matlab_msg_gen/glnxa64/src/ros_its_msgs/src/ros_its_msgs_PlatoonDist_message.cpp:22:
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:83:8: note: candidate: template<class CallbackT, typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> > >)> >::value, void>::type* <anonymous> > void rclcpp::AnySubscriptionCallback<MessageT, Alloc>::set(CallbackT) [with CallbackT = CallbackT; typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<_Tp>)> >::value>::type* <anonymous> = <enumerator>; MessageT = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; Alloc = std::allocator<void>]
83 | void set(CallbackT callback)
| ^~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:83:8: note: template argument deduction/substitution failed:
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:81:17: error: no type named ‘type’ in ‘struct std::enable_if<false, void>
81 | >::type * = nullptr
| ^~~~~~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:97:8: note: candidate: template<class CallbackT, typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> > >, const rclcpp::MessageInfo&)> >::value, void>::type* <anonymous> > void rclcpp::AnySubscriptionCallback<MessageT, Alloc>::set(CallbackT) [with CallbackT = CallbackT; typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<_Tp>, const rclcpp::MessageInfo&)> >::value>::type* <anonymous> = <enumerator>; MessageT = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; Alloc = std::allocator<void>]
97 | void set(CallbackT callback)
| ^~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:97:8: note: template argument deduction/substitution failed:
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:95:17: error: no type named ‘type’ in ‘struct std::enable_if<false, void>
95 | >::type * = nullptr
| ^~~~~~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:111:8: note: candidate: template<class CallbackT, typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<const ros_its_msgs::msg::PlatoonDist_<std::allocator<void> > >)> >::value, void>::type* <anonymous> > void rclcpp::AnySubscriptionCallback<MessageT, Alloc>::set(CallbackT) [with CallbackT = CallbackT; typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<const _Tp>)> >::value>::type* <anonymous> = <enumerator>; MessageT = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; Alloc = std::allocator<void>]
111 | void set(CallbackT callback)
| ^~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:111:8: note: template argument deduction/substitution failed:
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:109:17: error: no type named ‘type’ in ‘struct std::enable_if<false, void>
109 | >::type * = nullptr
| ^~~~~~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:125:8: note: candidate: template<class CallbackT, typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<const ros_its_msgs::msg::PlatoonDist_<std::allocator<void> > >, const rclcpp::MessageInfo&)> >::value, void>::type* <anonymous> > void rclcpp::AnySubscriptionCallback<MessageT, Alloc>::set(CallbackT) [with CallbackT = CallbackT; typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<const _Tp>, const rclcpp::MessageInfo&)> >::value>::type* <anonymous> = <enumerator>; MessageT = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; Alloc = std::allocator<void>]
125 | void set(CallbackT callback)
| ^~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:125:8: note: template argument deduction/substitution failed:
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:123:17: error: no type named ‘type’ in ‘struct std::enable_if<false, void>
123 | >::type * = nullptr
| ^~~~~~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:139:8: note: candidate: template<class CallbackT, typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::unique_ptr<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::default_delete<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> > > >)> >::value, void>::type* <anonymous> > void rclcpp::AnySubscriptionCallback<MessageT, Alloc>::set(CallbackT) [with CallbackT = CallbackT; typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::unique_ptr<MessageT, typename std::conditional<std::is_same<typename std::allocator_traits<typename std::allocator_traits<_Alloc>::rebind_traits<MessageT>::allocator_type>::rebind_alloc<MessageT>, typename std::allocator<void>::rebind<_Tp1>::other>::value, std::default_delete<_Tp>, rclcpp::allocator::AllocatorDeleter<typename std::allocator_traits<_Alloc>::rebind_traits<MessageT>::allocator_type> >::type>)> >::value>::type* <anonymous> = <enumerator>; MessageT = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; Alloc = std::allocator<void>]
139 | void set(CallbackT callback)
| ^~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:139:8: note: template argument deduction/substitution failed:
In file included from /opt/ros/foxy/include/rclcpp/node_interfaces/node_topics_interface.hpp:32,
from /opt/ros/foxy/include/rclcpp/node.hpp:55,
from /opt/ros/foxy/include/rclcpp/executors/single_threaded_executor.hpp:28,
from /opt/ros/foxy/include/rclcpp/executors.hpp:22,
from /opt/ros/foxy/include/rclcpp/rclcpp.hpp:146,
from /home/harun/custom/matlab_msg_gen/glnxa64/src/ros_its_msgs/src/ros_its_msgs_CAMMessage_message.cpp:22:
/opt/ros/foxy/include/rclcpp/subscription_factory.hpp: In instantiation of ‘rclcpp::SubscriptionFactory rclcpp::create_subscription_factory(CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr, std::shared_ptr<rclcpp::topic_statistics::SubscriptionTopicStatistics<CallbackMessageT> >) [with MessageT = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; CallbackT = ROS2SubscriberImpl<RosMessageType, CommonType>::createSubscription(const string&, const rclcpp::QoS&, rclcpp::Node::SharedPtr, void*, SendDataToMATLABFunc_T, bool) [with RosMessageType = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; CommonType = ros_its_msgs_msg_CAMMessage_common; intptr_t = long int; std::string = std::__cxx11::basic_string<char>; rclcpp::Node::SharedPtr = std::shared_ptr<rclcpp::Node>; SendDataToMATLABFunc_T = bool (*)(void*, const std::vector<matlab::data::Array>&)]::<lambda(std::shared_ptr<ros_its_msgs::msg::CAMMessage_<std::allocator<void> > >, const rmw_message_info_t&)>&; AllocatorT = std::allocator<void>; CallbackMessageT = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; SubscriptionT = rclcpp::Subscription<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void>, rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void> >; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void> > >]:
/opt/ros/foxy/include/rclcpp/create_subscription.hpp:144:63: required from ‘std::shared_ptr<SubscriptionT> rclcpp::create_subscription(NodeT&&, const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr) [with MessageT = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; CallbackT = ROS2SubscriberImpl<RosMessageType, CommonType>::createSubscription(const string&, const rclcpp::QoS&, rclcpp::Node::SharedPtr, void*, SendDataToMATLABFunc_T, bool) [with RosMessageType = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; CommonType = ros_its_msgs_msg_CAMMessage_common; intptr_t = long int; std::string = std::__cxx11::basic_string<char>; rclcpp::Node::SharedPtr = std::shared_ptr<rclcpp::Node>; SendDataToMATLABFunc_T = bool (*)(void*, const std::vector<matlab::data::Array>&)]::<lambda(std::shared_ptr<ros_its_msgs::msg::CAMMessage_<std::allocator<void> > >, const rmw_message_info_t&)>&; AllocatorT = std::allocator<void>; CallbackMessageT = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; SubscriptionT = rclcpp::Subscription<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void>, rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void> >; NodeT = rclcpp::Node&; std::string = std::__cxx11::basic_string<char>; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void> > >]
/opt/ros/foxy/include/rclcpp/node_impl.hpp:98:47: required from ‘std::shared_ptr<SubscriptionT> rclcpp::Node::create_subscription(const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr) [with MessageT = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; CallbackT = ROS2SubscriberImpl<RosMessageType, CommonType>::createSubscription(const string&, const rclcpp::QoS&, rclcpp::Node::SharedPtr, void*, SendDataToMATLABFunc_T, bool) [with RosMessageType = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; CommonType = ros_its_msgs_msg_CAMMessage_common; intptr_t = long int; std::string = std::__cxx11::basic_string<char>; rclcpp::Node::SharedPtr = std::shared_ptr<rclcpp::Node>; SendDataToMATLABFunc_T = bool (*)(void*, const std::vector<matlab::data::Array>&)]::<lambda(std::shared_ptr<ros_its_msgs::msg::CAMMessage_<std::allocator<void> > >, const rmw_message_info_t&)>&; AllocatorT = std::allocator<void>; CallbackMessageT = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; SubscriptionT = rclcpp::Subscription<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void>, rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void> >; std::string = std::__cxx11::basic_string<char>; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void> > >]
/usr/local/MATLAB/R2021a/toolbox/ros/include/ros2/ROS2PubSubTemplates.hpp:81:14: required from ‘intptr_t ROS2SubscriberImpl<RosMessageType, CommonType>::createSubscription(const string&, const rclcpp::QoS&, rclcpp::Node::SharedPtr, void*, SendDataToMATLABFunc_T, bool) [with RosMessageType = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; CommonType = ros_its_msgs_msg_CAMMessage_common; intptr_t = long int; std::string = std::__cxx11::basic_string<char>; rclcpp::Node::SharedPtr = std::shared_ptr<rclcpp::Node>; SendDataToMATLABFunc_T = bool (*)(void*, const std::vector<matlab::data::Array>&)]
/usr/local/MATLAB/R2021a/toolbox/ros/include/ros2/ROS2PubSubTemplates.hpp:61:22: required from here
/opt/ros/foxy/include/rclcpp/subscription_factory.hpp:97:3: error: no matching function for call to ‘rclcpp::AnySubscriptionCallback<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void> >::set(ROS2SubscriberImpl<RosMessageType, CommonType>::createSubscription(const string&, const rclcpp::QoS&, rclcpp::Node::SharedPtr, void*, SendDataToMATLABFunc_T, bool) [with RosMessageType = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; CommonType = ros_its_msgs_msg_CAMMessage_common; intptr_t = long int; std::string = std::__cxx11::basic_string<char>; rclcpp::Node::SharedPtr = std::shared_ptr<rclcpp::Node>; SendDataToMATLABFunc_T = bool (*)(void*, const std::vector<matlab::data::Array>&)]::<lambda(std::shared_ptr<ros_its_msgs::msg::CAMMessage_<std::allocator<void> > >, const rmw_message_info_t&)>&)
97 | any_subscription_callback.set(std::forward<CallbackT>(callback));
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:137:17: error: no type named ‘type’ in ‘struct std::enable_if<false, void>
137 | >::type * = nullptr
| ^~~~~~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:153:8: note: candidate: template<class CallbackT, typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::unique_ptr<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::default_delete<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> > > >, const rclcpp::MessageInfo&)> >::value, void>::type* <anonymous> > void rclcpp::AnySubscriptionCallback<MessageT, Alloc>::set(CallbackT) [with CallbackT = CallbackT; typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::unique_ptr<MessageT, typename std::conditional<std::is_same<typename std::allocator_traits<typename std::allocator_traits<_Alloc>::rebind_traits<MessageT>::allocator_type>::rebind_alloc<MessageT>, typename std::allocator<void>::rebind<_Tp1>::other>::value, std::default_delete<_Tp>, rclcpp::allocator::AllocatorDeleter<typename std::allocator_traits<_Alloc>::rebind_traits<MessageT>::allocator_type> >::type>, const rclcpp::MessageInfo&)> >::value>::type* <anonymous> = <enumerator>; MessageT = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; Alloc = std::allocator<void>]
153 | void set(CallbackT callback)
| ^~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:153:8: note: template argument deduction/substitution failed:
In file included from /opt/ros/foxy/include/rclcpp/subscription_base.hpp:29,
from /opt/ros/foxy/include/rclcpp/callback_group.hpp:26,
from /opt/ros/foxy/include/rclcpp/any_executable.hpp:20,
from /opt/ros/foxy/include/rclcpp/memory_strategy.hpp:24,
from /opt/ros/foxy/include/rclcpp/memory_strategies.hpp:18,
from /opt/ros/foxy/include/rclcpp/executor_options.hpp:20,
from /opt/ros/foxy/include/rclcpp/executor.hpp:33,
from /opt/ros/foxy/include/rclcpp/executors/multi_threaded_executor.hpp:25,
from /opt/ros/foxy/include/rclcpp/executors.hpp:21,
from /opt/ros/foxy/include/rclcpp/rclcpp.hpp:146,
from /home/harun/custom/matlab_msg_gen/glnxa64/src/ros_its_msgs/src/ros_its_msgs_CAMMessage_message.cpp:22:
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:83:8: note: candidate: template<class CallbackT, typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<ros_its_msgs::msg::CAMMessage_<std::allocator<void> > >)> >::value, void>::type* <anonymous> > void rclcpp::AnySubscriptionCallback<MessageT, Alloc>::set(CallbackT) [with CallbackT = CallbackT; typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<_Tp>)> >::value>::type* <anonymous> = <enumerator>; MessageT = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; Alloc = std::allocator<void>]
83 | void set(CallbackT callback)
| ^~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:151:17: error: no type named ‘type’ in ‘struct std::enable_if<false, void>
151 | >::type * = nullptr
| ^~~~~~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:83:8: note: template argument deduction/substitution failed:
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:81:17: error: no type named ‘type’ in ‘struct std::enable_if<false, void>
81 | >::type * = nullptr
| ^~~~~~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:97:8: note: candidate: template<class CallbackT, typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<ros_its_msgs::msg::CAMMessage_<std::allocator<void> > >, const rclcpp::MessageInfo&)> >::value, void>::type* <anonymous> > void rclcpp::AnySubscriptionCallback<MessageT, Alloc>::set(CallbackT) [with CallbackT = CallbackT; typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<_Tp>, const rclcpp::MessageInfo&)> >::value>::type* <anonymous> = <enumerator>; MessageT = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; Alloc = std::allocator<void>]
97 | void set(CallbackT callback)
| ^~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:97:8: note: template argument deduction/substitution failed:
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:95:17: error: no type named ‘type’ in ‘struct std::enable_if<false, void>
95 | >::type * = nullptr
| ^~~~~~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:111:8: note: candidate: template<class CallbackT, typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<const ros_its_msgs::msg::CAMMessage_<std::allocator<void> > >)> >::value, void>::type* <anonymous> > void rclcpp::AnySubscriptionCallback<MessageT, Alloc>::set(CallbackT) [with CallbackT = CallbackT; typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<const _Tp>)> >::value>::type* <anonymous> = <enumerator>; MessageT = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; Alloc = std::allocator<void>]
111 | void set(CallbackT callback)
| ^~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:111:8: note: template argument deduction/substitution failed:
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:109:17: error: no type named ‘type’ in ‘struct std::enable_if<false, void>
109 | >::type * = nullptr
| ^~~~~~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:125:8: note: candidate: template<class CallbackT, typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<const ros_its_msgs::msg::CAMMessage_<std::allocator<void> > >, const rclcpp::MessageInfo&)> >::value, void>::type* <anonymous> > void rclcpp::AnySubscriptionCallback<MessageT, Alloc>::set(CallbackT) [with CallbackT = CallbackT; typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<const _Tp>, const rclcpp::MessageInfo&)> >::value>::type* <anonymous> = <enumerator>; MessageT = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; Alloc = std::allocator<void>]
125 | void set(CallbackT callback)
| ^~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:125:8: note: template argument deduction/substitution failed:
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:123:17: error: no type named ‘type’ in ‘struct std::enable_if<false, void>
123 | >::type * = nullptr
| ^~~~~~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:139:8: note: candidate: template<class CallbackT, typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::unique_ptr<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::default_delete<ros_its_msgs::msg::CAMMessage_<std::allocator<void> > > >)> >::value, void>::type* <anonymous> > void rclcpp::AnySubscriptionCallback<MessageT, Alloc>::set(CallbackT) [with CallbackT = CallbackT; typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::unique_ptr<MessageT, typename std::conditional<std::is_same<typename std::allocator_traits<typename std::allocator_traits<_Alloc>::rebind_traits<MessageT>::allocator_type>::rebind_alloc<MessageT>, typename std::allocator<void>::rebind<_Tp1>::other>::value, std::default_delete<_Tp>, rclcpp::allocator::AllocatorDeleter<typename std::allocator_traits<_Alloc>::rebind_traits<MessageT>::allocator_type> >::type>)> >::value>::type* <anonymous> = <enumerator>; MessageT = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; Alloc = std::allocator<void>]
139 | void set(CallbackT callback)
| ^~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:139:8: note: template argument deduction/substitution failed:
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:137:17: error: no type named ‘type’ in ‘struct std::enable_if<false, void>
137 | >::type * = nullptr
| ^~~~~~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:153:8: note: candidate: template<class CallbackT, typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::unique_ptr<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::default_delete<ros_its_msgs::msg::CAMMessage_<std::allocator<void> > > >, const rclcpp::MessageInfo&)> >::value, void>::type* <anonymous> > void rclcpp::AnySubscriptionCallback<MessageT, Alloc>::set(CallbackT) [with CallbackT = CallbackT; typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::unique_ptr<MessageT, typename std::conditional<std::is_same<typename std::allocator_traits<typename std::allocator_traits<_Alloc>::rebind_traits<MessageT>::allocator_type>::rebind_alloc<MessageT>, typename std::allocator<void>::rebind<_Tp1>::other>::value, std::default_delete<_Tp>, rclcpp::allocator::AllocatorDeleter<typename std::allocator_traits<_Alloc>::rebind_traits<MessageT>::allocator_type> >::type>, const rclcpp::MessageInfo&)> >::value>::type* <anonymous> = <enumerator>; MessageT = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; Alloc = std::allocator<void>]
153 | void set(CallbackT callback)
| ^~~
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:153:8: note: template argument deduction/substitution failed:
/opt/ros/foxy/include/rclcpp/any_subscription_callback.hpp:151:17: error: no type named ‘type’ in ‘struct std::enable_if<false, void>
151 | >::type * = nullptr
| ^~~~~~~
In file included from /usr/include/c++/9/future:48,
from /opt/ros/foxy/include/rclcpp/executors.hpp:18,
from /opt/ros/foxy/include/rclcpp/rclcpp.hpp:146,
from /home/harun/custom/matlab_msg_gen/glnxa64/src/ros_its_msgs/src/ros_its_msgs_PlatoonDist_message.cpp:22:
/usr/include/c++/9/bits/std_function.h:667:7: error: std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = rclcpp::create_subscription_factory(CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr, std::shared_ptr<rclcpp::topic_statistics::SubscriptionTopicStatistics<CallbackMessageT> >) [with MessageT = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; CallbackT = ROS2SubscriberImpl<RosMessageType, CommonType>::createSubscription(const string&, const rclcpp::QoS&, rclcpp::Node::SharedPtr, void*, SendDataToMATLABFunc_T, bool) [with RosMessageType = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; CommonType = ros_its_msgs_msg_PlatoonDist_common; intptr_t = long int; std::string = std::__cxx11::basic_string<char>; rclcpp::Node::SharedPtr = std::shared_ptr<rclcpp::Node>; SendDataToMATLABFunc_T = bool (*)(void*, const std::vector<matlab::data::Array>&)]::<lambda(std::shared_ptr<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> > >, const rmw_message_info_t&)>&; AllocatorT = std::allocator<void>; CallbackMessageT = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; SubscriptionT = rclcpp::Subscription<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void>, rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> >; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> > >]::<lambda(rclcpp::node_interfaces::NodeBaseInterface*, const string&, const rclcpp::QoS&)>; <template-parameter-2-2> = void; <template-parameter-2-3> = void; _Res = std::shared_ptr<rclcpp::SubscriptionBase>; _ArgTypes = {rclcpp::node_interfaces::NodeBaseInterface*, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const rclcpp::QoS&}]’, declared using local type ‘rclcpp::create_subscription_factory(CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr, std::shared_ptr<rclcpp::topic_statistics::SubscriptionTopicStatistics<CallbackMessageT> >) [with MessageT = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; CallbackT = ROS2SubscriberImpl<RosMessageType, CommonType>::createSubscription(const string&, const rclcpp::QoS&, rclcpp::Node::SharedPtr, void*, SendDataToMATLABFunc_T, bool) [with RosMessageType = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; CommonType = ros_its_msgs_msg_PlatoonDist_common; intptr_t = long int; std::string = std::__cxx11::basic_string<char>; rclcpp::Node::SharedPtr = std::shared_ptr<rclcpp::Node>; SendDataToMATLABFunc_T = bool (*)(void*, const std::vector<matlab::data::Array>&)]::<lambda(std::shared_ptr<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> > >, const rmw_message_info_t&)>&; AllocatorT = std::allocator<void>; CallbackMessageT = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; SubscriptionT = rclcpp::Subscription<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void>, rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> >; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> > >]::<lambda(rclcpp::node_interfaces::NodeBaseInterface*, const string&, const rclcpp::QoS&)>’, is used but never defined [-fpermissive]
667 | function<_Res(_ArgTypes...)>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/9/future:48,
from /opt/ros/foxy/include/rclcpp/executors.hpp:18,
from /opt/ros/foxy/include/rclcpp/rclcpp.hpp:146,
from /home/harun/custom/matlab_msg_gen/glnxa64/src/ros_its_msgs/src/ros_its_msgs_CAMMessage_message.cpp:22:
/usr/include/c++/9/bits/std_function.h:667:7: error: std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = rclcpp::create_subscription_factory(CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr, std::shared_ptr<rclcpp::topic_statistics::SubscriptionTopicStatistics<CallbackMessageT> >) [with MessageT = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; CallbackT = ROS2SubscriberImpl<RosMessageType, CommonType>::createSubscription(const string&, const rclcpp::QoS&, rclcpp::Node::SharedPtr, void*, SendDataToMATLABFunc_T, bool) [with RosMessageType = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; CommonType = ros_its_msgs_msg_CAMMessage_common; intptr_t = long int; std::string = std::__cxx11::basic_string<char>; rclcpp::Node::SharedPtr = std::shared_ptr<rclcpp::Node>; SendDataToMATLABFunc_T = bool (*)(void*, const std::vector<matlab::data::Array>&)]::<lambda(std::shared_ptr<ros_its_msgs::msg::CAMMessage_<std::allocator<void> > >, const rmw_message_info_t&)>&; AllocatorT = std::allocator<void>; CallbackMessageT = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; SubscriptionT = rclcpp::Subscription<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void>, rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void> >; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void> > >]::<lambda(rclcpp::node_interfaces::NodeBaseInterface*, const string&, const rclcpp::QoS&)>; <template-parameter-2-2> = void; <template-parameter-2-3> = void; _Res = std::shared_ptr<rclcpp::SubscriptionBase>; _ArgTypes = {rclcpp::node_interfaces::NodeBaseInterface*, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const rclcpp::QoS&}]’, declared using local type ‘rclcpp::create_subscription_factory(CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr, std::shared_ptr<rclcpp::topic_statistics::SubscriptionTopicStatistics<CallbackMessageT> >) [with MessageT = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; CallbackT = ROS2SubscriberImpl<RosMessageType, CommonType>::createSubscription(const string&, const rclcpp::QoS&, rclcpp::Node::SharedPtr, void*, SendDataToMATLABFunc_T, bool) [with RosMessageType = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; CommonType = ros_its_msgs_msg_CAMMessage_common; intptr_t = long int; std::string = std::__cxx11::basic_string<char>; rclcpp::Node::SharedPtr = std::shared_ptr<rclcpp::Node>; SendDataToMATLABFunc_T = bool (*)(void*, const std::vector<matlab::data::Array>&)]::<lambda(std::shared_ptr<ros_its_msgs::msg::CAMMessage_<std::allocator<void> > >, const rmw_message_info_t&)>&; AllocatorT = std::allocator<void>; CallbackMessageT = ros_its_msgs::msg::CAMMessage_<std::allocator<void> >; SubscriptionT = rclcpp::Subscription<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void>, rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void> >; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<ros_its_msgs::msg::CAMMessage_<std::allocator<void> >, std::allocator<void> > >]::<lambda(rclcpp::node_interfaces::NodeBaseInterface*, const string&, const rclcpp::QoS&)>’, is used but never defined [-fpermissive]
667 | function<_Res(_ArgTypes...)>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/ros_its_msgs_matlab.dir/build.make:76: CMakeFiles/ros_its_msgs_matlab.dir/src/ros_its_msgs_PlatoonDist_message.cpp.o] Fehler 1
make[2]: *** Auf noch nicht beendete Prozesse wird gewartet …
make[2]: *** [CMakeFiles/ros_its_msgs_matlab.dir/build.make:63: CMakeFiles/ros_its_msgs_matlab.dir/src/ros_its_msgs_CAMMessage_message.cpp.o] Fehler 1
make[1]: *** [CMakeFiles/Makefile2:124: CMakeFiles/ros_its_msgs_matlab.dir/all] Fehler 2
make: *** [Makefile:141: all] Fehler 2
However at this point I don't know how to fix the issue. Does anyone have any ideas on how to proceed?
Best Regards
Harun Teper

2 Kommentare

Hello Harun,
First of all, thanks for all that detail. Seems like you've done everything right in terms of tracking down the issue.
Based on these kinds of errors:
error: no matching function for call to ‘rclcpp::AnySubscriptionCallback<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >, std::allocator<void> >::set(ROS2SubscriberImpl<RosMessageType, CommonType>::createSubscription(const string&, const rclcpp::QoS&, rclcpp::Node::SharedPtr, void*, SendDataToMATLABFunc_T, bool) [with RosMessageType = ros_its_msgs::msg::PlatoonDist_<std::allocator<void> >; CommonType = ros_its_msgs_msg_PlatoonDist_common; intptr_t = long int; std::string = std::__cxx11::basic_string<char>; rclcpp::Node::SharedPtr = std::shared_ptr<rclcpp::Node>; SendDataToMATLABFunc_T = bool (*)(void*, const std::vector<matlab::data::Array>&)]::<lambda(std::shared_ptr<ros_its_msgs::msg::PlatoonDist_<std::allocator<void> > >, const rmw_message_info_t&)>&)
97 | any_subscription_callback.set(std::forward<CallbackT>(callback));
| ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/ros/foxy/include/rclcpp/subscription_base.hpp:29,
it seems that the ROS installation files that are being included from the generated custom message code are being taken from your native ROS 2 Foxy installation, rather than the Dashing installation that ships with MATLAB. There are some API changes between Dashing and Foxy, so some of the methods called in the custom message code seem to use deprecated or changed APIs that aren't in Foxy.
I've seen similar issues with the linker attempting to link to Foxy libraries due to them being higher on LD_LIBRARY_PATH (or just PATH) for Windows, but this is the first time I've seen include errors. Can you show a printout of all your environment variables, or at least anything with the "foxy" path in it. It'd probably most helpful to see it within MATLAB, and from a standard terminal. I'm not certain which variable it would be that could be causing this issue.
-Cam
Hello Cam,
thanks for your help. This is the output of my environment variables in my terminal, only including paths containing foxy:
AMENT_PREFIX_PATH=/opt/ros/foxy
PYTHONPATH=/opt/ros/foxy/lib/python3.8/site-packages
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/gazebo-11/plugins:/opt/ros/foxy/opt/yaml_cpp_vendor/lib:/opt/ros/foxy/opt/rviz_ogre_vendor/lib:/opt/ros/foxy/lib/x86_64-linux-gnu:/opt/ros/foxy/lib
GAZEBO_MODEL_PATH=:/opt/ros/foxy/share/turtlebot3_gazebo/models:/home/harun/CMRCE/src/car_simulator/models
PATH=/home/harun/omnetpp-5.6.2/bin:/opt/ros/foxy/bin:/home/harun/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
ROS_DISTRO=foxy
For the matlab output I used the script from this thread (Stackoverflow URL) . I included the output containing ros, foxy and some others here:
AMENT_PREFIX_PATH=/opt/ros/foxy
GAZEBO_MODEL_PATH=:/opt/ros/foxy/share/turtlebot3_gazebo/models:/home/harun/CMRCE/src/car_simulator/models
LD_LIBRARY_PATH=/usr/local/MATLAB/R2021a/sys/os/glnxa64:/usr/local/MATLAB/R2021a/bin/glnxa64:/usr/local/MATLAB/R2021a/extern/lib/glnxa64:/usr/local/MATLAB/R2021a/cefclient/sys/os/glnxa64:/usr/local/MATLAB/R2021a/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/usr/local/MATLAB/R2021a/sys/java/jre/glnxa64/jre/lib/amd64/server:/usr/lib/x86_64-linux-gnu/gazebo-11/plugins:/opt/ros/foxy/opt/yaml_cpp_vendor/lib:/opt/ros/foxy/opt/rviz_ogre_vendor/lib:/opt/ros/foxy/lib/x86_64-linux-gnu:/opt/ros/foxy/lib
PATH=/home/harun/omnetpp-5.6.2/bin:/opt/ros/foxy/bin:/home/harun/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PYTHONPATH=/opt/ros/foxy/lib/python3.8/site-packages
RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
ROS_DISTRO=foxy
ROS_LOCALHOST_ONLY=0
ROS_PYTHON_VERSION=3
ROS_VERSION=2
If you need any additional information please let me know.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Cam Salzberger
Cam Salzberger am 9 Aug. 2021

1 Stimme

Hello Harun,
My money would be on this specific issue being cause by AMENT_PREFIX_PATH being checked for include files during the colcon build process. Unsetting that within MATLAB before running ros2genmsg would probably at least resolve this set of errors.
RMW_IMPLEMENTATION may cause an issue when it actually starts building, as it may try to link to rmw packages for Cyclone DDS, which aren't shipped with MATLAB's Dashing. To try to eliminate all problems from the get-go, it'd probably be easiest to start MATLAB from a terminal that hasn't sourced the Foxy setup script. Or temporarily remove it from your .bashrc file if it's in there, and see if that resolves the issue in one go.
-Cam

18 Kommentare

Hello Cam,
I tried solve the problem by removing everything that is related to ros from my .bashrc file and then starting matlab using a new terminal.
However the same error is still happening when trying to generate the message. When I looked at the output of the log files I also saw that matlab is still using the foxy installation, although I didnt source it in my terminal.
-- Found ament_cmake: 0.9.8 (/opt/ros/foxy/share/ament_cmake/cmake)
-- Found PythonInterp: /home/harun/.matlab/R2021a/ros2/glnxa64/venv/bin/python3 (found suitable version "3.7.11", minimum required is "3")
-- Using PYTHON_EXECUTABLE: /home/harun/.matlab/R2021a/ros2/glnxa64/venv/bin/python3
-- Found ament_cmake_ros: 0.9.2 (/opt/ros/foxy/share/ament_cmake_ros/cmake)
-- Found rosidl_typesupport_c: 1.0.2 (/opt/ros/foxy/share/rosidl_typesupport_c/cmake)
-- Using all available rosidl_typesupport_c: rosidl_typesupport_fastrtps_c;rosidl_typesupport_introspection_c
-- Found rosidl_adapter: 1.2.1 (/opt/ros/foxy/share/rosidl_adapter/cmake)
-- Found rosidl_typesupport_cpp: 1.0.2 (/opt/ros/foxy/share/rosidl_typesupport_cpp/cmake)
-- Using all available rosidl_typesupport_cpp: rosidl_typesupport_fastrtps_cpp;rosidl_typesupport_introspection_cpp
-- Found rosidl_default_generators: 1.0.1 (/opt/ros/foxy/share/rosidl_default_generators/cmake)
-- Found class_loader: 2.0.2 (/opt/ros/foxy/share/class_loader/cmake)
-- Found rclcpp: 2.3.1 (/opt/ros/foxy/share/rclcpp/cmake)
-- Found rmw_implementation_cmake: 1.0.3 (/opt/ros/foxy/share/rmw_implementation_cmake/cmake)
-- Using RMW implementation 'rmw_fastrtps_cpp' as default
-- Found PythonInterp: /home/harun/.matlab/R2021a/ros2/glnxa64/venv/bin/python3 (found version "3.7.11")
-- Using all available rosidl_typesupport_c: rosidl_typesupport_fastrtps_c;rosidl_typesupport_introspection_c
-- Using all available rosidl_typesupport_cpp: rosidl_typesupport_fastrtps_cpp;rosidl_typesupport_introspection_cpp
-- Found PythonInterp: /home/harun/.matlab/R2021a/ros2/glnxa64/venv/bin/python3 (found suitable version "3.7.11", minimum required is "3.5")
-- Found python_cmake_module: 0.8.1 (/opt/ros/foxy/share/python_cmake_module/cmake)
-- Using PYTHON_EXECUTABLE: /home/harun/.matlab/R2021a/ros2/glnxa64/venv/bin/python3
-- Using PYTHON_INCLUDE_DIRS: /usr/include/python3.7m
-- Using PYTHON_LIBRARIES: /usr/lib/x86_64-linux-gnu/libpython3.7m.so
-- Using numpy include directory: /home/harun/.matlab/R2021a/ros2/glnxa64/venv/lib/python3.7/site-packages/numpy/core/include
-- Configuring done
-- Generating done
-- Build files have been written to: /home/harun/custom/matlab_msg_gen/glnxa64/build/ros_its_msgs
Is there any way I can change the ros path that matlab is using? When I printed the environment variables again I didn't see any ros variables, whether it was in the ubuntu or matlab terminal.
Just to be sure, let's make sure all affected environment variables have ROS-related paths/variables removed:
setenv('AMENT_PREFIX_PATH')
setenv('GAZEBO_MODEL_PATH')
setenv('PYTHONPATH')
setenv('RMW_IMPLEMENTATION')
setenv('ROS_DISTRO')
setenv('ROS_LOCALHOST_ONLY')
setenv('ROS_PYTHON_VERSION')
setenv('ROS_VERSION')
setenv('LD_LIBRARY_PATH', '/usr/local/MATLAB/R2021a/sys/os/glnxa64:/usr/local/MATLAB/R2021a/bin/glnxa64:/usr/local/MATLAB/R2021a/extern/lib/glnxa64:/usr/local/MATLAB/R2021a/cefclient/sys/os/glnxa64:/usr/local/MATLAB/R2021a/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/usr/local/MATLAB/R2021a/sys/java/jre/glnxa64/jre/lib/amd64/server')
setenv('PATH', '/home/harun/omnetpp-5.6.2/bin:/home/harun/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin')
Then try it again and see what happens.
I set all the environments variables like you suggested but it still has the same output. I then tried to set the AMENT_PREFIX_PATH variable to "/usr/local/MATLAB/R2021a/sys/ros2/glnxa64/ros2/share/ament_cmake", however I got the following error message from the matlab terminal:
Identifying message files in folder '/home/harun/custom'..Done.
Validating message files in folder '/home/harun/custom'..Done.
Error using ros.ros2.internal.validateMsg (line 16)
Invalid message format, package, or structure found during validation. Ensure that custom message packages follow structure and naming rules.
Error in ros2genmsg (line 88)
ros.ros2.internal.validateMsg(folderPath);
Error in ros_cacc (line 38)
ros2genmsg("/home/harun/custom")
Caused by:
Traceback (most recent call last):
File "/usr/local/MATLAB/R2021a/toolbox/ros/mlros2/+ros/+ros2/+internal/validateMsg.py", line 23, in <module>
import rosidl_parser
ModuleNotFoundError: No module named 'rosidl_parser'
That is bizarre to say the least. There shouldn't be any ways for Foxy to be found at that point, except if CMake is making certain assumptions about the typical installation location for ROS 2, and is searching there first.
That's a good idea with the AMENT_PREFIX_PATH, though you set it a little deep. Try again with just "/usr/local/MATLAB/R2021a/sys/ros2/glnxa64/ros2". That's the expected output of "ros.ros2.internal.getAmentPrefixPath", so try that too to make sure it's given the expected value.
Are you on base R2021a, or an update version? I believe that R2021a Update 4 has been released, though I'm doubting that would make a difference in this case. You can check the release by just entering "version".
Sorry that I'm just asking you to try stuff without a clear idea what's going on here.
-Cam
I set up the path like you suggested and also set the ros distribution to dashing and ros_version to 2 in the matlab terminal. It seemed to work, however there was a problem with the numpy version:
/home/harun/custom/matlab_msg_gen/glnxa64/build/ros_its_msgs/rosidl_generator_py/ros_its_msgs/msg/_cam_message_s.c:11:10: fatal error: numpy/ndarrayobject.h: Datei oder Verzeichnis nicht gefunden
11 | #include "numpy/ndarrayobject.h"
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/ros_its_msgs__python.dir/build.make:63: CMakeFiles/ros_its_msgs__python.dir/rosidl_generator_py/ros_its_msgs/msg/_cam_message_s.c.o] Fehler 1
make[2]: *** Auf noch nicht beendete Prozesse wird gewartet …
/home/harun/custom/matlab_msg_gen/glnxa64/build/ros_its_msgs/rosidl_generator_py/ros_its_msgs/msg/_platoon_dist_s.c:11:10: fatal error: numpy/ndarrayobject.h: Datei oder Verzeichnis nicht gefunden
11 | #include "numpy/ndarrayobject.h"
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/ros_its_msgs__python.dir/build.make:76: CMakeFiles/ros_its_msgs__python.dir/rosidl_generator_py/ros_its_msgs/msg/_platoon_dist_s.c.o] Fehler 1
make[1]: *** [CMakeFiles/Makefile2:381: CMakeFiles/ros_its_msgs__python.dir/all] Fehler 2
make[1]: *** Auf noch nicht beendete Prozesse wird gewartet …
make: *** [Makefile:141: all] Fehler 2
I haven't fixed it yet but there are probably some problems because python3.8 is natively installed for Ubuntu 20.04 and I installed python3.7 for matlab and ros2, which has numpy missing at the moment.
I updated to R2021a Update 4, however, after my update, MATLAB couldn't find the rmw_cyclone_dds implementation and I got the following error when I tried to create the message:
CMake Error at /opt/ros/foxy/share/rmw_implementation/cmake/rmw_implementation-extras.cmake:54 (message):
The RMW implementation has been specified as 'rmw_cyclonedds_cpp' via
environment variable 'RMW_IMPLEMENTATION', but it is not available at this
time.
Currently available middlewares:
'rmw_fastrtps_cpp;rmw_fastrtps_dynamic_cpp'
After that I reinstalled Ubuntu completely and everything MATLAB related, that included python3.7 and the links, aswell as the cmake compability with MATLAB. I now got the following behaviour:
  1. When I try to launch matlab and source my ros2 foxy installation and the cyclonedds before, I can start my simulink model and execute the matlab scripts, which communicate with my ros2 foxy nodes. So everything works fine.
  2. Then I tried not sourcing anything ros related in my .bashrc file and set the environment variables in matlab like this, as I did before the update:
setenv('AMENT_PREFIX_PATH','/usr/local/MATLAB/R2021a/sys/ros2/glnxa64/ros2/')
setenv('GAZEBO_MODEL_PATH')
setenv('PYTHONPATH')
setenv('RMW_IMPLEMENTATION','rmw_cyclonedds_cpp')
setenv('ROS_DISTRO','dashing')
setenv('ROS_LOCALHOST_ONLY')
setenv('ROS_PYTHON_VERSION','3')
setenv('ROS_VERSION','2')
setenv('LD_LIBRARY_PATH', '/usr/local/MATLAB/R2021a/sys/os/glnxa64:/usr/local/MATLAB/R2021a/bin/glnxa64:/usr/local/MATLAB/R2021a/extern/lib/glnxa64:/usr/local/MATLAB/R2021a/cefclient/sys/os/glnxa64:/usr/local/MATLAB/R2021a/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/usr/local/MATLAB/R2021a/sys/java/jre/glnxa64/jre/lib/amd64/server')
setenv('PATH', '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin')
However it still couldnt find the rmw_implementation
CMake Error at /opt/ros/foxy/share/rmw_implementation/cmake/rmw_implementation-extras.cmake:54 (message):
The RMW implementation has been specified as 'rmw_cyclonedds_cpp' via
environment variable 'RMW_IMPLEMENTATION', but it is not available at this
time.
Currently available middlewares:
'rmw_fastrtps_cpp;rmw_fastrtps_dynamic_cpp'
I looked at the output of the log again and got the same error as at the beginning, when it didn't find the ros packages that are shipped with matlab. I then looked at the log output:
-- Found ament_cmake: 0.9.8 (/opt/ros/foxy/share/ament_cmake/cmake)
-- Using PYTHON_EXECUTABLE: /home/harun/.matlab/R2021a/ros2/glnxa64/venv/bin/python3
-- Found ament_cmake_ros: 0.9.2 (/opt/ros/foxy/share/ament_cmake_ros/cmake)
-- Found rosidl_typesupport_c: 1.0.2 (/opt/ros/foxy/share/rosidl_typesupport_c/cmake)
-- Using all available rosidl_typesupport_c: rosidl_typesupport_fastrtps_c;rosidl_typesupport_introspection_c
-- Found rosidl_adapter: 1.2.1 (/opt/ros/foxy/share/rosidl_adapter/cmake)
-- Found rosidl_typesupport_cpp: 1.0.2 (/opt/ros/foxy/share/rosidl_typesupport_cpp/cmake)
-- Using all available rosidl_typesupport_cpp: rosidl_typesupport_fastrtps_cpp;rosidl_typesupport_introspection_cpp
-- Found rosidl_default_generators: 1.0.1 (/opt/ros/foxy/share/rosidl_default_generators/cmake)
-- Found class_loader: 2.0.2 (/opt/ros/foxy/share/class_loader/cmake)
-- Found rclcpp: 2.3.1 (/opt/ros/foxy/share/rclcpp/cmake)
-- Found rmw_implementation_cmake: 1.0.3 (/opt/ros/foxy/share/rmw_implementation_cmake/cmake)
-- Using RMW implementation 'rmw_fastrtps_cpp' as default
-- Found PythonInterp: /home/harun/.matlab/R2021a/ros2/glnxa64/venv/bin/python3 (found version "3.7.11")
-- Using all available rosidl_typesupport_c: rosidl_typesupport_fastrtps_c;rosidl_typesupport_introspection_c
-- Using all available rosidl_typesupport_cpp: rosidl_typesupport_fastrtps_cpp;rosidl_typesupport_introspection_cpp
-- Found PythonInterp: /home/harun/.matlab/R2021a/ros2/glnxa64/venv/bin/python3 (found suitable version "3.7.11", minimum required is "3.5")
-- Found python_cmake_module: 0.8.1 (/opt/ros/foxy/share/python_cmake_module/cmake)
-- Using PYTHON_EXECUTABLE: /home/harun/.matlab/R2021a/ros2/glnxa64/venv/bin/python3
-- Using PYTHON_INCLUDE_DIRS: /usr/include/python3.8
-- Using PYTHON_LIBRARIES: /usr/lib/x86_64-linux-gnu/libpython3.8.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/harun/custom/matlab_msg_gen/glnxa64/build/ros_its_msgs
[ 9%] Built target ros_its_msgs__rosidl_generator_c
[ 11%] Built target ros_its_msgs__cpp
[ 21%] Built target ros_its_msgs__rosidl_typesupport_c
[ 30%] Built target ros_its_msgs__rosidl_typesupport_cpp
[ 40%] Built target ros_its_msgs__rosidl_typesupport_introspection_c
[ 50%] Built target ros_its_msgs__rosidl_typesupport_introspection_cpp
[ 59%] Built target ros_its_msgs__rosidl_typesupport_fastrtps_cpp
[ 69%] Built target ros_its_msgs__rosidl_typesupport_fastrtps_c
[ 69%] Built target ros_its_msgs
[ 71%] Built target ros_its_msgs__py
[ 76%] Building CXX object CMakeFiles/ros_its_msgs_matlab.dir/src/ros_its_msgs_PlatoonDist_message.cpp.o
[ 76%] Building CXX object CMakeFiles/ros_its_msgs_matlab.dir/src/ros_its_msgs_CAMMessage_message.cpp.o
[ 83%] Built target ros_its_msgs__python
[ 88%] Built target ros_its_msgs__rosidl_typesupport_c__pyext
[ 92%] Built target ros_its_msgs__rosidl_typesupport_fastrtps_c__pyext
[ 97%] Built target ros_its_msgs__rosidl_typesupport_introspection_c__pyext
It seems with update 4 that it is even harder to make matlab use its own packages instead of foxy, however I cant explain why this is even happening, although I didnt source anything and I set everything to point to the dashing packages in the matlab script before trying to generate the custom message.
I can't explain the rest of it, but I can at least say that Cyclone DDS is not shipped with MATLAB, only Fast-RTPS. So rmw_fastrtps_cpp should be the target of RMW_IMPLEMENTATION, if you need to set it at all.
I've seen the numpy issue before, on occasion. Usually that means that the Python virtual environment was set up in a previous release (R2019b) that didn't use numpy, or it wasn't fully set up. Usually, running this to force recreation of the virtual environment fixes the issue:
ros.ros2.internal.createOrGetLocalPython(true)
A couple of users have found that there continue to be issues, and have needed to ensure numpy was installed in their Python outside of the virtual environment. They'll ensure that "python3" will run Python 3.7 (using PATH manipulation) and run:
python3 -m pip install --upgrade numpy
There are some details here.
The build log also shows that it's grabbing Python 3.8 libraries and include directories. Can you check if you have Python-related environment variables set?
One other long log file you can take a look at is matlab_msg_gen/<arch>/build/<package_name>/CMakeCache.txt. Check in there for anything that calls out "foxy", as that may give us a clue as to where it is coming from. It's probably going to be 90% paths to foxy, but it may show the root cause in one of the variables.
I have no idea why it would work when you source your Foxy installation, and not work when you don't. I feel like we're in "two wrongs making a right" territory here.
-Cam
I finally succeeded to build the messages.
The important step for me was to execute
source /usr/local/MATLAB/R2021a/sys/ros2/glnxa64/ros2/setup.bash
in the ubuntu terminal before starting up matlab. I think this does the trick to not source anything from foxy.
To conclude all the steps that you can try to make Matlab work with ros foxy:
First install python3.7
sudo apt install python3.7 python3.7-venv libpython3.7
For me I also had to install python3-venv, but I don't know if this is necessary in general.
Then create the following two symlinks:
sudo ln -s /usr/lib/x86_64-linux-gnu/libpython3.7m.so.1 /usr/lib/libpython3.7m.so.1
sudo ln -s /usr/lib/x86_64-linux-gnu/libpython3.7m.so.1.0 /usr/lib/libpython3.7m.so.1.0
For ros2genmsg, additionall install numpy for python3.7. There are several ways to do this but the one that finally worked for me was:
sudo apt-get install python-numpy
In the script in MATLAB, that you want to execute, there are three possible things you can do. First you can set the environment variables, but for me I don't need to do that after sourcing the matlab ros installation and setting the python path right.
To do so you need to include:
pyenv('Version','/usr/bin/python3.7');
If you installed python3.7 at another location you need to change the path.
This made the message building possible for me.
However, when I tried to execute the script that worked with my foxy script. I was able to receive the messages that were sent by foxy nodes, but I couldn't send any messages via topics. When I took a look at the problem online, I found out that it is a well known problem, that you cant communicate between dashing and foxy using rmw_fastrtps_cpp. However, when using dashing and cyclonedds, the communication with foxy is possible.
The conclusion would be that I cannot use custom messages with the current state of ros2 and matlab when I want to connect matlab with ros2 foxy. If I could somehow include cyclonedds into the native matlab dashing installation this could work, but I don't know how I should go about it.
Thank you for your help. If you have any advice on how to make it work please let me know.
Cam Salzberger
Cam Salzberger am 16 Aug. 2021
Bearbeitet: Cam Salzberger am 16 Aug. 2021
Thanks for doing all the troubleshooting, and it's good to hear how you got the custom messages built.
I had assumed that you were using rmw_cyclonedds_cpp with Foxy already, since that was the RMW_IMPLEMENTATION environment variable that was set. Is your native Foxy using Fast-RTPS or a different DDS implementation?
We can't guarantee it, since ROS and ROS 2 are really only designed and tested to communicate within their distribution, but we have been able to succeed in communication between Foxy and Dashing if Foxy is using Cylcone DDS and Dashing (in MATLAB) is using Fast-RTPS.
We are working on updating the version of ROS 2 that MATLAB uses, but it won't be in R2021b.
-Cam
Ah you are right. I had to reinstall everything before my last reply, and I didn't set cyclonedds up for foxy. Everything seems to be working now.
When I try to build my model, I get the following stderr log:
In file included from /home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/slros_busmsg_conversion.h:19,
from /home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/src/slros_busmsg_conversion.cpp:1:
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/slros_msgconvert_utils.h: In member function ‘virtual void slros::ROSPropertyWarnStatus::emitTruncationWarning(int, int) const’:
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/slros_msgconvert_utils.h:27:44: warning: unused parameter ‘numReceivedItems’ [-Wunused-parameter]
27 | virtual void emitTruncationWarning(int numReceivedItems, int maxArraySize) const {};
| ~~~~^~~~~~~~~~~~~~~~
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/slros_msgconvert_utils.h:27:66: warning: unused parameter ‘maxArraySize’ [-Wunused-parameter]
27 | virtual void emitTruncationWarning(int numReceivedItems, int maxArraySize) const {};
| ~~~~^~~~~~~~~~~~
In file included from /home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/src/ros2nodeinterface.cpp:23:
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/ros2nodeinterface.h: In constructor ‘ros2::matlab::NodeInterface::NodeInterface()’:
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/ros2nodeinterface.h:72:31: warning: ros2::matlab::NodeInterface::mExtModeThreadwill be initialized after [-Wreorder]
72 | std::shared_ptr<std::thread> mExtModeThread;
| ^~~~~~~~~~~~~~
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/ros2nodeinterface.h:69:15: warning: ros2::matlab::Semaphore ros2::matlab::NodeInterface::mStopSem[-Wreorder]
69 | Semaphore mStopSem;
| ^~~~~~~~
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/src/ros2nodeinterface.cpp:30:1: warning: when initialized here [-Wreorder]
30 | NodeInterface::NodeInterface()
| ^~~~~~~~~~~~~
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/slros_msgconvert_utils.h: In instantiation of ‘void convertToBusFixedPrimitiveArray(BusType&, const MsgType&, const slros::ROSPropertyWarnStatus&) [with BusType = double [36]; MsgType = std::array<double, 36>]:
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/src/slros_busmsg_conversion.cpp:96:94: required from here
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/slros_msgconvert_utils.h:541:81: warning: unused parameter ‘warnStatus’ [-Wunused-parameter]
541 | const slros::ROSPropertyWarnStatus& warnStatus) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/src/ros2nodeinterface.cpp: In member function ‘void ros2::matlab::NodeInterface::initialize(int, char* const*)’:
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/src/ros2nodeinterface.cpp:58:26: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
58 | char* extmodeArg[] = {"-port","17725","-blocking","1","-verbose","0"};
| ^~~~~~~
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/src/ros2nodeinterface.cpp:58:34: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
58 | char* extmodeArg[] = {"-port","17725","-blocking","1","-verbose","0"};
| ^~~~~~~
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/src/ros2nodeinterface.cpp:58:42: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
58 | char* extmodeArg[] = {"-port","17725","-blocking","1","-verbose","0"};
| ^~~~~~~~~~~
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/src/ros2nodeinterface.cpp:58:54: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
58 | char* extmodeArg[] = {"-port","17725","-blocking","1","-verbose","0"};
| ^~~
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/src/ros2nodeinterface.cpp:58:58: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
58 | char* extmodeArg[] = {"-port","17725","-blocking","1","-verbose","0"};
| ^~~~~~~~~~
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/src/ros2nodeinterface.cpp:58:69: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
58 | char* extmodeArg[] = {"-port","17725","-blocking","1","-verbose","0"};
| ^~~
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/slros_msgconvert_utils.h: In instantiation of ‘int slros::getNumItemsInFixedSimpleArray(ArrayType (&)[N]) [with ArrayType = const double; long unsigned int N = 36]’:
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/slros_msgconvert_utils.h:579:68: required from ‘void convertFromBusFixedPrimitiveArray(MsgType&, const BusType&) [with BusType = double [36]; MsgType = std::array<double, 36>]
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/src/slros_busmsg_conversion.cpp:88:74: required from here
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/slros_msgconvert_utils.h:118:54: warning: unused parameter ‘array’ [-Wunused-parameter]
118 | inline int getNumItemsInFixedSimpleArray(ArrayType (&array)[N]) {
| ~~~~~~~~~~~~^~~~~~~~~
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/slros_msgconvert_utils.h: In instantiation of ‘int slros::getNumItemsInFixedSimpleArray(ArrayType (&)[N]) [with ArrayType = double; long unsigned int N = 36]’:
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/slros_msgconvert_utils.h:542:68: required from ‘void convertToBusFixedPrimitiveArray(BusType&, const MsgType&, const slros::ROSPropertyWarnStatus&) [with BusType = double [36]; MsgType = std::array<double, 36>]
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/src/slros_busmsg_conversion.cpp:96:94: required from here
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/slros_msgconvert_utils.h:118:54: warning: unused parameter ‘array’ [-Wunused-parameter]
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/slros_msgconvert_utils.h: In instantiation of ‘int slros::getNumItemsInFixedSimpleArray(ArrayType (&)[N]) [with ArrayType = const unsigned char; long unsigned int N = 128]’:
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/slros_msgconvert_utils.h:157:69: required from ‘int slros::setReceivedAndCurrentLengths(const BusType&, BusInfoType&, const MsgType&, const slros::ROSPropertyWarnStatus&) [with BusType = unsigned char [128]; BusInfoType = SL_Bus_ROSVariableLengthArrayInfo; MsgType = std::__cxx11::basic_string<char>]
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/slros_msgconvert_utils.h:565:44: required from ‘void convertToBusVariablePrimitiveArray(BusType&, BusInfoType&, const MsgType&, const slros::ROSPropertyWarnStatus&) [with BusType = unsigned char [128]; BusInfoType = SL_Bus_ROSVariableLengthArrayInfo; MsgType = std::__cxx11::basic_string<char>]
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/src/slros_busmsg_conversion.cpp:199:172: required from here
/home/harun/CMRCE/src/car_simulator/matlab/src/cacc_leader/include/cacc_leader/slros_msgconvert_utils.h:118:54: warning: unused parameter ‘array’ [-Wunused-parameter]
However the model still builds fine and is executing after compiling. Thank you very much for your help.
If you don't mind, do you know what I need to do to fill the content of a string in a msg that I want to send from my simulink model. There are 3 parts string_name, and then currentlength and receivedlength under string_name_SL_Info. I tried to use a string constant for the input of string_name, however the input dimension is 128, while the constant outputs just 1.
Hello Harun,
To fill the content of a string in a message and send it over in Simulink, you would need to at least fill in the Data file and current length field so that Simulink knows how long the string is. The "Work with String Arrays" section on this documentation page gave an example on how to properly assign a string array in a ROS message in Simulink.
Hope this helps!
Josh
Thank you very much Josh and Cam for helping me to make everything work.
Hello Cam,
I would like to acknowledge your contribution for the integration of ROS2 and MATLAB.
Could you contact me, you can find my personal details here.
Best Regards
Harun
I appreciate the thought, but no acknowledgement is really necessary. We're just doing our best to help all users of MATLAB and ROS Toolbox!
Good luck with your work!
-Cam
Hey Cam and Harun,
I also seem to be having a similar issue to Harun when running ros2genmsg
Error in ros2genmsg (line 241)
buildPackage (builder, [], '--merge-install' , colconMakeArgs); % other messages might need to be present in the same directory
I am running r2021a on Windows trying to build for ros2 foxy. my cmake version is set to 3.20 and pyenv is set to 3.9.
Just wondering if you had other suggestions that I could try to build the custom messages.
thanks,
-Jovin
Jovin,
The important error messages nearly always are in the "build log" linked at the end of an attempted build. By itself, this error message doesn't tell us anything.
Also, R2021a requires Python 3.7 for ros2genmsg, not 3.9, and the back-end version of ROS 2 is Dashing, not Foxy. There may be issues with communicating between Dashing and Foxy, just as an FYI. Always check the documentation for the release you are using to make sure your environment is compatible.
As I've noted here, R2022a will use a Foxy back-end and require Python 3.9. If your license allows you to get the pre-release of R2022a, that may be an option for you to try.
-Cam
Jovin Dsa
Jovin Dsa am 18 Feb. 2022
Bearbeitet: Jovin Dsa am 18 Feb. 2022
Hi Cam,
Thanks for the quick response.
I actually tried the pre-release of R2022a with Python 3.9, cmake 3.20 and visual studio 2017 on a windows 10 machine (I accidentally wrote R2021a in my previous message so i apologize for the confusion).
As a side note - I was able to generate a standalone rosnode using the ' Feedback Control of a ROS-Enabled Robot Over ROS 2' example. I was also able to build this rosnode inside the ros2 foxy workspace on a separate machine running ubunutu and foxy and was able to see the messages being displayed with ros2 echo so it seems to be working fine with standard messages.
I also couldnt find any other similar issues reported for ros2genmsg on the pre-release of 2022a so I thought I'd check in with you.
Thanks!
Understood. Thanks for clarifying the release.
You would still need to look at the build log of the custom messages to see what is going wrong. It could be as simple as a path length issue (if you have long message/package names, or a long folder path to the location where you are building the messages).
-Cam

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by