connect simulink ROS2 pub/subs with PX4
조회 수: 6 (최근 30일)
이전 댓글 표시
Hello,
I am having issues trying to establish communication between Simulink and PX4 running in SITL mode.
The set up is as:
- PX4 is running on a terminal and is connected to my Simulink Flight Dynamics Model. Data are exchanged as expected and the vehicle is able to take off etc..
- Qgroundcontrol is also in the loop and coms are established and working fine
- I am running the Fast-DDS agent in a docker container and this is working fine, I can see data are communicated from the client on the PX4 side to the Agent in the docker.
- working on macOS machine
Having all the above running in good order, when on the Matlab/Simulink side i try to list the available topics I get just the below listed and all PX4 messages are not visible.
>> ros2 topic list
/parameter_events
/rosout
It seems like there is some component missing, or the configuration on the Matlab/Simulink side is not the right one?
Is it nessessary to run a ros2 network in a different terminal, or Matlab/Simulink sort this out internally?
Any thoughts?
Thanks,
댓글 수: 2
Karthik Reddy Vennapureddy
2023년 12월 19일
Hi Panos,
What is the ROS Domain ID in which you are running the FastDDS agent in docker container. Also what is the ROS 2 Distribution in which fast dds agent is running (Is it Humble or Galactic, etc)?
If the topics are being published on a different ROS domain id, you wont be able to see the list of topics as part of "ros2 topic list".
"ros2 topic list" honors environment variable "ROS_DOMAIN_ID". By default ROS_DOMAIN_ID will be 0 when MATLAB/Simulink is running. so ros2 topic list introspects the topics present on domain id 0. For example, If you want to see topics that are available on Domain ID 25, you can execute the following command:
ros2 topic list DomainID 25
Also, It is not necessary to run a ros2 network in a different terminal, MATLAB/Simulink will do this internally. Let me know, if you are still unable to view the topics.
Thanks,
Karthik Reddy
답변 (1개)
Anurag
2023년 12월 21일
Hi Panos,
I understand that you are having issues in establishing communication between Simulink and PX4.
Follow the steps below for solving the issue:
- Make sure you have sourced the ROS 2 setup files in the terminal where you are running MATLAB/Simulink. You can do this by running the following command:
source /path/to/ros2/install/setup.bash
- PX4 topics may be under a specific namespace. Try listing topics with different namespaces:
ros2 topic list -n /px4
- While MATLAB/Simulink may internally manage the ROS 2 network, in some cases, it might be necessary to run a separate ROS 2 network. You can try running the ROS 2 network manually in a separate terminal:
ros2 run ros2 run ros2cli network list
- Ensure that there are no firewall issues preventing communication between MATLAB/Simulink and the Fast-DDS agent running in the Docker container.
Please refer to the documentation below for the same:
- https://www.mathworks.com/help/supportpkg/px4/ug/px4-capabilities-integration.html
- For some basic examples : https://www.mathworks.com/help/supportpkg/px4/examples.html?category=setup-and-configuration_mw_ff962a41-f9ec-4cc4-9805-97342944ec56&s_tid=CRUX_topnav
Hope it helps,
Regards,
Anurag
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!