Change DCM intersect info
This commit is contained in:
parent
bf2ba4604c
commit
54d5b968bc
15
src/dcm.c
15
src/dcm.c
|
|
@ -12,7 +12,8 @@
|
||||||
|
|
||||||
static int are_vehicles_intersecting(
|
static int are_vehicles_intersecting(
|
||||||
it2s_tender_st_s* tA, int tA_len, uint16_t vA_length, uint16_t vA_width,
|
it2s_tender_st_s* tA, int tA_len, uint16_t vA_length, uint16_t vA_width,
|
||||||
it2s_tender_st_s* tB, int tB_len, uint16_t vB_length, uint16_t vB_width
|
it2s_tender_st_s* tB, int tB_len, uint16_t vB_length, uint16_t vB_width,
|
||||||
|
int* index
|
||||||
) {
|
) {
|
||||||
|
|
||||||
// TODO check first time intersection, then the spacial trajectory
|
// TODO check first time intersection, then the spacial trajectory
|
||||||
|
|
@ -37,7 +38,7 @@ static int are_vehicles_intersecting(
|
||||||
if (it2s_tender_is_inside_rectangle(tA[a].latitude, tA[a].longitude, tB[b].latitude, tB[b].longitude, 8, 8, 0, DCM_HAVERSINE)) {
|
if (it2s_tender_is_inside_rectangle(tA[a].latitude, tA[a].longitude, tB[b].latitude, tB[b].longitude, 8, 8, 0, DCM_HAVERSINE)) {
|
||||||
if (tA[a].timestamp < tB[b].timestamp + 2000 &&
|
if (tA[a].timestamp < tB[b].timestamp + 2000 &&
|
||||||
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);
|
*index = a;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -86,7 +87,15 @@ int dcm_check(void* fc, DCM_t* dcm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trajectoryA_len > 1 && trajectoryB_len > 1) {
|
if (trajectoryA_len > 1 && trajectoryB_len > 1) {
|
||||||
are_vehicles_intersecting(trajectoryA, trajectoryA_len, facilities->vehicle.length, facilities->vehicle.width, trajectoryB, trajectoryB_len, dcm->dcm.vehicleDimensions.length, dcm->dcm.vehicleDimensions.width);
|
int index = 0;
|
||||||
|
if (are_vehicles_intersecting(
|
||||||
|
trajectoryA, trajectoryA_len, facilities->vehicle.length, facilities->vehicle.width,
|
||||||
|
trajectoryB, trajectoryB_len, dcm->dcm.vehicleDimensions.length, dcm->dcm.vehicleDimensions.width,
|
||||||
|
&index)
|
||||||
|
) {
|
||||||
|
syslog_info("[facilities] [dc] intersection danger with %ld @ (%d, %d) in %ld ms",
|
||||||
|
dcm->header.stationID, trajectoryA[index].latitude, trajectoryA[index].longitude, trajectoryA[index].timestamp - now);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue