MATLAB: How to check if there is a new response in the “Call Service” block using ROS Toolbox

ROS Toolbox

How to check if there is a new response in the "Call Service" block using ROS Toolbox?

Best Answer

The "Call Service" block is "blocking". That means that the service client block does not finish processing a simulation time-step until it has sent a request and received a response from the service server. So technically, any output that is not indicating it has timed out is a new response from the service server.
This is a different way of functioning than the Subscribe block, where it will output the latest message receive, but will indicate when it has gotten a new message.
What the block doesn't tell you is if the values of the response message are different from the previous response received. If you need to do that, you will need to implement some kind of checks yourself in the model.