Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ jobs:
run: |
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release

- name: Run public tests
- name: Run tests
run: |
cmake --build build --target run_public_test run_fmacm_test -j
cmake --build build --target run_tests -j

- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: public-test-results
name: test-results
path: unittest/*results.xml

# - name: Publish JUnit test results
Expand Down
5 changes: 2 additions & 3 deletions AircraftDynamicsTestFramework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,14 @@ include(sample_algorithm_library.cmake OPTIONAL)

add_library(framework STATIC ${SOURCE_FILES} ${DATA_READER_FILES} ${DATA_LOADER_FILES} ${DATA_WRITER_FILES})
target_include_directories(framework PUBLIC
${aaesim_INCLUDE_DIRS}
${geolib_idealab_INCLUDE_DIRS})
${aaesim_INCLUDE_DIRS})
target_link_libraries(framework
PUBLIC
mitre::fsloader
${BADA_LIBRARY}
${SAMPLE_ALGORITHM_LIBRARY}
log4cplus::log4cplus
pub)
mitre::oss::simcore)
if (DEFINED BADA_LIBRARY)
# Add a compile definition to the build
target_compile_definitions(framework PUBLIC "MITRE_BADA3_LIBRARY")
Expand Down
4 changes: 3 additions & 1 deletion AircraftDynamicsTestFramework/TestFrameworkApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
// ****************************************************************************

#include "framework/TestFrameworkApplication.h"
#include "utility/constants.h"

#include <iostream>

#include "public/AircraftCalculations.h"

using namespace std;
Expand Down
33 changes: 20 additions & 13 deletions AircraftDynamicsTestFramework/TestFrameworkFMS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,18 @@
// 2022 The MITRE Corporation. All Rights Reserved.
// ****************************************************************************

#include <public/CoreUtils.h>
#include <public/AlongPathDistanceCalculator.h>
#include "framework/TestFrameworkFMS.h"
#include "math/CustomMath.h"

#include <cmath>
#include <vector>

#include "public/CoreUtils.h"
#include "public/AlongPathDistanceCalculator.h"
#include "public/AircraftCalculations.h"
#include "math/CustomMath.h" // FIXME Stuart why is thsi here?
#include "utility/UtilityConstants.h"

namespace constants = aaesim::open_source::constants;

Units::DegreesAngle TestFrameworkFMS::MAX_BANK_ANGLE(25.0);

Expand Down Expand Up @@ -113,7 +120,7 @@ void TestFrameworkFMS::Update(const aaesim::open_source::AircraftState &state,

if (bank_angle_rad != 0.00) {
double gs = Units::FeetPerSecondSpeed(state.GetGroundSpeed()).value();
m_turn_radius = gs * gs / (GRAVITY_METERS_PER_SECOND / FEET_TO_METERS * tan(bank_angle_rad));
m_turn_radius = gs * gs / (constants::GRAVITY_FEET_PER_SECOND * tan(bank_angle_rad));

m_range_start_turn = fabs(m_turn_radius * tan(0.5 * m_delta_track));
} else {
Expand Down Expand Up @@ -151,29 +158,29 @@ void TestFrameworkFMS::Update(const aaesim::open_source::AircraftState &state,

double track_error = course - desired_course;

if (track_error > M_PI) {
while (track_error > M_PI) {
track_error = track_error - 2.0 * M_PI;
if (track_error > constants::PI) {
while (track_error > constants::PI) {
track_error = track_error - constants::TWO_PI;
}
}
if (track_error < -M_PI) {
while (track_error < -M_PI) {
track_error = track_error + 2.0 * M_PI;
if (track_error < -constants::PI) {
while (track_error < -constants::PI) {
track_error = track_error + constants::TWO_PI;
}
}

if (m_mode == TURNING) {
double DeltaGroundTrack = -1.0 * track_error;

if (cross_track_error < 0.00 && DeltaGroundTrack < 10.00 * DEGREES_TO_RADIAN) {
if (cross_track_error < 0.00 && DeltaGroundTrack < 10.00 * constants::DEGREES_TO_RADIAN) {
m_mode = TRACKING;
}

if (cross_track_error > 0.00 && DeltaGroundTrack > 10.00 * DEGREES_TO_RADIAN) {
if (cross_track_error > 0.00 && DeltaGroundTrack > 10.00 * constants::DEGREES_TO_RADIAN) {
m_mode = TRACKING;
}

if (fabs(cross_track_error) < 1000.0 && fabs(track_error) < 5.0 * DEGREES_TO_RADIAN) {
if (fabs(cross_track_error) < 1000.0 && fabs(track_error) < 5.0 * constants::DEGREES_TO_RADIAN) {
m_mode = TRACKING;
}
}
Expand Down
25 changes: 16 additions & 9 deletions AircraftDynamicsTestFramework/TrajectoryFromFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,18 @@
// ****************************************************************************

#include "framework/TrajectoryFromFile.h"

#include <iostream>
#include <string>

#include "scalar/AngularSpeed.h"
#include "public/AircraftCalculations.h"
#include "public/CoreUtils.h"
#include "framework/HfpReader2020.h"
#include "utility/CsvParser.h"
#include "utility/UtilityConstants.h"

#include <scalar/AngularSpeed.h>
namespace constants = aaesim::open_source::constants;

TrajectoryFromFile::TrajectoryFromFile()
: m_vertical_data(),
Expand Down Expand Up @@ -107,12 +113,15 @@ aaesim::open_source::Guidance TrajectoryFromFile::Update(const aaesim::open_sour

result.m_enu_track_angle = course_at_position;

double unsigned_cross_track_meters = sqrt(pow(state.m_x * FEET_TO_METERS - estimated_position_on_path_x.value(), 2) +
pow(state.m_y * FEET_TO_METERS - estimated_position_on_path_y.value(), 2));
const double state_x_meters = state.m_x * constants::FEET_TO_METERS;
const double state_y_meters = state.m_y * constants::FEET_TO_METERS;

double unsigned_cross_track_meters = sqrt(pow(state_x_meters - estimated_position_on_path_x.value(), 2) +
pow(state_y_meters - estimated_position_on_path_y.value(), 2));

double center_dist_meters =
sqrt(pow(state.m_x * FEET_TO_METERS - m_horizontal_trajectory[traj_index].m_turn_info.x_position_meters, 2) +
pow(state.m_y * FEET_TO_METERS - m_horizontal_trajectory[traj_index].m_turn_info.y_position_meters, 2));
sqrt(pow(state_x_meters - m_horizontal_trajectory[traj_index].m_turn_info.x_position_meters, 2) +
pow(state_y_meters - m_horizontal_trajectory[traj_index].m_turn_info.y_position_meters, 2));

if (m_horizontal_trajectory[traj_index].m_segment_type == HorizontalPath::SegmentType::TURN) {
Units::FeetLength distance_to_waypoint =
Expand Down Expand Up @@ -162,10 +171,8 @@ aaesim::open_source::Guidance TrajectoryFromFile::Update(const aaesim::open_sour
}
} else {
result.m_cross_track_error = Units::MetersLength(
-(state.m_y * FEET_TO_METERS - m_horizontal_trajectory[traj_index].GetYPositionMeters()) *
cos(estimated_course) +
(state.m_x * FEET_TO_METERS - m_horizontal_trajectory[traj_index].GetXPositionMeters()) *
sin(estimated_course));
-(state_y_meters - m_horizontal_trajectory[traj_index].GetYPositionMeters()) * cos(estimated_course) +
(state_x_meters - m_horizontal_trajectory[traj_index].GetXPositionMeters()) * sin(estimated_course));
}

result.m_use_cross_track = true;
Expand Down
3 changes: 0 additions & 3 deletions AircraftDynamicsTestFramework/framework.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ if(NOT ${BUILD_LIBARIES_ONLY})
add_executable(FMACM ${FMACM_MAIN_SRC})
target_link_libraries(FMACM framework)
target_include_directories(FMACM PUBLIC
$<BUILD_INTERFACE:${geolib_idealab_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${nlohmann_json_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${cppmanifest_INCLUDE_DIR}>
$<BUILD_INTERFACE:${aaesim_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${minicsv_INCLUDE_DIR}>
)
set_target_properties(FMACM PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin
Expand Down
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,17 @@ CPMAddPackage(
"BUILD_SHARED_LIBS FALSE"
)

set (PUBLIC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Public)
CPMAddPackage(
NAME aircraft_simulation_core
GIT_REPOSITORY https://github.com/mitre/aircraft_simulation_core.git
GIT_TAG a84dc78805bf35b6a45c68ac99f1c47fe47ad892 # FIXME switch to a release tag when available
OPTIONS
"SIMCORE_BUILD_TESTING OFF"
)

set (FRAMEWORK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/AircraftDynamicsTestFramework)
set (aaesim_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include )
set (UNITTEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/unittest)

add_subdirectory(${PUBLIC_DIR})

include(${UNITTEST_DIR}/unittest.cmake OPTIONAL)
include(${FRAMEWORK_DIR}/framework.cmake OPTIONAL)
157 changes: 0 additions & 157 deletions Public/ADSBSVReport.cpp

This file was deleted.

Loading
Loading