Making my own altitude control system using PX4 for a quadrotor

I want to make my own altitude control system for a quadrotor using ROS and integrating it with PX4. I already went through the ROS integration and Offboard tutorial in the page. I am able to use the position setpoint with geometry_msgs, and I already understood and play around with the example given in the Offboard example code. Where should I go after that if I want to be able to make my own altitude controller? I would really appreciate the suggestions!

You can (with an off board computer) publish a laser or ultrasound value (height).

Once it works as expected, you can make a I2C or CAN driver on the PixHawk directly and implement your own system by publishing your height via the uOrb system.

So that means it is like the application example, but this time I am implementing a whole controller, with all the sensors and control loop that I want to use, am I right about that? What do you mean by I2C or CAN driver?

Also I have try to run the OFFBOARD mode example from the website. Is there any position/altitude control going on when I publish the position setpoint for the quadrotor? I assume there is one, but in the gazebo simulation, what I observe was that there are a bit of movement here and there, even though it is relatively stable.

I thought you were implementing a sensor, if you were, you would need an hardware interface (I²C or CAN).

For the software controller, you have to do like the Hello world application on the Pixhawk, but subscribing to all sensors you need and publishing the power information. If you need inspiration, check the PX4 Modules implemented right now.

For your application, I would start reading the actual position control system, as well for the best practices in use.

1 Like

Thank you for the suggestions, I am gonna try to learn about the control from the link you gave