필터 지우기
필터 지우기

How does matlab send message to ros turtlesim

조회 수: 8 (최근 30일)
Gabriel Silva
Gabriel Silva 2022년 1월 28일
답변: Cam Salzberger 2022년 2월 1일
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;
rosinit(host,port)
vel_topic = "/turtle1/cmd_vel";
msg_type = "geometry_msgs/Twist";
velpub = rospublisher(vel_topic,msg_type,"DataFormat","struct");
msg = rosmessage(velpub);
msg.linear.x =1;
send(velpub,msg);
I don't get any error messages, but it doesn't work.

답변 (1개)

Cam Salzberger
Cam Salzberger 2022년 2월 1일
Hello Gabriel,
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?
-Cam

카테고리

Help CenterFile Exchange에서 Network Connection and Exploration에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by