PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.57k stars 13.55k forks source link

Dual rotor VTOL simulation #13875

Open ghost opened 4 years ago

ghost commented 4 years ago

As for the present release v1.10.0, tailsitter simulation which is gazebo_tailsitter is based on 4 rotor tailsitter. If this could be extended to a dual rotor platform with elevons, it could be useful for many.

I came across an opensource project that simulates this using PX4 called PX4-PhoenixDrone which was conducted in Toronto. I think it could be integrated into the main stack as it already has a model and the sdf file for dual rotor tailsitter configuration.

https://github.com/utiasSTARS/PhoenixDrone-sitl_gazebo/tree/ed3b70cbd7612746db90d3d091c1ba3767f4f151/models/phoenixdrone

Jaeyoung-Lim commented 4 years ago

@YuCodes I looked into the code, but the dynamics in the repo you mentioned is a approximate model of the tailsitter in hover, therefore it doesn't work in fixed wing mode

Related discussion: https://github.com/PX4/sitl_gazebo/issues/333

ghost commented 4 years ago

@Jaeyoung-Lim Thank you much for the update, I went through the thread. Do you think that is there any-way to model the prop wash in the gazebo, so that dual-rotor configuration is somehow possible to simulate? Any pointers?

Jaeyoung-Lim commented 4 years ago

@YuCodes I do have some ideas, but I can't promise you any delivery dates

Is there a special reason why you need the duo tailsitter? Given the abstraction px4 mixer does, I think most cases you can test with the quad tailsitters no?

ghost commented 4 years ago

yeah, I'm currently testing the platform with the quad tailsitter. I intend to flight test a platform, that i designed. I was thinking to get an understanding of flight characteristics especially the transition before I move on to the actual test flight.

Jaeyoung-Lim commented 4 years ago

@YuCodes Gazebo SITL simulations are not intended to accurately show the flight characteristics of a vehicle. This is true for all multirotor and fixed wing models too.

It is more designed to check the sanity of the software, so the dynamics is "good enough" to check the software functionalities. I would like to support dual rotor tail sitters just to check the mixer functioning properly, but this will always be far from reality given the priorities we have. (e.g. execution speed over accuracy)

ghost commented 4 years ago

@Jaeyoung-Lim thanks for the explanation, I understand your point on not being accurate about flight characteristics. what I actually needed to test is more what you described, whether the mixers are configured right, so that in transition, it behaves as it should behave.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

lum-supakorn commented 4 years ago

Any news on this? I'm developing a model for a complete dual rotor flight envelope too.

Jaeyoung-Lim commented 4 years ago

@lum-supakorn You can test all of the firmware functions with the current tailsitter model given the mixer architecture of px4. The only difference would be the control authority difference at low speed which will be platform specific.

What are the functionalities that you would not be able to test using the current tailsitter model?

lum-supakorn commented 4 years ago

Thank you! Do you know why the current tailsitter model needs a virtual elevator? Can it not control pitch using just the elevons?

Jaeyoung-Lim commented 4 years ago

@lum-supakorn That comes from the liftdrag plugin not being able to properly model the moments generated by the lift.

lum-supakorn commented 4 years ago

@lum-supakorn That comes from the liftdrag plugin not being able to properly model the moments generated by the lift.

If the virtual elevator generates pitching moment by generating lift off-centered, can't the elevons do the same and control the pitch as well? Why do we need a separate pitch controller?

Jaeyoung-Lim commented 4 years ago

@lum-supakorn Those two are physically different phenomenons. The moments that are generated by elevons are induced by the wing itself and not by generating lift by an offset from the CG.

The reason that the moments are not being modeled in the liftdrag plugin can be found here: https://github.com/PX4/sitl_gazebo/blob/master/src/liftdrag_plugin/liftdrag_plugin.cpp#L372

Since the moment of all control surfaces are set to zero, the elevator is generating lift and therefore generating moment around the vehicle.

lum-supakorn commented 4 years ago

@lum-supakorn Those two are physically different phenomenons. The moments that are generated by elevons are induced by the wing itself and not by generating lift by an offset from the CG.

The reason that the moments are not being modeled in the liftdrag plugin can be found here: https://github.com/PX4/sitl_gazebo/blob/master/src/liftdrag_plugin/liftdrag_plugin.cpp#L372

Since the moment of all control surfaces are set to zero, the elevator is generating lift and therefore generating moment around the vehicle.

I'm quite confused. Aren't the elevons responsible for increasing/decreasing the left/right wing CL and (because the lift of each wing is applied away from CG) therefore controlling the rolling moment of the vehicle?

If so, can't the lift generated on each wing (applied behind the CG) control the pitching moment as well?

Jaeyoung-Lim commented 4 years ago

@lum-supakorn No, that is not how the pitch of flying wings are controlled. It is affected by both the moment generated from the wing and the moment generated from the lift of the wing. Please revisit how the dynamics actually work for flying wings.

I have added https://github.com/PX4/sitl_gazebo/pull/516 to fix this problem

lum-supakorn commented 4 years ago

@lum-supakorn No, that is not how the pitch of flying wings are controlled. It is affected by both the moment generated from the wing and the moment generated from the lift of the wing. Please revisit how the dynamics actually work for flying wings.

Thank you!

lum-supakorn commented 4 years ago

Proven. I have hard-coded pitching moment control using data obtained from XFLR5 and the tailsitter SITL model is now able to fly without the virtual elevator. Working on properly reading moment coefficient data.

Jaeyoung-Lim commented 4 years ago

@lum-supakorn Could you maybe propagate this and make a PR on fixing the delta-wing model in PX4/sitl_gazebo?

lum-supakorn commented 4 years ago

@lum-supakorn Could you maybe propagate this and make a PR on fixing the delta-wing model in PX4/sitl_gazebo?

I would love to but I’m trying to figure out which approach I should implement regarding reading CL, CD, and CM data.

Could you please take a look at https://github.com/PX4/sitl_gazebo/issues/519

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

hvourtsis commented 3 years ago

Hello! Are there any updates on this topic? Thanks a lot!

Jaeyoung-Lim commented 3 years ago

@hvourtsis This is currently limited with the aerodynamics modeling capabilities of the liftdrag_plugin in the post stall regime.

hvourtsis commented 3 years ago

Thank you for the prompt reply @Jaeyoung-Lim. Does this also mean that prop-wash is still not modeled? I saw some ongoing work on the plugin and also that you mentioned in another topic that there would be work on a new https://github.com/PX4/PX4-SITL_gazebo/issues/684#issuecomment-752801575.

lum-supakorn commented 3 years ago

@hvourtsis For slipstream aerodynamics take a look at PhoenixDrone. Slipstream forces and moments are empirically modeled as functions of motor angular velocity and elevon deflection angle.

harshilairbound commented 1 year ago

Hello! I'm trying to simulate a tailsitter as well. Reading the above discussion, it seems that using gazebo to test out the more nuanced stuff, like the effects of wingtips and wing shapes on the flight performance might not be a good option. Does anyone have any suggestions on how to simulate flights with that fidelity?

lum-supakorn commented 1 year ago

Hi, @harshilairbound. I'd suggest you employ computational or experimental aerodynamics methods to study the effects of wingtips and wing shapes on your vehicle, then import the resulting data into Gazebo dynamics simulation. What is going on in the PX4-Gazebo simulation stack is that the aerodynamic loads (forces and moments) on the vehicle are already prescribed somewhere in the model. For example, these loads might be prescribed as functions of control surface deflection angle and the rotational speed of the propeller. Gazebo then uses these loads to calculate the dynamics (linear and angular velocity, etc.) of the vehicle being simulated. The physics of fluid and the vehicle is not directly simulated in Gazebo since it is only a dynamics simulator, not a computational fluid dynamics package.

Cheers

HarshilNaikk commented 1 year ago

Hey @lum-supakorn Thank you for your reply. I am doing just that for now! We are simulating different vehicle geometries in a CFD software, and getting lift and drag coefficient values, which I am looking to put directly into the advanced lift drag plugin. Unfortunately, I am a little new to this and am still figuring out how to setup the plugin. @Jaeyoung-Lim any ideas or pointers? Thank you so much in advance.

Best

HarshilNaikk commented 1 year ago

From what I have figured out yet, the libLiftDragPlugin.so file being used in the sdf is generated during the build process. I wish to know how to use the Advanced Lift Drag Plugin in this way. Thanks again!

Jaeyoung-Lim commented 1 year ago

@HarshilNaikk It is only using jinja templates to configure the UDP/TCP ports and nothing else. You can also do so for the advanced liftdrag plugin

harshilairbound commented 1 year ago

Right. I was able to successfully use it. Thanks a lot!

The issue I'm currently facing is, my duo tailsitter doesnt takeoff in a stable way in gazebo. It always crashes, and has no roll stability apparently. I think it has something to do with the differential thrust not being part of the mixer, since I made this model by repurposing the existing quad tailsitter model. I also went through the Control Allocation code, and cannot figure out what's wrong.

Any ideas on this? @lum-supakorn did you also face this?

Thanks a ton again!