Skip to content

Commit e1fcc3c

Browse files
committed
fix data bug for simposix
1 parent b4ebed8 commit e1fcc3c

13 files changed

Lines changed: 416 additions & 21 deletions

File tree

flight/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ flight_uavobjects: $(UAVOBJGENERATOR)
272272
#
273273
##############################
274274

275-
ALL_UNITTESTS := logfs math lednotification
275+
ALL_UNITTESTS := logfs math lednotification modules
276276

277277
# Build the directory for the unit tests
278278
UT_OUT_DIR := $(BUILD_DIR)/unit_tests

flight/libraries/inc/CoordinateConversions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#ifndef COORDINATECONVERSIONS_H_
3131
#define COORDINATECONVERSIONS_H_
3232
#include <math.h>
33+
#include <stdint.h>
3334

3435
// ****** convert Lat,Lon,Alt to ECEF ************
3536
void LLA2ECEF(const int32_t LLAi[3], float ECEF[3]);

flight/modules/Sensors/simulated/Sensors/sensors.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ static void simulateModelQuadcopter()
353353
ActuatorDesiredData actuatorDesired;
354354
ActuatorDesiredGet(&actuatorDesired);
355355

356-
float thrust = (flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMED) ? actuatorDesired.Throttle * MAX_THRUST : 0;
356+
float thrust = (flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMED) ? actuatorDesired.Thrust * MAX_THRUST : 0;
357357
if (thrust < 0) {
358358
thrust = 0;
359359
}
@@ -543,12 +543,12 @@ static void simulateModelQuadcopter()
543543
attitudeSimulated.q3 = q[2];
544544
attitudeSimulated.q4 = q[3];
545545
Quaternion2RPY(q, &attitudeSimulated.Roll);
546-
attitudeSimulated.Position[0] = pos[0];
547-
attitudeSimulated.Position[1] = pos[1];
548-
attitudeSimulated.Position[2] = pos[2];
549-
attitudeSimulated.Velocity[0] = vel[0];
550-
attitudeSimulated.Velocity[1] = vel[1];
551-
attitudeSimulated.Velocity[2] = vel[2];
546+
attitudeSimulated.Position.North = pos[0];
547+
attitudeSimulated.Position.East = pos[1];
548+
attitudeSimulated.Position.Down = pos[2];
549+
attitudeSimulated.Velocity.North = vel[0];
550+
attitudeSimulated.Velocity.East = vel[1];
551+
attitudeSimulated.Velocity.Down = vel[2];
552552
AttitudeSimulatedSet(&attitudeSimulated);
553553
}
554554

@@ -596,7 +596,7 @@ static void simulateModelAirplane()
596596
ActuatorDesiredData actuatorDesired;
597597
ActuatorDesiredGet(&actuatorDesired);
598598

599-
float thrust = (flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMED) ? actuatorDesired.Throttle * MAX_THRUST : 0;
599+
float thrust = (flightStatus.Armed == FLIGHTSTATUS_ARMED_ARMED) ? actuatorDesired.Thrust * MAX_THRUST : 0;
600600
if (thrust < 0) {
601601
thrust = 0;
602602
}
@@ -825,12 +825,12 @@ static void simulateModelAirplane()
825825
attitudeSimulated.q3 = q[2];
826826
attitudeSimulated.q4 = q[3];
827827
Quaternion2RPY(q, &attitudeSimulated.Roll);
828-
attitudeSimulated.Position[0] = pos[0];
829-
attitudeSimulated.Position[1] = pos[1];
830-
attitudeSimulated.Position[2] = pos[2];
831-
attitudeSimulated.Velocity[0] = vel[0];
832-
attitudeSimulated.Velocity[1] = vel[1];
833-
attitudeSimulated.Velocity[2] = vel[2];
828+
attitudeSimulated.Position.North = pos[0];
829+
attitudeSimulated.Position.East = pos[1];
830+
attitudeSimulated.Position.Down = pos[2];
831+
attitudeSimulated.Velocity.North = vel[0];
832+
attitudeSimulated.Velocity.East = vel[1];
833+
attitudeSimulated.Velocity.Down = vel[2];
834834
AttitudeSimulatedSet(&attitudeSimulated);
835835
}
836836

flight/sty_midware/sty_midware.h

Whitespace-only changes.

flight/targets/boards/simposix/firmware/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ DEBUG ?= YES
3838
MODULES = ManualControl Stabilization GPS
3939
MODULES += PathPlanner
4040
MODULES += PathFollower
41-
MODULES += CameraStab
41+
# MODULES += CameraStab
4242
MODULES += Telemetry
4343
MODULES += Logging
4444
MODULES += FirmwareIAP
4545
MODULES += StateEstimation
46-
#MODULES += Sensors/simulated/Sensors
47-
MODULES += Airspeed
46+
MODULES += Sensors/simulated/Sensors
47+
#MODULES += Airspeed
4848
#MODULES += AltitudeHold # now integrated in Stabilization
4949
#MODULES += OveroSync
5050

flight/targets/boards/simposix/firmware/inc/pios_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@
101101

102102
#define PIOS_INCLUDE_DEBUGLOG
103103

104+
#define HAS_LOGGING_MODULE /* used in telemetry module */
105+
104106
/* Other Interfaces */
105107
// #define PIOS_INCLUDE_I2C_ESC
106108

flight/tests/math/coordinateconversiontest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ TEST_F(CoordinateConversionsTestRaw, LLA2ECEF) {
3737
int32_t LLAi[3] = {
3838
419291818,
3939
125571688,
40-
50 * 1e4
40+
500000
4141
};
4242
int32_t LLAfromECEF[3];
4343

@@ -56,14 +56,14 @@ TEST_F(CoordinateConversionsTestRaw, LLA2NED) {
5656
int32_t LLAi[3] = {
5757
419291818,
5858
125571688,
59-
50 * 1e4
59+
500000
6060
};
6161
int32_t LLAfromNED[3];
6262

6363
int32_t HomeLLAi[3] = {
6464
419291600,
6565
125571300,
66-
24 * 1e4
66+
240000
6767
};
6868

6969
float Rne[3][3];

flight/tests/modules/Makefile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
###############################################################################
2+
# @file Makefile
3+
# @author SantyPilot, Copyright (C) 2023
4+
# Copyright (c) 2023, The SantyPilot Team
5+
# @addtogroup
6+
# @{
7+
# @addtogroup
8+
# @{
9+
# @brief Makefile for unit test
10+
###############################################################################
11+
#
12+
# This program is free software; you can redistribute it and/or modify
13+
# it under the terms of the GNU General Public License as published by
14+
# the Free Software Foundation; either version 3 of the License, or
15+
# (at your option) any later version.
16+
#
17+
# This program is distributed in the hope that it will be useful, but
18+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19+
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20+
# for more details.
21+
#
22+
# You should have received a copy of the GNU General Public License along
23+
# with this program; if not, write to the Free Software Foundation, Inc.,
24+
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25+
#
26+
27+
ifndef FLIGHT_MAKEFILE
28+
$(error Top level Makefile must be used to build this target)
29+
endif
30+
31+
include $(FLIGHT_ROOT_DIR)/make/firmware-defs.mk
32+
33+
EXTRAINCDIRS += $(TOPDIR)
34+
EXTRAINCDIRS += $(PIOS)/inc
35+
36+
include $(FLIGHT_ROOT_DIR)/make/unittest.mk
37+
38+
## UAVObjects
39+
# include ./UAVObjects.inc
40+
# SRC += $(UAVOBJSRC)
41+
42+
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
#
2+
# Copyright (C) 2016, The LibrePilot Project, http://www.librepilot.org
3+
# Copyright (C) 2009-2013, The OpenPilot Team, http://www.openpilot.org
4+
#
5+
# This program is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 3 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# This program is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12+
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13+
# for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License along
16+
# with this program; if not, write to the Free Software Foundation, Inc.,
17+
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18+
#
19+
20+
# These are the UAVObjects supposed to be build as part of the OpenPilot target
21+
# (all architectures)
22+
UAVOBJSRCFILENAMES =
23+
UAVOBJSRCFILENAMES += statusgrounddrive
24+
UAVOBJSRCFILENAMES += statusvtolautotakeoff
25+
UAVOBJSRCFILENAMES += pidstatus
26+
UAVOBJSRCFILENAMES += statusvtolland
27+
UAVOBJSRCFILENAMES += vtolselftuningstats
28+
UAVOBJSRCFILENAMES += accelgyrosettings
29+
UAVOBJSRCFILENAMES += accessorydesired
30+
UAVOBJSRCFILENAMES += actuatorcommand
31+
UAVOBJSRCFILENAMES += actuatordesired
32+
UAVOBJSRCFILENAMES += actuatorsettings
33+
UAVOBJSRCFILENAMES += attitudesettings
34+
UAVOBJSRCFILENAMES += attitudestate
35+
UAVOBJSRCFILENAMES += gyrostate
36+
UAVOBJSRCFILENAMES += gyrosensor
37+
UAVOBJSRCFILENAMES += accelstate
38+
UAVOBJSRCFILENAMES += accelsensor
39+
UAVOBJSRCFILENAMES += magsensor
40+
UAVOBJSRCFILENAMES += auxmagsensor
41+
UAVOBJSRCFILENAMES += auxmagsettings
42+
UAVOBJSRCFILENAMES += magstate
43+
UAVOBJSRCFILENAMES += barosensor
44+
UAVOBJSRCFILENAMES += airspeedsensor
45+
UAVOBJSRCFILENAMES += airspeedsettings
46+
UAVOBJSRCFILENAMES += airspeedstate
47+
UAVOBJSRCFILENAMES += debuglogsettings
48+
UAVOBJSRCFILENAMES += debuglogcontrol
49+
UAVOBJSRCFILENAMES += debuglogstatus
50+
UAVOBJSRCFILENAMES += debuglogentry
51+
UAVOBJSRCFILENAMES += flightbatterysettings
52+
UAVOBJSRCFILENAMES += firmwareiapobj
53+
UAVOBJSRCFILENAMES += flightbatterystate
54+
UAVOBJSRCFILENAMES += flightplancontrol
55+
UAVOBJSRCFILENAMES += flightplansettings
56+
UAVOBJSRCFILENAMES += flightplanstatus
57+
UAVOBJSRCFILENAMES += flighttelemetrystats
58+
UAVOBJSRCFILENAMES += gcstelemetrystats
59+
UAVOBJSRCFILENAMES += gcsreceiver
60+
UAVOBJSRCFILENAMES += gpspositionsensor
61+
UAVOBJSRCFILENAMES += gpssatellites
62+
UAVOBJSRCFILENAMES += gpstime
63+
UAVOBJSRCFILENAMES += gpsvelocitysensor
64+
UAVOBJSRCFILENAMES += gpssettings
65+
UAVOBJSRCFILENAMES += gpsextendedstatus
66+
UAVOBJSRCFILENAMES += fixedwingpathfollowersettings
67+
UAVOBJSRCFILENAMES += fixedwingpathfollowerstatus
68+
UAVOBJSRCFILENAMES += vtolpathfollowersettings
69+
UAVOBJSRCFILENAMES += groundpathfollowersettings
70+
UAVOBJSRCFILENAMES += homelocation
71+
UAVOBJSRCFILENAMES += i2cstats
72+
UAVOBJSRCFILENAMES += manualcontrolcommand
73+
UAVOBJSRCFILENAMES += manualcontrolsettings
74+
UAVOBJSRCFILENAMES += flightmodesettings
75+
UAVOBJSRCFILENAMES += mixersettings
76+
UAVOBJSRCFILENAMES += mixerstatus
77+
UAVOBJSRCFILENAMES += nedaccel
78+
UAVOBJSRCFILENAMES += objectpersistence
79+
UAVOBJSRCFILENAMES += oplinkreceiver
80+
UAVOBJSRCFILENAMES += pathaction
81+
UAVOBJSRCFILENAMES += pathdesired
82+
UAVOBJSRCFILENAMES += pathplan
83+
UAVOBJSRCFILENAMES += pathstatus
84+
UAVOBJSRCFILENAMES += pathsummary
85+
UAVOBJSRCFILENAMES += positionstate
86+
UAVOBJSRCFILENAMES += ratedesired
87+
UAVOBJSRCFILENAMES += ekfconfiguration
88+
UAVOBJSRCFILENAMES += ekfstatevariance
89+
UAVOBJSRCFILENAMES += revocalibration
90+
UAVOBJSRCFILENAMES += revosettings
91+
UAVOBJSRCFILENAMES += sonaraltitude
92+
UAVOBJSRCFILENAMES += stabilizationdesired
93+
UAVOBJSRCFILENAMES += stabilizationsettings
94+
UAVOBJSRCFILENAMES += stabilizationsettingsbank1
95+
UAVOBJSRCFILENAMES += stabilizationsettingsbank2
96+
UAVOBJSRCFILENAMES += stabilizationsettingsbank3
97+
UAVOBJSRCFILENAMES += stabilizationstatus
98+
UAVOBJSRCFILENAMES += stabilizationbank
99+
UAVOBJSRCFILENAMES += systemalarms
100+
UAVOBJSRCFILENAMES += systemsettings
101+
UAVOBJSRCFILENAMES += systemstats
102+
UAVOBJSRCFILENAMES += taskinfo
103+
UAVOBJSRCFILENAMES += callbackinfo
104+
UAVOBJSRCFILENAMES += velocitystate
105+
UAVOBJSRCFILENAMES += velocitydesired
106+
UAVOBJSRCFILENAMES += watchdogstatus
107+
UAVOBJSRCFILENAMES += flightstatus
108+
UAVOBJSRCFILENAMES += hwsettings
109+
UAVOBJSRCFILENAMES += receiveractivity
110+
UAVOBJSRCFILENAMES += receiverstatus
111+
UAVOBJSRCFILENAMES += cameradesired
112+
UAVOBJSRCFILENAMES += camerastabsettings
113+
UAVOBJSRCFILENAMES += cameracontrolsettings
114+
UAVOBJSRCFILENAMES += cameracontrolactivity
115+
UAVOBJSRCFILENAMES += altitudeholdsettings
116+
UAVOBJSRCFILENAMES += oplinksettings
117+
UAVOBJSRCFILENAMES += oplinkstatus
118+
UAVOBJSRCFILENAMES += altitudefiltersettings
119+
UAVOBJSRCFILENAMES += altitudeholdstatus
120+
UAVOBJSRCFILENAMES += waypoint
121+
UAVOBJSRCFILENAMES += waypointactive
122+
UAVOBJSRCFILENAMES += poilocation
123+
UAVOBJSRCFILENAMES += poilearnsettings
124+
UAVOBJSRCFILENAMES += mpugyroaccelsettings
125+
UAVOBJSRCFILENAMES += txpidsettings
126+
UAVOBJSRCFILENAMES += txpidstatus
127+
UAVOBJSRCFILENAMES += hottbridgesettings
128+
UAVOBJSRCFILENAMES += hottbridgestatus
129+
UAVOBJSRCFILENAMES += takeofflocation
130+
UAVOBJSRCFILENAMES += perfcounter
131+
UAVOBJSRCFILENAMES += systemidentsettings
132+
UAVOBJSRCFILENAMES += systemidentstate
133+
134+
FLIGHT_TEST_UAVOBJ_DIR = $(UAVOBJ_OUT_DIR)/flight
135+
UAVOBJSRC = $(foreach UAVOBJSRCFILE,$(UAVOBJSRCFILENAMES),$(FLIGHT_TEST_UAVOBJ_DIR)/$(UAVOBJSRCFILE).c )
136+
UAVOBJDEFINE = $(foreach UAVOBJSRCFILE,$(UAVOBJSRCFILENAMES),-DUAVOBJ_INIT_$(UAVOBJSRCFILE) )

flight/tests/modules/empty.cpp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
******************************************************************************
3+
* @addtogroup SANTY_GTEST
4+
* @{
5+
* @addtogroup SANTY_GETST FUNCTIONS
6+
* @brief Deals with module mock & test
7+
* @{
8+
* @file empty.cpp
9+
* @author The SantyPilot Team, Copyright (C) 2023.
10+
* @brief gtest usage demo
11+
* @see The GNU Public License (GPL) Version 3
12+
*
13+
******************************************************************************
14+
*/
15+
/*
16+
* This program is free software; you can redistribute it and/or modify
17+
* it under the terms of the GNU General Public License as published by
18+
* the Free Software Foundation; either version 3 of the License, or
19+
* (at your option) any later version.
20+
*
21+
* This program is distributed in the hope that it will be useful, but
22+
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23+
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24+
* for more details.
25+
*
26+
* You should have received a copy of the GNU General Public License along
27+
* with this program; if not, write to the Free Software Foundation, Inc.,
28+
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29+
*/
30+
#include "gtest/gtest.h"
31+
32+
#include <stdio.h> /* printf */
33+
#include <stdlib.h> /* abort */
34+
#include <string.h> /* memset */
35+
36+
extern "C" {
37+
38+
} // extern "C"
39+
40+
41+
class EmptyTest: public testing::Test {
42+
protected:
43+
virtual void SetUp() {}
44+
virtual void TearDown() {}
45+
};
46+
47+
// EMPTY TEST
48+
TEST(EmptyTest, Expect) {
49+
EXPECT_EQ(1, 1);
50+
}
51+
52+
TEST(EmptyTest, SensorsGenerator) {
53+
}

0 commit comments

Comments
 (0)