Hi,
I followed https://www.mathworks.com/help/ros/ug/communicate-with-the-turtlebot.html , and applied this idea to my specific project in my robot, not to the Turtlebot.
Basically, I have my own ROS project, and successfully built it in the Virtual Machine- Ubuntu-Gazebo 9.
After I used roslaunch to start my own project in VM, and in the Matlab I used rosinit(ipaddress) to successfully intialized Matlab global node and connected with ROS master,
and I successfuly got the names of all rostopic by using the command rostopic list in Matlab command window.
—————————————————————————
Now, I am trying to create a new publisher in Matlab to publish information to one topic (name as /mytopic, for example) in my own ROS project by using command: Matlab_Pub = rospublisher("/mytopic").
But I got an error: Failed to create a ROS publisher with topic name /mytopic and message type mytopic_msgs/MotorCmd.
—————————————————————————-
And I also got the same issue when trying to creat a new subscriber in Matlab to subscribe to one topic in my own ROS project: Matlab_Sub = rossubscriber("/mytopic")
Could you please give me some insight on this issue and how to fix them?
Thank you so much for your help!
Best Answer