I'm having trouble trying to connect to an external (i.e. a ROS MASTER running outside the Matlab environment) ROS service server.
In particular, I am trying to connect to a mavros service server (mavros/cmd/takeoff) but I have several problems.
Being a custom message type, I followed the Matlab documentation to generate custom messages (rosgenmsg). Here I had a different generated directory structure, so I modified the path in the addpath command in the following way: ..matlab_msg_gen_ros1/glnxa64/install/m
Typing the command "rosmsg list", I can see all the generated custom messages. Fine!
Then I moved to the service client generation for the /mavros/cmd/takeoff server, as described in the documentation:
client = rossvcclient('/mavros/cmd/takeoff');
testreq = rosmessage(client);
response = call(testreq,'TimeOut',3);
I got the following error: "Failed to create a service client"
I investigated a lot the problem, but I am not being able to find a solution.
Can someone help me?
What am I doing wrong?
rosservice type /mavros/cmd/takeoff
rosservice info /mavros/cmd/takeoff
=> initially doesn't work (error message: Unrecognized function or variable 'ros.internal.ros.messages.mavros_msgs.commandTOLRequest' )
I had to rename the generated custom_message folder in the following way:
Now it finds the function and provides the expected output:
Args: MessageType MinPitch Yaw Latitude Longitude Altitude