# Custom PX4 Multirotor "input\_scaling" parameter

**URL:** <https://discuss.px4.io/t/custom-px4-multirotor-input-scaling-parameter/21489>\
**Category:** PX4 Autopilot\
**Created:** [March 16, 2021, 6:27am UTC](https://discuss.px4.io/t/custom-px4-multirotor-input-scaling-parameter/21489 "2021-03-16T06:27:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanghun17](https://discuss.px4.io/user_avatar/discuss.px4.io/sanghun17/32/8242_2.png) [@sanghun17](https://discuss.px4.io/u/sanghun17)\
**Post date:** [March 16, 2021, 6:27am UTC](https://discuss.px4.io/t/custom-px4-multirotor-input-scaling-parameter/21489/1 "2021-03-16T06:27:30Z")

</div>

Hello, I am making a custom multirotor model in the sdf file and I am having trouble with the parameter “input\_scaling”.

```
<plugin name='mavlink_interface' filename='libgazebo_mavlink_interface.so'>
  <robotNamespace/>
  <imuSubTopic>/imu</imuSubTopic>
  <magSubTopic>/mag</magSubTopic>
  <baroSubTopic>/baro</baroSubTopic>
  <mavlink_addr>INADDR_ANY</mavlink_addr>
  <mavlink_tcp_port>4560</mavlink_tcp_port>
  <mavlink_udp_port>14560</mavlink_udp_port>
  <serialEnabled>0</serialEnabled>
  <serialDevice>/dev/ttyACM0</serialDevice>
  <baudRate>921600</baudRate>
  <qgc_addr>INADDR_ANY</qgc_addr>
  <qgc_udp_port>14550</qgc_udp_port>
  <sdk_addr>INADDR_ANY</sdk_addr>
  <sdk_udp_port>14540</sdk_udp_port>
  <hil_mode>0</hil_mode>
  <hil_state_level>0</hil_state_level>
  <send_vision_estimation>0</send_vision_estimation>
  <send_odometry>1</send_odometry>
  <enable_lockstep>1</enable_lockstep>
  <use_tcp>1</use_tcp>
  <motorSpeedCommandPubTopic>/gazebo/command/motor_speed</motorSpeedCommandPubTopic>
  <control_channels>
    <channel name='rotor1'>
      <input_index>0</input_index>
      <input_offset>0</input_offset>
      <input_scaling>1000</input_scaling>
      <zero_position_disarmed>0</zero_position_disarmed>
      <zero_position_armed>100</zero_position_armed>
      <joint_control_type>velocity</joint_control_type>
    </channel>
    <channel name='rotor2'>
      <input_index>1</input_index>
      <input_offset>0</input_offset>
      <input_scaling>1000</input_scaling>
      <zero_position_disarmed>0</zero_position_disarmed>
      <zero_position_armed>100</zero_position_armed>
      <joint_control_type>velocity</joint_control_type>
    </channel>
    <channel name='rotor3'>
      <input_index>2</input_index>
      <input_offset>0</input_offset>
      <input_scaling>1000</input_scaling>
      <zero_position_disarmed>0</zero_position_disarmed>
      <zero_position_armed>100</zero_position_armed>
      <joint_control_type>velocity</joint_control_type>
    </channel>
    <channel name='rotor4'>
      <input_index>3</input_index>
      <input_offset>0</input_offset>
      <input_scaling>1000</input_scaling>
      <zero_position_disarmed>0</zero_position_disarmed>
      <zero_position_armed>100</zero_position_armed>
      <joint_control_type>velocity</joint_control_type>
    </channel>
  </control_channels>
</plugin>

```

I’ve found out that iris model has input\_scaling of 1000, solo with 1200, and typhoon with 1500. I am wondering why these values are different for each model and what this parameter means.

Sincerely,  
Sang Hun

---

<div class="post-metadata">

**Author:** ![Jaeyoung-Lim](https://discuss.px4.io/user_avatar/discuss.px4.io/jaeyoung-lim/32/10829_2.png) [@Jaeyoung-Lim](https://discuss.px4.io/u/Jaeyoung-Lim)\
**Post date:** [March 16, 2021, 6:43am UTC](https://discuss.px4.io/t/custom-px4-multirotor-input-scaling-parameter/21489/2 "2021-03-16T06:43:28Z")

</div>

@sanghun17 You can look at how the input scaling is used: [PX4-SITL\_gazebo/gazebo\_mavlink\_interface.cpp at 6b6f4749a74215b9a4fb81cfaa99a3950f13464d · PX4/PX4-SITL\_gazebo · GitHub](https://github.com/PX4/PX4-SITL_gazebo/blob/6b6f4749a74215b9a4fb81cfaa99a3950f13464d/src/gazebo_mavlink_interface.cpp#L241)

The scale basically maps the normalized inputs [-1, …, +1] to something similar to the rotation speed values of the rotors, which gets consumed in the `gazebo_motor_model`. Therefore it should vary between models because the props have different thrust constants, and therefore spin at different RPMs.

---

<div class="post-metadata">

**Author:** ![sanghun17](https://discuss.px4.io/user_avatar/discuss.px4.io/sanghun17/32/8242_2.png) [@sanghun17](https://discuss.px4.io/u/sanghun17)\
**Post date:** [March 19, 2021, 4:04am UTC](https://discuss.px4.io/t/custom-px4-multirotor-input-scaling-parameter/21489/3 "2021-03-19T04:04:10Z")

</div>

[Jaeyoung-Lim](https://discuss.px4.io/t/custom-px4-multirotor-input-scaling-parameter/21489/2)

I am trying to duplicate a real drone into to a realistic model that can run in SITL. I am currently using ROS and I can give throttle setpoing to the SITL vehicle, so I am not really sure why input\_scaling is needed here. Perhaps, do I have to use the maximum value of input\_scaling for this purpose (I’m guessing it is 10000)?

---

<div class="post-metadata">

**Author:** ![Jaeyoung-Lim](https://discuss.px4.io/user_avatar/discuss.px4.io/jaeyoung-lim/32/10829_2.png) [@Jaeyoung-Lim](https://discuss.px4.io/u/Jaeyoung-Lim)\
**Post date:** [March 19, 2021, 4:57am UTC](https://discuss.px4.io/t/custom-px4-multirotor-input-scaling-parameter/21489/4 "2021-03-19T04:57:40Z")

</div>

> I am trying to duplicate a real drone into to a realistic model that can run in SITL. I am currently using ROS and I can give throttle setpoing to the SITL vehicle, so I am not really sure why input\_scaling is needed here. Perhaps, do I have to use the maximum value of input\_scaling for this purpose (I’m guessing it is 10000)?

The simulated motor model is expecting the rotational velocity of the motors. Therefore you need to scale your input so that it represents the rotor velocity: [PX4-SITL\_gazebo-classic/src/gazebo\_motor\_model.cpp at 1b1afca3440df678167818eaf8e38f301b16bcbd · PX4/PX4-SITL\_gazebo-classic · GitHub](https://github.com/PX4/PX4-SITL_gazebo/blob/1b1afca3440df678167818eaf8e38f301b16bcbd/src/gazebo_motor_model.cpp#L188)

---

<div class="post-metadata">

**Author:** ![Fatih\_Ozkan](https://discuss.px4.io/user_avatar/discuss.px4.io/fatih_ozkan/32/10828_2.png) [@Fatih\_Ozkan](https://discuss.px4.io/u/Fatih_Ozkan)\
**Post date:** [April 14, 2021, 7:54am UTC](https://discuss.px4.io/t/custom-px4-multirotor-input-scaling-parameter/21489/5 "2021-04-14T07:54:10Z")

</div>

@Jaeyoung-Lim

Hello again,

Like others i am trying to make my own model. I didn’t face with any issue with my quadrotors.

But for my tail mixer i am trying to do reduce yaw effect to %50 so in mixer file it’s something like this:

```
-----------------
M: 2
O: 10000 10000 0 -10000 10000
S: 1 1 9000 9000 0 -10000 10000
S: 1 2 -5000 -5000 0 -10000 10000

```

but when print deflection (In liftdrag\_plugin.cpp/control angle(deg)) it is 25 degree. But logically it must be 12.5 degree.

Should i change my input\_scaling for my tail too? I thought changing rotors input\_scaling is enough for my model. Because deflection modelling probably same in other models?

Or are there any other way to do that?

Thanks.

---

<div class="post-metadata">

**Author:** ![egm](https://discuss.px4.io/user_avatar/discuss.px4.io/egm/32/13514_2.png) [@egm](https://discuss.px4.io/u/egm)\
**Post date:** [June 13, 2023, 9:40pm UTC](https://discuss.px4.io/t/custom-px4-multirotor-input-scaling-parameter/21489/6 "2023-06-13T21:40:56Z")

</div>

Hello, if I have a controller that gives me thrust force in newtons, and I’m controlling body rates and throttle, and I’m using the iris quadcopter, would the following equations be sensible to give me the the desired throttle value from thrust?

motor\_speed = sqrt(thrust / 4 \* motorConstant)  
throttle = (motor\_speed - zero\_position\_armed ) / input\_scaling
