MATLAB Answers

How to correctly initialize ros service object

14 views (last 30 days)
If I run a simple ros service from terminal
roscore
rosrun rospy_tutorials add_two_ints_server
(or any other service) and connect to it in Matlab using
rosinit
cl = rossvcclient('/add_two_ints')
I get the following output in the terminal:
[ERROR] [1595324358.790565]: incoming connection failed: unable to receive data from sender, check sender's logs for details
According to https://github.com/ros-controls/ros_control/issues/256 it seems that a malformed service call is sent.
After that I can do proppers service calls normally, using
call(cl)
but this error message is annoying.
How to init rossvcclient object in such a way that it doesn't send malformed calls?

Accepted Answer

Cam Salzberger
Cam Salzberger on 21 Jul 2020
Hello Mihael,
I've been able to reproduce this on my machine, testing with the Indigo VM. You are creating the service client in the right manner, and I don't believe any other manner of setting it up will avoid this error message popping up. I've checked the code flow, and determined that this error message on the external server only comes up when a temporary communication used to determine the service type is being shut down. It shouldn't have an impact on subsequent service calls, nor on the service server.
I understand the annoyance aspect of it though, so I've passed along your comments to the appropriate people.
-Cam
  1 Comment
Jeff Dillon
Jeff Dillon on 3 May 2021
Unfortunately this is a breaking bug in the Simulink ROS Toolbox in R2021a for the Call Service block. In the Select a ROS Service dialog, /add_two_ints is grayed out and not selectable. On the remote ROS host, the error is "Incoming connection failed:..." I'm not able to call any ROS service from Simulink. This example does work, but it doesn't work if the ROS host is on a remote system (a Jetson Nano on the local area network, in this case) https://www.mathworks.com/help/ros/ug/call-and-provide-ros-services.html

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by