mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-08 23:38:52 +08:00
Merge branch 'main' into pr-servo-pwm-trim
This commit is contained in:
@@ -54,6 +54,7 @@ jobs:
|
||||
run: |
|
||||
make clean
|
||||
make distclean
|
||||
make submodulesclean
|
||||
|
||||
- name: If it's a PR checkout the base branch
|
||||
if: ${{ github.event.pull_request }}
|
||||
|
||||
@@ -118,7 +118,7 @@ jobs:
|
||||
PX4_HOME_LON: ${{matrix.config.longitude}}
|
||||
PX4_HOME_ALT: ${{matrix.config.altitude}}
|
||||
PX4_CMAKE_BUILD_TYPE: ${{matrix.config.build_type}}
|
||||
run: test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 10 --abort-early --model ${{matrix.config.model}} --upload test/mavsdk_tests/configs/sitl.json --verbose --force-color
|
||||
run: test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 10 --abort-early --model ${{matrix.config.model}} test/mavsdk_tests/configs/sitl.json --verbose --force-color
|
||||
timeout-minutes: 45
|
||||
|
||||
- name: Upload failed logs
|
||||
|
||||
@@ -1656,9 +1656,9 @@ sensor_baro_0['pressure'] = median_filter(sensor_baro_0['pressure'])
|
||||
# fit data
|
||||
median_pressure = np.median(sensor_baro_0['pressure'])
|
||||
if noResample:
|
||||
coef_baro_0_x = np.polyfit(temp_rel,100*(sensor_baro_0['pressure']-median_pressure),5) # convert from hPa to Pa
|
||||
coef_baro_0_x = np.polyfit(temp_rel,(sensor_baro_0['pressure']-median_pressure),5) # pressure in Pascal
|
||||
else:
|
||||
temperature, baro = resampleWithDeltaX(temp_rel,100*(sensor_baro_0['pressure']-median_pressure)) # convert from hPa to Pa
|
||||
temperature, baro = resampleWithDeltaX(temp_rel,(sensor_baro_0['pressure']-median_pressure)) # pressure in Pascal
|
||||
coef_baro_0_x = np.polyfit(temperature,baro,5)
|
||||
|
||||
baro_0_params['TC_B0_X5'] = coef_baro_0_x[0]
|
||||
@@ -1717,9 +1717,9 @@ if num_baros >= 2:
|
||||
# fit data
|
||||
median_pressure = np.median(sensor_baro_1['pressure'])
|
||||
if noResample:
|
||||
coef_baro_1_x = np.polyfit(temp_rel,100*(sensor_baro_1['pressure']-median_pressure),5) # convert from hPa to Pa
|
||||
coef_baro_1_x = np.polyfit(temp_rel,(sensor_baro_1['pressure']-median_pressure),5) # pressure in Pascal
|
||||
else:
|
||||
temperature, baro = resampleWithDeltaX(temp_rel,100*(sensor_baro_1['pressure']-median_pressure)) # convert from hPa to Pa
|
||||
temperature, baro = resampleWithDeltaX(temp_rel,(sensor_baro_1['pressure']-median_pressure)) # pressure in Pascal
|
||||
coef_baro_1_x = np.polyfit(temperature,baro,5)
|
||||
|
||||
baro_1_params['TC_B1_X5'] = coef_baro_1_x[0]
|
||||
@@ -1778,9 +1778,9 @@ if num_baros >= 3:
|
||||
# fit data
|
||||
median_pressure = np.median(sensor_baro_2['pressure'])
|
||||
if noResample:
|
||||
coef_baro_2_x = np.polyfit(temp_rel,100*(sensor_baro_2['pressure']-median_pressure),5) # convert from hPa to Pa
|
||||
coef_baro_2_x = np.polyfit(temp_rel,(sensor_baro_2['pressure']-median_pressure),5) # pressure in Pascal
|
||||
else:
|
||||
temperature, baro = resampleWithDeltaX(temp_rel,100*(sensor_baro_2['pressure']-median_pressure)) # convert from hPa to Pa
|
||||
temperature, baro = resampleWithDeltaX(temp_rel,(sensor_baro_2['pressure']-median_pressure)) # pressure in Pascal
|
||||
coef_baro_2_x = np.polyfit(temperature,baro,5)
|
||||
|
||||
baro_2_params['TC_B2_X5'] = coef_baro_2_x[0]
|
||||
@@ -1838,7 +1838,7 @@ if num_baros >= 4:
|
||||
|
||||
# fit data
|
||||
median_pressure = np.median(sensor_baro_3['pressure'])
|
||||
coef_baro_3_x = np.polyfit(temp_rel,100*(sensor_baro_3['pressure']-median_pressure),5) # convert from hPa to Pa
|
||||
coef_baro_3_x = np.polyfit(temp_rel,(sensor_baro_3['pressure']-median_pressure),5) # pressure in Pascal
|
||||
baro_3_params['TC_B3_X5'] = coef_baro_3_x[0]
|
||||
baro_3_params['TC_B3_X4'] = coef_baro_3_x[1]
|
||||
baro_3_params['TC_B3_X3'] = coef_baro_3_x[2]
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#define GPIO_BTN_SAFETY /* PB15 */ (GPIO_INPUT|GPIO_PULLDOWN|GPIO_PORTB|GPIO_PIN15)
|
||||
|
||||
/* Safety LED */
|
||||
#define GPIO_LED_SAFETY /* PA1 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN1)
|
||||
#define GPIO_LED_SAFETY /* PA1 */ (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN1)
|
||||
|
||||
/* Tone alarm output. */
|
||||
#define TONE_ALARM_TIMER 2 /* timer 2 */
|
||||
|
||||
@@ -14,6 +14,7 @@ CONFIG_COMMON_DISTANCE_SENSOR=y
|
||||
CONFIG_DRIVERS_DSHOT=y
|
||||
CONFIG_DRIVERS_GNSS_SEPTENTRIO=y
|
||||
CONFIG_DRIVERS_GPS=y
|
||||
CONFIG_DRIVERS_PPS_CAPTURE=y
|
||||
CONFIG_DRIVERS_IMU_BOSCH_BMI088=y
|
||||
CONFIG_BMI088_ACCELEROMETER_INT2=y
|
||||
CONFIG_COMMON_LIGHT=y
|
||||
|
||||
@@ -19,6 +19,13 @@ param set-default SDLOG_BACKEND 2
|
||||
# 200kOhm/10kOhm voltage divider on V_BAT
|
||||
param set-default BAT1_V_DIV 21
|
||||
|
||||
# Uncomment to use PWM9 as Analog input
|
||||
# param set-default PWM_MAIN_TIM2 -2
|
||||
|
||||
# Uncomment to use PWM10 as PPS input
|
||||
# param set-default PWM_MAIN_TIM3 -2
|
||||
# param set-default PWM_MAIN_FUNC10 2064
|
||||
|
||||
# Skynode: use the "custom participant", IP=10.41.10.1 config for uxrce_dds_client
|
||||
param set-default UXRCE_DDS_PTCFG 2
|
||||
param set-default UXRCE_DDS_AG_IP 170461697
|
||||
|
||||
@@ -238,9 +238,12 @@ CONFIG_STM32H7_SPI3_DMA_BUFFER=1024
|
||||
CONFIG_STM32H7_SPI4=y
|
||||
CONFIG_STM32H7_SPI4_DMA=y
|
||||
CONFIG_STM32H7_SPI4_DMA_BUFFER=4096
|
||||
CONFIG_STM32H7_TIM12=y
|
||||
CONFIG_STM32H7_TIM1=y
|
||||
CONFIG_STM32H7_TIM2=y
|
||||
CONFIG_STM32H7_TIM3=y
|
||||
CONFIG_STM32H7_TIM4=y
|
||||
CONFIG_STM32H7_TIM5=y
|
||||
CONFIG_STM32H7_TIM8=y
|
||||
CONFIG_STM32H7_UART4=y
|
||||
CONFIG_STM32H7_UART5=y
|
||||
CONFIG_STM32H7_UART7=y
|
||||
|
||||
@@ -135,15 +135,14 @@
|
||||
|
||||
|
||||
/* PWM Timers */
|
||||
#define BOARD_NUM_IO_TIMERS 2
|
||||
#define DIRECT_PWM_OUTPUT_CHANNELS 8
|
||||
/* 3 for PWM outputs, 1 for input capture */
|
||||
#define BOARD_NUM_IO_TIMERS 4
|
||||
/* 9 for PWM outputs, 1 for input capture */
|
||||
#define DIRECT_PWM_OUTPUT_CHANNELS 10
|
||||
|
||||
/* High-resolution timer */
|
||||
#define HRT_TIMER 8 /* use timer8 for the HRT */
|
||||
#define HRT_TIMER_CHANNEL 3 /* use capture/compare channel 3 */
|
||||
|
||||
#define HRT_PPM_CHANNEL /* T8C2 */ 2 /* use capture/compare channel 1 */
|
||||
#define GPIO_PPM_IN /* PC7 */ GPIO_TIM8_CH2IN_1
|
||||
#define HRT_TIMER 4 /* use timer4 for the HRT */
|
||||
#define HRT_TIMER_CHANNEL 1 /* use capture/compare channel 1 */
|
||||
|
||||
/* This board provides a DMA pool and APIs */
|
||||
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
|
||||
|
||||
@@ -44,11 +44,17 @@
|
||||
* TIM3_CH2 T FMU_CH6
|
||||
* TIM3_CH3 T FMU_CH7
|
||||
* TIM3_CH4 T FMU_CH8
|
||||
*
|
||||
* TIM5_CH1 T FMU_CH9
|
||||
*
|
||||
* TIM8_CH2 T FMU_CAP1 < Input Capture
|
||||
*/
|
||||
|
||||
constexpr io_timers_t io_timers[MAX_IO_TIMERS] = {
|
||||
initIOTimer(Timer::Timer1, DMA{DMA::Index1}),
|
||||
initIOTimer(Timer::Timer3, DMA{DMA::Index1}),
|
||||
initIOTimer(Timer::Timer5),
|
||||
initIOTimer(Timer::Timer8),
|
||||
};
|
||||
|
||||
constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = {
|
||||
@@ -60,6 +66,8 @@ constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = {
|
||||
initIOTimerChannel(io_timers, {Timer::Timer3, Timer::Channel2}, {GPIO::PortB, GPIO::Pin5}),
|
||||
initIOTimerChannel(io_timers, {Timer::Timer3, Timer::Channel3}, {GPIO::PortB, GPIO::Pin0}),
|
||||
initIOTimerChannel(io_timers, {Timer::Timer3, Timer::Channel4}, {GPIO::PortC, GPIO::Pin9}),
|
||||
initIOTimerChannel(io_timers, {Timer::Timer5, Timer::Channel1}, {GPIO::PortA, GPIO::Pin0}),
|
||||
initIOTimerChannelCapture(io_timers, {Timer::Timer8, Timer::Channel2}, {GPIO::PortC, GPIO::Pin7}),
|
||||
};
|
||||
|
||||
constexpr io_timers_channel_mapping_t io_timers_channel_mapping =
|
||||
|
||||
@@ -20,6 +20,7 @@ CONFIG_DRIVERS_DSHOT=y
|
||||
CONFIG_DRIVERS_GNSS_SEPTENTRIO=y
|
||||
CONFIG_DRIVERS_GPIO_MCP23009=y
|
||||
CONFIG_DRIVERS_GPS=y
|
||||
CONFIG_DRIVERS_PPS_CAPTURE=y
|
||||
CONFIG_DRIVERS_IMU_BOSCH_BMI088=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM20602=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM42688P=y
|
||||
|
||||
@@ -471,7 +471,7 @@
|
||||
#define PX4_I2C_BUS_MTD 4,5
|
||||
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 5
|
||||
#define BOARD_NUM_IO_TIMERS 4
|
||||
|
||||
/* No CDCACM driver for this board, so this is manually defined for version.c
|
||||
* so that the px4_board_version reports the correct board id to the companion */
|
||||
|
||||
@@ -50,8 +50,6 @@
|
||||
* TIM1_CH3 T SPI2_DRDY2_ISM330_INT2 < Capture or GPIO INT
|
||||
* TIM1_CH1 T SPIX_SYNC > Pulse or GPIO strobe
|
||||
*
|
||||
* TIM2_CH3 T HEATER > PWM OUT or GPIO
|
||||
*
|
||||
* TIM14_CH1 T BUZZER_1 - Driven by other driver
|
||||
* TIM8_CH1_IN T FMU_PPM_INPUT - Sampled byt HRT by other driver
|
||||
*/
|
||||
@@ -61,7 +59,6 @@ constexpr io_timers_t io_timers[MAX_IO_TIMERS] = {
|
||||
initIOTimer(Timer::Timer4, DMA{DMA::Index1}),
|
||||
initIOTimer(Timer::Timer12),
|
||||
initIOTimer(Timer::Timer1),
|
||||
initIOTimer(Timer::Timer2),
|
||||
};
|
||||
|
||||
constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = {
|
||||
|
||||
@@ -20,7 +20,6 @@ CONFIG_DRIVERS_HEATER=y
|
||||
CONFIG_DRIVERS_IMU_BOSCH_BMI055=y
|
||||
CONFIG_DRIVERS_IMU_BOSCH_BMI088=y
|
||||
CONFIG_DRIVERS_IMU_INVENSENSE_ICM42688P=y
|
||||
CONFIG_COMMON_INS=y
|
||||
CONFIG_COMMON_LIGHT=y
|
||||
CONFIG_COMMON_MAGNETOMETER=y
|
||||
CONFIG_COMMON_OPTICAL_FLOW=y
|
||||
|
||||
@@ -85,7 +85,7 @@ Flight controllers that have bootloader PX4-Autopilot `make` targets, can build
|
||||
The list of controllers for which this applies can be obtained by running the following `make` command, and noting the `make` targets that end in `_bootloader`
|
||||
|
||||
```
|
||||
$make list_config_targets
|
||||
$ make list_config_targets
|
||||
|
||||
...
|
||||
cuav_nora_bootloader
|
||||
|
||||
@@ -332,14 +332,13 @@ int MS5837::_collect()
|
||||
|
||||
} else {
|
||||
/* pressure calculation, result in Pa */
|
||||
int32_t P = (((raw * _SENS) >> 21) - _OFF) >> 13;
|
||||
|
||||
int32_t pressure_pascal = ((((raw * _SENS) >> 21) - _OFF) >> 13) * 10;
|
||||
|
||||
// publish
|
||||
sensor_baro_s sensor_baro{};
|
||||
sensor_baro.timestamp_sample = timestamp_sample;
|
||||
sensor_baro.device_id = get_device_id();
|
||||
sensor_baro.pressure = P;
|
||||
sensor_baro.pressure = pressure_pascal;
|
||||
sensor_baro.temperature = _last_temperature;
|
||||
sensor_baro.error_count = perf_event_count(_comms_errors);
|
||||
sensor_baro.timestamp = hrt_absolute_time();
|
||||
|
||||
+1
-1
Submodule src/drivers/gps/devices updated: 0b9695881b...caf5158061
+17
-14
@@ -108,26 +108,29 @@ void InternalCombustionEngineControl::Run()
|
||||
|
||||
const hrt_abstime now = hrt_absolute_time();
|
||||
|
||||
UserOnOffRequest user_request = UserOnOffRequest::Off;
|
||||
|
||||
switch (static_cast<ICESource>(_param_ice_on_source.get())) {
|
||||
case ICESource::ArmingState: {
|
||||
if (vehicle_status.arming_state == vehicle_status_s::ARMING_STATE_ARMED) {
|
||||
user_request = UserOnOffRequest::On;
|
||||
}
|
||||
_user_request = vehicle_status.arming_state == vehicle_status_s::ARMING_STATE_ARMED ? UserOnOffRequest::On :
|
||||
UserOnOffRequest::Off;
|
||||
}
|
||||
break;
|
||||
|
||||
case ICESource::Aux1: {
|
||||
if (manual_control_setpoint.aux1 > 0.5f) {
|
||||
user_request = UserOnOffRequest::On;
|
||||
_user_request = UserOnOffRequest::On;
|
||||
|
||||
} else if (manual_control_setpoint.aux1 < -0.5f) {
|
||||
_user_request = UserOnOffRequest::Off;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ICESource::Aux2: {
|
||||
if (manual_control_setpoint.aux2 > 0.5f) {
|
||||
user_request = UserOnOffRequest::On;
|
||||
_user_request = UserOnOffRequest::On;
|
||||
|
||||
} else if (manual_control_setpoint.aux2 < -0.5f) {
|
||||
_user_request = UserOnOffRequest::Off;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -137,7 +140,7 @@ void InternalCombustionEngineControl::Run()
|
||||
case State::Stopped: {
|
||||
controlEngineStop();
|
||||
|
||||
if (user_request == UserOnOffRequest::On && !maximumAttemptsReached()) {
|
||||
if (_user_request == UserOnOffRequest::On && !maximumAttemptsReached()) {
|
||||
|
||||
_state = State::Starting;
|
||||
_state_start_time = now;
|
||||
@@ -148,7 +151,7 @@ void InternalCombustionEngineControl::Run()
|
||||
|
||||
case State::Starting: {
|
||||
|
||||
if (user_request == UserOnOffRequest::Off) {
|
||||
if (_user_request == UserOnOffRequest::Off) {
|
||||
_state = State::Stopped;
|
||||
_starting_retry_cycle = 0;
|
||||
PX4_INFO("ICE: Stopped");
|
||||
@@ -196,7 +199,7 @@ void InternalCombustionEngineControl::Run()
|
||||
case State::Running: {
|
||||
controlEngineRunning(throttle_in);
|
||||
|
||||
if (user_request == UserOnOffRequest::Off) {
|
||||
if (_user_request == UserOnOffRequest::Off) {
|
||||
_state = State::Stopped;
|
||||
_starting_retry_cycle = 0;
|
||||
PX4_INFO("ICE: Stopped");
|
||||
@@ -217,7 +220,7 @@ void InternalCombustionEngineControl::Run()
|
||||
|
||||
case State::Fault: {
|
||||
|
||||
if (user_request == UserOnOffRequest::Off) {
|
||||
if (_user_request == UserOnOffRequest::Off) {
|
||||
_state = State::Stopped;
|
||||
_starting_retry_cycle = 0;
|
||||
PX4_INFO("ICE: Stopped");
|
||||
@@ -243,10 +246,10 @@ void InternalCombustionEngineControl::Run()
|
||||
_throttle_control_slew_rate.setForcedValue(0.f);
|
||||
}
|
||||
|
||||
publishControl(now, user_request);
|
||||
publishControl(now);
|
||||
}
|
||||
|
||||
void InternalCombustionEngineControl::publishControl(const hrt_abstime now, const UserOnOffRequest user_request)
|
||||
void InternalCombustionEngineControl::publishControl(const hrt_abstime now)
|
||||
{
|
||||
internal_combustion_engine_control_s ice_control{};
|
||||
ice_control.timestamp = now;
|
||||
@@ -254,7 +257,7 @@ void InternalCombustionEngineControl::publishControl(const hrt_abstime now, cons
|
||||
ice_control.ignition_on = _ignition_on;
|
||||
ice_control.starter_engine_control = _starter_engine_control;
|
||||
ice_control.throttle_control = _throttle_control;
|
||||
ice_control.user_request = static_cast<uint8_t>(user_request);
|
||||
ice_control.user_request = static_cast<uint8_t>(_user_request);
|
||||
_internal_combustion_engine_control_pub.publish(ice_control);
|
||||
|
||||
internal_combustion_engine_status_s ice_status;
|
||||
|
||||
@@ -102,7 +102,7 @@ private:
|
||||
enum class UserOnOffRequest {
|
||||
Off,
|
||||
On
|
||||
};
|
||||
} _user_request{UserOnOffRequest::Off};
|
||||
|
||||
enum class ICESource {
|
||||
ArmingState,
|
||||
@@ -126,7 +126,7 @@ private:
|
||||
void controlEngineStartup(const hrt_abstime now);
|
||||
void controlEngineFault();
|
||||
bool maximumAttemptsReached();
|
||||
void publishControl(const hrt_abstime now, const UserOnOffRequest user_request);
|
||||
void publishControl(const hrt_abstime now);
|
||||
|
||||
// Starting state specifics
|
||||
static constexpr float DELAY_BEFORE_RESTARTING{1.f};
|
||||
|
||||
@@ -155,7 +155,7 @@ void SensorBaroSim::Run()
|
||||
_baro_drift_pa += _baro_drift_pa_per_sec * dt;
|
||||
const float absolute_pressure_noisy = absolute_pressure + abs_pressure_noise + _baro_drift_pa;
|
||||
|
||||
// convert to hPa
|
||||
// Apply pressure offset
|
||||
float pressure = absolute_pressure_noisy + _sim_baro_off_p.get();
|
||||
|
||||
// calculate temperature in Celsius
|
||||
|
||||
@@ -96,7 +96,7 @@ int TemperatureCalibrationBaro::update_sensor_instance(PerSensorData &data, int
|
||||
|
||||
data.device_id = baro_data.device_id;
|
||||
|
||||
data.sensor_sample_filt[0] = 100.0f * baro_data.pressure; // convert from hPA to Pa
|
||||
data.sensor_sample_filt[0] = baro_data.pressure;
|
||||
data.sensor_sample_filt[1] = baro_data.temperature;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user