Call Service block in simulink error "input must be a structure"

8 views (last 30 days)
Hi, everyone
I have a Matlab R2021b and Ros melodic , I'm using call service to request message from Ros melodic, but when I change service type,(click "select" button), it returns error, as show in the picture, and the communication between ros and simulink is right.
Is there somebody know how to solve this problem, thank you.

Answers (1)

Sugandhi
Sugandhi on 19 Oct 2023
Hi,
I understand that you are getting errros on using call service to request message from Ros melodic, and change service type.
The error message you encountered indicates that the input to the ROS Call Service block's mask parameter callback should be a structure, but it received something else. This error commonly occurs when there is an issue with the ROS service definition or the configuration of the block itself.
To resolve this issue, you can try below few workarounds:
  1. Ensure that the ROS service message definition is correctly defined and available in your ROS environment. Make sure you have sourced the appropriate ROS setup file.
  2. Double-check the configuration of the ROS Call Service block. Verify that the service name and message type are correctly specified.
  3. If you recently changed the service type, try restarting MATLAB to ensure that any cached information is cleared.
  4. If the issue persists, consider reinstalling or updating the ROS toolbox in MATLAB to ensure compatibility between MATLAB R2021b and ROS Melodic.

Community Treasure Hunt

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

Start Hunting!