forked from Archive/PX4-Autopilot
mixers: Multirotor remove text roll, pitch, yaw scaling and idle speed
This commit is contained in:
parent
4afb27411c
commit
26bac78eaf
|
@ -14,7 +14,7 @@
|
|||
|
||||
sh /etc/init.d/rc.mc_defaults
|
||||
|
||||
set MIXER zmr250
|
||||
set MIXER quad_x
|
||||
set PWM_OUT 1234
|
||||
|
||||
if [ $AUTOCNF = yes ]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Mixer for the gazebo tailsitter model
|
||||
=====================================
|
||||
|
||||
R: 4x 10000 10000 10000 0
|
||||
R: 4x
|
||||
|
||||
Z:
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ Mixer for standard vtol plane (SITL) with motor x configuration
|
|||
|
||||
This file defines a single mixer for a standard vtol plane (SITL gazebo) with motors in X configuration. The plane has two ailerons and one elevator.
|
||||
|
||||
R: 4x 10000 10000 10000 0
|
||||
R: 4x
|
||||
|
||||
# mixer for the pusher/puller throttle
|
||||
M: 1
|
||||
|
|
|
@ -3,7 +3,7 @@ Mixer for quad tiltrotor (x motor configuration)
|
|||
|
||||
This file defines a single mixer for a tiltrotor (SITL gazebo) with motors in X configuration. The plane has two ailerons and one elevator.
|
||||
|
||||
R: 4x 10000 10000 10000 0
|
||||
R: 4x
|
||||
|
||||
# tilt servo motor 1
|
||||
M: 1
|
||||
|
|
|
@ -57,7 +57,6 @@ px4_add_romfs_files(
|
|||
IO_pass.main.mix
|
||||
mount.aux.mix
|
||||
mount_legs.aux.mix
|
||||
ocpoc_quad_x.main.mix
|
||||
octo_cox.main.mix
|
||||
octo_cox_w.main.mix
|
||||
octo_+.main.mix
|
||||
|
@ -84,7 +83,6 @@ px4_add_romfs_files(
|
|||
vtol_convergence.main.mix
|
||||
vtol_delta.aux.mix
|
||||
wingwing.main.mix
|
||||
zmr250.main.mix
|
||||
TF-AutoG2.main.mix
|
||||
uuv_x.main.mix
|
||||
)
|
||||
|
|
|
@ -35,4 +35,4 @@ S: 1 1 -8000 -8000 0 -10000 10000
|
|||
|
||||
Quad motors 1 - 4
|
||||
-----------------
|
||||
R: 4x 10000 10000 10000 0
|
||||
R: 4x
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
|
||||
#===========================
|
||||
|
||||
R: 4x 10000 10000 10000 0
|
||||
R: 4x
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Quad motors 1 - 4
|
||||
-------------
|
||||
|
||||
R: 4x 10000 10000 10000 0
|
||||
R: 4x
|
||||
|
||||
|
||||
Elevon mixers
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# Dodeca Cox
|
||||
|
||||
R: 6a 10000 10000 10000 0
|
||||
R: 6a
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# Dodeca Cox
|
||||
|
||||
R: 6m 10000 10000 10000 0
|
||||
R: 6m
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# FireFly6 mixer for PX4FMU
|
||||
#
|
||||
#===========================
|
||||
R: 6c 10000 10000 10000 0
|
||||
R: 6c
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# Hexa +
|
||||
|
||||
R: 6+ 10000 10000 10000 0
|
||||
R: 6+
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# Hexa coaxial
|
||||
|
||||
R: 6c 10000 10000 10000 0
|
||||
R: 6c
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Hexa X
|
||||
|
||||
R: 6x 10000 10000 10000 0
|
||||
R: 6x
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
R: 4x 10000 10000 10000 1300
|
|
@ -1,3 +1,3 @@
|
|||
# Octo +
|
||||
|
||||
R: 8+ 10000 10000 10000 0
|
||||
R: 8+
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# Octo coaxial
|
||||
|
||||
R: 8c 10000 10000 10000 0
|
||||
R: 8c
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# Octo coaxial with wide arms
|
||||
|
||||
R: 8cw 10000 10000 10000 0
|
||||
R: 8cw
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# Octo X
|
||||
|
||||
R: 8x 10000 10000 10000 0
|
||||
R: 8x
|
||||
|
|
|
@ -4,7 +4,7 @@ Multirotor mixer for PX4FMU
|
|||
This file defines a single mixer for a quadrotor in the + configuration. All controls
|
||||
are mixed 100%.
|
||||
|
||||
R: 4+ 10000 10000 10000 0
|
||||
R: 4+
|
||||
|
||||
Gimbal / payload mixer for last two channels
|
||||
-----------------------------------------------------
|
||||
|
|
|
@ -4,7 +4,7 @@ Mixer for Tailsitter with + motor configuration and elevons
|
|||
This file defines a single mixer for tailsitter with motors in X configuration. All controls
|
||||
are mixed 100%.
|
||||
|
||||
R: 4+ 10000 10000 10000 0
|
||||
R: 4+
|
||||
|
||||
# mixer for the elevons
|
||||
M: 2
|
||||
|
|
|
@ -3,4 +3,4 @@ Multirotor mixer
|
|||
|
||||
This file defines a single mixer for a quadrotor in DC wide arms configuration. All controls are mixed 100%.
|
||||
|
||||
R: 4dc 10000 10000 10000 0
|
||||
R: 4dc
|
||||
|
|
|
@ -4,7 +4,7 @@ Multirotor mixer for PX4FMU
|
|||
This file defines a single mixer for a quadrotor in the H configuration. All controls
|
||||
are mixed 100%.
|
||||
|
||||
R: 4h 10000 10000 10000 0
|
||||
R: 4h
|
||||
|
||||
Gimbal / payload mixer for last two channels
|
||||
-----------------------------------------------------
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
R: 4s 10000 10000 10000 0
|
||||
R: 4s
|
||||
M: 1
|
||||
S: 3 5 10000 10000 0 -10000 10000
|
||||
M: 1
|
||||
|
|
|
@ -3,7 +3,7 @@ Multirotor mixer for PX4FMU
|
|||
|
||||
This file defines a single mixer for a quadrotor with a wide configuration. All controls are mixed 100%.
|
||||
|
||||
R: 4w 10000 10000 10000 0
|
||||
R: 4w
|
||||
|
||||
Gimbal / payload mixer for last two channels
|
||||
-----------------------------------------------------
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
R: 4x 10000 10000 10000 0
|
||||
R: 4x
|
||||
|
||||
AUX1 Passthrough
|
||||
M: 1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# @board px4_fmu-v2 exclude
|
||||
# Quad X with clock-wise motor assigment
|
||||
|
||||
R: 4xcw 10000 10000 10000 0
|
||||
R: 4xcw
|
||||
|
|
|
@ -4,7 +4,7 @@ Mixer for Tailsitter with x motor configuration and elevons
|
|||
This file defines a single mixer for tailsitter with motors in X configuration. All controls
|
||||
are mixed 100%.
|
||||
|
||||
R: 4x 10000 10000 10000 0
|
||||
R: 4x
|
||||
|
||||
# left elevon
|
||||
M: 2
|
||||
|
|
|
@ -3,7 +3,7 @@ Mixer for Standard VTOL (QuadPlane) with motor x configuration (Gazebo HITL)
|
|||
|
||||
# @board px4_fmu-v2 exclude
|
||||
|
||||
R: 4x 10000 10000 10000 0
|
||||
R: 4x
|
||||
|
||||
# mixer for the pusher/puller throttle
|
||||
M: 1
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# Yaw Servo +Output ==> +Yaw Vehicle Rotation
|
||||
|
||||
# Motors
|
||||
R: 3y 10000 10000 10000 0
|
||||
R: 3y
|
||||
|
||||
# Yaw Servo
|
||||
M: 1
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# Yaw Servo +Output ==> -Yaw Vehicle Rotation
|
||||
|
||||
# Motors
|
||||
R: 3y 10000 10000 10000 0
|
||||
R: 3y
|
||||
|
||||
# Yaw Servo
|
||||
M: 1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# E-flite Convergence Tricopter Y-Configuration Mixer
|
||||
|
||||
# Motors
|
||||
R: 3y 10000 10000 10000 0
|
||||
R: 3y
|
||||
|
||||
Z:
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ Motor mixer
|
|||
Channel 1 connects to the right (starboard) motor.
|
||||
Channel 2 connects to the left (port) motor.
|
||||
|
||||
R: 2- 10000 10000 10000 0
|
||||
R: 2-
|
||||
|
||||
Zero mixer (2x)
|
||||
---------------
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
#
|
||||
# @board px4_fmu-v2 exclude
|
||||
#
|
||||
# R: <geometry> <roll scale> <pitch scale> <yaw scale> <deadband>
|
||||
R: 4x 7654 10000 10000 0
|
||||
|
||||
M: 1
|
||||
S: 0 4 10000 10000 0 -10000 10000
|
||||
|
||||
M: 1
|
||||
S: 0 5 10000 10000 0 -10000 10000
|
|
@ -1,4 +1,4 @@
|
|||
# Hexa X
|
||||
|
||||
R: 6x 10000 10000 10000 0
|
||||
R: 6x
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# Octo X
|
||||
|
||||
R: 8x 10000 10000 10000 0
|
||||
R: 8x
|
||||
|
|
|
@ -4,7 +4,7 @@ Multirotor mixer for PX4FMU
|
|||
This file defines a single mixer for a quadrotor in the + configuration. All controls
|
||||
are mixed 100%.
|
||||
|
||||
R: 4+ 10000 10000 10000 0
|
||||
R: 4+
|
||||
|
||||
Gimbal / payload mixer for last two channels
|
||||
-----------------------------------------------------
|
||||
|
|
|
@ -4,7 +4,7 @@ Mixer for Tailsitter with + motor configuration and elevons
|
|||
This file defines a single mixer for tailsitter with motors in X configuration. All controls
|
||||
are mixed 100%.
|
||||
|
||||
R: 4+ 10000 10000 10000 0
|
||||
R: 4+
|
||||
|
||||
# mixer for the elevons
|
||||
M: 2
|
||||
|
|
|
@ -3,7 +3,7 @@ Multirotor mixer for TEST
|
|||
|
||||
This file defines a single mixer for a quadrotor with a wide configuration. All controls are mixed 100%.
|
||||
|
||||
R: 4w 10000 10000 10000 0
|
||||
R: 4w
|
||||
|
||||
Gimbal / payload mixer for last four channels
|
||||
-----------------------------------------------------
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
R: 4x 10000 10000 10000 0
|
||||
R: 4x
|
||||
M: 1
|
||||
O: 10000 10000 0 -10000 10000
|
||||
S: 3 5 10000 10000 0 -10000 10000
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# VTOL test mixer
|
||||
|
||||
R: 2- 10000 10000 10000 0
|
||||
R: 2-
|
||||
Z:
|
||||
M: 2
|
||||
O: 10000 10000 0 -10000 10000
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# E-flite Convergence Tricopter Y-Configuration Mixer
|
||||
|
||||
# Motors
|
||||
R: 3y 10000 10000 10000 0
|
||||
R: 3y
|
||||
|
||||
Z:
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# E-flite Convergence Tricopter Y-Configuration Mixer
|
||||
|
||||
# Motors
|
||||
R: 3y 10000 10000 10000 0
|
||||
R: 3y
|
||||
|
||||
Z:
|
||||
|
||||
|
|
|
@ -46,6 +46,6 @@ mavlink stream -d /dev/ttyPS1 -s ATTITUDE -r 50
|
|||
|
||||
rc_input start -d /dev/ttyS2
|
||||
|
||||
linux_pwm_out start -p ocpoc_mmap -m ROMFS/px4fmu_common/mixers/ocpoc_quad_x.main.mix
|
||||
linux_pwm_out start -p ocpoc_mmap -m ROMFS/px4fmu_common/mixers/quad_x.main.mix
|
||||
logger start -t -b 200
|
||||
mavlink boot_complete
|
||||
|
|
|
@ -79,14 +79,9 @@ const char *_config_key[] = {"4x"};
|
|||
//#include <debug.h>
|
||||
//#define debug(fmt, args...) syslog(fmt "\n", ##args)
|
||||
|
||||
MultirotorMixer::MultirotorMixer(ControlCallback control_cb, uintptr_t cb_handle, MultirotorGeometry geometry,
|
||||
float roll_scale, float pitch_scale, float yaw_scale, float idle_speed) :
|
||||
MultirotorMixer::MultirotorMixer(ControlCallback control_cb, uintptr_t cb_handle, MultirotorGeometry geometry) :
|
||||
MultirotorMixer(control_cb, cb_handle, _config_index[(int)geometry], _config_rotor_count[(int)geometry])
|
||||
{
|
||||
_roll_scale = roll_scale;
|
||||
_pitch_scale = pitch_scale;
|
||||
_yaw_scale = yaw_scale;
|
||||
_idle_speed = -1.0f + idle_speed * 2.0f; /* shift to output range here to avoid runtime calculation */
|
||||
}
|
||||
|
||||
MultirotorMixer::MultirotorMixer(ControlCallback control_cb, uintptr_t cb_handle, const Rotor *rotors,
|
||||
|
@ -98,7 +93,7 @@ MultirotorMixer::MultirotorMixer(ControlCallback control_cb, uintptr_t cb_handle
|
|||
_tmp_array(new float[_rotor_count])
|
||||
{
|
||||
for (unsigned i = 0; i < _rotor_count; ++i) {
|
||||
_outputs_prev[i] = _idle_speed;
|
||||
_outputs_prev[i] = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,24 +108,17 @@ MultirotorMixer::from_text(Mixer::ControlCallback control_cb, uintptr_t cb_handl
|
|||
{
|
||||
MultirotorGeometry geometry = MultirotorGeometry::MAX_GEOMETRY;
|
||||
char geomname[16];
|
||||
int s[4];
|
||||
int used;
|
||||
|
||||
/* enforce that the mixer ends with a new line */
|
||||
if (!string_well_formed(buf, buflen)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (sscanf(buf, "R: %15s %d %d %d %d%n", geomname, &s[0], &s[1], &s[2], &s[3], &used) != 5) {
|
||||
if (sscanf(buf, "R: %15s", geomname) != 1) {
|
||||
debug("multirotor parse failed on '%s'", buf);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (used > (int)buflen) {
|
||||
debug("OVERFLOW: multirotor spec used %d of %u", used, buflen);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
buf = skipline(buf, buflen);
|
||||
|
||||
if (buf == nullptr) {
|
||||
|
@ -155,14 +143,7 @@ MultirotorMixer::from_text(Mixer::ControlCallback control_cb, uintptr_t cb_handl
|
|||
|
||||
debug("adding multirotor mixer '%s'", geomname);
|
||||
|
||||
return new MultirotorMixer(
|
||||
control_cb,
|
||||
cb_handle,
|
||||
geometry,
|
||||
s[0] / 10000.0f,
|
||||
s[1] / 10000.0f,
|
||||
s[2] / 10000.0f,
|
||||
s[3] / 10000.0f);
|
||||
return new MultirotorMixer(control_cb, cb_handle, geometry);
|
||||
}
|
||||
|
||||
float
|
||||
|
@ -339,9 +320,9 @@ MultirotorMixer::mix(float *outputs, unsigned space)
|
|||
return 0;
|
||||
}
|
||||
|
||||
float roll = math::constrain(get_control(0, 0) * _roll_scale, -1.0f, 1.0f);
|
||||
float pitch = math::constrain(get_control(0, 1) * _pitch_scale, -1.0f, 1.0f);
|
||||
float yaw = math::constrain(get_control(0, 2) * _yaw_scale, -1.0f, 1.0f);
|
||||
float roll = math::constrain(get_control(0, 0), -1.0f, 1.0f);
|
||||
float pitch = math::constrain(get_control(0, 1), -1.0f, 1.0f);
|
||||
float yaw = math::constrain(get_control(0, 2), -1.0f, 1.0f);
|
||||
float thrust = math::constrain(get_control(0, 3), 0.0f, 1.0f);
|
||||
|
||||
// clean out class variable used to capture saturation
|
||||
|
@ -375,7 +356,7 @@ MultirotorMixer::mix(float *outputs, unsigned space)
|
|||
_thrust_factor));
|
||||
}
|
||||
|
||||
outputs[i] = math::constrain(_idle_speed + (outputs[i] * (1.0f - _idle_speed)), _idle_speed, 1.0f);
|
||||
outputs[i] = math::constrain(outputs[i], 0.f, 1.f);
|
||||
}
|
||||
|
||||
// Slew rate limiting and saturation checking
|
||||
|
@ -389,7 +370,7 @@ MultirotorMixer::mix(float *outputs, unsigned space)
|
|||
// clipping if airmode==roll/pitch), since in all other cases thrust will
|
||||
// be reduced or boosted and we can keep the integrators enabled, which
|
||||
// leads to better tracking performance.
|
||||
if (outputs[i] < _idle_speed + 0.01f) {
|
||||
if (outputs[i] < 0.01f) {
|
||||
if (_airmode == Airmode::disabled) {
|
||||
clipping_low_roll_pitch = true;
|
||||
clipping_low_yaw = true;
|
||||
|
|
|
@ -79,8 +79,7 @@ public:
|
|||
* tuned to ensure that rotors never stall at the
|
||||
* low end of their control range.
|
||||
*/
|
||||
MultirotorMixer(ControlCallback control_cb, uintptr_t cb_handle, MultirotorGeometry geometry,
|
||||
float roll_scale, float pitch_scale, float yaw_scale, float idle_speed);
|
||||
MultirotorMixer(ControlCallback control_cb, uintptr_t cb_handle, MultirotorGeometry geometry);
|
||||
|
||||
/**
|
||||
* Constructor (for testing).
|
||||
|
@ -241,10 +240,6 @@ private:
|
|||
|
||||
void update_saturation_status(unsigned index, bool clipping_high, bool clipping_low_roll_pitch, bool clipping_low_yaw);
|
||||
|
||||
float _roll_scale{1.0f};
|
||||
float _pitch_scale{1.0f};
|
||||
float _yaw_scale{1.0f};
|
||||
float _idle_speed{0.0f};
|
||||
float _delta_out_max{0.0f};
|
||||
float _thrust_factor{0.0f};
|
||||
|
||||
|
|
Loading…
Reference in New Issue