How to publish visualizat​ion_msgs/M​arker to ROS from MATLAB

12 visualizaciones (últimos 30 días)
Ákos Odry
Ákos Odry el 22 de Nov. de 2018
Comentada: Tohru Kikawada el 5 de Mayo de 2019
Hello Community!
I am trying to publish visualization_msgs/Marker messages to ROS from MATLAB without luck. When i call rostopic echo in MATLAB i can see the data i am publishing , but in ROS i get the following:
WARNING: no messages received and simulated time is active. Is /clock being published?
(I am publishing on other topics as well from MATLAB, and those work well.) I have only problem with Marker messages.
Can someone give an example code/script of Marker publishing which worked and could visualize the data sent from MATLAB in rviz?
This is my code:
obj.MarkerMsg.Header.FrameId = '/world';
obj.MarkerMsg.Ns = 'points';
obj.MarkerMsg.Header.Stamp = rostime('now','system');
obj.MarkerMsg.Id = 0;
obj.MarkerMsg.Scale.X = 0.03;
obj.MarkerMsg.Scale.Y = 0.03;
%obj.MarkerMsg.Scale.Z = 1;
tmppoints = [rosmessage('geometry_msgs/Point') rosmessage('geometry_msgs/Point')];
tmppoints(1).X = 1.3;
tmppoints(1).Y = 0;
tmppoints(1).Z = 1.9;
tmppoints(2).X = 1.3;
tmppoints(2).Y = 0.3;
tmppoints(2).Z = 1.9;
obj.MarkerMsg.Points = tmppoints;
Color = rosmessage('std_msgs/ColorRGBA');
%Color.R = 1;
Color.G = 1;
%Color.B = 0;
Color.A = 1;
obj.MarkerMsg.Colors(1) = Color;
obj.MarkerMsg.Colors(2) = Color;
obj.MarkerMsg.Type = 8;
send(obj.MarkerPub,obj.MarkerMsg);
Thank you in advance.
Best regards.

Respuestas (1)

Chuhao Liu
Chuhao Liu el 12 de Dic. de 2018
Hi
I meet similar question. That I use matlab try to read /visualization_msgs/InteractiveMarker, which is shows with error
[ERROR] [1544588729.446161141]: Client [/matlab_global_node_05131] wants topic /quad_marker to have datatype/md5sum [visualization_msgs/InteractiveMarkerUpdate/83e22f99d3b31fde725e0a338200e036], but our version has [visualization_msgs/InteractiveMarkerUpdate/710d308d0a9276d65945e92dd30b3946]. Dropping connection.
I think its message type in Matlab and ROS is different. But when I use Matlab send and read /visualization_msgs/Marker, it can receive the ros messages sent by matlab.
I have no idea how to solve this.

Categorías

Más información sobre Network Connection and Exploration en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by