# Help with PX4 topic subscriber using MATLAB

**URL:** <https://discuss.px4.io/t/help-with-px4-topic-subscriber-using-matlab/32640>\
**Category:** PX4 Autopilot\
**Created:** [June 8, 2023, 7:44pm UTC](https://discuss.px4.io/t/help-with-px4-topic-subscriber-using-matlab/32640 "2023-06-08T19:44:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![I\_R](https://discuss.px4.io/letter_avatar_proxy/v4/letter/i/6de8d8/32.png) [@I\_R](https://discuss.px4.io/u/I_R)\
**Post date:** [June 8, 2023, 7:44pm UTC](https://discuss.px4.io/t/help-with-px4-topic-subscriber-using-matlab/32640/1 "2023-06-08T19:44:16Z")

</div>

I am having an issue with subscribing to px4 topics using MATLAB’s ROS toolbox. I have generated the PX4 custom messages in MATLAB. It appears no message is actually passed through.

```auto
node1 = ros2node('matlab');
node2 = ros2subscriber(node1,'/fmu/out/sensor_combined')

```

Above results in "ros2subscriber with properties:

```
    TopicName: '/fmu/out/vehicle_odometry'
LatestMessage: []
  MessageType: 'px4_msgs/VehicleOdometry'
NewMessageFcn: []
      History: 'keeplast'
        Depth: 10
  Reliability: 'reliable'
   Durability: 'volatile'"

```

LatestMessage should probably have :[1x1 struct] or something along those lines. Does anyone have an idea of what the issue is? Is there a px4\_msgs download specifically for custom messages in the ROS toolbox ?

---

<div class="post-metadata">

**Author:** ![Benja](https://discuss.px4.io/user_avatar/discuss.px4.io/benja/32/11872_2.png) [@Benja](https://discuss.px4.io/u/Benja)\
**Post date:** [June 8, 2023, 10:13pm UTC](https://discuss.px4.io/t/help-with-px4-topic-subscriber-using-matlab/32640/2 "2023-06-08T22:13:32Z")

</div>

Hi @I_R

Start by using the right [QoS setting](https://docs.px4.io/main/en/middleware/uxrce_dds.html#px4-ros-2-qos-settings)  
`durability=TRANSIENT_LOCAL`  
`reliability=BEST_EFFORT`  
in the subscriber, [Manage Quality of Service Policies in ROS 2 - MATLAB & Simulink](https://www.mathworks.com/help/ros/ug/manage-quality-of-service-policies-in-ros2.html).  
maybe it is just that.

Moreover, I would expect that you must wait a bit after creating the subscriber before actually having available messages.

---

<div class="post-metadata">

**Author:** ![I\_R](https://discuss.px4.io/letter_avatar_proxy/v4/letter/i/6de8d8/32.png) [@I\_R](https://discuss.px4.io/u/I_R)\
**Post date:** [June 8, 2023, 11:05pm UTC](https://discuss.px4.io/t/help-with-px4-topic-subscriber-using-matlab/32640/3 "2023-06-08T23:05:17Z")

</div>

Yup, you are correct. Thank you!
