mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-08-21 08:03:42 +08:00
openpilot v0.7 release
This commit is contained in:
@@ -1,115 +0,0 @@
|
||||
CC = clang
|
||||
CXX = clang++
|
||||
|
||||
ARCH := $(shell uname -m)
|
||||
OS := $(shell uname -o)
|
||||
|
||||
BASEDIR = ../..
|
||||
PHONELIBS = ../../phonelibs
|
||||
|
||||
WARN_FLAGS = -Werror=implicit-function-declaration \
|
||||
-Werror=incompatible-pointer-types \
|
||||
-Werror=int-conversion \
|
||||
-Werror=return-type \
|
||||
-Werror=format-extra-args
|
||||
|
||||
CFLAGS = -std=gnu11 -g -fPIC -I../ -I../../ -O2 $(WARN_FLAGS) -Wall
|
||||
CXXFLAGS = -std=c++11 -g -fPIC -I../ -I../../ -O2 $(WARN_FLAGS) -Wall
|
||||
|
||||
MESSAGING_FLAGS = -I$(BASEDIR)/selfdrive/messaging
|
||||
MESSAGING_LIBS = $(BASEDIR)/selfdrive/messaging/messaging.a
|
||||
|
||||
EXTRA_LIBS = -lpthread
|
||||
|
||||
ifeq ($(ARCH),aarch64)
|
||||
CFLAGS += -mcpu=cortex-a57
|
||||
CXXFLAGS += -mcpu=cortex-a57
|
||||
EXTRA_LIBS += -llog -luuid -lgnustl_shared
|
||||
endif
|
||||
|
||||
|
||||
JSON_FLAGS = -I$(PHONELIBS)/json/src
|
||||
JSON11_FLAGS = -I$(PHONELIBS)/json11
|
||||
|
||||
|
||||
ifeq ($(ARCH),x86_64)
|
||||
ZMQ_FLAGS = -I$(BASEDIR)/phonelibs/zmq/x64/include
|
||||
endif
|
||||
|
||||
.PHONY: all
|
||||
all: ubloxd paramsd
|
||||
|
||||
include ../common/cereal.mk
|
||||
|
||||
LOC_OBJS = locationd_yawrate.o params_learner.o paramsd.o \
|
||||
../common/swaglog.o \
|
||||
../common/params.o \
|
||||
../common/util.o \
|
||||
$(PHONELIBS)/json11/json11.o \
|
||||
$(PHONELIBS)/json/src/json.o \
|
||||
$(CEREAL_OBJS)
|
||||
|
||||
LOC_DEPS := $(LOC_OBJS:.o=.d)
|
||||
|
||||
OBJS = ublox_msg.o \
|
||||
ubloxd_main.o \
|
||||
../common/swaglog.o \
|
||||
../common/params.o \
|
||||
../common/util.o \
|
||||
$(PHONELIBS)/json/src/json.o \
|
||||
$(CEREAL_OBJS)
|
||||
|
||||
DEPS := $(OBJS:.o=.d) ubloxd.d ubloxd_test.d
|
||||
|
||||
liblocationd.so: $(LOC_OBJS) $(MESSAGING_LIBS)
|
||||
@echo "[ LINK ] $@"
|
||||
$(CXX) -shared -o '$@' $^ \
|
||||
$(CEREAL_LIBS) \
|
||||
$(EXTRA_LIBS)
|
||||
|
||||
paramsd: $(LOC_OBJS) $(MESSAGING_LIBS)
|
||||
@echo "[ LINK ] $@"
|
||||
$(CXX) -fPIC -o '$@' $^ \
|
||||
$(CEREAL_LIBS) \
|
||||
$(EXTRA_LIBS)
|
||||
|
||||
ubloxd: ubloxd.o $(OBJS) $(MESSAGING_LIBS)
|
||||
@echo "[ LINK ] $@"
|
||||
$(CXX) -fPIC -o '$@' $^ \
|
||||
$(CEREAL_LIBS) \
|
||||
$(EXTRA_LIBS)
|
||||
|
||||
ubloxd_test: ubloxd_test.o $(OBJS) $(MESSAGING_LIBS)
|
||||
@echo "[ LINK ] $@"
|
||||
$(CXX) -fPIC -o '$@' $^ \
|
||||
$(CEREAL_LIBS) \
|
||||
$(EXTRA_LIBS)
|
||||
|
||||
%.o: %.cc
|
||||
@echo "[ CXX ] $@"
|
||||
$(CXX) $(CXXFLAGS) -MMD \
|
||||
-Iinclude -I.. -I../.. \
|
||||
$(CEREAL_CXXFLAGS) \
|
||||
$(ZMQ_FLAGS) \
|
||||
$(MESSAGING_FLAGS) \
|
||||
$(JSON11_FLAGS) \
|
||||
$(JSON_FLAGS) \
|
||||
-I../ \
|
||||
-I../../ \
|
||||
-c -o '$@' '$<'
|
||||
|
||||
%.o: %.c
|
||||
@echo "[ CC ] $@"
|
||||
$(CC) $(CFLAGS) -MMD \
|
||||
-Iinclude -I.. -I../.. \
|
||||
$(CEREAL_CFLAGS) \
|
||||
$(ZMQ_FLAGS) \
|
||||
$(JSON_FLAGS) \
|
||||
-c -o '$@' '$<'
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f ubloxd paramsd liblocationd.so ubloxd.d ubloxd.o ubloxd_test ubloxd_test.o ubloxd_test.d $(OBJS) $(LOC_OBJS) $(DEPS)
|
||||
|
||||
-include $(DEPS)
|
||||
-include $(LOC_DEPS)
|
||||
@@ -0,0 +1,25 @@
|
||||
Import('env', 'common', 'messaging')
|
||||
loc_objs = [
|
||||
"locationd_yawrate.cc",
|
||||
"params_learner.cc",
|
||||
"paramsd.cc"]
|
||||
loc_libs = [messaging, 'zmq', common, 'capnp', 'kj', 'json', 'json11', 'pthread']
|
||||
|
||||
env.Program("paramsd", loc_objs, LIBS=loc_libs)
|
||||
env.SharedLibrary("locationd", loc_objs, LIBS=loc_libs)
|
||||
|
||||
env.Program("ubloxd", [
|
||||
"ubloxd.cc",
|
||||
"ublox_msg.cc",
|
||||
"ubloxd_main.cc"],
|
||||
LIBS=loc_libs)
|
||||
|
||||
env.Program("ubloxd_test", [
|
||||
"ubloxd_test.cc",
|
||||
"ublox_msg.cc",
|
||||
"ubloxd_main.cc"],
|
||||
LIBS=loc_libs)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import os
|
||||
import copy
|
||||
import json
|
||||
import numpy as np
|
||||
import selfdrive.messaging as messaging
|
||||
import cereal.messaging as messaging
|
||||
from selfdrive.locationd.calibration_helpers import Calibration
|
||||
from selfdrive.swaglog import cloudlog
|
||||
from common.params import Params, put_nonblocking
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
int get_intersections(double *lines, double *intersections, long long n) {
|
||||
double D, Dx, Dy;
|
||||
double x, y;
|
||||
double *L1, *L2;
|
||||
int k = 0;
|
||||
for (int i=0; i < n; i++) {
|
||||
for (int j=0; j < n; j++) {
|
||||
L1 = lines + i*3;
|
||||
L2 = lines + j*3;
|
||||
D = L1[0] * L2[1] - L1[1] * L2[0];
|
||||
Dx = L1[2] * L2[1] - L1[1] * L2[2];
|
||||
Dy = L1[0] * L2[2] - L1[2] * L2[0];
|
||||
// only intersect lines from different quadrants and only left-right crossing
|
||||
if ((D != 0) && (L1[0]*L2[0]*L1[1]*L2[1] < 0) && (L1[1]*L2[1] < 0)){
|
||||
x = Dx / D;
|
||||
y = Dy / D;
|
||||
if ((0 < x) &&
|
||||
(x < W) &&
|
||||
(0 < y) &&
|
||||
(y < H)){
|
||||
intersections[k*2 + 0] = x;
|
||||
intersections[k*2 + 1] = y;
|
||||
k++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return k;
|
||||
}
|
||||
|
||||
void increment_grid(double *grid, double *lines, long long n) {
|
||||
double *intersections = (double*) malloc(n*n*2*sizeof(double));
|
||||
int y, x, k;
|
||||
k = get_intersections(lines, intersections, n);
|
||||
for (int i=0; i < k; i++) {
|
||||
x = (int) (intersections[i*2 + 0] + 0.5);
|
||||
y = (int) (intersections[i*2 + 1] + 0.5);
|
||||
grid[y*(W+1) + x] += 1.;
|
||||
}
|
||||
free(intersections);
|
||||
}
|
||||
@@ -34,6 +34,12 @@ int main(int argc, char *argv[]) {
|
||||
SubSocket * sensor_events_sock = SubSocket::create(c, "sensorEvents");
|
||||
SubSocket * camera_odometry_sock = SubSocket::create(c, "cameraOdometry");
|
||||
PubSocket * live_parameters_sock = PubSocket::create(c, "liveParameters");
|
||||
|
||||
assert(controls_state_sock != NULL);
|
||||
assert(sensor_events_sock != NULL);
|
||||
assert(camera_odometry_sock != NULL);
|
||||
assert(live_parameters_sock != NULL);
|
||||
|
||||
Poller * poller = Poller::create({controls_state_sock, sensor_events_sock, camera_odometry_sock});
|
||||
|
||||
Localizer localizer;
|
||||
@@ -97,7 +103,7 @@ int main(int argc, char *argv[]) {
|
||||
// Main loop
|
||||
int save_counter = 0;
|
||||
while (true){
|
||||
for (auto s : poller->poll(-1)){
|
||||
for (auto s : poller->poll(100)){
|
||||
Message * msg = s->receive();
|
||||
|
||||
auto amsg = kj::heapArray<capnp::word>((msg->getSize() / sizeof(capnp::word)) + 1);
|
||||
|
||||
@@ -38,9 +38,6 @@ def main(args):
|
||||
print('Extract file failed')
|
||||
sys.exit(-3)
|
||||
|
||||
print('Compiling test app...')
|
||||
subprocess.check_call(["make", "ubloxd_test"], cwd=ubloxd_dir)
|
||||
|
||||
print('Run regression test - CC parser...')
|
||||
if args.valgrind:
|
||||
subprocess.check_call(["valgrind", "--leak-check=full", os.path.join(ubloxd_dir, 'ubloxd_test'), stream_file_path, cc_output_dir])
|
||||
|
||||
@@ -6,7 +6,7 @@ import unittest
|
||||
from selfdrive.car.honda.interface import CarInterface
|
||||
from selfdrive.car.honda.values import CAR
|
||||
from selfdrive.controls.lib.vehicle_model import VehicleModel
|
||||
from selfdrive.locationd.liblocationd_py import liblocationd # pylint: disable=no-name-in-module, import-error
|
||||
from selfdrive.locationd.liblocationd_py import liblocationd # pylint: disable=no-name-in-module, import-error
|
||||
|
||||
|
||||
class TestParamsLearner(unittest.TestCase):
|
||||
|
||||
@@ -720,7 +720,7 @@ class UBlox:
|
||||
|
||||
self.dev = PandaSerial(self.panda, 1, self.baudrate)
|
||||
elif grey:
|
||||
import selfdrive.messaging as messaging
|
||||
import cereal.messaging as messaging
|
||||
|
||||
class BoarddSerial():
|
||||
def __init__(self):
|
||||
|
||||
@@ -9,7 +9,7 @@ import struct
|
||||
import sys
|
||||
from cereal import log
|
||||
from common import realtime
|
||||
import selfdrive.messaging as messaging
|
||||
import cereal.messaging as messaging
|
||||
from selfdrive.locationd.test.ephemeris import EphemerisData, GET_FIELD_U
|
||||
|
||||
panda = os.getenv("PANDA") is not None # panda directly connected
|
||||
|
||||
@@ -5,7 +5,7 @@ from selfdrive.locationd.test import ublox
|
||||
from common import realtime
|
||||
from selfdrive.locationd.test.ubloxd import gen_raw, gen_solution
|
||||
import zmq
|
||||
import selfdrive.messaging as messaging
|
||||
import cereal.messaging as messaging
|
||||
|
||||
|
||||
unlogger = os.getenv("UNLOGGER") is not None # debug prints
|
||||
|
||||
@@ -44,6 +44,11 @@ int ubloxd_main(poll_ubloxraw_msg_func poll_func, send_gps_event_func send_func)
|
||||
PubSocket * gpsLocationExternal = PubSocket::create(c, "gpsLocationExternal");
|
||||
PubSocket * ubloxGnss = PubSocket::create(c, "ubloxGnss");
|
||||
SubSocket * ubloxRaw = SubSocket::create(c, "ubloxRaw");
|
||||
|
||||
assert(gpsLocationExternal != NULL);
|
||||
assert(ubloxGnss != NULL);
|
||||
assert(ubloxRaw != NULL);
|
||||
|
||||
Poller * poller = Poller::create({ubloxRaw});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user