Questions about ros2 call service blocks in simulink

1 vue (au cours des 30 derniers jours)
Xiaochen Gao
Xiaochen Gao le 20 Avr 2022
Hello!
I'm using a ros2 call service block to call a service named "load_track". While debugging I can't receive anything from the server.
But if I use matlab function(.m file) and follow the instructions in the https://www.mathworks.com/help/ros/ref/ros2serviceserver.html, the server can normally receive the srvice request.
Could you please have a look, and see where could be the problem?
Thanks a lot!
The simulink screenshot is in the appendix.

Réponses (1)

Josh Chen
Josh Chen le 28 Avr 2022
Hello Xiaochen,
It is difficult to figure out the culprit from the screenshot of the model. However, I do have some troubleshooting suggestions that you may want to give it a try:
  1. Have you tried this example before? Are you able to see the same output as shown on the example?
  2. What is the ErrorCode it returned from the block output port?
  3. If you create and start a ros2svcserver in MATLAB, are you able to get the result in Simulink?
  4. Does the domain id matches with the domain id the service server in? You can check the ROS 2 Domain ID for your model under SIMULATION->PREPARE->ROS Network.
If the above ideas still can't resolve this issue, I would recommend you to reach out to MathWorks Technical Support and share a sample model/workflow for a closer look.
Hope this helps,
Thanks,
Josh

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by