-
Notifications
You must be signed in to change notification settings - Fork 810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation: What is the math behind the Motor Model? #110
Comments
Just to let you know - using the math above I was able to get a 20kg VTOL model to fly, but I'm getting a strange behavior where the vehicle, so to move into a certain setpoint, back drifts and rotates 180 degrees in yaw, and just then it starts moving into the commanded position (so basically moving on its back into the commanded position). I can confirm that this behavior is due to some weird value I'm probably inserting on the motors model parameters (computed from the math above) which makes the vehicle drift on the back motors before then moving to the commanded position, which is something weird to watch. |
I believe this will also help solving #78. |
@LorenzMeier, @Tumbili, @ChristophTobler, @devbharat are you able to give some insights here? The purpose for this is that anyone that wants to build is own vehicle model is able to properly do it. Thanks in advance! |
Looking into this. |
Awesome! Thank you! |
@LorenzMeier were you able to make any progress in this? |
Hi, I'm also looking into the motor model. |
I'm still waiting that someone clarifies and confirms this in a clear way. |
@TSC21 I understand, I'm just curious about where the equation come from. |
@AlexandreBorowczyk - http://m-selig.ae.illinois.edu/props/propDB.html ( |
Yeah I was doing something wrong here. I'm applying the corrections now (though is kinda hard to guess what units are being used on Gazebo side). |
Ok for the rotor drag, I could compute it with this reference plus the above reference: |
@AlexandreBorowczyk can you test the formulas above and check if it makes sense now? |
The vehicle is pretty stable right now but I'm still getting the stupid behavior of rotating 180 degrees on yaw. @LorenzMeier any points/tips on what can be happening? May the inertial matrix of the vehicle interfere with that? |
@TSC21 I've looked at the reference you pointed to as well as into the code. I suspect the equation for the The moment constant is used as such in the code As for the 180 degrees yaw problem, check the orientation of your IMU link in our model make sure it is correctly oriented. |
I got the above from https://en.wikipedia.org/wiki/Motor_constants - Motor Torque Constant.
I already looked at that reference without luck. Also, I believe that this drag is the combination of the actuation of the motor and the propeller, and that's why it is included both thrust constant and power in constants. That's also math I found available in the proppeler database. But I can be wrong of course. What I don't think it make sense is that we have to be looking for this math models when this could be properly documented already by who created the plugins (open-source contributions usually indicate how can people use and modify the code).
Already checked that many times and with different orientations with no luck. Though I can confirm that if I send a setpoint of 180 degrees on yaw, it goes forward as expected. |
@AlexandreBorowczyk do you have news on this? |
I see however this is not the coefficient we are looking for. I believe the best way to obtain this coefficient would be from experimental data. However, I also think that is you use a similar type propeller (airfoil shape and number of blades) the force to moment ratio should not be very different and you can use the default. As for the Rotor Drag Coefficient, I see the "The True Role of Accelerometer Feedback in Quadrotor Control" paper point to a book "Helicopter Theory" by W. Johnson which I have so I will look into it and see what I can find. However, I don't believe a motor modelisation error is the source of your issue. |
What leads to think it is not? From the calculations I do, it leads me to very similar values to the default ones.
Great. This is the value that does not show consistency with the default ones on the simulation (gives a two degrees higher value, though it seems to work, besides the yaw issue).
Probably not but right now I cannot tell what is the problem right now. |
@AlexandreBorowczyk here you can find that the rotor drag coefficient is: |
@TSC21, Can you repost the first link it seems not to work. Nevertheless, I believe I understand your reasoning and I see possible issue. First, it is important to differentiate between static thrust and dynamic thrust, most often for a motor-propeller combo thrust spec is the static thrust. A propeller thrust is highly dependent of the air inflow velocity so it's maximum dynamic thrust (if motion parallel to rotation axis) is must smaller than it's static thrust. In addition, the rotor drag is calculated with respect to the rotor disc motion (if you does account for wind) but the the propeller thrust is only along the rotation axis (for this simplified model). Hence, the drag=thrust cannot be used in this setting. So the equation could be correct but you would need to know the drag force to get the coefficient. |
It's a file it should automatically download - www.dtic.mil/cgi-bin/GetTRDoc?AD=ADA224493.
And how do you expect to find the drag force without simplifying the model for static thrust? |
@AlexandreBorowczyk any news? |
@TSC21 I finally got the time to do a little bit of algebra and look at the simplifying the H-Force equation.
where
To implement this you need first to evaluate your lift and drag coefficient in a static setup.
Consequently you need to have a rought idea of the propeller twist and airfoil shape and be able to measure the Thrust, torque and RMP in a static setup. I could do a bit more math to include the effect of coning at hover but you would need to know the rotor blade inertia. Also due to the approximation and simplification this equation is more accurate at level flight and low advancement speed. However, I would recommend to use SITL to evaluate "Top Level functionality" rather then physical configuration functionality as the motor_model and liftdrag (I believe you are working on a VTOL) plugin implementations are of limited accuracy. |
Thanks for the effort @AlexandreBorowczyk. But in a general perspective, I think the equation you came up with come to be more complicated than expected. Are we to suppose that the person who wrote the plugin use this type of math to get the values, or would be something more standard that could be find on a table (like http://m-selig.ae.illinois.edu/props/propDB.html)? |
Now I'm confuse: what does the H-Force represent here? Aren't we trying to get the rotor drag coefficient? |
Yes and no. The lift drag is basically applied to control surfaces, as elevons or rudders, which you can find if vehicle capable of forward flight. So yes, it is applied for fixed wing, no it's not exclusive to fixed wing vehicle as you have also VTOLs. But generally speaking, you would want to use the motor model, unless you are willing to apply the lift-drag to individual propellers and compute the dynamics from there. |
Hi, Great discussion here. I wanted to ask, if the motor model accounts for the thrust deficit in the forward flight? |
@Chraebi thanks for catching the error, I fixed it here: mvernacc/gazebo_motor_model_docs@9275d82 |
Would someone mind explaining how to derive the time constants (tau)? I'm having difficulty finding any sources that describe the processes. |
Some updates other may find useful. I was under the assumption the time constant was the time to reach 63% of the max motor velocity however this was giving me poor results. After some experimental measurements there were a couple interesting things I found. |
Can anyone here provide successfully implemented equations to change the parameters in the motor model plugin. I have followed the notes provided by @mvernacc but can only calculate the motor and moment constant using it. Since other equations are not that clearly defined. |
@TSC21 @hamishwillee are there any updates regarding corresponding documentation? So, are there any updates/documentation regarding how to model the motors used in SITL? Thanks. |
@mzahana No updated docs. This happening depends on @TSC21 or someone else who understands the modeling making it happen. Is it possible to further test the assumption that it is the motor modeling that is the problem. Nuno, got any advice? There are a couple of modeling cases like this that have been sitting as questions for a long time. Are there any other people you could recommend might be able to help us expand on these docs? |
I'm trying to get a model working with the T motors f80 pro 1900 Kv and I was wondering if some one was willing to double check my math. Also if I did make a mistake feel free to explain what I did wrong as math like this isn't my strong suite. Gazebo motor calculations.xlsx I was basing it on the information as found here. Edit: Noticed I needed to use Feet for propeller diameter and not meters, This was not clear. |
@luuxx I think max motor efficiency is wrong. The motor efficiency on the information is thrust/power [g/w].The max motor efficiency should be around 0-1[dimensionless]. |
Hi, I read the whole discussion and I found it really interesting. Thanks to all the people participating in this. I am also looking into this topic and I found that in the discussion is missing one point that might be either stupid or that I might have just missed. The whole point of the discussion and why it started (as far as I understood) is that the documentation of a specific plugin ( |
@LorenzMeier Is this issue resolved? |
This was never an issue in the first place. It was a question with a lengthy discussion. Please use the forums. |
@tayyabkhalil-313 Please dont hijack this thread with a topic that is not related. |
what is the unit of max motor efficiency used here? and how it has been derived ? |
This issue has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: https://discuss.px4.io/t/gazebo-sdf-file-motor-parameters-definitions/34747/1 |
This issue has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: |
This issue has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: https://discuss.px4.io/t/heavy-drone-climbs-unresponsively-after-takeoff-in-px4-sitl-gazebo/39412/5 |
This issue has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: https://discuss.px4.io/t/heavy-drone-climbs-unresponsively-after-takeoff-in-px4-sitl-gazebo/39412/21 |
Hi guys,
So here's the thing: I'm building a VTOL model similar to the standard VTOL which has some specifications in terms of motor setup: for example, the front motors have less torque than the back motors, which are more powerful in order to keep the vehicle balanced. The pusher motor is also different from those.
Having some time already working with Gazebo SITL, I found out that most of the vehicle models have the same motor models, pretty similar configurations and even weights. The thing is, if one wants to create his own vehicle model, with proper inertia matrix and weight, it also needs to have the motors model with the correct setup.
So after some research, and trying to figure out how to compute the different parameters that compose the motor model in the SDF config, I came up with the following math for those:
Ω or Max Rotational Velocity = Kv * Max Applied Voltage * Max Motor Efficiency * 2π / 60
Motor Constant = Thrust / (Ω) ²
Moment Constant = 60 / (2π * Kv)
Rotor Drag Coefficient = Thrust / (ρ * (Kv * Max Applied Voltage * Max Motor Efficiency / 60) ² * Propeller diameter ⁴)
Rolling Moment Coefficient =
Using SST turbulence model from reference, and bent/round wings/propellers:~0.0220 for angle of attack smaller than 16 degrees
- I'm keeping this defaulted to1E-06
for now.where,
Kv [RPM/V]
Max Thrust [N]
Max Applied Voltage [V]
Ω Rotor angular velocity [rad/s]
ρ Air density at 20ºC: 1.2041 [kg/m³]
The
Motor Time Constant
is still something I don't know how to get it.So what I ask is for help from someone that dedicated time writing the motor model plugin and that knows how's the math structured so to confirm or correct the math above. This will be helpful to everyone facing the same trouble when wanting to properly simulate their vehicle models, and not just copy paste from the existing models.
The text was updated successfully, but these errors were encountered: