mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-30 19:33:45 +08:00
openpilot v0.7.8 release
This commit is contained in:
@@ -56,7 +56,6 @@ int main(int argc, char **argv) {
|
||||
buf = visionstream_get(&stream, &extra);
|
||||
if (buf == NULL) {
|
||||
printf("visionstream get failed\n");
|
||||
visionstream_destroy(&stream);
|
||||
break;
|
||||
}
|
||||
//printf("frame_id: %d %dx%d\n", extra.frame_id, buf_info.width, buf_info.height);
|
||||
@@ -84,11 +83,9 @@ int main(int argc, char **argv) {
|
||||
LOGD("dmonitoring process: %.2fms, from last %.2fms", t2-t1, t1-last);
|
||||
last = t1;
|
||||
}
|
||||
|
||||
visionstream_destroy(&stream);
|
||||
}
|
||||
|
||||
visionstream_destroy(&stream);
|
||||
|
||||
dmonitoring_free(&dmonitoringmodel);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -181,7 +181,7 @@ int main(int argc, char **argv) {
|
||||
cl_mem yuv_cl;
|
||||
VisionBuf yuv_ion = visionbuf_allocate_cl(buf_info.buf_len, device_id, context, &yuv_cl);
|
||||
|
||||
uint32_t last_vipc_frame_id = 0;
|
||||
uint32_t frame_id = 0, last_vipc_frame_id = 0;
|
||||
double last = 0;
|
||||
int desire = -1;
|
||||
while (!do_exit) {
|
||||
@@ -190,7 +190,6 @@ int main(int argc, char **argv) {
|
||||
buf = visionstream_get(&stream, &extra);
|
||||
if (buf == NULL) {
|
||||
LOGW("visionstream get failed");
|
||||
visionstream_destroy(&stream);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -202,6 +201,7 @@ int main(int argc, char **argv) {
|
||||
if (sm.update(0) > 0){
|
||||
// TODO: path planner timeout?
|
||||
desire = ((int)sm["pathPlan"].getPathPlan().getDesire()) - 1;
|
||||
frame_id = sm["frame"].getFrame().getFrameId();
|
||||
}
|
||||
|
||||
double mt1 = 0, mt2 = 0;
|
||||
@@ -212,8 +212,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
mat3 model_transform = matmul3(yuv_transform, transform);
|
||||
uint32_t frame_id = sm["frame"].getFrame().getFrameId();
|
||||
|
||||
|
||||
mt1 = millis_since_boot();
|
||||
|
||||
// TODO: don't make copies!
|
||||
@@ -232,17 +231,16 @@ int main(int argc, char **argv) {
|
||||
model_publish(pm, extra.frame_id, frame_id, vipc_dropped_frames, frame_drop_perc, model_buf, extra.timestamp_eof);
|
||||
posenet_publish(pm, extra.frame_id, frame_id, vipc_dropped_frames, frame_drop_perc, model_buf, extra.timestamp_eof);
|
||||
|
||||
LOGD("model process: %.2fms, from last %.2fms, vipc_frame_id %zu, frame_id, %zu, frame_drop %.3f%", mt2-mt1, mt1-last, extra.frame_id, frame_id, frame_drop_perc);
|
||||
LOGD("model process: %.2fms, from last %.2fms, vipc_frame_id %zu, frame_id, %zu, frame_drop %.3f", mt2-mt1, mt1-last, extra.frame_id, frame_id, frame_drop_perc);
|
||||
last = mt1;
|
||||
last_vipc_frame_id = extra.frame_id;
|
||||
}
|
||||
|
||||
}
|
||||
visionbuf_free(&yuv_ion);
|
||||
visionstream_destroy(&stream);
|
||||
}
|
||||
|
||||
visionstream_destroy(&stream);
|
||||
|
||||
model_free(&model);
|
||||
|
||||
LOG("joining live_thread");
|
||||
|
||||
@@ -15,13 +15,13 @@ void frame_init(ModelFrame* frame, int width, int height,
|
||||
frame->transformed_height = height;
|
||||
|
||||
frame->transformed_y_cl = clCreateBuffer(frame->context, CL_MEM_READ_WRITE,
|
||||
frame->transformed_width*frame->transformed_height, NULL, &err);
|
||||
(size_t)frame->transformed_width*frame->transformed_height, NULL, &err);
|
||||
assert(err == 0);
|
||||
frame->transformed_u_cl = clCreateBuffer(frame->context, CL_MEM_READ_WRITE,
|
||||
(frame->transformed_width/2)*(frame->transformed_height/2), NULL, &err);
|
||||
(size_t)(frame->transformed_width/2)*(frame->transformed_height/2), NULL, &err);
|
||||
assert(err == 0);
|
||||
frame->transformed_v_cl = clCreateBuffer(frame->context, CL_MEM_READ_WRITE,
|
||||
(frame->transformed_width/2)*(frame->transformed_height/2), NULL, &err);
|
||||
(size_t)(frame->transformed_width/2)*(frame->transformed_height/2), NULL, &err);
|
||||
assert(err == 0);
|
||||
|
||||
frame->net_input_size = ((width*height*3)/2)*sizeof(float);
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
#include <libyuv.h>
|
||||
|
||||
#define MODEL_WIDTH 160
|
||||
#define MODEL_HEIGHT 320
|
||||
#define FULL_W 426
|
||||
#define MODEL_WIDTH 320
|
||||
#define MODEL_HEIGHT 640
|
||||
#define FULL_W 852
|
||||
|
||||
#if defined(QCOM) || defined(QCOM2)
|
||||
#define input_lambda(x) (x - 128.f) * 0.0078125f
|
||||
@@ -136,6 +136,7 @@ DMonitoringResult dmonitoring_eval_frame(DMonitoringModelState* s, void* stream_
|
||||
memcpy(&ret.right_eye_prob, &s->output[30], sizeof ret.right_eye_prob);
|
||||
memcpy(&ret.left_blink_prob, &s->output[31], sizeof ret.right_eye_prob);
|
||||
memcpy(&ret.right_blink_prob, &s->output[32], sizeof ret.right_eye_prob);
|
||||
memcpy(&ret.sg_prob, &s->output[33], sizeof ret.sg_prob);
|
||||
ret.face_orientation_meta[0] = softplus(ret.face_orientation_meta[0]);
|
||||
ret.face_orientation_meta[1] = softplus(ret.face_orientation_meta[1]);
|
||||
ret.face_orientation_meta[2] = softplus(ret.face_orientation_meta[2]);
|
||||
@@ -166,6 +167,7 @@ void dmonitoring_publish(PubMaster &pm, uint32_t frame_id, const DMonitoringResu
|
||||
framed.setRightEyeProb(res.right_eye_prob);
|
||||
framed.setLeftBlinkProb(res.left_blink_prob);
|
||||
framed.setRightBlinkProb(res.right_blink_prob);
|
||||
framed.setSgProb(res.sg_prob);
|
||||
|
||||
pm.send("driverState", msg);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define OUTPUT_SIZE 33
|
||||
#define OUTPUT_SIZE 34
|
||||
#define RHD_CHECK_INTERVAL 10
|
||||
|
||||
typedef struct DMonitoringResult {
|
||||
@@ -22,6 +22,7 @@ typedef struct DMonitoringResult {
|
||||
float right_eye_prob;
|
||||
float left_blink_prob;
|
||||
float right_blink_prob;
|
||||
float sg_prob;
|
||||
} DMonitoringResult;
|
||||
|
||||
typedef struct DMonitoringModelState {
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
#include "common/params.h"
|
||||
#include "driving.h"
|
||||
|
||||
|
||||
|
||||
|
||||
#define PATH_IDX 0
|
||||
#define LL_IDX PATH_IDX + MODEL_PATH_DISTANCE*2 + 1
|
||||
#define RL_IDX LL_IDX + MODEL_PATH_DISTANCE*2 + 2
|
||||
@@ -48,17 +45,14 @@ void model_init(ModelState* s, cl_device_id device_id, cl_context context, int t
|
||||
#endif
|
||||
|
||||
#ifdef DESIRE
|
||||
s->prev_desire = (float*)malloc(DESIRE_LEN * sizeof(float));
|
||||
for (int i = 0; i < DESIRE_LEN; i++) s->prev_desire[i] = 0.0;
|
||||
s->pulse_desire = (float*)malloc(DESIRE_LEN * sizeof(float));
|
||||
for (int i = 0; i < DESIRE_LEN; i++) s->pulse_desire[i] = 0.0;
|
||||
s->m->addDesire(s->pulse_desire, DESIRE_LEN);
|
||||
s->prev_desire = std::make_unique<float[]>(DESIRE_LEN);
|
||||
s->pulse_desire = std::make_unique<float[]>(DESIRE_LEN);
|
||||
s->m->addDesire(s->pulse_desire.get(), DESIRE_LEN);
|
||||
#endif
|
||||
|
||||
#ifdef TRAFFIC_CONVENTION
|
||||
s->traffic_convention = (float*)malloc(TRAFFIC_CONVENTION_LEN * sizeof(float));
|
||||
for (int i = 0; i < TRAFFIC_CONVENTION_LEN; i++) s->traffic_convention[i] = 0.0;
|
||||
s->m->addTrafficConvention(s->traffic_convention, TRAFFIC_CONVENTION_LEN);
|
||||
s->traffic_convention = std::make_unique<float[]>(TRAFFIC_CONVENTION_LEN);
|
||||
s->m->addTrafficConvention(s->traffic_convention.get(), TRAFFIC_CONVENTION_LEN);
|
||||
|
||||
std::vector<char> result = read_db_bytes("IsRHD");
|
||||
if (result.size() > 0) {
|
||||
@@ -79,8 +73,6 @@ void model_init(ModelState* s, cl_device_id device_id, cl_context context, int t
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ModelDataRaw model_eval_frame(ModelState* s, cl_command_queue q,
|
||||
cl_mem yuv_cl, int width, int height,
|
||||
mat3 transform, void* sock,
|
||||
@@ -100,7 +92,6 @@ ModelDataRaw model_eval_frame(ModelState* s, cl_command_queue q,
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//for (int i = 0; i < OUTPUT_SIZE + TEMPORAL_SIZE; i++) { printf("%f ", s->output[i]); } printf("\n");
|
||||
|
||||
float *new_frame_buf = frame_prepare(&s->frame, q, yuv_cl, width, height, transform);
|
||||
@@ -163,7 +154,6 @@ void poly_fit(float *in_pts, float *in_stds, float *out, int valid_len) {
|
||||
out[3] = y0;
|
||||
}
|
||||
|
||||
|
||||
void fill_path(cereal::ModelData::PathData::Builder path, const float * data, bool has_prob, const float offset) {
|
||||
float points_arr[MODEL_PATH_DISTANCE];
|
||||
float stds_arr[MODEL_PATH_DISTANCE];
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "runners/run.h"
|
||||
|
||||
#include <czmq.h>
|
||||
#include <memory>
|
||||
#include "messaging.hpp"
|
||||
|
||||
#define MODEL_WIDTH 512
|
||||
@@ -58,11 +59,11 @@ typedef struct ModelState {
|
||||
float *input_frames;
|
||||
RunModel *m;
|
||||
#ifdef DESIRE
|
||||
float *prev_desire;
|
||||
float *pulse_desire;
|
||||
std::unique_ptr<float[]> prev_desire;
|
||||
std::unique_ptr<float[]> pulse_desire;
|
||||
#endif
|
||||
#ifdef TRAFFIC_CONVENTION
|
||||
float *traffic_convention;
|
||||
std::unique_ptr<float[]> traffic_convention;
|
||||
#endif
|
||||
} ModelState;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user