필터 지우기
필터 지우기

Cannot create publisher or subscriber of custom message

조회 수: 5 (최근 30일)
George Rossides
George Rossides 2024년 3월 25일
댓글: George Rossides 2024년 3월 26일
Hello,
I keep receiving the same error when trying to use a ROS1 custom message to create either a publisher or subscriber.
>> rospublisher('/test', 'nmpc_control/Predictions')
Failed to create a ROS publisher with topic name /test and message type nmpc_control/Predictions.
>> ub = rossubscriber('/predictions', 'nmpc_control/Predictions')
Failed to create a ROS subscriber with topic name /predictions and message type nmpc_control/Predictions.
The message was generated properly using rosgenmsg and the msg type is already used by active ROS nodes without any problem (both publishers and subscribers). MATLAB has no problem creating publishers and subscribers for other built-in message types.
I have also properly updated the MATLAB path as specified here. The msg type appears properly when rosmsg list and rosmsg show are used in MATLAB and it properly matches what is used by ROS.
>> rosmsg show nmpc_control/Predictions
std_msgs/UInt8 Id
std_msgs/Float32MultiArray PredictionsX
std_msgs/Float32MultiArray PredictionsY
std_msgs/Float32MultiArray PredictionsTheta
I am using ROS Noetic on Ubuntu 20.04 and MATLAB R2024a (very recently installed). I have seen previous questions posted here with similar problems, but they all appear to be solved with the latest versions of MATLAB. One other question makes reference to CMake version (3.15.5+) Python 2.7. I have CMake 3.16.3. That said, Python 2.7 is not support beyond Ubuntu 20.04 and I don't think that this would be the issue since it would have been patched already.
$ cmake --version
cmake version 3.16.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
Thanks in advance and I am open to any suggestions that may help.
  댓글 수: 2
Josh Chen
Josh Chen 2024년 3월 25일
Hey George,
Based on what you showed, I did not see any issue either. Unless there is a topic with different type already exist in the network, I am not sure how you can get this error message.
Can you share a ros message definition folder so I can try on my end and see if it is reproducible?
Thanks,
Josh
George Rossides
George Rossides 2024년 3월 26일
Hi Josh,
Many thanks for the response. You can find the complete nmpc_control package and the associated matlab generated folder here.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Custom Message Support에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by