mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-22 01:10:35 +08:00
Merge branch 'master' of https://github.com/PX4/Firmware into px4flow_integral_i2c
This commit is contained in:
Regular → Executable
+2
-2
@@ -154,8 +154,8 @@ class SDLog2Parser:
|
|||||||
first_data_msg = False
|
first_data_msg = False
|
||||||
self.__parseMsg(msg_descr)
|
self.__parseMsg(msg_descr)
|
||||||
bytes_read += self.__ptr
|
bytes_read += self.__ptr
|
||||||
if not self.__debug_out and self.__time_msg != None and self.__csv_updated:
|
if not self.__debug_out and self.__time_msg != None and self.__csv_updated:
|
||||||
self.__printCSVRow()
|
self.__printCSVRow()
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
def __bytesLeft(self):
|
def __bytesLeft(self):
|
||||||
|
|||||||
@@ -213,6 +213,9 @@ ORB_DECLARE(output_pwm);
|
|||||||
/** make failsafe non-recoverable (termination) if it occurs */
|
/** make failsafe non-recoverable (termination) if it occurs */
|
||||||
#define PWM_SERVO_SET_TERMINATION_FAILSAFE _IOC(_PWM_SERVO_BASE, 25)
|
#define PWM_SERVO_SET_TERMINATION_FAILSAFE _IOC(_PWM_SERVO_BASE, 25)
|
||||||
|
|
||||||
|
/** force safety switch on (to enable use of safety switch) */
|
||||||
|
#define PWM_SERVO_SET_FORCE_SAFETY_ON _IOC(_PWM_SERVO_BASE, 26)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -229,6 +229,7 @@ private:
|
|||||||
perf_counter_t _gyro_reads;
|
perf_counter_t _gyro_reads;
|
||||||
perf_counter_t _sample_perf;
|
perf_counter_t _sample_perf;
|
||||||
perf_counter_t _bad_transfers;
|
perf_counter_t _bad_transfers;
|
||||||
|
perf_counter_t _good_transfers;
|
||||||
|
|
||||||
math::LowPassFilter2p _accel_filter_x;
|
math::LowPassFilter2p _accel_filter_x;
|
||||||
math::LowPassFilter2p _accel_filter_y;
|
math::LowPassFilter2p _accel_filter_y;
|
||||||
@@ -404,6 +405,7 @@ MPU6000::MPU6000(int bus, const char *path_accel, const char *path_gyro, spi_dev
|
|||||||
_gyro_reads(perf_alloc(PC_COUNT, "mpu6000_gyro_read")),
|
_gyro_reads(perf_alloc(PC_COUNT, "mpu6000_gyro_read")),
|
||||||
_sample_perf(perf_alloc(PC_ELAPSED, "mpu6000_read")),
|
_sample_perf(perf_alloc(PC_ELAPSED, "mpu6000_read")),
|
||||||
_bad_transfers(perf_alloc(PC_COUNT, "mpu6000_bad_transfers")),
|
_bad_transfers(perf_alloc(PC_COUNT, "mpu6000_bad_transfers")),
|
||||||
|
_good_transfers(perf_alloc(PC_COUNT, "mpu6000_good_transfers")),
|
||||||
_accel_filter_x(MPU6000_ACCEL_DEFAULT_RATE, MPU6000_ACCEL_DEFAULT_DRIVER_FILTER_FREQ),
|
_accel_filter_x(MPU6000_ACCEL_DEFAULT_RATE, MPU6000_ACCEL_DEFAULT_DRIVER_FILTER_FREQ),
|
||||||
_accel_filter_y(MPU6000_ACCEL_DEFAULT_RATE, MPU6000_ACCEL_DEFAULT_DRIVER_FILTER_FREQ),
|
_accel_filter_y(MPU6000_ACCEL_DEFAULT_RATE, MPU6000_ACCEL_DEFAULT_DRIVER_FILTER_FREQ),
|
||||||
_accel_filter_z(MPU6000_ACCEL_DEFAULT_RATE, MPU6000_ACCEL_DEFAULT_DRIVER_FILTER_FREQ),
|
_accel_filter_z(MPU6000_ACCEL_DEFAULT_RATE, MPU6000_ACCEL_DEFAULT_DRIVER_FILTER_FREQ),
|
||||||
@@ -456,6 +458,7 @@ MPU6000::~MPU6000()
|
|||||||
perf_free(_accel_reads);
|
perf_free(_accel_reads);
|
||||||
perf_free(_gyro_reads);
|
perf_free(_gyro_reads);
|
||||||
perf_free(_bad_transfers);
|
perf_free(_bad_transfers);
|
||||||
|
perf_free(_good_transfers);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -1279,8 +1282,14 @@ MPU6000::measure()
|
|||||||
// all zero data - probably a SPI bus error
|
// all zero data - probably a SPI bus error
|
||||||
perf_count(_bad_transfers);
|
perf_count(_bad_transfers);
|
||||||
perf_end(_sample_perf);
|
perf_end(_sample_perf);
|
||||||
|
// note that we don't call reset() here as a reset()
|
||||||
|
// costs 20ms with interrupts disabled. That means if
|
||||||
|
// the mpu6k does go bad it would cause a FMU failure,
|
||||||
|
// regardless of whether another sensor is available,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
perf_count(_good_transfers);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1399,6 +1408,8 @@ MPU6000::print_info()
|
|||||||
perf_print_counter(_sample_perf);
|
perf_print_counter(_sample_perf);
|
||||||
perf_print_counter(_accel_reads);
|
perf_print_counter(_accel_reads);
|
||||||
perf_print_counter(_gyro_reads);
|
perf_print_counter(_gyro_reads);
|
||||||
|
perf_print_counter(_bad_transfers);
|
||||||
|
perf_print_counter(_good_transfers);
|
||||||
_accel_reports->print_info("accel queue");
|
_accel_reports->print_info("accel queue");
|
||||||
_gyro_reports->print_info("gyro queue");
|
_gyro_reports->print_info("gyro queue");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -829,6 +829,7 @@ PX4FMU::pwm_ioctl(file *filp, int cmd, unsigned long arg)
|
|||||||
case PWM_SERVO_SET_ARM_OK:
|
case PWM_SERVO_SET_ARM_OK:
|
||||||
case PWM_SERVO_CLEAR_ARM_OK:
|
case PWM_SERVO_CLEAR_ARM_OK:
|
||||||
case PWM_SERVO_SET_FORCE_SAFETY_OFF:
|
case PWM_SERVO_SET_FORCE_SAFETY_OFF:
|
||||||
|
case PWM_SERVO_SET_FORCE_SAFETY_ON:
|
||||||
// these are no-ops, as no safety switch
|
// these are no-ops, as no safety switch
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -2278,6 +2278,11 @@ PX4IO::ioctl(file * filep, int cmd, unsigned long arg)
|
|||||||
ret = io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_FORCE_SAFETY_OFF, PX4IO_FORCE_SAFETY_MAGIC);
|
ret = io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_FORCE_SAFETY_OFF, PX4IO_FORCE_SAFETY_MAGIC);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PWM_SERVO_SET_FORCE_SAFETY_ON:
|
||||||
|
/* force safety switch on */
|
||||||
|
ret = io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_FORCE_SAFETY_ON, PX4IO_FORCE_SAFETY_MAGIC);
|
||||||
|
break;
|
||||||
|
|
||||||
case PWM_SERVO_SET_FORCE_FAILSAFE:
|
case PWM_SERVO_SET_FORCE_FAILSAFE:
|
||||||
/* force failsafe mode instantly */
|
/* force failsafe mode instantly */
|
||||||
if (arg == 0) {
|
if (arg == 0) {
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ void TECS::_update_throttle(float throttle_cruise, const math::Matrix<3,3> &rotM
|
|||||||
// Calculate throttle demand
|
// Calculate throttle demand
|
||||||
// If underspeed condition is set, then demand full throttle
|
// If underspeed condition is set, then demand full throttle
|
||||||
if (_underspeed) {
|
if (_underspeed) {
|
||||||
_throttle_dem_unc = 1.0f;
|
_throttle_dem = 1.0f;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Calculate gain scaler from specific energy error to throttle
|
// Calculate gain scaler from specific energy error to throttle
|
||||||
@@ -363,10 +363,10 @@ void TECS::_update_throttle(float throttle_cruise, const math::Matrix<3,3> &rotM
|
|||||||
} else {
|
} else {
|
||||||
_throttle_dem = ff_throttle;
|
_throttle_dem = ff_throttle;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Constrain throttle demand
|
// Constrain throttle demand
|
||||||
_throttle_dem = constrain(_throttle_dem, _THRminf, _THRmaxf);
|
_throttle_dem = constrain(_throttle_dem, _THRminf, _THRmaxf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TECS::_detect_bad_descent(void)
|
void TECS::_detect_bad_descent(void)
|
||||||
|
|||||||
@@ -345,9 +345,6 @@ private:
|
|||||||
// climbout mode
|
// climbout mode
|
||||||
bool _climbOutDem;
|
bool _climbOutDem;
|
||||||
|
|
||||||
// throttle demand before limiting
|
|
||||||
float _throttle_dem_unc;
|
|
||||||
|
|
||||||
// pitch demand before limiting
|
// pitch demand before limiting
|
||||||
float _pitch_dem_unc;
|
float _pitch_dem_unc;
|
||||||
|
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ int commander_main(int argc, char *argv[])
|
|||||||
daemon_task = task_spawn_cmd("commander",
|
daemon_task = task_spawn_cmd("commander",
|
||||||
SCHED_DEFAULT,
|
SCHED_DEFAULT,
|
||||||
SCHED_PRIORITY_MAX - 40,
|
SCHED_PRIORITY_MAX - 40,
|
||||||
2950,
|
3200,
|
||||||
commander_thread_main,
|
commander_thread_main,
|
||||||
(argv) ? (const char **)&argv[2] : (const char **)NULL);
|
(argv) ? (const char **)&argv[2] : (const char **)NULL);
|
||||||
|
|
||||||
|
|||||||
@@ -763,7 +763,7 @@ Mavlink::send_message(const uint8_t msgid, const void *msg)
|
|||||||
_last_write_try_time = hrt_absolute_time();
|
_last_write_try_time = hrt_absolute_time();
|
||||||
|
|
||||||
/* check if there is space in the buffer, let it overflow else */
|
/* check if there is space in the buffer, let it overflow else */
|
||||||
if (buf_free < TX_BUFFER_GAP) {
|
if ((buf_free < TX_BUFFER_GAP) || (buf_free < packet_len)) {
|
||||||
/* no enough space in buffer to send */
|
/* no enough space in buffer to send */
|
||||||
count_txerr();
|
count_txerr();
|
||||||
count_txerrbytes(packet_len);
|
count_txerrbytes(packet_len);
|
||||||
|
|||||||
@@ -221,6 +221,7 @@ enum { /* DSM bind states */
|
|||||||
hence index 12 can safely be used. */
|
hence index 12 can safely be used. */
|
||||||
#define PX4IO_P_SETUP_RC_THR_FAILSAFE_US 13 /**< the throttle failsafe pulse length in microseconds */
|
#define PX4IO_P_SETUP_RC_THR_FAILSAFE_US 13 /**< the throttle failsafe pulse length in microseconds */
|
||||||
|
|
||||||
|
#define PX4IO_P_SETUP_FORCE_SAFETY_ON 14 /* force safety switch into 'disarmed' (PWM disabled state) */
|
||||||
#define PX4IO_FORCE_SAFETY_MAGIC 22027 /* required argument for force safety (random) */
|
#define PX4IO_FORCE_SAFETY_MAGIC 22027 /* required argument for force safety (random) */
|
||||||
|
|
||||||
/* autopilot control values, -10000..10000 */
|
/* autopilot control values, -10000..10000 */
|
||||||
|
|||||||
@@ -603,6 +603,12 @@ registers_set_one(uint8_t page, uint8_t offset, uint16_t value)
|
|||||||
dsm_bind(value & 0x0f, (value >> 4) & 0xF);
|
dsm_bind(value & 0x0f, (value >> 4) & 0xF);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PX4IO_P_SETUP_FORCE_SAFETY_ON:
|
||||||
|
if (value == PX4IO_FORCE_SAFETY_MAGIC) {
|
||||||
|
r_status_flags &= ~PX4IO_P_STATUS_FLAGS_SAFETY_OFF;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case PX4IO_P_SETUP_FORCE_SAFETY_OFF:
|
case PX4IO_P_SETUP_FORCE_SAFETY_OFF:
|
||||||
if (value == PX4IO_FORCE_SAFETY_MAGIC) {
|
if (value == PX4IO_FORCE_SAFETY_MAGIC) {
|
||||||
r_status_flags |= PX4IO_P_STATUS_FLAGS_SAFETY_OFF;
|
r_status_flags |= PX4IO_P_STATUS_FLAGS_SAFETY_OFF;
|
||||||
|
|||||||
Reference in New Issue
Block a user