Sending sensor data from Pixhawk as Mavlink packets through serial port

I want to use a raspberry pi 4B as an onboard companion computer with pixhawk 4. I want to continuously send sensor data from pixhawk to raspberry pi. I have read about Mavros and Mavsdk, but I want to know if it is possible to send these data as Mavlink packets through a serial port without having to use the aforementioned protocols.

So what you’re saying is that you don’t want to use MAVSDK or MAVROS? If yes, I would be interested to learn why that is, or what your concerns are.

You can basically just parse MAVLink yourself like in this example:

@JulianOes It’s not that I don’t want to use MAVROS or MAVSDK. I wanted to learn about various available communication protocols, their benefits and the challenges associated with them. I am very new to this and different people are suggesting me different things so I thought it would be a good idea to learn about all of them and then make a sound decision.

1 Like

MAVSDK tries to give you a limited but easy to use API with various language wrappers. It abstracts away the MAVLink meta protocols like how to upload a mission or command retransmission, etc.

MAVROS on the other side is an adapter if you’re coming from the ROS side, so it makes it easier to integrate with ROS.

@JulianOes Thanks for the information. I am using MAVROS right now. Currently, I am working towards creating a new package and a ROS node which will subscribe to the sensor data (acceleration, attitude, angular rate, etc), run a h-infinity controller to compute the actuator commands, and publish these values in the actuator control topic.


Could you please tell me more about your plan to use H-inf to control the drone?
Thank you

@xx11xx I am going to implement and test H-inf controller for my research on uncertainty quantification. I have not yet started on it. Currently, working on system identification to get a good model.


I have some question for you about the px4 data outputting.

How do you make sure the data from EKF2 is outputting at a PRECISE rate, so that your controller on the companion computer can run correctly.

Do you have an email, so I could communicate with you easier?

Thank you.