本文整理汇总了C++中TrafficState类的典型用法代码示例。如果您正苦于以下问题:C++ TrafficState类的具体用法?C++ TrafficState怎么用?C++ TrafficState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TrafficState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vert_repul_at
bool KinematicIntegerBands::vert_repul_at(double tstep, bool trajdir, int k, const TrafficState& ownship,
const TrafficState& repac, int epsv) const {
// repac is not NULL at this point and k >= 0
if (k==0) {
return true;
}
std::pair<Vect3,Velocity> sovo = trajectory(ownship,0,trajdir);
Vect3 so = sovo.first;
Vect3 vo = sovo.second;
Vect3 si = repac.get_s();
Vect3 vi = repac.get_v();
bool rep = true;
if (k==1) {
rep = CriteriaCore::vertical_new_repulsive_criterion(so.Sub(si),vo,vi,linvel(ownship,tstep,trajdir,0),epsv);
}
if (rep) {
std::pair<Vect3,Velocity> sovot = trajectory(ownship,k*tstep,trajdir);
Vect3 sot = sovot.first;
Vect3 vot = sovot.second;
Vect3 sit = vi.ScalAdd(k*tstep,si);
Vect3 st = sot.Sub(sit);
Vect3 vop = linvel(ownship,tstep,trajdir,k-1);
Vect3 vok = linvel(ownship,tstep,trajdir,k);
return CriteriaCore::vertical_new_repulsive_criterion(st,vop,vi,vot,epsv) &&
CriteriaCore::vertical_new_repulsive_criterion(st,vot,vi,vok,epsv) &&
CriteriaCore::vertical_new_repulsive_criterion(st,vop,vi,vok,epsv);
}
return false;
}
示例2: epsilonH
int KinematicBandsCore::epsilonH(const OwnshipState& ownship, const TrafficState& ac) {
Position pi = ac.getPosition();
Velocity vi = ac.getVelocity();
Vect2 s = ownship.get_s().Sub(ownship.pos_to_s(pi)).vect2();
Vect2 v = ownship.get_v().Sub(ownship.vel_to_v(pi,vi)).vect2();
return CriteriaCore::horizontalCoordination(s,v);
}
示例3: epsilonV
int KinematicBandsCore::epsilonV(const OwnshipState& ownship, const TrafficState& ac) {
Position pi = ac.getPosition();
Velocity vi = ac.getVelocity();
Vect3 si = ownship.pos_to_s(pi);
Vect3 s = ownship.get_s().Sub(si);
return CriteriaCore::verticalCoordinationLoS(s,ownship.get_v(),ownship.vel_to_v(pi,vi),
ownship.getId(), ac.getId());
}
示例4: first_band_alt_generic
int KinematicAltBands::first_band_alt_generic(Detection3D* conflict_det, Detection3D* recovery_det,
double B, double T, double B2, double T2,
const TrafficState& ownship, const std::vector<TrafficState>& traffic, bool dir, bool green) {
int upper = (int)(dir ? std::floor((max_val(ownship)-min_val(ownship))/get_step())+1 :
std::floor((ownship.altitude()-min_val(ownship))/get_step()));
int lower = dir ? (int)(std::ceil(ownship.altitude()-min_val(ownship))/get_step()) : 0;
if (ownship.altitude() < min_val(ownship) || ownship.altitude() > max_val(ownship)) {
return -1;
} else {
return first_nat(lower,upper,dir,conflict_det,recovery_det,B,T,B2,T2,ownship,traffic,green);
}
}
示例5: cd_future_traj
bool KinematicIntegerBands::cd_future_traj(Detection3D* det, double B, double T, bool trajdir, double t,
const TrafficState& ownship, const TrafficState& ac) const {
if (t > T || B > T) return false;
std::pair<Vect3,Velocity> sovot = trajectory(ownship,t,trajdir);
Vect3 sot = sovot.first;
Velocity vot = sovot.second;
Vect3 si = ac.get_s();
Velocity vi = ac.get_v();
Vect3 sit = vi.ScalAdd(t,si);
if (B > t) {
return conflict(det, sot, vot, sit, vi, B-t, T-t);
}
return conflict(det, sot, vot, sit, vi, 0, T-t);
}
示例6: any_los_aircraft
bool KinematicIntegerBands::any_los_aircraft(Detection3D* det, bool trajdir, double tsk,
const TrafficState& ownship, const std::vector<TrafficState>& traffic) const {
for (TrafficState::nat i=0; i < traffic.size(); ++i) {
TrafficState ac = traffic[i];
std::pair<Vect3,Velocity> sovot = trajectory(ownship,tsk,trajdir);
Vect3 sot = sovot.first;
Velocity vot = sovot.second;
Vect3 si = ac.get_s();
Velocity vi = ac.get_v();
Vect3 sit = vi.ScalAdd(tsk,si);
if (det->violation(sot, vot, sit, vi))
return true;
}
return false;
}
示例7: epsilonV
int KinematicBandsCore::epsilonV(const TrafficState& ownship, const TrafficState& ac) {
if (ownship.isValid() && ac.isValid()) {
Vect3 s = ownship.get_s().Sub(ac.get_s());
return CriteriaCore::verticalCoordinationLoS(s,ownship.get_v(),ac.get_v(),
ownship.getId(), ac.getId());
} else {
return 0;
}
}
示例8:
std::pair<Vect3, Velocity> KinematicTrkBands::trajectory(const TrafficState& ownship, double time, bool dir) const {
std::pair<Position,Velocity> posvel;
if (instantaneous_bands()) {
double trk = ownship.getVelocity().trk()+(dir?1:-1)*j_step_*get_step();
posvel = std::pair<Position,Velocity>(ownship.getPosition(),ownship.getVelocity().mkTrk(trk));
} else {
double gso = ownship.groundSpeed();
double bank = turn_rate_ == 0 ? bank_angle_ : std::abs(Kinematics::bankAngle(gso,turn_rate_));
double R = Kinematics::turnRadius(ownship.get_v().gs(), bank);
posvel = ProjectedKinematics::turn(ownship.getPosition(),ownship.getVelocity(),time,R,dir);
}
return std::pair<Vect3, Velocity>(ownship.pos_to_s(posvel.first),ownship.vel_to_v(posvel.first,posvel.second));
}
示例9: no_instantaneous_conflict
bool KinematicIntegerBands::no_instantaneous_conflict(Detection3D* conflict_det, Detection3D* recovery_det,
double B, double T, double B2, double T2,
bool trajdir, const TrafficState& ownship, const std::vector<TrafficState>& traffic,
const TrafficState& repac,
int epsh, int epsv) {
bool usehcrit = repac.isValid() && epsh != 0;
bool usevcrit = repac.isValid() && epsv != 0;
std::pair<Vect3,Velocity> nsovo = trajectory(ownship,0,trajdir);
Vect3 so = ownship.get_s();
Vect3 vo = ownship.get_v();
Vect3 si = repac.get_s();
Vect3 vi = repac.get_v();
Vect3 nvo = nsovo.second;
Vect3 s = so.Sub(si);
return
(!usehcrit || CriteriaCore::horizontal_new_repulsive_criterion(s,vo,vi,nvo,epsh)) &&
(!usevcrit || CriteriaCore::vertical_new_repulsive_criterion(s,vo,vi,nvo,epsv)) &&
no_conflict(conflict_det,recovery_det,B,T,B2,T2,trajdir,0,ownship,traffic);
}
示例10: red_band_exist
// trajdir: false is left
bool KinematicIntegerBands::red_band_exist(Detection3D* conflict_det, Detection3D* recovery_det, double tstep,
double B, double T, double B2, double T2,
bool trajdir, int max, const TrafficState& ownship, const std::vector<TrafficState>& traffic, const TrafficState& repac,
int epsh, int epsv) const {
bool usehcrit = repac.isValid() && epsh != 0;
bool usevcrit = repac.isValid() && epsv != 0;
return (usehcrit && first_nonrepulsive_step(tstep,trajdir,max,ownship,repac,epsh) >= 0) ||
(usevcrit && first_nonvert_repul_step(tstep,trajdir,max,ownship,repac,epsv) >= 0) ||
any_conflict_step(conflict_det,tstep,B,T,trajdir,max,ownship,traffic) ||
(recovery_det != NULL && any_conflict_step(recovery_det,tstep,B2,T2,trajdir,max,ownship,traffic));
}
示例11: all_red
bool KinematicVsBands::all_red(Detection3D* conflict_det, Detection3D* recovery_det, const TrafficState& repac,
double B, double T, const OwnshipState& ownship, const std::vector<TrafficState>& traffic) const {
double vso = ownship.getVelocity().vs();
int maxdown = (int)std::max(std::ceil((vso-min)/step),0.0)+1;
int maxup = (int)std::max(std::ceil((max-vso)/step),0.0)+1;
double tstep = step/vertical_accel;
int epsv = 0;
if (repac.isValid()) {
epsv = KinematicBandsCore::epsilonV(ownship,repac);
}
return KinematicIntegerBands::all_int_red(conflict_det,recovery_det,tstep,B,T,0,B,maxdown,maxup,ownship,traffic,repac,0,epsv,0);
}
示例12: conflict_aircraft
/**
* Put in conflict_acs_ the list of aircraft predicted to be in conflict for the given alert level.
* Requires: 1 <= alert_level <= parameters.alertor.mostSevereAlertLevel()
*/
void KinematicBandsCore::conflict_aircraft(int alert_level) {
double tin = PINFINITY;
double tout = NINFINITY;
bool conflict_band = BandsRegion::isConflictBand(parameters.alertor.getLevel(alert_level).getRegion());
Detection3D* detector = parameters.alertor.getLevel(alert_level).getDetectorRef();
double alerting_time = Util::min(parameters.getLookaheadTime(),
parameters.alertor.getLevel(alert_level).getAlertingTime());
for (TrafficState::nat i = 0; i < traffic.size(); ++i) {
TrafficState ac = traffic[i];
ConflictData det = detector->conflictDetection(ownship.get_s(),ownship.get_v(),ac.get_s(),ac.get_v(),
0,parameters.getLookaheadTime());
bool lowc = detector->violation(ownship.get_s(),ownship.get_v(),ac.get_s(),ac.get_v());
if (lowc || det.conflict()) {
if (conflict_band && (lowc || det.getTimeIn() < alerting_time)) {
conflict_acs_[alert_level-1].push_back(ac);
}
tin = Util::min(tin,det.getTimeIn());
tout = Util::max(tout,det.getTimeOut());
}
}
tiov_.push_back(Interval(tin,tout));
}
示例13: none_bands
void KinematicVsBands::none_bands(IntervalSet& noneset, Detection3D* conflict_det, Detection3D* recovery_det, const TrafficState& repac, double B, double T,
const OwnshipState& ownship, const std::vector<TrafficState>& traffic) const {
double vso = ownship.getVelocity().vs();
int maxdown = (int)std::max(std::ceil((vso-min)/step),0.0)+1;
int maxup = (int)std::max(std::ceil((max-vso)/step),0.0)+1;
double tstep = step/vertical_accel;
std::vector<Integerval> vsint = std::vector<Integerval>();
int epsv = 0;
if (repac.isValid()) {
epsv = KinematicBandsCore::epsilonV(ownship,repac);
}
KinematicIntegerBands::kinematic_bands_combine(vsint,conflict_det,recovery_det,tstep,B,T,0,B,maxdown,maxup,ownship,traffic,repac,0,epsv);
KinematicIntegerBands::toIntervalSet(noneset,vsint,step,vso,min,max);
}
示例14: mostUrgentAircraft
TrafficState DCPAUrgencyStrategy::mostUrgentAircraft(Detection3D* detector, const TrafficState& ownship, const std::vector<TrafficState>& traffic, double T) {
TrafficState repac = TrafficState::INVALID;
if (!ownship.isValid() || traffic.empty()) {
return repac;
}
double mindcpa = 0;
double mintcpa = 0;
double D = ACCoRDConfig::NMAC_D;
double H = ACCoRDConfig::NMAC_H;
Vect3 so = ownship.get_s();
Velocity vo = ownship.get_v();
for (TrafficState::nat ac = 0; ac < traffic.size(); ++ac) {
Vect3 si = traffic[ac].get_s();
Velocity vi = traffic[ac].get_v();
Vect3 s = so.Sub(si);
Velocity v = vo.Sub(vi);
ConflictData det = detector->conflictDetection(so,vo,si,vi,0,T);
if (det.conflict()) {
double tcpa = CD3D::tccpa(s,vo,vi,D,H);
double dcpa = v.ScalAdd(tcpa,s).cyl_norm(D,H);
// If aircraft have almost same tcpa, select the one with smallest dcpa
// Otherwise, select aircraft with smallest tcpa
bool tcpa_strategy = Util::almost_equals(tcpa,mintcpa,PRECISION5) ? dcpa < mindcpa : tcpa < mintcpa;
// If aircraft have almost same dcpa, select the one with smallest tcpa
// Otherwise, select aircraft with smallest dcpa
bool dcpa_strategy = Util::almost_equals(dcpa,mindcpa,PRECISION5) ? tcpa < mintcpa : dcpa < mindcpa;
// If aircraft are both in a min recovery trajectory, follows tcpa strategy. Otherwise follows dcpa strategy
if (!repac.isValid() || // There are no candidates
(dcpa <= 1 ? mindcpa > 1 || tcpa_strategy : dcpa_strategy)) {
repac = traffic[ac];
mindcpa = dcpa;
mintcpa = tcpa;
}
}
}
return repac;
}
示例15: epsilonH
int KinematicBandsCore::epsilonH(const TrafficState& ownship, const TrafficState& ac) {
if (ownship.isValid() && ac.isValid()) {
Vect2 s = ownship.get_s().Sub(ac.get_s()).vect2();
Vect2 v = ownship.get_v().Sub(ac.get_v()).vect2();
return CriteriaCore::horizontalCoordination(s,v);
} else {
return 0;
}
}