# Thrust to throttle in /mavros/setpoint_raw/attitude

#6

But, do you find a precise model for mapping thrust into the normalised value? Also, did you try to control the torque?

#7

Currently working on the same. Will update once some result is obtained.

#8

I will try as well.
Thank you very much for your help:grinning:

#9

(Static) Thrust = f(RPM).
I think it should be reasonable to calculate RPM = f(Thrust) given that equation.
(S)He also explains the derivation of the equation.
@BossHater: how did you come up with your equation?

throttle = throttle + (a_cmd - a_curr) *k

Is there any scientific background to that or is it a fit using some data?
I don’t want to sound rude, just wondering…

#10

I thinks his approach is more like a P controller…It is not based on the model

#11

@robin-ecn The only thing you need to figure out is the scaling factor between the normalized thrust and the acceleration. This is hardwawre dependent on what kind of mootrs / voltage you are using.

A good guess can be made with the hover throttle. For example, if your drone hovers at a normalized thrust value of 0.5, that means the normalized thrust value of 0.5 is going to be close to accelration value of 9.8m/s^2.

This way, the normalized thrust values can be mapped to the actual acceleration.

#12

Still, maybe a function would do better?

#13

I think it could be better to find the exact mapping. Maybe this How are pwm values set after controllers outputs are calculated for quadrotors? would be useful for you.

#14

Thanks man.

But we are not sure the mapping is linear, right? I am not sure about that. That is why I am stepping inside of the px4 and mavros codes trying finding out the exact relation.

#15

@robin-ecn The actuator commands corresponds to the PWM values commanded on the ESCs. The nonlinearity is not that high and I believe the performance will not be too bad even if you assume that it is linear. Given that the thrust values will not vary too much around the hovering value of the thrust commands.

Even if you manage to model the nonlinearity between the pwm and thrust generation, this will no longer hold when the drone starts to move dynamically as the thrust generated by the rotors will vary on the load and speed.

There are a lot of people testing motors and measuring thrust vs pwm values on benches so this could be a good reference for you

#16

Thanks so much for you reply. I agree even with the correct model, it is not the case when the drone moves dynamically.

#17

Check the actuator_control in mavros http://docs.ros.org/melodic/api/mavros_msgs/html/msg/ActuatorControl.html.
I believe it is useful.

#18

@robin-ecn are you by chance talking about this topic (Control Multicopter via thrust f and moments M)?

#19

It was me as well.

#20

Hi, Jaeyoung.

I have a question. When you said “The actuator commands corresponds to the PWM values commanded on the ESCs.”, you mean “actuator_control provided by MAVROS are actually the PWM of the motors”?

Now I am trying to control the motors directly, do you have some good reference on that.

Thanks very much

#21

@robin-ecn You can look into how the mixer works : https://dev.px4.io/en/concept/mixing.html

The actuator control message goes through the mixer as you can see here: http://docs.ros.org/api/mavros_msgs/html/msg/ActuatorControl.html

#22

Hi, Jaeyong.

In order to control each motor directly, I have read the webpages that you recommand and thank for that.

Now my idea is I receive the pose information from mocap in my conputor and I compute the required force and torques to track a trajectory. Then, I can mapping the force and torques into angular velocity for each motor. Then I just need to send those commands to /actuator_control.

I still have two questions in terms of mixer for quadrotors.

(1) I need to write a new simple mixer using tag M instead of R?

(2) I find the quad+x.main.mix to understand how the mixer maps the roll, pitch, yaw and thrust into the actuator commands. But there is only one line

R: 4+ 10000 10000 10000 0

I can not understand how this is transformed to the actuator_control.

Could you give me some help? Thanks

#23

@robin-ecn It is because it is a multirotor mixer, geometry of 4+. It is explained in the document

#24

@Jaeyoung-Lim yes, is it possible to find out how those roll, pitch, yaw and thrust commandes are transformed into actuator commandes, like PWM?

This is because I try to understand how this works before writing my mixer file. Maybe it is not necessary?

PX4: dynamic control need for a drone
#25

@robin-ecn So the purpose of a mixer file is to use actuator commands without knowing how exactly the geometry of the drone is. If you want to look into the multirotor mixer you can look here

The attitude controller simply commands angular moments and thrust and this translates to the actuator inputs according to the geometry of the mixer. This enables same attitude controller be applied to various airframes.