JacopoPan / px4-fw-aerobatics

PX4 VTOL off-board control in ROS2 for autonomous agile flight
MIT License
4 stars 3 forks source link

Nice Project! I have some questions. #1

Open Pinking-Lee opened 2 weeks ago

Pinking-Lee commented 2 weeks ago

Thanks for your project. What a Nice Project!

I am currently working on the offboard control of VTOL by ROS2, too. But I am using C++ code, not python. This source code may inspire me a lot.

  1. I am a beginner of PX4. At start, I follow the official doc and achieve the offboard control to fly a square path in STIL simulation by px4_msgs::msg::TrajectorySetpoint msg. I can successfully changed the mode of VTOL to FW(Fixedwing) by px4_msgs::msg::VehicleCommand msg in ROS2. But then the plane can not fly the right path. May be the VTOL can not be offboard controlled by new uXRCE-DDS way(i.e., using official px4_msgs, it is very convenient)?

  2. Then I git your code and successfully run the demo. It is excellent! Here I have some questions: I mean, I am using current official PX4-Autopilot.git, V1.15. Have you customized a lot on PX4-Autopilot.git? Or I just only need to customize uXRCE DDS Agent and then I can achieve path following using C++?

  3. And some of your README.md has misspelling, i.e. [resrouces] should be fixed as [resources].

Thank you very much.

JacopoPan commented 2 weeks ago

Hi @Pinking-Lee

For point 1, In principle, off board control with uXRCE-DDS works fine in C++ and Python. This repo includes and example of rates control that at these lines https://github.com/JacopoPan/px4-fw-aerobatics/blob/ed0b3c6768f6a34f8a45673f975cdf2af8ea6fab/vtol_example/px4whisperer.py#L192-L207

For point 2, the only changes I made to PX4 1.14 are these 2 commits:

For point 3, thank you, I fixed it, if you see any other mistake please let me know. All the code you see here should be easy to re-write in C++ (in fact, I mostly work in C++ for this, but Python is friendlier for easy-to-run examples)

JacopoPan commented 2 weeks ago

note that I updated the dds_topics.yaml, it would have prevented doing rolls before but now it will work as in the README gif

Pinking-Lee commented 2 weeks ago

Thanks. Refer to your example, I have reproduced the several basic functions and follow your example to control VTOL by C++.

Now I am working on the smooth trajectory tracking control of FW mode. I find 2 msgs in px4_msgs as VehicleTrajectoryWaypoint.msg and VehicleTrajectoryBezier.msg.

I searched some comments, said they are mainly used for Mulitrotors. And I currently haven't found any trajectory tracking control example scheme for FW mode by these 2 msgs yet (Maybe.., not support FW plane?). Have you tried these 2 msgs to achieve smooth trajectory tracking in FW mode?
Do I need to independently write a set of tracking control code based on the attitude control case you provided? Or give me some suggestions.

Thanks very much.

JacopoPan commented 2 weeks ago

You can definitely use off-board and the TrajectorySetpoint message with fixed-wings (see this example for the messages definitions https://github.com/PX4/px4_ros_com/blob/main/src/examples/offboard/offboard_control.cpp) but of course the modules in the fixed-wing position controller (L1, TECS) may or may not be able to follow with depending on its dynamic feasibility.

Pinking-Lee commented 2 weeks ago

You can definitely use off-board and the TrajectorySetpoint message with fixed-wings (see this example for the messages definitions https://github.com/PX4/px4_ros_com/blob/main/src/examples/offboard/offboard_control.cpp) but of course the modules in the fixed-wing position controller (L1, TECS) may or may not be able to follow with depending on its dynamic feasibility.

yes... I tried, not follow with the FW dynamics. I am tring to find another way....

JacopoPan commented 2 weeks ago

It should work, make sure you publish the proper boolean flag for the position reference in the OffboardMode message. And try very shallow turn, the banking limits are still set but some of the autopilot parameters.

JacopoPan commented 1 week ago

I just pushed an example that use the velocity field of TrajectorySetpoint