diff --git a/C++/Makefile b/C++/Makefile index ecba7a7d..905de280 100644 --- a/C++/Makefile +++ b/C++/Makefile @@ -1,7 +1,7 @@ # Simple Makefile to build DAIDALUS library and example applications NAME=DAIDALUS MAJOR=2 -MINOR=.0.3 +MINOR=.0.4 VERSION=$(NAME)$(MAJOR) RELEASE=$(NAME)v$(MAJOR)$(MINOR) @@ -51,6 +51,9 @@ configs: examples clean: rm -f DaidalusExample DaidalusAlerting DaidalusBatch src/*.o examples/*.o lib/*.a +check: + cppcheck --enable=all $(INCLUDEFLAGS) -q $(SRC) + mold: examples ./DaidalusExample --config no_sum --verbose > ../Regression/C++/DaidalusExample-no_sum.out ./DaidalusExample --config nom_a --verbose > ../Regression/C++/DaidalusExample-nom_a.out diff --git a/C++/README.md b/C++/README.md index cb03acbb..e9d431a8 100644 --- a/C++/README.md +++ b/C++/README.md @@ -1,7 +1,7 @@ DAIDALUS: Detect and Avoid Alerting Logic for Unmanned Systems --------------------------------------------------------- -Release: v2.0.3a (C++), September-8-2023 +Release: v2.0.4 (C++), October-31-2023 Copyright: Copyright (c) 2021 United States Government as represented by the National Aeronautics and Space Administration. No copyright diff --git a/C++/include/ProjectedKinematics.h b/C++/include/ProjectedKinematics.h index b497da4a..ca2d2fda 100644 --- a/C++/include/ProjectedKinematics.h +++ b/C++/include/ProjectedKinematics.h @@ -34,7 +34,7 @@ class ProjectedKinematics { * @param R * @return the turn angle */ - static double turnAngle(Position s1, Position s2, double R); + static double turnAngle(const Position& s1, const Position& s2, double R); /** * Horizontal distance covered in a turn @@ -44,7 +44,7 @@ class ProjectedKinematics { * @param R * @return the turn distance */ - static double turnDistance(Position s1, Position s2, double R); + static double turnDistance(const Position& s1, const Position& s2, double R); /** * Given two points on a turn and the velocity (direction) at the first point, determine the direction for the shortest turn going through the second point, @@ -55,7 +55,7 @@ class ProjectedKinematics { * @param s2 * @return true if clockwise turn */ - static bool clockwise(Position s1, Velocity v1, Position s2); + static bool clockwise(const Position& s1, const Velocity& v1, const Position& s2); //static double closestTimeOnTurn(const Position& turnstart, const Velocity& v1, double omega, const Position& x, double endTime); @@ -109,10 +109,9 @@ class ProjectedKinematics { */ static std::pair turnUntil(const Position& so, const Velocity& vo, double t, double goalTrack, double bankAngle); - static std::pair turnUntil(std::pair sv, double t, double goalTrack, double bankAngle); + static std::pair turnUntil(const std::pair& sv, double t, double goalTrack, double bankAngle); - - static std::pair linear(std::pair p, double t); + static std::pair linear(const std::pair& p, double t); static std::pair linear(const Position& so, const Velocity& p, double t); diff --git a/C++/include/TrafficState.h b/C++/include/TrafficState.h index 9e4bf1e0..713433fb 100644 --- a/C++/include/TrafficState.h +++ b/C++/include/TrafficState.h @@ -74,7 +74,7 @@ class TrafficState { * @param eprj Euclidean projection */ TrafficState(const std::string& id, const Position& pos, const Velocity& vel, - EuclideanProjection eprj,int alerter); + const EuclideanProjection& eprj,int alerter); /** * Apply Euclidean projection. Requires aircraft's position in lat/lon diff --git a/C++/src/ProjectedKinematics.cpp b/C++/src/ProjectedKinematics.cpp index c69d5e6a..0d5f522e 100644 --- a/C++/src/ProjectedKinematics.cpp +++ b/C++/src/ProjectedKinematics.cpp @@ -27,7 +27,7 @@ namespace larcfm { -std::pair ProjectedKinematics::linear(std::pair p, double t) { +std::pair ProjectedKinematics::linear(const std::pair& p, double t) { return linear(p.first, p.second, t); } @@ -49,7 +49,7 @@ std::pair ProjectedKinematics::linear(const Position& so, con /** * Calculate the angle of a constant-radius turn from two points and the radius */ -double ProjectedKinematics::turnAngle(Position s1, Position s2, double R) { +double ProjectedKinematics::turnAngle(const Position& s1, const Position& s2, double R) { double distAB = s1.distanceH(s2); return 2*(Util::asin_safe(distAB/(2*R))); } @@ -57,7 +57,7 @@ double ProjectedKinematics::turnAngle(Position s1, Position s2, double R) { /** * Horizontal distance covered in a turn */ -double ProjectedKinematics::turnDistance(Position s1, Position s2, double R) { +double ProjectedKinematics::turnDistance(const Position& s1, const Position& s2, double R) { return turnAngle(s1,s2,R)*R; } @@ -66,7 +66,7 @@ double ProjectedKinematics::turnDistance(Position s1, Position s2, double R) { * Given two points on a turn and the velocity (direction) at the first point, determine the direction for the shortest turn going through the second point, * returning true if that relative direction is to the right */ -bool ProjectedKinematics::clockwise(Position s1, Velocity v1, Position s2) { +bool ProjectedKinematics::clockwise(const Position& s1, const Velocity& v1, const Position& s2) { double trk1 = v1.trk(); double trk2; if (s1.isLatLon()) { @@ -187,12 +187,10 @@ std::pair ProjectedKinematics::turnUntil(const Position& so, } } -std::pair ProjectedKinematics::turnUntil(std::pair sv, double t, double goalTrack, double bankAngle) { +std::pair ProjectedKinematics::turnUntil(const std::pair& sv, double t, double goalTrack, double bankAngle) { return turnUntil(sv.first, sv.second,t, goalTrack, bankAngle); } - - std::pair ProjectedKinematics::gsAccel(const Position& so, const Velocity& vo, double t, double a) { if (so.isLatLon()) { EuclideanProjection proj = Projection::createProjection(so.lla().zeroAlt()); @@ -257,8 +255,6 @@ std::pair ProjectedKinematics::vsAccelUntil(const Position& s } } - - // if this fails, it returns a NaN time std::pair ProjectedKinematics::intersection(const Position& so, const Velocity& vo, const Position& si, const Velocity& vi) { Vect3 so3 = so.vect3(); @@ -276,7 +272,6 @@ std::pair ProjectedKinematics::intersection(const Position& so, } } - double ProjectedKinematics::timeOfintersection(const Position& so, const Velocity& vo, const Position& si, const Velocity& vi) { Vect3 so3 = so.vect3(); Vect3 si3 = si.vect3(); @@ -289,15 +284,6 @@ double ProjectedKinematics::timeOfintersection(const Position& so, const Velocit return intersectTime; } - - - - - - - - - /** Wrapper around Kinematic.turnTimeDirecTo() * Returns a triple: end of turn point, velocity at that point, time at that point */ diff --git a/C++/src/TrafficState.cpp b/C++/src/TrafficState.cpp index cc29e2eb..08ce37ca 100644 --- a/C++/src/TrafficState.cpp +++ b/C++/src/TrafficState.cpp @@ -46,7 +46,7 @@ TrafficState::TrafficState(const std::string& id, const Position& pos, const Vel sxyz_(pos.vect3()), velxyz_(airvel) {} -TrafficState::TrafficState(const std::string& id, const Position& pos, const Velocity& vel, EuclideanProjection eprj, int alerter) : +TrafficState::TrafficState(const std::string& id, const Position& pos, const Velocity& vel, const EuclideanProjection& eprj, int alerter) : id_(id), pos_(pos), gvel_(vel), diff --git a/Java/Makefile b/Java/Makefile index 799dea40..bb972b17 100644 --- a/Java/Makefile +++ b/Java/Makefile @@ -1,7 +1,7 @@ # Simple Makefile to build DAIDALUS library and example applications NAME=DAIDALUS MAJOR=2 -MINOR=.0.3 +MINOR=.0.4 VERSION=$(NAME)$(MAJOR) RELEASE=$(NAME)v$(MAJOR)$(MINOR) diff --git a/Java/README.md b/Java/README.md index e2cd5b21..9d2ae09d 100644 --- a/Java/README.md +++ b/Java/README.md @@ -1,7 +1,7 @@ DAIDALUS: Detect and Avoid Alerting Logic for Unmanned Systems --------------------------------------------------------- -Release: v2.0.3a (Java), September-8-2023 +Release: v2.0.4 (Java), October-31-2023 Copyright: Copyright (c) 2021 United States Government as represented by the National Aeronautics and Space Administration. No copyright diff --git a/README.md b/README.md index 4257cb36..6ce03afa 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ repository, visit https://shemesh.larc.nasa.gov/fm/DAIDALUS. ### Current Release -v2.0.3a, September-8-2023 +v2.0.4, October-31-2023 ### License