Compare commits

...

10 Commits

Author SHA1 Message Date
Christian Rauch 437b6b9844 remove unused debug.h 2023-08-14 11:03:24 -04:00
Christian Rauch 43ec73165f BMI0xx: remove unused board_dma_alloc.h 2023-08-14 11:03:24 -04:00
Christian Rauch ecbbaeb457 ADIS16497: replace NuttX specific up_udelay with HAL version px4_udelay 2023-08-14 11:03:24 -04:00
Christian Rauch 345d814ca4 enable common barometer, IMU and magnetometer 2023-08-14 11:03:24 -04:00
Christian Rauch c2b10ced8d linux_pwm_out must link mixer_module 2023-08-14 10:52:37 -04:00
Christian Rauch 2bcb3ea3f7 skip SSH key check for simpler builds in the Docker container 2023-08-14 10:50:28 -04:00
bresch dcb4c182fe ekf2: stop GNSS fusion when fix is loss 2023-07-21 10:21:57 +02:00
Matthias Grob 5736a31a67 rc.interface: explicitly save empty ESC mask 2023-07-13 16:27:38 +02:00
Mathieu Bresciani cc26cf4121 mc_pos_control: fix potential thrust spike on hover thrust change
Co-authored-by: Josh Henderson <hendjoshsr71@gmail.com>
Co-authored-by: Matthias Grob <maetugr@gmail.com>
2023-06-16 15:52:52 +02:00
Beat Küng 504d951c75 fix kconfig: rename LINUX to LINUX_TARGET
LINUX is defined by cmake >= 3.25:
https://cmake.org/cmake/help/latest/variable/LINUX.html
2023-04-21 07:42:20 +02:00
23 changed files with 61 additions and 39 deletions
+2 -2
View File
@@ -37,8 +37,8 @@ menu "Toolchain"
help
forces nolockstep behaviour, despite REPLAY env variable
config BOARD_LINUX
bool "Linux OS"
config BOARD_LINUX_TARGET
bool "Linux OS Target"
depends on PLATFORM_POSIX
help
Board Platform is running the Linux operating system
+6 -2
View File
@@ -17,17 +17,21 @@ set OUTPUT_DEV none
set OUTPUT_AUX_DEV /dev/pwm_output1
set OUTPUT_EXTRA_DEV /dev/pwm_output0
# set these before starting the modules
# set ESC mask before starting the modules
# setting the numeric parameter to "none" would make the startup script fail
if [ $PWM_AUX_OUT != none ]
then
param set PWM_AUX_OUT ${PWM_AUX_OUT}
else
param set PWM_AUX_OUT 0
fi
if [ $PWM_OUT != none ]
then
param set PWM_MAIN_OUT ${PWM_OUT}
else
param set PWM_AUX_OUT 0
fi
#
+1 -1
View File
@@ -1,5 +1,5 @@
CONFIG_PLATFORM_POSIX=y
CONFIG_BOARD_LINUX=y
CONFIG_BOARD_LINUX_TARGET=y
CONFIG_BOARD_TOOLCHAIN="arm-linux-gnueabihf"
CONFIG_BOARD_ARCHITECTURE="cortex-a8"
CONFIG_BOARD_TESTING=y
+1 -1
View File
@@ -1,5 +1,5 @@
CONFIG_PLATFORM_POSIX=y
CONFIG_BOARD_LINUX=y
CONFIG_BOARD_LINUX_TARGET=y
CONFIG_BOARD_TOOLCHAIN="arm-linux-gnueabihf"
CONFIG_BOARD_ARCHITECTURE="cortex-a53"
CONFIG_BOARD_TESTING=y
+1 -1
View File
@@ -38,7 +38,7 @@ else()
endif()
add_custom_target(upload
COMMAND rsync -arh --progress
COMMAND rsync -arh --progress -e "ssh -o StrictHostKeyChecking=no"
${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${PX4_SOURCE_DIR}/posix-configs/rpi/*.config ${PX4_BINARY_DIR}/etc # source
pi@${AUTOPILOT_HOST}:/home/pi/px4 # destination
DEPENDS px4
+4 -4
View File
@@ -1,18 +1,18 @@
CONFIG_PLATFORM_POSIX=y
CONFIG_BOARD_LINUX=y
CONFIG_BOARD_LINUX_TARGET=y
CONFIG_BOARD_TOOLCHAIN="arm-linux-gnueabihf"
CONFIG_BOARD_ARCHITECTURE="cortex-a53"
CONFIG_BOARD_TESTING=y
CONFIG_DRIVERS_ADC_ADS1115=y
CONFIG_DRIVERS_BAROMETER_MS5611=y
CONFIG_COMMON_BAROMETERS=y
CONFIG_DRIVERS_BATT_SMBUS=y
CONFIG_DRIVERS_CAMERA_TRIGGER=y
CONFIG_COMMON_DIFFERENTIAL_PRESSURE=y
CONFIG_COMMON_DISTANCE_SENSOR=y
CONFIG_DRIVERS_GPS=y
CONFIG_COMMON_IMU=y
CONFIG_DRIVERS_IMU_INVENSENSE_ICM20948=y
CONFIG_DRIVERS_IMU_INVENSENSE_MPU9250=y
CONFIG_DRIVERS_MAGNETOMETER_HMC5883=y
CONFIG_COMMON_MAGNETOMETER=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_PWM_OUT_SIM=y
CONFIG_DRIVERS_RC_INPUT=y
+1 -1
View File
@@ -1,5 +1,5 @@
CONFIG_PLATFORM_POSIX=y
CONFIG_BOARD_LINUX=y
CONFIG_BOARD_LINUX_TARGET=y
CONFIG_BOARD_TOOLCHAIN="arm-linux-gnueabihf"
CONFIG_BOARD_ARCHITECTURE="cortex-a53"
CONFIG_BOARD_TESTING=y
+1 -1
View File
@@ -341,7 +341,7 @@ if(EXISTS ${BOARD_DEFCONFIG})
add_definitions( ${COMPILE_DEFINITIONS})
endif()
if(LINUX)
if(LINUX_TARGET)
add_definitions( "-D__PX4_LINUX" )
endif()
+4 -4
View File
@@ -342,9 +342,9 @@ ADIS16497::read_reg16(uint8_t reg)
cmd[0] = ((reg | DIR_READ) << 8) & 0xff00;
transferhword(cmd, nullptr, 1);
up_udelay(T_STALL);
px4_udelay(T_STALL);
transferhword(nullptr, cmd, 1);
up_udelay(T_STALL);
px4_udelay(T_STALL);
return cmd[0];
}
@@ -367,9 +367,9 @@ ADIS16497::write_reg16(uint8_t reg, uint16_t value)
cmd[1] = (((reg + 0x1) | DIR_WRITE) << 8) | ((0xff00 & value) >> 8);
transferhword(cmd, nullptr, 1);
up_udelay(T_STALL);
px4_udelay(T_STALL);
transferhword(cmd + 1, nullptr, 1);
up_udelay(T_STALL);
px4_udelay(T_STALL);
}
void
@@ -33,8 +33,6 @@
#include "BMI055_Gyroscope.hpp"
#include <px4_platform/board_dma_alloc.h>
using namespace time_literals;
namespace Bosch::BMI055::Gyroscope
@@ -33,8 +33,6 @@
#include "BMI088_Gyroscope.hpp"
#include <px4_platform/board_dma_alloc.h>
using namespace time_literals;
namespace Bosch::BMI088::Gyroscope
+1 -1
View File
@@ -40,5 +40,5 @@ px4_add_module(
MODULE_CONFIG
module.yaml
DEPENDS
mixer_module
)
@@ -40,7 +40,6 @@
#include <px4_platform_common/px4_config.h>
#include <assert.h>
#include <debug.h>
#include <errno.h>
#include <stdint.h>
#include <stdbool.h>
@@ -40,7 +40,6 @@
#include <px4_platform_common/px4_config.h>
#include <assert.h>
#include <debug.h>
#include <errno.h>
#include <stdint.h>
#include <stdbool.h>
@@ -40,7 +40,6 @@
#include <px4_platform_common/px4_config.h>
#include <assert.h>
#include <debug.h>
#include <errno.h>
#include <stdint.h>
#include <stdbool.h>
@@ -40,7 +40,6 @@
#include <px4_platform_common/px4_config.h>
#include <assert.h>
#include <debug.h>
#include <errno.h>
#include <stdint.h>
#include <stdbool.h>
@@ -40,7 +40,6 @@
#include <px4_platform_common/px4_config.h>
#include <assert.h>
#include <debug.h>
#include <errno.h>
#include <stdint.h>
#include <stdbool.h>
@@ -40,7 +40,6 @@
#include <px4_platform_common/px4_config.h>
#include <assert.h>
#include <debug.h>
#include <errno.h>
#include <stdint.h>
#include <stdbool.h>
@@ -148,6 +148,11 @@ void EstimatorInterface::setGpsData(const gps_message &gps)
}
if ((gps.time_usec - _time_last_gps) > _min_obs_interval_us) {
if (!gps.vel_ned_valid || (gps.fix_type == 0)) {
return;
}
_time_last_gps = gps.time_usec;
gpsSample gps_sample_new;
+19
View File
@@ -79,6 +79,7 @@ public:
TEST_F(EkfGpsTest, gpsTimeout)
{
// GIVEN:EKF that fuses GPS
EXPECT_TRUE(_ekf_wrapper.isIntendingGpsFusion());
// WHEN: setting the PDOP to high
_sensor_simulator._gps.setNumberOfSatellites(3);
@@ -90,6 +91,24 @@ TEST_F(EkfGpsTest, gpsTimeout)
EXPECT_TRUE(_ekf_wrapper.isIntendingGpsFusion());
}
TEST_F(EkfGpsTest, gpsFixLoss)
{
// GIVEN:EKF that fuses GPS
EXPECT_TRUE(_ekf_wrapper.isIntendingGpsFusion());
// WHEN: the fix is loss
_sensor_simulator._gps.setFixType(0);
// THEN: after dead-reconing for a couple of seconds, the local position gets invalidated
_sensor_simulator.runSeconds(5);
EXPECT_TRUE(_ekf->control_status_flags().inertial_dead_reckoning);
EXPECT_FALSE(_ekf->local_position_is_valid());
// The control logic takes a bit more time to deactivate the GNSS fusion completely
_sensor_simulator.runSeconds(5);
EXPECT_FALSE(_ekf_wrapper.isIntendingGpsFusion());
}
TEST_F(EkfGpsTest, resetToGpsVelocity)
{
ResetLoggingChecker reset_logging_checker(_ekf);
@@ -443,7 +443,6 @@ void MulticopterPositionControl::Run()
// Allow ramping from zero thrust on takeoff
const float minimum_thrust = flying ? _param_mpc_thr_min.get() : 0.f;
_control.setThrustLimits(minimum_thrust, _param_mpc_thr_max.get());
_control.setVelocityLimits(
@@ -79,10 +79,11 @@ void PositionControl::updateHoverThrust(const float hover_thrust_new)
// T' = T => a_sp' * Th' / g - Th' = a_sp * Th / g - Th
// so a_sp' = (a_sp - g) * Th / Th' + g
// we can then add a_sp' - a_sp to the current integrator to absorb the effect of changing Th by Th'
if (hover_thrust_new > FLT_EPSILON) {
_vel_int(2) += (_acc_sp(2) - CONSTANTS_ONE_G) * _hover_thrust / hover_thrust_new + CONSTANTS_ONE_G - _acc_sp(2);
setHoverThrust(hover_thrust_new);
}
const float previous_hover_thrust = _hover_thrust;
setHoverThrust(hover_thrust_new);
_vel_int(2) += (_acc_sp(2) - CONSTANTS_ONE_G) * previous_hover_thrust / _hover_thrust
+ CONSTANTS_ONE_G - _acc_sp(2);
}
void PositionControl::setState(const PositionControlStates &states)
@@ -139,6 +140,9 @@ void PositionControl::_positionControl()
void PositionControl::_velocityControl(const float dt)
{
// Constrain vertical velocity integral
_vel_int(2) = math::constrain(_vel_int(2), -CONSTANTS_ONE_G, CONSTANTS_ONE_G);
// PID velocity control
Vector3f vel_error = _vel_sp - _vel;
Vector3f acc_sp_velocity = vel_error.emult(_gain_vel_p) + _vel_int - _vel_dot.emult(_gain_vel_d);
@@ -189,9 +193,6 @@ void PositionControl::_velocityControl(const float dt)
ControlMath::setZeroIfNanVector3f(vel_error);
// Update integral part of velocity control
_vel_int += vel_error.emult(_gain_vel_i) * dt;
// limit thrust integral
_vel_int(2) = math::min(fabsf(_vel_int(2)), CONSTANTS_ONE_G) * sign(_vel_int(2));
}
void PositionControl::_accelerationControl()
@@ -121,9 +121,9 @@ public:
/**
* Set the normalized hover thrust
* @param thrust [0.1, 0.9] with which the vehicle hovers not acelerating down or up with level orientation
* @param hover_thrust [HOVER_THRUST_MIN, HOVER_THRUST_MAX] with which the vehicle hovers not accelerating down or up with level orientation
*/
void setHoverThrust(const float hover_thrust) { _hover_thrust = math::constrain(hover_thrust, 0.1f, 0.9f); }
void setHoverThrust(const float hover_thrust) { _hover_thrust = math::constrain(hover_thrust, HOVER_THRUST_MIN, HOVER_THRUST_MAX); }
/**
* Update the hover thrust without immediately affecting the output
@@ -179,6 +179,10 @@ public:
void getAttitudeSetpoint(vehicle_attitude_setpoint_s &attitude_setpoint) const;
private:
// The range limits of the hover thrust configuration/estimate
static constexpr float HOVER_THRUST_MIN = 0.05f;
static constexpr float HOVER_THRUST_MAX = 0.9f;
bool _inputValid();
void _positionControl(); ///< Position proportional control
@@ -200,7 +204,7 @@ private:
float _lim_thr_xy_margin{}; ///< Margin to keep for horizontal control when saturating prioritized vertical thrust
float _lim_tilt{}; ///< Maximum tilt from level the output attitude is allowed to have
float _hover_thrust{}; ///< Thrust [0.1, 0.9] with which the vehicle hovers not accelerating down or up with level orientation
float _hover_thrust{}; ///< Thrust [HOVER_THRUST_MIN, HOVER_THRUST_MAX] with which the vehicle hovers not accelerating down or up with level orientation
// States
matrix::Vector3f _pos; /**< current position */