mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-30 03:27:33 +08:00
[tests] add a compilation test node to modules (#2653)
When adding a test node to a makefile section, with required compilation flags, include and other options, all the files (not arch dependent files) can be compiled with a TAP compatible program, included in the standard tests of the CI servers. Not all module's XML files are converted, but a large part of the most important parts are already covered. More will be added later. The number of tested airframes (full compilation of all targets) have been reduced to speed the CI compile time but still covers the relevant architecture and boards. The main benefit is that the overall coverage is already better than before as previous test aircraft were compiling more or less the same part of the airborne code, while this new mechanism is more efficient to test modules not included in any config.
This commit is contained in:
committed by
GitHub
parent
c522927a69
commit
494e3f3ad9
@@ -35,6 +35,11 @@ INCLUDES = -I$(PAPARAZZI_SRC)/sw/include -I$(PAPARAZZI_SRC)/sw/airborne -I$(PAPA
|
||||
|
||||
VPATH = .
|
||||
|
||||
# AND and OR variables to be used in XML module files
|
||||
AND = &&
|
||||
OR = ||
|
||||
REDIRECT = >
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
include $(AIRCRAFT_BUILD_DIR)/Makefile.ac
|
||||
$(TARGET).srcs += $($(TARGET).EXTRA_SRCS)
|
||||
|
||||
@@ -71,7 +71,7 @@ static inline void actuators_ardrone_reset_flipflop(void)
|
||||
{
|
||||
gpio_setup_output(ARDRONE_GPIO_PORT, ARDRONE_GPIO_PIN_IRQ_FLIPFLOP);
|
||||
gpio_clear(ARDRONE_GPIO_PORT, ARDRONE_GPIO_PIN_IRQ_FLIPFLOP);
|
||||
int32_t stop = sys_time.nb_sec + 2;
|
||||
uint32_t stop = sys_time.nb_sec + 2;
|
||||
while (sys_time.nb_sec < stop);
|
||||
gpio_set(ARDRONE_GPIO_PORT, ARDRONE_GPIO_PIN_IRQ_FLIPFLOP);
|
||||
}
|
||||
|
||||
@@ -1108,7 +1108,7 @@ void mt9f002_reset_exposure(struct mt9f002_t *mt)
|
||||
/* Handler for propagating user resolution change so the camera
|
||||
*
|
||||
*/
|
||||
void mt9f002_setting_update_resolution(float in)
|
||||
void mt9f002_setting_update_resolution(float in UNUSED)
|
||||
{
|
||||
mt9f002.sensor_width = CFG_MT9F002_PIXEL_ARRAY_WIDTH / mt9f002.set_zoom;
|
||||
mt9f002.sensor_height = CFG_MT9F002_PIXEL_ARRAY_HEIGHT / mt9f002.set_zoom;
|
||||
@@ -1130,12 +1130,12 @@ void mt9f002_setting_update_resolution(float in)
|
||||
isp_request_statistics_yuv_window(0, mt9f002.sensor_width, 0, mt9f002.sensor_height, 1, 1);
|
||||
}
|
||||
|
||||
void mt9f002_setting_update_color(float in)
|
||||
void mt9f002_setting_update_color(float in UNUSED)
|
||||
{
|
||||
mt9f002_set_gains(&mt9f002);
|
||||
}
|
||||
|
||||
void mt9f002_setting_update_exposure(float in)
|
||||
void mt9f002_setting_update_exposure(float in UNUSED)
|
||||
{
|
||||
mt9f002_set_exposure(&mt9f002);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "modules/gps/gps_ubx_i2c.h"
|
||||
#include "subsystems/datalink/downlink.h"
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
// ublox i2c address
|
||||
#define GPS_I2C_SLAVE_ADDR (0x42 << 1)
|
||||
@@ -55,7 +56,7 @@ uint16_t gps_ubx_i2c_bytes_to_read; ///< ublox bytes to read
|
||||
/** null function
|
||||
* @param p unused
|
||||
*/
|
||||
void null_function(struct GpsUbxI2C *p);
|
||||
void null_function(struct GpsUbxI2C *p, uint32_t baudrate);
|
||||
|
||||
/** Check available space in transmit buffer
|
||||
* @param p unused
|
||||
@@ -120,7 +121,7 @@ void gps_ubx_i2c_init(void)
|
||||
gps_i2c.device.set_baudrate = (set_baudrate_t)null_function; ///< set device baudrate
|
||||
}
|
||||
|
||||
void null_function(struct GpsUbxI2C *p __attribute__((unused))) {}
|
||||
void null_function(struct GpsUbxI2C *p __attribute__((unused)), uint32_t baudrate __attribute__((unused))) {}
|
||||
|
||||
int gps_i2c_check_free_space(struct GpsUbxI2C *p __attribute__((unused)), long *fd __attribute__((unused)), uint16_t len)
|
||||
{
|
||||
|
||||
@@ -64,6 +64,7 @@ Receiving:
|
||||
#include "subsystems/electrical.h"
|
||||
//#include "subsystems/navigation/common_nav.h" //why is should this be needed?
|
||||
#include "generated/settings.h"
|
||||
#include "led.h"
|
||||
|
||||
#ifndef GSM_LINK
|
||||
#define GSM_LINK UART3100
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "modules/ins/ins_mekf_wind_wrapper.h"
|
||||
#include "modules/ins/ins_mekf_wind.h"
|
||||
#include "modules/air_data/air_data.h"
|
||||
#include "subsystems/ahrs/ahrs_float_utils.h"
|
||||
#if USE_AHRS_ALIGNER
|
||||
#include "subsystems/ahrs/ahrs_aligner.h"
|
||||
|
||||
@@ -72,6 +72,76 @@ struct InsModuleInt ins_module;
|
||||
|
||||
void ins_module_wrapper_init(void);
|
||||
|
||||
/** copy position and speed to state interface */
|
||||
static void ins_ned_to_state(void)
|
||||
{
|
||||
stateSetPositionNed_i(&ins_module.ltp_pos);
|
||||
stateSetSpeedNed_i(&ins_module.ltp_speed);
|
||||
stateSetAccelNed_i(&ins_module.ltp_accel);
|
||||
|
||||
#if defined SITL && USE_NPS
|
||||
if (nps_bypass_ins) {
|
||||
sim_overwrite_ins();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
* ABI callback functions
|
||||
**********************************************************/
|
||||
|
||||
static void baro_cb(uint8_t __attribute__((unused)) sender_id, __attribute__((unused)) uint32_t stamp, float pressure)
|
||||
{
|
||||
/* call module implementation */
|
||||
ins_module_update_baro(pressure);
|
||||
ins_ned_to_state();
|
||||
}
|
||||
|
||||
static void accel_cb(uint8_t sender_id __attribute__((unused)),
|
||||
uint32_t stamp, struct Int32Vect3 *accel)
|
||||
{
|
||||
/* timestamp in usec when last callback was received */
|
||||
static uint32_t last_stamp = 0;
|
||||
|
||||
if (last_stamp > 0) {
|
||||
float dt = (float)(stamp - last_stamp) * 1e-6;
|
||||
/* call module implementation */
|
||||
ins_module_propagate(accel, dt);
|
||||
ins_ned_to_state();
|
||||
}
|
||||
last_stamp = stamp;
|
||||
}
|
||||
|
||||
static void gps_cb(uint8_t sender_id __attribute__((unused)),
|
||||
uint32_t stamp, struct GpsState *gps_s)
|
||||
{
|
||||
/* timestamp in usec when last callback was received */
|
||||
static uint32_t last_stamp = 0;
|
||||
|
||||
if (last_stamp > 0) {
|
||||
float dt = (float)(stamp - last_stamp) * 1e-6;
|
||||
|
||||
/* copy GPS state */
|
||||
ins_module.gps = *gps_s;
|
||||
|
||||
if (!ins_module.ltp_initialized) {
|
||||
ins_reset_local_origin();
|
||||
}
|
||||
|
||||
if (gps_s->fix >= GPS_FIX_3D) {
|
||||
/* call module implementation */
|
||||
ins_module_update_gps(gps_s, dt);
|
||||
ins_ned_to_state();
|
||||
}
|
||||
}
|
||||
last_stamp = stamp;
|
||||
}
|
||||
|
||||
static void body_to_imu_cb(uint8_t sender_id __attribute__((unused)),
|
||||
struct FloatQuat *q_b2i_f)
|
||||
{
|
||||
orientationSetQuat_f(&ins_module.body_to_imu, q_b2i_f);
|
||||
}
|
||||
/*********************************************************************
|
||||
* weak functions that are used if not implemented in a module
|
||||
********************************************************************/
|
||||
@@ -172,73 +242,3 @@ void ins_module_wrapper_init(void)
|
||||
AbiBindMsgBODY_TO_IMU_QUAT(INS_MODULE_IMU_ID, &body_to_imu_ev, body_to_imu_cb);
|
||||
}
|
||||
|
||||
/** copy position and speed to state interface */
|
||||
static void ins_ned_to_state(void)
|
||||
{
|
||||
stateSetPositionNed_i(&ins_module.ltp_pos);
|
||||
stateSetSpeedNed_i(&ins_module.ltp_speed);
|
||||
stateSetAccelNed_i(&ins_module.ltp_accel);
|
||||
|
||||
#if defined SITL && USE_NPS
|
||||
if (nps_bypass_ins) {
|
||||
sim_overwrite_ins();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
* ABI callback functions
|
||||
**********************************************************/
|
||||
|
||||
static void baro_cb(uint8_t __attribute__((unused)) sender_id, __attribute__((unused)) uint32_t stamp, float pressure)
|
||||
{
|
||||
/* call module implementation */
|
||||
ins_module_update_baro(pressure);
|
||||
ins_ned_to_state();
|
||||
}
|
||||
|
||||
static void accel_cb(uint8_t sender_id __attribute__((unused)),
|
||||
uint32_t stamp, struct Int32Vect3 *accel)
|
||||
{
|
||||
/* timestamp in usec when last callback was received */
|
||||
static uint32_t last_stamp = 0;
|
||||
|
||||
if (last_stamp > 0) {
|
||||
float dt = (float)(stamp - last_stamp) * 1e-6;
|
||||
/* call module implementation */
|
||||
ins_module_propagate(accel, dt);
|
||||
ins_ned_to_state();
|
||||
}
|
||||
last_stamp = stamp;
|
||||
}
|
||||
|
||||
static void gps_cb(uint8_t sender_id __attribute__((unused)),
|
||||
uint32_t stamp, struct GpsState *gps_s)
|
||||
{
|
||||
/* timestamp in usec when last callback was received */
|
||||
static uint32_t last_stamp = 0;
|
||||
|
||||
if (last_stamp > 0) {
|
||||
float dt = (float)(stamp - last_stamp) * 1e-6;
|
||||
|
||||
/* copy GPS state */
|
||||
ins_module.gps = *gps_s;
|
||||
|
||||
if (!ins_module.ltp_initialized) {
|
||||
ins_reset_local_origin();
|
||||
}
|
||||
|
||||
if (gps_s->fix >= GPS_FIX_3D) {
|
||||
/* call module implementation */
|
||||
ins_module_update_gps(gps_s, dt);
|
||||
ins_ned_to_state();
|
||||
}
|
||||
}
|
||||
last_stamp = stamp;
|
||||
}
|
||||
|
||||
static void body_to_imu_cb(uint8_t sender_id __attribute__((unused)),
|
||||
struct FloatQuat *q_b2i_f)
|
||||
{
|
||||
orientationSetQuat_f(&ins_module.body_to_imu, q_b2i_f);
|
||||
}
|
||||
|
||||
@@ -157,7 +157,9 @@ static void handle_ins_msg(void)
|
||||
update_state_interface();
|
||||
|
||||
if (xsens.new_attitude) {
|
||||
#ifdef AHRS_TRIGGERED_ATTITUDE_LOOP
|
||||
new_ins_attitude = true;
|
||||
#endif
|
||||
xsens.new_attitude = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,9 @@ void handle_ins_msg(void)
|
||||
update_state_interface();
|
||||
|
||||
if (xsens700.new_attitude) {
|
||||
#ifdef AHRS_TRIGGERED_ATTITUDE_LOOP
|
||||
new_ins_attitude = true;
|
||||
#endif
|
||||
xsens700.new_attitude = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@ bool nav_survey_disc_run(uint8_t center_wp, float radius)
|
||||
disc_survey.c2.y = waypoints[center_wp].y - upwind.y * radius;
|
||||
disc_survey.status = SEGMENT;
|
||||
/* No break; */
|
||||
/* fallthrough */
|
||||
|
||||
case SEGMENT:
|
||||
nav_route_xy(disc_survey.c1.x, disc_survey.c1.y, disc_survey.c2.x, disc_survey.c2.y);
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "modules/sensors/airspeed_ads1114.h"
|
||||
#include "subsystems/sensors/baro.h"
|
||||
#include "baro_board.h"
|
||||
#include "peripherals/ads1114.h"
|
||||
|
||||
void airspeed_periodic(void)
|
||||
{
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "subsystems/datalink/downlink.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if FLIGHTRECORDER_SDLOG
|
||||
#include "subsystems/datalink/telemetry.h"
|
||||
|
||||
@@ -172,7 +172,7 @@ void ahrs_dcm_propagate(struct FloatRates *gyro, float dt)
|
||||
compute_ahrs_representations();
|
||||
}
|
||||
|
||||
void ahrs_dcm_update_gps(struct GpsState *gps_s)
|
||||
void ahrs_dcm_update_gps(struct GpsState *gps_s UNUSED)
|
||||
{
|
||||
static float last_gps_speed_3d = 0;
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
// for ahrs_register_impl
|
||||
#include "subsystems/ahrs.h"
|
||||
#include "subsystems/abi.h"
|
||||
|
||||
#define GX3_CHKSM(_ubx_payload) (uint16_t)((uint16_t)(*((uint8_t*)_ubx_payload+66+1))|(uint16_t)(*((uint8_t*)_ubx_payload+66+0))<<8)
|
||||
|
||||
@@ -260,13 +261,13 @@ void gx3_packet_read_message(void)
|
||||
struct FloatRates body_rate;
|
||||
/* compute body rates */
|
||||
struct FloatRMat *body_to_imu_rmat = orientationGetRMat_f(&imu.body_to_imu);
|
||||
FLOAT_RMAT_TRANSP_RATEMULT(body_rate, *body_to_imu_rmat, ahrs_gx3.rate);
|
||||
float_rmat_ratemult(&body_rate, body_to_imu_rmat, &ahrs_gx3.rate);
|
||||
/* Set state */
|
||||
stateSetBodyRates_f(&body_rate);
|
||||
|
||||
// Attitude
|
||||
struct FloatRMat ltp_to_body_rmat;
|
||||
float_rmat_comp(ltp_to_body_rmat, ahrs_gx3.rmat, *body_to_imu_rmat);
|
||||
float_rmat_comp(<p_to_body_rmat, &ahrs_gx3.rmat, body_to_imu_rmat);
|
||||
|
||||
#if AHRS_USE_GPS_HEADING && USE_GPS
|
||||
struct FloatEulers ltp_to_body_eulers;
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
* @author Michal Podhradsky <michal.podhradsky@aggiemail.usu.edu>
|
||||
*/
|
||||
#include "subsystems/ahrs/ahrs_vectornav.h"
|
||||
#include "subsystems/ahrs/ahrs_vectornav_wrapper.h"
|
||||
#include "subsystems/abi.h"
|
||||
#include "state.h"
|
||||
|
||||
struct AhrsVectornav ahrs_vn;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "subsystems/imu.h"
|
||||
#include "subsystems/abi.h"
|
||||
#include "generated/airframe.h"
|
||||
|
||||
#include "subsystems/imu/imu_nps.h"
|
||||
#include "nps_sensors.h"
|
||||
|
||||
struct ImuNps imu_nps;
|
||||
|
||||
@@ -41,9 +41,6 @@
|
||||
#error "You must at least define the primary Spektrum satellite receiver."
|
||||
#endif
|
||||
|
||||
/* Changed radio control order Notice */
|
||||
INFO("Radio-Control now follows PPRZ sign convention: this means you might need to reverese some channels in your transmitter: RollRight / PitchUp / YawRight / FullThrottle / Auto2 are positive deflections")
|
||||
|
||||
/* Number of low pulses sent during binding to the satellite receivers
|
||||
* Spektrum documentation recommend that master and slave receivers
|
||||
* should be configured in DSMX 11ms mode, other modes (DSM2, 22ms) will be
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
#include "superbitrf_rc.h"
|
||||
#include "subsystems/radio_control.h"
|
||||
|
||||
INFO("Radio-Control now follows PPRZ sign convention: this means you might need to reverese some channels in your transmitter: RollRight / PitchUp / YawRight / FullThrottle / Auto2 are positive deflections")
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*/
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#define _STRINGIFY(s) #s
|
||||
#define STRINGIFY(s) _STRINGIFY(s)
|
||||
|
||||
#define PTR(_f) &_f
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE false
|
||||
#endif
|
||||
|
||||
@@ -128,7 +128,9 @@ let rec parse_makefile mkf = function
|
||||
| Xml.Element ("file_arch", _, []) as xml ->
|
||||
{ mkf with files_arch = parse_file xml :: mkf.files_arch }
|
||||
| Xml.Element ("raw", [], [Xml.PCData raw]) ->
|
||||
{mkf with raws = raw :: mkf.raws}
|
||||
{ mkf with raws = raw :: mkf.raws }
|
||||
| Xml.Element ("test", _, _) ->
|
||||
mkf
|
||||
| _ -> failwith "Module.parse_makefile: unreachable"
|
||||
|
||||
type autorun = True | False | Lock
|
||||
|
||||
@@ -181,8 +181,10 @@ class FilesCreate:
|
||||
# set makefile
|
||||
c_file = etree.Element("file")
|
||||
c_file.attrib["name"] = "{}.c".format(self.name)
|
||||
test = etree.Element("test")
|
||||
makefile = etree.Element("makefile")
|
||||
makefile.append(c_file)
|
||||
makefile.append(test)
|
||||
self.xml.append(makefile)
|
||||
|
||||
def build_src(self, licence="GPLv2"):
|
||||
|
||||
Reference in New Issue
Block a user