remove obd support; this has to be replaced with peripherals implementation
This commit is contained in:
parent
11cad350ee
commit
87c629a931
|
|
@ -33,7 +33,6 @@ TARGET_LINK_LIBRARIES(it2s-itss-facilities
|
||||||
-lit2s-asn-evcsnm
|
-lit2s-asn-evcsnm
|
||||||
-lit2s-asn-evrsrm
|
-lit2s-asn-evrsrm
|
||||||
-lit2s-tender
|
-lit2s-tender
|
||||||
-lit2s-obd
|
|
||||||
-lm
|
-lm
|
||||||
-lrt
|
-lrt
|
||||||
)
|
)
|
||||||
|
|
|
||||||
65
src/cam.c
65
src/cam.c
|
|
@ -21,8 +21,6 @@
|
||||||
#include <it2s-tender/recorder.h>
|
#include <it2s-tender/recorder.h>
|
||||||
#include <it2s-tender/packet.h>
|
#include <it2s-tender/packet.h>
|
||||||
|
|
||||||
#include <it2s-obd.h>
|
|
||||||
|
|
||||||
#define EARTH_RADIUS 6369000.0
|
#define EARTH_RADIUS 6369000.0
|
||||||
#define RAD_PER_DEG M_PI/180.0
|
#define RAD_PER_DEG M_PI/180.0
|
||||||
|
|
||||||
|
|
@ -160,15 +158,9 @@ static void path_history_update(pos_point_t* pn) {
|
||||||
static int mk_cam(uint8_t *cam_oer, uint16_t *cam_len) {
|
static int mk_cam(uint8_t *cam_oer, uint16_t *cam_len) {
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
int shm_fd, shm_valid = 0;
|
int shm_fd, shm_valid = 0;
|
||||||
it2s_obd_data* shared_message;
|
|
||||||
|
|
||||||
lightship_t* lightship = &facilities.lightship;
|
lightship_t* lightship = &facilities.lightship;
|
||||||
|
|
||||||
if (lightship->use_obd) {
|
|
||||||
it2s_obd_data* shared_message = malloc(sizeof(it2s_obd_data));
|
|
||||||
it2s_obd_read(shared_message);
|
|
||||||
}
|
|
||||||
|
|
||||||
CAM_t *cam = calloc(1, sizeof(CAM_t));
|
CAM_t *cam = calloc(1, sizeof(CAM_t));
|
||||||
|
|
||||||
cam->header.protocolVersion = 2;
|
cam->header.protocolVersion = 2;
|
||||||
|
|
@ -201,35 +193,6 @@ static int mk_cam(uint8_t *cam_oer, uint16_t *cam_len) {
|
||||||
cam->cam.camParameters.highFrequencyContainer.present = HighFrequencyContainer_PR_basicVehicleContainerHighFrequency;
|
cam->cam.camParameters.highFrequencyContainer.present = HighFrequencyContainer_PR_basicVehicleContainerHighFrequency;
|
||||||
BasicVehicleContainerHighFrequency_t* bvc_hf = &cam->cam.camParameters.highFrequencyContainer.choice.basicVehicleContainerHighFrequency;
|
BasicVehicleContainerHighFrequency_t* bvc_hf = &cam->cam.camParameters.highFrequencyContainer.choice.basicVehicleContainerHighFrequency;
|
||||||
|
|
||||||
if (lightship->use_obd) {
|
|
||||||
uint8_t ac = 0x00;
|
|
||||||
|
|
||||||
// Speed (already getting set bellow)
|
|
||||||
// bvc_hf.speed.speedValue = ceil(shared_message->speed_value ÷ 0.036);
|
|
||||||
// bvc_hf_speed.speedConfidence = 1;
|
|
||||||
|
|
||||||
// Steering Wheel Angle
|
|
||||||
if(shared_message->w_angle_value != 1683 && (now/1000 - shared_message->w_angle_timestamp) <= 1){
|
|
||||||
bvc_hf->steeringWheelAngle = calloc(1, sizeof(SteeringWheelAngle_t));
|
|
||||||
bvc_hf->steeringWheelAngle->steeringWheelAngleValue = shared_message->w_angle_value;
|
|
||||||
bvc_hf->steeringWheelAngle->steeringWheelAngleConfidence = 1;
|
|
||||||
}
|
|
||||||
// still missing temperature; where is de_temperature ?
|
|
||||||
|
|
||||||
// Acceleration Control (encondig failure)
|
|
||||||
if (shared_message->b_pedal_value != 1683 && shared_message->s_pedal_value != 1683 && (now/1000 - shared_message->b_pedal_timestamp) <= 1 && (now - shared_message->s_pedal_timestamp) <= 1){
|
|
||||||
if(shared_message->b_pedal_value)
|
|
||||||
ac = ac | 0x80;
|
|
||||||
if(shared_message->s_pedal_value)
|
|
||||||
ac = ac | 0x40;
|
|
||||||
bvc_hf->accelerationControl = calloc(1, sizeof(AccelerationControl_t));
|
|
||||||
bvc_hf->accelerationControl->buf = malloc(sizeof(uint8_t));
|
|
||||||
memcpy(bvc_hf->accelerationControl->buf, &ac, 1);
|
|
||||||
bvc_hf->accelerationControl->size = 1;
|
|
||||||
bvc_hf->accelerationControl->bits_unused = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set speed
|
// Set speed
|
||||||
bvc_hf->speed.speedValue = epv.space.speed;
|
bvc_hf->speed.speedValue = epv.space.speed;
|
||||||
bvc_hf->speed.speedConfidence = epv.space.speed_conf;
|
bvc_hf->speed.speedConfidence = epv.space.speed_conf;
|
||||||
|
|
@ -311,20 +274,6 @@ static int mk_cam(uint8_t *cam_oer, uint16_t *cam_len) {
|
||||||
|
|
||||||
BasicVehicleContainerLowFrequency_t* bvc_lf = &cam->cam.camParameters.lowFrequencyContainer->choice.basicVehicleContainerLowFrequency;
|
BasicVehicleContainerLowFrequency_t* bvc_lf = &cam->cam.camParameters.lowFrequencyContainer->choice.basicVehicleContainerLowFrequency;
|
||||||
|
|
||||||
if (lightship->use_obd) {
|
|
||||||
uint8_t el = 0x00;
|
|
||||||
|
|
||||||
// Exterior Lights
|
|
||||||
if (shared_message->lights_value != 1683 && (now/1000 - shared_message->lights_timestamp) <= 1) {
|
|
||||||
if (shared_message->lights_value)
|
|
||||||
el = el | 0x80;
|
|
||||||
bvc_lf->exteriorLights.buf = malloc(sizeof(uint8_t));
|
|
||||||
memcpy(bvc_lf->exteriorLights.buf, &el, 1);
|
|
||||||
bvc_lf->exteriorLights.size = 1;
|
|
||||||
bvc_lf->exteriorLights.bits_unused = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PathHistory_t* ph = &cam->cam.camParameters.lowFrequencyContainer->choice.basicVehicleContainerLowFrequency.pathHistory;
|
PathHistory_t* ph = &cam->cam.camParameters.lowFrequencyContainer->choice.basicVehicleContainerLowFrequency.pathHistory;
|
||||||
|
|
||||||
if (lightship->path_history_len != 0) {
|
if (lightship->path_history_len != 0) {
|
||||||
|
|
@ -444,9 +393,6 @@ static int mk_cam(uint8_t *cam_oer, uint16_t *cam_len) {
|
||||||
}
|
}
|
||||||
*cam_len = (enc.encoded + 7) / 8;
|
*cam_len = (enc.encoded + 7) / 8;
|
||||||
|
|
||||||
if (lightship->use_obd)
|
|
||||||
free(shared_message);
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
ASN_STRUCT_FREE(asn_DEF_CAM, cam);
|
ASN_STRUCT_FREE(asn_DEF_CAM, cam);
|
||||||
|
|
||||||
|
|
@ -461,17 +407,6 @@ int lightship_init() {
|
||||||
lightship->protected_zones.pz = calloc(256, sizeof(void*));
|
lightship->protected_zones.pz = calloc(256, sizeof(void*));
|
||||||
pthread_mutex_init(&lightship->lock, NULL);
|
pthread_mutex_init(&lightship->lock, NULL);
|
||||||
|
|
||||||
int shm_fd;
|
|
||||||
shm_fd = shm_open("it2s-obd", O_RDONLY, 0666);
|
|
||||||
if (shm_fd == -1) {
|
|
||||||
log_debug("obd shmem not found\n");
|
|
||||||
lightship->use_obd = 0;
|
|
||||||
} else {
|
|
||||||
log_debug("obd shmem found\n");
|
|
||||||
lightship->use_obd = 1;
|
|
||||||
close(shm_fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,8 +83,6 @@ typedef struct lightship {
|
||||||
uint32_t rsu_gen_min;
|
uint32_t rsu_gen_min;
|
||||||
uint32_t rsu_vehicle_permanence;
|
uint32_t rsu_vehicle_permanence;
|
||||||
|
|
||||||
bool use_obd;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
ProtectedCommunicationZone_t ** pz;
|
ProtectedCommunicationZone_t ** pz;
|
||||||
uint16_t pz_len;
|
uint16_t pz_len;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue