Deploying ROS2 Node with Custom Messages
이전 댓글 표시
I have Matlab code that includes a ROS2 node/publisher. I want to publish custom messages. This works when I run it natively in Matlab after running ros2genmsg. I now want to deploy me code to a remote Linux machine. This worked before I added the custom ROS2 message type, but now it appears that CMake can't find my custom message definitions (see below). How to do provide this to coder/CMake? The message output below suggests that I need to provide something to CMAKE_MODULE_PATH, should I do that as a environmental variable on my system like
$export CMAKE_MODULE_PATH="$CMAKE_MODULE_PATH:<path_to_my_custom_message_directory>"
or do I need to set it in MATLAB somehow?
Here are the commands I ran in the Matlab terminal to run coder.
(Note that I have omitted my IP, username and password. )
>> cfg = coder.config('exe');
cfg.Hardware = coder.hardware('Robot Operating System 2 (ROS 2)');
cfg.Hardware.BuildAction = 'Build and run';
cfg.Hardware.RemoteDeviceAddress = '[OMITTED]';
cfg.Hardware.RemoteDeviceUsername = '[OMITTED]';
cfg.Hardware.RemoteDevicePassword = '[OMITTED]';
cfg.Hardware.DeployTo = 'Remote Device';
cfg.Hardware.ROS2Folder = '/opt/ros/galactic';
cfg.Hardware.ROS2Workspace = '~/detector_ws2';
cfg.HardwareImplementation.ProdHWDeviceType = 'Intel->x86-64 (Linux 64)';
codegen detectstreaming -args {} -config cfg
Here is the result
Connecting to ROS 2 device at '134.114.64.127'.
Using ROS 2 workspace '~/detector_ws2' to build ROS 2 node.
---
Transferring generated code for 'detectstreaming' to ROS device.
Starting build for ROS node.
---
ROS 2 project directory: /home/dasl/detector_ws2/src
Starting >>> detectstreaming
--- stderr: detectstreaming
CMake Error at CMakeLists.txt:19 (find_package):
By not providing "Finduavrt_interfaces.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"uavrt_interfaces", but CMake did not find one.
Could not find a package configuration file provided by "uavrt_interfaces"
with any of the following names:
uavrt_interfacesConfig.cmake
uavrt_interfaces-config.cmake
Add the installation prefix of "uavrt_interfaces" to CMAKE_PREFIX_PATH or
set "uavrt_interfaces_DIR" to a directory containing one of the above
files. If "uavrt_interfaces" provides a separate development package or
SDK, be sure it has been installed.
make: *** [Makefile:959: cmake_check_build_system] Error 1
---
Failed <<< detectstreaming [0.83s, exited with code 2]
Summary: 0 packages finished [1.12s]
1 package failed: detectstreaming
1 package had stderr output: detectstreaming
??? The following error occurred during deployment to your hardware board:
Build unsuccessful for model 'detectstreaming'. Check the build log in the diagnostics viewer
for error messages.
Code generation failed: View Error Report
채택된 답변
추가 답변 (1개)
Nupur
2023년 11월 22일
0 개 추천
Hello @Jagadeesh Konakalla @Michael I am trying to subscribe from Matlab to the topic which is inside the container. The topic has 'ackermann_msgs/AckermannDrive' message type.
I installed this ros2 message type on my host PC and gave the path through ros2genmsg inside the Matlab. I then try to subscribe to the topic from container however, it is not subscribing to the topic.
I did check the 'ros2 topic list' on my host terminal and i could see my topic there but not in matlab.
I am new to this feild, please help me out if I am missing here something.
Host Machine: Ubuntu 22.04
Matlab/Simulink 2022b: Host Machine (Subscriber node)
ROS2 : Container (Publisher node)
댓글 수: 2
Jagadeesh Konakalla
2023년 11월 23일
Hi Nupur,
Can you please ensure that ROS_DOMAIN_ID environement variable is same on Docker container and Host mahcine MATLAB ?
Thanks,
Jagadeesh K.
Nupur
2023년 11월 24일
Hello Jagadeesh,
Yes i made sure that the ROS_DOMAIN_ID is same however, Matlab not been able to see the topic. In my host terminal i can see my topic from container.
I also did try to communicate from my Host terminal to the Matlab and it does work but with the container, matlab is not been able to see the topic.
Please guide me through this.
Thank you.
카테고리
도움말 센터 및 File Exchange에서 Get Started with ROS Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
