# Is it possible to use uORB directly in a voxl module?

Source: https://forum.modalai.com/topic/1804/is-it-possible-to-use-uorb-directly-in-a-voxl-module
Category: VOXL 2 and VOXL 2 Mini (https://forum.modalai.com/category/26/voxl-2-and-voxl-2-mini)
Tags: voxl-2
Posted: 2023-02-09 20:46:39 UTC by Dan
Replies: 8 · Views: 2093

## Dan · 2023-02-09 20:46:39 UTC

Hi ModalAI devs,

I'm wondering if it's possible to subscribe to a uORB topic in a voxl module. I want to subscribe to the barometer sensor and there isn't an MPA server for this.

The reason I ask is that when using the voxl-cross docker container I'm unsure which dependency is required to install to get access to the uORB headers etc. 

Thanks,
Dan

## Reply by Guest · 2023-02-09 20:55:48 UTC

Hi Dan,

You can directly subscribe to the mavlink output using the `mavlink_to_px4` pipe and check for messages of type `MAVLINK_MSG_ID_ALTITUDE` to receive barometer updates in an MPA server. 

See [here](https://gitlab.com/voxl-public/voxl-sdk/services/voxl-flow-server/-/blob/master/src/main.cpp#L1022) for a code example.

## Reply by Dan · 2023-02-09 21:02:05 UTC (in reply to Guest)

@Matt-Turi 

Hi Matt,

Thanks for the quick reply and thanks for the example that's super useful.

Just to clarify what you're saying. From my understanding when I do `uorb top` the topic name `sensor_baro` is available and I can call `px4-listener sensor_baro` to get an update from what I believe to be a uorb message? Are you saying that there are mavlink messages also published that will give me the same information and I can use something similar to your example to then create a barometer MPA server?

## Reply by Eric Katzfey (ModalAI staff) · 2023-02-09 21:15:05 UTC

@Dan There is no uorb to pipe bridge so not really possible. But you can run the system command px4-listener and parse the output of it. Or if what you really need is something in a Mavlink message then you can go the route Matt suggested.

## Reply by Guest · 2023-02-09 21:15:17 UTC

There is a mavlink message you can parse for barometer data, that is the code example I sent above. In that file as well, there is an example of calling px4-listener programmatically and parsing its output - see [here](https://gitlab.com/voxl-public/voxl-sdk/services/voxl-flow-server/-/blob/master/src/main.cpp#L936)

## Reply by Dan · 2023-02-09 21:41:51 UTC (in reply to Eric Katzfey)

@Eric-Katzfey 

No problem. I was wondering if I could do that bridging myself by subscribing to the uORB topic `sensor_baro` and then publishing onto a barometer MPA server but wasn't sure if it was possibly to subscribe to uORB topics in the voxl SDK.

@Matt-Turi 

Thanks for the clarification. I'll take a look at the px4-listener parsing too.

## Reply by Dan · 2023-02-09 21:55:10 UTC (in reply to Guest)

@Matt-Turi 

Apologies. Final question for now. Who is the producer of the mavlink message for the barometer data?

## Reply by Chad Sweet (ModalAI staff) · 2023-02-10 00:11:01 UTC

The PX4 flight control software

## Reply by Dan · 2023-02-10 09:04:48 UTC (in reply to Chad Sweet)

@Chad-Sweet 

Thanks Chad.:+1:
