Borrar filtros
Borrar filtros

ROS2: Unrecognized message without using it in script

24 visualizaciones (últimos 30 días)
Andre Below
Andre Below el 8 de Abr. de 2022
Respondida: Andre Below el 20 de Abr. de 2022
Hello Everyone,
i managed to import custom massages via the command ros2genmsg. But now i get allways the error, that some massage type is not recognisable by matlab. Even when i dont use any commands that need the custom commands. See code snippet:
clc
clear
topicName="/sensor_state";
matlabNode = ros2node("matlabNode");
SensorState = ros2subscriber(matlabNode,topicName);
This example gives me now the following error massage:
Error using ros.internal.getEmptyMessage>getMessageDataAndInfo
Unrecognized message type turtlebot3_msgs/SensorState. Use ros2 msg list to see available types.
Error in ros.internal.getEmptyMessage>getCachedMap (line 46)
[structInfo.data,structInfo.info] = getMessageDataAndInfo(msg, msgInfo, rosver);
Error in ros.internal.getEmptyMessage (line 35)
[data,info] = getCachedMap(msgMapROS2,msg,msgInfo,rosver);
Error in ros.internal.utilities.findMsgDepends (line 17)
[msgStruct,info] = ros.internal.getEmptyMessage(msgName,rosver);
Error in ros.internal.utilities.getPathOfDependentDlls (line 14)
pkgNamesMap = ros.internal.utilities.findMsgDepends(msgType,map,rosver);
Error in ros2subscriber/createSubscriber (line 669)
dllPaths = ros.internal.utilities.getPathOfDependentDlls(obj.MessageType,'ros2');
Error in ros2subscriber (line 330)
createSubscriber(obj, ordinalParser.Results.node.ServerNodeHandle, ...
Error in Turtlebot3_Subscription_SensorState (line 21)
SensorState = ros2subscriber(matlabNode,topicName);
I used turtlebot3_msgs/SensorState in the past, but deleted it afterwards because it was not longer necessary in my project. Is there any kind of storage in matlab that i have to reset when i delete packages on my disc?
EDIT: I can subscribe every topic, but not /sensor_state. E.g. /rosout.. Anyone a guess what it could be?
I use Matlab 2022a and ROS Toolbox 1.5.
I would much appreciate your help.
greetings, André

Respuesta aceptada

Andre Below
Andre Below el 20 de Abr. de 2022
It works now. I just createt a new package "turtlebot3_msgs" with a folder msg. The only msg defined there is SensorState.msg.
I have SensorState now two times. turtlebot3_matlab/SensorState and turtlebot3_msgs/SensorState.
thanks for your help.

Más respuestas (1)

Hari Krishna Kakarla
Hari Krishna Kakarla el 11 de Abr. de 2022
Hi Andre,
When you generate any custom messages, It registers with MATLAB Preferences. And when you want to delete your custom messages, you need to delete your generated matlab_msg_gen folder. After deleting it, Doing "clear all" in MATLAB should actually remove the messages from preferences.
Else, call this command to update your MATLAB preferences:
reg = ros.internal.CustomMessageRegistry.getInstance('ros2',true)
This will update the MATLAB preferences correctly. I hope this information is helpful.
Thanks
Hari
  6 comentarios
Hari Krishna Kakarla
Hari Krishna Kakarla el 14 de Abr. de 2022
Hi Andre,
reg = ros.internal.CustomMessageRegistry.getInstance('ros2',true) will create a registry object. If you want to see the messages in the registry:
>> reg.getMessageList
Then check this:
>> reg.getMessageInfo('turtlebot3_msgs/SensorState');
If the above command says that there is no such message type in registry, then you can confirm that your previously generated custom messages are deleted from custom message registry.
Regarding your second question, I see that your topic is still subscring to the old message. It means some ROS 2 nodes are still active in background which earlier used those old messages. Please make sure to check all the ROS 2 nodes available in network and delete them. Please make sure to close all your MATLAB sessions running and start a new MATLAB session.
Thanks
Hari
Andre Below
Andre Below el 19 de Abr. de 2022
Hello Hari,
the command reg.getMessageList shows me only the correct massages.
For the second question i looped over all DomainID`s (1 to 101) with the command curNodeList = ros2("node","list","DomainID",curDomainID); and it shows me no old nodes. when i close all programms that create nodes, all nodes are correctly gone.
i also allready reinstalled matlab2022a but nothing works.
greetins, André

Iniciar sesión para comentar.

Categorías

Más información sobre Custom Message Support en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by