Gazebo Motor parameters
-
Pixhawk controller output is shaped via function
output = (original_output + input_offset) * input_scaling + zero_position_armed
in gazebo_mavlink_interface.cpp. The parameters are loaded from component_snippets.xacro from the rotor block:
<channel name="rotor2">
<input_index>1</input_index>
<input_offset>0</input_offset>
<input_scaling>1</input_scaling>
<zero_position_disarmed>0</zero_position_disarmed>
<zero_position_armed>0.15</zero_position_armed>
<joint_control_type>velocity</joint_control_type>
</channel>The original_output is scaled from 0 to 1. The new output has zero_position_armed added, which offsets the signal up and emulates the "minimal rotor speed" set in PixHawk.
-
Gazebo receives the signals from PixHawk ([0, 1])
- A simulated rotor speed (rad/s) is generated by dividing the signal by the rotor_velocity_slowdown_sim constant
- that is the speed of the actual model in gazebo
- A thrust [N] is generated from the signal (NOT the simulated rotor speed) by the function
thrust = motor_constant * signal^2
- the parameters are in the .xacro file
<xacro:property name="rotor_velocity_slowdown_sim" value="0.0159236" />
<xacro:property name="motor_constant" value="8.3" /> <!-- [kg.m/s^2] -->- rotor_velocity_slowdown_sim is set so the max velocity is 10 revolutions per second
- A simulated rotor speed (rad/s) is generated by dividing the signal by the rotor_velocity_slowdown_sim constant