Fix DCM intersecting time

This commit is contained in:
emanuel 2022-02-09 11:47:16 +00:00
parent 258190395e
commit 55d6488c41
1 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@
#define SLEEP_TIME_MS 100
static int are_paths_intersecting(it2s_tender_st_s* tA, int tA_len, it2s_tender_st_s* tB, int tB_len) {
static int are_paths_intersecting(it2s_tender_st_s* tA, int tA_len, it2s_tender_st_s* tB, int tB_len, uint64_t now) {
// TODO check first time intersection, then the spacial trajectory
@ -32,7 +32,7 @@ static int are_paths_intersecting(it2s_tender_st_s* tA, int tA_len, it2s_tender_
if (it2s_tender_do_segments_intersect(A1, A2, B1, B2)) {
if (tA[a].timestamp < tB[b].timestamp + 2000 &&
tA[a].timestamp > tB[b].timestamp - 2000) {
syslog_info("[facilities] [dc] intersecting @ (%d, %d) in %ld ms", tA[a].latitude, tA[a].longitude, tA[a].timestamp-tA[0].timestamp);
syslog_info("[facilities] [dc] intersecting @ (%d, %d) in %ld ms", tA[a].latitude, tA[a].longitude, tA[a].timestamp-now);
return 1;
}
}
@ -81,7 +81,7 @@ int dcm_check(void* fc, DCM_t* dcm) {
}
if (trajectoryA_len > 1 && trajectoryB_len > 1) {
are_paths_intersecting(trajectoryA, trajectoryA_len, trajectoryB, trajectoryB_len);
are_paths_intersecting(trajectoryA, trajectoryA_len, trajectoryB, trajectoryB_len, now);
}
cleanup: