mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-22 16:43:43 +08:00
Cereal cleanup (#20003)
* start cleanup * fan speed * cleanup dm * fix cereal * hwType -> pandaType * update refs * update refs * bump cereal * freeSpacePercent * cereal master
This commit is contained in:
@@ -7,7 +7,7 @@ import cereal.messaging as messaging
|
||||
from selfdrive.car.car_helpers import get_car, get_one_can
|
||||
from selfdrive.boardd.boardd import can_list_to_can_capnp
|
||||
|
||||
HwType = log.HealthData.HwType
|
||||
PandaType = log.HealthData.PandaType
|
||||
|
||||
|
||||
def steer_thread():
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
#include <capnp/schema.h>
|
||||
|
||||
// include the dynamic struct
|
||||
#include "cereal/gen/cpp/car.capnp.c++"
|
||||
#include "cereal/gen/cpp/log.capnp.c++"
|
||||
#include "cereal/gen/cpp/car.capnp.c++"
|
||||
#include "cereal/gen/cpp/legacy.capnp.c++"
|
||||
#include "cereal/services.h"
|
||||
|
||||
#include "Unlogger.hpp"
|
||||
|
||||
+4
-2
@@ -165,6 +165,7 @@ void Window::paintEvent(QPaintEvent *event) {
|
||||
//p.drawRect(0, 0, 600, 100);
|
||||
|
||||
// TODO: we really don't have to redraw this every time, only on updates to events
|
||||
float vEgo = 0.;
|
||||
int this_event_size = events.size();
|
||||
if (last_event_size != this_event_size) {
|
||||
if (px != NULL) delete px;
|
||||
@@ -179,10 +180,11 @@ void Window::paintEvent(QPaintEvent *event) {
|
||||
for (auto e : events) {
|
||||
auto type = e.which();
|
||||
//printf("%lld %d\n", e.getLogMonoTime()-t0, type);
|
||||
if (type == cereal::Event::CONTROLS_STATE) {
|
||||
if (type == cereal::Event::CAR_STATE) {
|
||||
vEgo = e.getCarState().getVEgo();
|
||||
} else if (type == cereal::Event::CONTROLS_STATE) {
|
||||
auto controlsState = e.getControlsState();
|
||||
uint64_t t = (e.getLogMonoTime()-t0);
|
||||
float vEgo = controlsState.getVEgo();
|
||||
int enabled = controlsState.getState() == cereal::ControlsState::OpenpilotState::ENABLED;
|
||||
int rt = timeToPixel(t); // 250 ms per pixel
|
||||
if (rt != lt) {
|
||||
|
||||
+2
-2
@@ -70,7 +70,7 @@ def ui_thread(addr, frame_address):
|
||||
|
||||
frame = messaging.sub_sock('frame', addr=addr, conflate=True)
|
||||
sm = messaging.SubMaster(['carState', 'plan', 'carControl', 'radarState', 'liveCalibration', 'controlsState',
|
||||
'liveTracks', 'model', 'liveMpc', 'liveParameters', 'pathPlan', 'frame'], addr=addr)
|
||||
'liveTracks', 'model', 'liveMpc', 'liveParameters', 'lateralPlan', 'frame'], addr=addr)
|
||||
|
||||
calibration = None
|
||||
img = np.zeros((480, 640, 3), dtype='uint8')
|
||||
@@ -184,7 +184,7 @@ def ui_thread(addr, frame_address):
|
||||
if len(sm['model'].path.poly) > 0:
|
||||
model_data = extract_model_data(sm['model'])
|
||||
plot_model(model_data, VM, sm['controlsState'].vEgo, sm['controlsState'].curvature, imgw, calibration,
|
||||
top_down, np.array(sm['pathPlan'].dPolyDEPRECATED))
|
||||
top_down, np.array(sm['lateralPlan'].dPolyDEPRECATED))
|
||||
|
||||
# MPC
|
||||
if sm.updated['liveMpc']:
|
||||
|
||||
+5
-5
@@ -88,7 +88,7 @@ def health_function():
|
||||
dat.valid = True
|
||||
dat.health = {
|
||||
'ignitionLine': True,
|
||||
'hwType': "blackPanda",
|
||||
'pandaType': "blackPanda",
|
||||
'controlsAllowed': True,
|
||||
'safetyModel': 'hondaNidec'
|
||||
}
|
||||
@@ -104,7 +104,7 @@ def fake_gps():
|
||||
time.sleep(0.01)
|
||||
|
||||
def fake_driver_monitoring():
|
||||
pm = messaging.PubMaster(['driverState','dMonitoringState'])
|
||||
pm = messaging.PubMaster(['driverState','driverMonitoringState'])
|
||||
while 1:
|
||||
|
||||
# dmonitoringmodeld output
|
||||
@@ -113,14 +113,14 @@ def fake_driver_monitoring():
|
||||
pm.send('driverState', dat)
|
||||
|
||||
# dmonitoringd output
|
||||
dat = messaging.new_message('dMonitoringState')
|
||||
dat.dMonitoringState = {
|
||||
dat = messaging.new_message('driverMonitoringState')
|
||||
dat.driverMonitoringState = {
|
||||
"faceDetected": True,
|
||||
"isDistracted": False,
|
||||
"awarenessStatus": 1.,
|
||||
"isRHD": False,
|
||||
}
|
||||
pm.send('dMonitoringState', dat)
|
||||
pm.send('driverMonitoringState', dat)
|
||||
|
||||
time.sleep(DT_DMON)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user