Skip to content

Commit

Permalink
v2.0.1g
Browse files Browse the repository at this point in the history
  • Loading branch information
Cesar Munoz committed Jan 11, 2021
1 parent 121f7bc commit 2ef80cd
Show file tree
Hide file tree
Showing 11 changed files with 446 additions and 52 deletions.
4 changes: 4 additions & 0 deletions C++/RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Rights Reserved.

Release DAIDALUS-v2.0.1:
------------------
* January 11, 2021
- Fixed comment related to SUM setting in Daidalus class
- Added interface to raw resolutions

* December 11, 2020
- Fixed computation of TCPA hazard volume when TTHR*||v|| < DTHR and
other volumes when relative velocity is zero (these fixes are only for display)
Expand Down
6 changes: 6 additions & 0 deletions C++/include/BandsHysteresis.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ class BandsHysteresis {

double getLastResolutionUp() const;

double getRawResolutionLow() const;

double getRawResolutionUp() const;

int getLastNFactorLow() const;

int getLastNFactorUp() const;
Expand Down Expand Up @@ -107,6 +111,8 @@ class BandsHysteresis {
*/
double resolution_up_;
double resolution_low_;
double raw_up_; // Resolution up without hysteresis
double raw_low_; // Resolution low without hysteresis
// nfactor >= 0 means recovery bands. It's the reduction factor for the internal cylinder
int nfactor_up_;
int nfactor_low_;
Expand Down
162 changes: 127 additions & 35 deletions C++/include/Daidalus.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,32 @@
* Rights Reserved.
*/

#ifndef DAIDALUSBANDS_H_
#define DAIDALUSBANDS_H_

#include "GenericStateBands.h"
#include "DaidalusCore.h"
#include "DaidalusAltBands.h"
#include "DaidalusDirBands.h"
#include "DaidalusHsBands.h"
#include "DaidalusVsBands.h"
#include "UrgencyStrategy.h"
#include "Velocity.h"
#include "ErrorLog.h"
#include "ErrorReporter.h"
#include "TrafficState.h"
#include "BandsRegion.h"
#include "Alerter.h"
#include "Detection3D.h"
#include "IndexLevelT.h"
#include "string_util.h"
#include "format.h"
#include <vector>
#include <string>
#include <cmath>

namespace larcfm {

/**
* Objects of class "Daidalus" compute the conflict bands using
* kinematic single-maneuver projections of the ownship and linear preditions
Expand Down Expand Up @@ -65,32 +91,6 @@
*
*/

#ifndef DAIDALUSBANDS_H_
#define DAIDALUSBANDS_H_

#include "GenericStateBands.h"
#include "DaidalusCore.h"
#include "DaidalusAltBands.h"
#include "DaidalusDirBands.h"
#include "DaidalusHsBands.h"
#include "DaidalusVsBands.h"
#include "UrgencyStrategy.h"
#include "Velocity.h"
#include "ErrorLog.h"
#include "ErrorReporter.h"
#include "TrafficState.h"
#include "BandsRegion.h"
#include "Alerter.h"
#include "Detection3D.h"
#include "IndexLevelT.h"
#include "string_util.h"
#include "format.h"
#include <vector>
#include <string>
#include <cmath>

namespace larcfm {

class Daidalus : public GenericStateBands, public ErrorReporter {

private:
Expand All @@ -109,7 +109,7 @@ class Daidalus : public GenericStateBands, public ErrorReporter {
/**
* Construct an empty Daidalus object.
* NOTE: This object doesn't have any alert configured. Alerters can be
* configured either programmatically, set_DO_365A(true,true) or
* configured either programmatically, set_DO_365A() or
* via a configuration file with the method loadFromFile(configurationfile)
**/
Daidalus();
Expand Down Expand Up @@ -370,18 +370,18 @@ class Daidalus : public GenericStateBands, public ErrorReporter {
void setVerticalPositionUncertainty(int ac_idx, double sz_std, const std::string& u);

/**
* Set horizontal speed uncertainty of aircraft at index ac_idx
* v_EW_std: East/West position standard deviation in internal units
* v_NS_std: North/South position standard deviation in internal units
* v_EN_std: East/North position standard deviation in internal units
* Set horizontal velocity uncertainty of aircraft at index ac_idx
* v_EW_std: East/West speed standard deviation in internal units
* v_NS_std: North/South speed standard deviation in internal units
* v_EN_std: East/North speed standard deviation in internal units
*/
void setHorizontalVelocityUncertainty(int ac_idx, double v_EW_std, double v_NS_std, double v_EN_std);

/**
* Set horizontal speed uncertainty of aircraft at index ac_idx
* v_EW_std: East/West position standard deviation in given units
* v_NS_std: North/South position standard deviation in given units
* v_EN_std: East/North position standard deviation in given units
* Set horizontal velocity uncertainty of aircraft at index ac_idx
* v_EW_std: East/West speed standard deviation in given units
* v_NS_std: North/South speed standard deviation in given units
* v_EN_std: East/North speed standard deviation in given units
*/
void setHorizontalVelocityUncertainty(int ac_idx, double v_EW_std, double v_NS_std, double v_EN_std, const std::string& u);

Expand Down Expand Up @@ -1976,6 +1976,29 @@ class Daidalus : public GenericStateBands, public ErrorReporter {
*/
double horizontalDirectionResolution(bool dir, const std::string& u);

/**
* Compute horizontal direction *raw* resolution maneuver for a given direction.
* Raw resolution is the resolution without persistence
* @parameter dir is right (true)/left (false) of ownship current direction
* @return direction resolution in internal units [rad] in specified direction.
* Resolution maneuver is valid for lookahead time in seconds. Return NaN if there is no conflict,
* positive infinity if there is no resolution to the right, and negative infinity if there
* is no resolution to the left.
*/
double horizontalDirectionRawResolution(bool dir);

/**
* Compute horizontal direction *raw* resolution maneuver for a given direction.
* Raw resolution is the resolution without persistence
* @parameter dir is right (true)/left (false) of ownship current direction
* @parameter u units
* @return direction resolution in specified units [u] in specified direction.
* Resolution maneuver is valid for lookahead time in seconds. Return NaN if there is no conflict,
* positive infinity if there is no resolution to the right, and negative infinity if there
* is no resolution to the left.
*/
double horizontalDirectionRawResolution(bool dir, const std::string& u);

/**
* Compute preferred horizontal direction based on resolution that is closer to current direction.
* @return True: Right. False: Left.
Expand Down Expand Up @@ -2100,6 +2123,29 @@ class Daidalus : public GenericStateBands, public ErrorReporter {
*/
double horizontalSpeedResolution(bool dir, const std::string& u);

/**
* Compute horizontal speed *raw* resolution maneuver.
* Raw resolution is the resolution without persistence
* @parameter dir is up (true)/down (false) of ownship current horizontal speed
* @return horizontal speed resolution in internal units [m/s] in specified direction.
* Resolution maneuver is valid for lookahead time in seconds. Return NaN if there is no conflict,
* positive infinity if there is no up resolution, and negative infinity if there
* is no down resolution.
*/
double horizontalSpeedRawResolution(bool dir);

/**
* Compute horizontal speed *raw* resolution maneuver for corrective region.
* Raw resolution is the resolution without persistence
* @parameter dir is up (true)/down (false) of ownship current horizontal speed
* @parameter u units
* @return horizontal speed resolution in specified units [u] in specified direction.
* Resolution maneuver is valid for lookahead time in seconds. Return NaN if there is no conflict,
* positive infinity if there is no up resolution, and negative infinity if there
* is no down resolution.
*/
double horizontalSpeedRawResolution(bool dir, const std::string& u);

/**
* Compute preferred horizontal speed direction on resolution that is closer to current horizontal speed.
* True: Increase speed, False: Decrease speed.
Expand Down Expand Up @@ -2224,6 +2270,29 @@ class Daidalus : public GenericStateBands, public ErrorReporter {
*/
double verticalSpeedResolution(bool dir, const std::string& u);

/**
* Compute vertical speed *raw* resolution maneuver for given direction.
* Raw resolution is the resolution without persistence
* @parameter dir is up (true)/down (false) of ownship current vertical speed
* @return vertical speed resolution in internal units [m/s] in specified direction.
* Resolution maneuver is valid for lookahead time in seconds. Return NaN if there is no conflict,
* positive infinity if there is no up resolution, and negative infinity if there
* is no down resolution.
*/
double verticalSpeedRawResolution(bool dir);

/**
* Compute vertical speed *raw* resolution maneuver for given direction.
* Raw resolution is the resolution without persistence
* @parameter dir is up (true)/down (false) of ownship current vertical speed
* @parameter u units
* @return vertical speed resolution in specified units [u] in specified direction.
* Resolution maneuver is valid for lookahead time in seconds. Return NaN if there is no conflict,
* positive infinity if there is no up resolution, and negative infinity if there
* is no down resolution.
*/
double verticalSpeedRawResolution(bool dir, const std::string& u);

/**
* Compute preferred vertical speed direction based on resolution that is closer to current vertical speed.
* True: Increase speed, False: Decrease speed.
Expand Down Expand Up @@ -2349,6 +2418,29 @@ class Daidalus : public GenericStateBands, public ErrorReporter {
*/
double altitudeResolution(bool dir, const std::string& u);

/**
* Compute altitude *raw* resolution maneuver for given direction.
* Raw resolution is the resolution without persistence
* @parameter dir is up (true)/down (false) of ownship current altitude
* @return altitude resolution in internal units [m] in specified direction.
* Resolution maneuver is valid for lookahead time in seconds. Return NaN if there is no conflict,
* positive infinity if there is no up resolution, and negative infinity if there
* is no down resolution.
*/
double altitudeRawResolution(bool dir);

/**
* Compute altitude *raw* resolution maneuver for given direction.
* Raw resolution is the resolution without persistence
* @parameter dir is up (true)/down (false) of ownship current altitude
* @parameter u units
* @return altitude resolution in specified units [u] in specified direction.
* Resolution maneuver is valid for lookahead time in seconds. Return NaN if there is no conflict,
* positive infinity if there is no up resolution, and negative infinity if there
* is no down resolution.
*/
double altitudeRawResolution(bool dir, const std::string& u);

/**
* Compute preferred altitude direction on resolution that is closer to current altitude.
* True: Climb, False: Descend.
Expand Down
8 changes: 8 additions & 0 deletions C++/include/DaidalusRealBands.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,14 @@ class DaidalusRealBands : public DaidalusIntegerBands {
*/
double resolution(DaidalusCore& core, bool dir);

/**
* Returns raw resolution maneuver (no hysteresis, no persistence).
* Return NaN if there is no conflict or if input is invalid.
* Return positive/negative infinity if there is no resolution to the
* right/up and negative infinity if there is no resolution to the left/down.
*/
double raw_resolution(DaidalusCore& core, bool dir);

/**
* Compute preferred direction based on resolution that is closer
* to current value.
Expand Down
16 changes: 16 additions & 0 deletions C++/src/BandsHysteresis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ double BandsHysteresis::getLastResolutionUp() const {
return resolution_up_;
}

double BandsHysteresis::getRawResolutionLow() const {
return raw_low_;
}

double BandsHysteresis::getRawResolutionUp() const {
return raw_up_;
}

int BandsHysteresis::getLastNFactorLow() const {
return nfactor_low_;
}
Expand Down Expand Up @@ -90,6 +98,10 @@ void BandsHysteresis::reset() {

resolution_up_ = NAN;
resolution_low_ = NAN;

raw_up_ = NAN;
raw_low_ = NAN;

nfactor_up_ = 0;
nfactor_low_ = 0;
}
Expand Down Expand Up @@ -427,6 +439,8 @@ void BandsHysteresis::bandsHysteresis(const std::vector<BandsRange>& ranges,
res_u = ranges[idx_u].interval.low;
}
}
raw_low_ = res_l;
raw_up_ = res_u;
resolutionsHysteresis(ranges,corrective_region,delta,nfactor,val,idx_l,res_l,idx_u,res_u);
preferredDirectionHysteresis(delta,val,res_l,res_u);
}
Expand All @@ -447,6 +461,8 @@ std::string BandsHysteresis::toString() const {
s += "time_of_dir_ = "+FmPrecision(time_of_dir_)+"\n";
s += "resolution_low_ = "+FmPrecision(resolution_low_)+"\n";
s += "resolution_up_ = "+FmPrecision(resolution_up_)+"\n";
s += "raw_low_ = "+FmPrecision(raw_low_)+"\n";
s += "raw_up_ = "+FmPrecision(raw_up_)+"\n";
s += "nfactor_low_ = "+Fmi(nfactor_low_)+"\n";
s += "nfactor_up_ = "+Fmi(nfactor_up_)+"\n";
s += "conflict_region_ = "+BandsRegion::to_string(conflict_region_)+"\n";
Expand Down
Loading

0 comments on commit 2ef80cd

Please sign in to comment.