How does matlab send message to ros turtlesim
8 views (last 30 days)
I'm trying to use matlab to move the turtle in turtlesim, but it doesn't work.
The code is shown:
host = 'usr';
port = 11311;
vel_topic = "/turtle1/cmd_vel";
msg_type = "geometry_msgs/Twist";
velpub = rospublisher(vel_topic,msg_type,"DataFormat","struct");
msg = rosmessage(velpub);
I don't get any error messages, but it doesn't work.
Cam Salzberger on 1 Feb 2022
If there is no communication between an external machine or VM and MATLAB over ROS, the issue is usually related to the environment on the external machine/VM. See this answer for details.
If that doesn't work, try to gather more information about what works and what doesn't. Does a subscriber on MATLAB receive messages from the turtlebot? Can you see nodes/topics with "rosnode list"/"rostopic list"? Can you do a "rostopic echo" on a different terminal on the turtlebot machine and send messages to it from MATLAB?