mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 14:33:34 +08:00
Merge branch 'beta' into stable
This commit is contained in:
@@ -564,7 +564,7 @@ then
|
|||||||
fi
|
fi
|
||||||
if [ $MIXER == tri_y_yaw- -o $MIXER == tri_y_yaw+ ]
|
if [ $MIXER == tri_y_yaw- -o $MIXER == tri_y_yaw+ ]
|
||||||
then
|
then
|
||||||
set MAV_TYPE 2
|
set MAV_TYPE 15
|
||||||
fi
|
fi
|
||||||
if [ $MIXER == hexa_x -o $MIXER == hexa_+ ]
|
if [ $MIXER == hexa_x -o $MIXER == hexa_+ ]
|
||||||
then
|
then
|
||||||
@@ -588,6 +588,7 @@ then
|
|||||||
if [ $MAV_TYPE == none ]
|
if [ $MAV_TYPE == none ]
|
||||||
then
|
then
|
||||||
echo "Unknown MAV_TYPE"
|
echo "Unknown MAV_TYPE"
|
||||||
|
param set MAV_TYPE 2
|
||||||
else
|
else
|
||||||
param set MAV_TYPE $MAV_TYPE
|
param set MAV_TYPE $MAV_TYPE
|
||||||
fi
|
fi
|
||||||
@@ -631,6 +632,7 @@ then
|
|||||||
if [ $MAV_TYPE == none ]
|
if [ $MAV_TYPE == none ]
|
||||||
then
|
then
|
||||||
echo "Unknown MAV_TYPE"
|
echo "Unknown MAV_TYPE"
|
||||||
|
param set MAV_TYPE 19
|
||||||
else
|
else
|
||||||
param set MAV_TYPE $MAV_TYPE
|
param set MAV_TYPE $MAV_TYPE
|
||||||
fi
|
fi
|
||||||
@@ -661,6 +663,8 @@ then
|
|||||||
then
|
then
|
||||||
sh /etc/init.d/rc.axialracing_ax10_apps
|
sh /etc/init.d/rc.axialracing_ax10_apps
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
param set MAV_TYPE 10
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset MIXER
|
unset MIXER
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ Mavlink::Mavlink() :
|
|||||||
_datarate(1000),
|
_datarate(1000),
|
||||||
_datarate_events(500),
|
_datarate_events(500),
|
||||||
_rate_mult(1.0f),
|
_rate_mult(1.0f),
|
||||||
|
_last_hw_rate_timestamp(0),
|
||||||
_mavlink_param_queue_index(0),
|
_mavlink_param_queue_index(0),
|
||||||
mavlink_link_termination_allowed(false),
|
mavlink_link_termination_allowed(false),
|
||||||
_subscribe_to_stream(nullptr),
|
_subscribe_to_stream(nullptr),
|
||||||
@@ -1244,12 +1245,53 @@ Mavlink::update_rate_mult()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* don't scale up rates, only scale down if needed */
|
/* don't scale up rates, only scale down if needed */
|
||||||
_rate_mult = fminf(1.0f, ((float)_datarate - const_rate) / rate);
|
float bandwidth_mult = fminf(1.0f, ((float)_datarate - const_rate) / rate);
|
||||||
|
|
||||||
|
/* check if we have radio feedback */
|
||||||
|
struct telemetry_status_s &tstatus = get_rx_status();
|
||||||
|
|
||||||
|
bool radio_critical = false;
|
||||||
|
bool radio_found = false;
|
||||||
|
|
||||||
|
/* 2nd pass: Now check hardware limits */
|
||||||
|
if (tstatus.type == TELEMETRY_STATUS_RADIO_TYPE_3DR_RADIO) {
|
||||||
|
|
||||||
|
radio_found = true;
|
||||||
|
|
||||||
|
if (tstatus.txbuf < RADIO_BUFFER_LOW_PERCENTAGE) {
|
||||||
|
radio_critical = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float hardware_mult = _rate_mult;
|
||||||
|
|
||||||
/* scale down if we have a TX err rate suggesting link congestion */
|
/* scale down if we have a TX err rate suggesting link congestion */
|
||||||
if (_rate_txerr > 0.0f) {
|
if (_rate_txerr > 0.0f && !radio_critical) {
|
||||||
_rate_mult = (_rate_tx) / (_rate_tx + _rate_txerr);
|
hardware_mult = (_rate_tx) / (_rate_tx + _rate_txerr);
|
||||||
|
warnx("RTS limiting");
|
||||||
|
} else if (radio_found && tstatus.timestamp != _last_hw_rate_timestamp) {
|
||||||
|
|
||||||
|
if (tstatus.txbuf < RADIO_BUFFER_CRITICAL_LOW_PERCENTAGE) {
|
||||||
|
/* this indicates link congestion, reduce rate by 20% */
|
||||||
|
hardware_mult *= 0.80f;
|
||||||
|
} else if (tstatus.txbuf < RADIO_BUFFER_LOW_PERCENTAGE) {
|
||||||
|
/* this indicates link congestion, reduce rate by 2.5% */
|
||||||
|
hardware_mult *= 0.975f;
|
||||||
|
} else if (tstatus.txbuf > RADIO_BUFFER_HALF_PERCENTAGE) {
|
||||||
|
/* this indicates spare bandwidth, increase by 2.5% */
|
||||||
|
hardware_mult *= 1.025f;
|
||||||
|
/* limit to a max multiplier of 1 */
|
||||||
|
hardware_mult = fminf(1.0f, hardware_mult);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_last_hw_rate_timestamp = tstatus.timestamp;
|
||||||
|
|
||||||
|
/* pick the minimum from bandwidth mult and hardware mult as limit */
|
||||||
|
_rate_mult = fminf(bandwidth_mult, hardware_mult);
|
||||||
|
|
||||||
|
/* ensure the rate multiplier never drops below 5% so that something is always sent */
|
||||||
|
_rate_mult = fmaxf(0.05f, _rate_mult);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
@@ -351,6 +351,7 @@ private:
|
|||||||
int _datarate; ///< data rate for normal streams (attitude, position, etc.)
|
int _datarate; ///< data rate for normal streams (attitude, position, etc.)
|
||||||
int _datarate_events; ///< data rate for params, waypoints, text messages
|
int _datarate_events; ///< data rate for params, waypoints, text messages
|
||||||
float _rate_mult;
|
float _rate_mult;
|
||||||
|
hrt_abstime _last_hw_rate_timestamp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the queue index is not at 0, the queue sending
|
* If the queue index is not at 0, the queue sending
|
||||||
@@ -409,6 +410,10 @@ private:
|
|||||||
|
|
||||||
static unsigned int interval_from_rate(float rate);
|
static unsigned int interval_from_rate(float rate);
|
||||||
|
|
||||||
|
static constexpr unsigned RADIO_BUFFER_CRITICAL_LOW_PERCENTAGE = 25;
|
||||||
|
static constexpr unsigned RADIO_BUFFER_LOW_PERCENTAGE = 35;
|
||||||
|
static constexpr unsigned RADIO_BUFFER_HALF_PERCENTAGE = 50;
|
||||||
|
|
||||||
int configure_stream(const char *stream_name, const float rate);
|
int configure_stream(const char *stream_name, const float rate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user