Communicate using ROS between 2 different MATLAB versions

Hello,
I have been trying to use ROS publish and subscribe blocks for communicating between 2 different versions of MATLAB (R2018a and R2022a) on the same computer (same machine). The thing is, I am trying to run experiments on a hardware system that is compatible with R2018a or lower. However, I want to implement Reinforcement learning on the system. RL toolbox is available from R2019a onwards. Hence, I trained my RL agent using R2022a, and now want to deploy the trained agent on the hardware (which interfaces only through R2018a).
The system models, for the hardware interface and the RL agent are in Simulink. So the below description is for Simulink models in the respective MATLAB versions.
I was planning on using ROS publish blocks in R2018a (hardware compatible version) and corresponding subscribe blocks in R2022a (RL agent trained version), both versions on the same computer (my laptop). I thought this way, I will be able to communicate with the hardware using R2018a and recieve the states from the hardware system, which I can publish on a ROS topic. After this, I wanted the subscribe block in R2022a, to subscribe to that ROS topic and recieve the system states which can then be fed to the RL agent. This RL agent can then give out actions, which I planned to communicate the same way (in reverse manner) to the hardware. However, after a lot of tries and going through multiple solutions, I have not been able to figure this out. Any suggestions or ideas are welcome.

댓글 수: 6

Hi Mohammed Mohiuddin,
I understand your case. But it is not clear for me what is that not working. Are you facing any errors ?
The publisher block in 18a should communicate with 22a subscribe block. Please make sure that both MATLAB sessions are connected to same ROS Master.
Provide me more information on issue that you are observing.
Thanks,
Jagadeesh K.
Hello,
The issue here is that it is not working. The two MATLAB versions are not communicating with each other. They are on the same local computer machine. Yes, I tried to connect them to the same ROS master, but I am not sure it did connect to the same master despite me trying it.
Hi Mohammed,
Can you please share models that you used in 18a and 22a MATLAB ? I will try on my end and let you know.
Thanks,
Jagadeesh K.
I am trying with any sample simulink model and I am facing the issue. I created one basic model that publishes (sin signals) in R2018 and another model in R2022 that subscribes to those signals, and even in that case I am facing the issue.
Hi Mohammed,
I have tried on my end and i do not see any issue with communication. Here is what i followed.
  1. I launched the rosinit from 22a release MATLAB.
  2. Then i ran the rosinit on 18a MATLAB.
  3. Simulated the publisher model in 22a release with inf time as Stop time
  4. Simulated the subscriber model in 18b release with inf time as Stop time.
  5. I can see that subscriber gets the data published from 22a release MATLAB.
Thanks,
Jagadeesh K
If you don't mind can you please share the models with me, and also let me know of any parameters or settings I need to keep in mind.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jagadeesh Konakalla
Jagadeesh Konakalla 2022년 6월 21일
이동: Remo Pillat 2023년 5월 1일

0 개 추천

Hi Mohammed,
Is the issue resolved on your end ?
In case if the issue is not resolved, Please contact us through the MathWorks Technical Support team for further assitance.
Thanks,
Jagadeesh K.

카테고리

질문:

2022년 5월 31일

이동:

2023년 5월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by