diff --git a/release/files_common b/release/files_common index 9a933a1d..57a6ea54 100644 --- a/release/files_common +++ b/release/files_common @@ -319,14 +319,12 @@ selfdrive/loggerd/deleter.py selfdrive/loggerd/xattr_cache.py selfdrive/sensord/SConscript -selfdrive/sensord/gpsd.cc selfdrive/sensord/libdiag.h selfdrive/sensord/sensors_qcom.cc selfdrive/sensord/sensors_qcom2.cc selfdrive/sensord/sensors/*.cc selfdrive/sensord/sensors/*.hpp selfdrive/sensord/sensord -selfdrive/sensord/gpsd selfdrive/thermald/thermald.py selfdrive/thermald/power_monitoring.py diff --git a/selfdrive/car/mock/interface.py b/selfdrive/car/mock/interface.py index f75d1c58..e497ab96 100755 --- a/selfdrive/car/mock/interface.py +++ b/selfdrive/car/mock/interface.py @@ -21,7 +21,7 @@ class CarInterface(CarInterfaceBase): # TODO: subscribe to phone sensor self.sensor = messaging.sub_sock('sensorEvents') - self.gps = messaging.sub_sock('gpsLocation') + self.gps = messaging.sub_sock('gpsLocationExternal') self.speed = 0. self.prev_speed = 0. @@ -59,7 +59,7 @@ class CarInterface(CarInterfaceBase): gps = messaging.recv_sock(self.gps) if gps is not None: self.prev_speed = self.speed - self.speed = gps.gpsLocation.speed + self.speed = gps.gpsLocationExternal.speed # create message ret = car.CarState.new_message() diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 690a4692..ad317b7c 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -30,7 +30,7 @@ STEER_ANGLE_SATURATION_THRESHOLD = 2.5 # Degrees SIMULATION = "SIMULATION" in os.environ NOSENSOR = "NOSENSOR" in os.environ -IGNORE_PROCESSES = set(["rtshield", "uploader", "deleter", "loggerd", "logmessaged", "tombstoned", "logcatd", "proclogd", "clocksd", "gpsd", "updated", "timezoned"]) +IGNORE_PROCESSES = set(["rtshield", "uploader", "deleter", "loggerd", "logmessaged", "tombstoned", "logcatd", "proclogd", "clocksd", "updated", "timezoned"]) ThermalStatus = log.ThermalData.ThermalStatus State = log.ControlsState.OpenpilotState diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 1f3467f8..3fb37317 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -173,7 +173,6 @@ managed_processes = { "camerad": ("selfdrive/camerad", ["./camerad"]), "sensord": ("selfdrive/sensord", ["./sensord"]), "clocksd": ("selfdrive/clocksd", ["./clocksd"]), - "gpsd": ("selfdrive/sensord", ["./gpsd"]), "updated": "selfdrive.updated", "dmonitoringmodeld": ("selfdrive/modeld", ["./dmonitoringmodeld"]), "modeld": ("selfdrive/modeld", ["./modeld"]), @@ -252,7 +251,6 @@ if not PC or WEBCAM: if EON: car_started_processes += [ - 'gpsd', 'rtshield', ] else: diff --git a/selfdrive/sensord/SConscript b/selfdrive/sensord/SConscript index 01b0eec8..0817a4d3 100644 --- a/selfdrive/sensord/SConscript +++ b/selfdrive/sensord/SConscript @@ -1,9 +1,7 @@ Import('env', 'arch', 'common', 'cereal', 'messaging') + if arch == "aarch64": env.Program('_sensord', 'sensors_qcom.cc', LIBS=['hardware', common, cereal, messaging, 'capnp', 'zmq', 'kj']) - lenv = env.Clone() - lenv['LIBPATH'] += ['/system/vendor/lib64'] - lenv.Program('_gpsd', ['gpsd.cc'], LIBS=['hardware', common, 'diag', 'time_genoff', cereal, messaging, 'capnp', 'zmq', 'kj']) else: sensors = [ 'sensors/file_sensor.cc', diff --git a/selfdrive/sensord/gpsd b/selfdrive/sensord/gpsd deleted file mode 100755 index c3010826..00000000 --- a/selfdrive/sensord/gpsd +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -export LD_LIBRARY_PATH="/system/lib64:$LD_LIBRARY_PATH" -exec ./_gpsd diff --git a/selfdrive/sensord/gpsd.cc b/selfdrive/sensord/gpsd.cc deleted file mode 100644 index 7b892350..00000000 --- a/selfdrive/sensord/gpsd.cc +++ /dev/null @@ -1,155 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include - -#include "messaging.hpp" -#include "common/timing.h" -#include "common/util.h" -#include "common/swaglog.h" - -ExitHandler do_exit; - -namespace { - -PubMaster *pm; - -const GpsInterface* gGpsInterface = NULL; -const AGpsInterface* gAGpsInterface = NULL; - -void nmea_callback(GpsUtcTime timestamp, const char* nmea, int length) { - - uint64_t log_time_wall = nanos_since_epoch(); - - MessageBuilder msg; - auto nmeaData = msg.initEvent().initGpsNMEA(); - nmeaData.setTimestamp(timestamp); - nmeaData.setLocalWallTime(log_time_wall); - nmeaData.setNmea(nmea); - - pm->send("gpsNMEA", msg); -} - -void location_callback(GpsLocation* location) { - //printf("got location callback\n"); - - MessageBuilder msg; - auto locationData = msg.initEvent().initGpsLocation(); - locationData.setFlags(location->flags); - locationData.setLatitude(location->latitude); - locationData.setLongitude(location->longitude); - locationData.setAltitude(location->altitude); - locationData.setSpeed(location->speed); - locationData.setBearing(location->bearing); - locationData.setAccuracy(location->accuracy); - locationData.setTimestamp(location->timestamp); - locationData.setSource(cereal::GpsLocationData::SensorSource::ANDROID); - - pm->send("gpsLocation", msg); -} - -pthread_t create_thread_callback(const char* name, void (*start)(void *), void* arg) { - LOG("creating thread: %s", name); - pthread_t thread; - pthread_attr_t attr; - int err; - - err = pthread_attr_init(&attr); - err = pthread_create(&thread, &attr, (void*(*)(void*))start, arg); - - return thread; -} - -GpsCallbacks gps_callbacks = { - sizeof(GpsCallbacks), - location_callback, - NULL, - NULL, - nmea_callback, - NULL, - NULL, - NULL, - create_thread_callback, -}; - -void agps_status_cb(AGpsStatus *status) { - switch (status->status) { - case GPS_REQUEST_AGPS_DATA_CONN: - fprintf(stdout, "*** data_conn_open\n"); - gAGpsInterface->data_conn_open("internet"); - break; - case GPS_RELEASE_AGPS_DATA_CONN: - fprintf(stdout, "*** data_conn_closed\n"); - gAGpsInterface->data_conn_closed(); - break; - } -} - -AGpsCallbacks agps_callbacks = { - agps_status_cb, - create_thread_callback, -}; - -void gps_init() { - pm = new PubMaster({"gpsNMEA", "gpsLocation"}); - LOG("*** init GPS"); - hw_module_t* module = NULL; - hw_get_module(GPS_HARDWARE_MODULE_ID, (hw_module_t const**)&module); - assert(module); - - static hw_device_t* device = NULL; - module->methods->open(module, GPS_HARDWARE_MODULE_ID, &device); - assert(device); - - // ** get gps interface ** - gps_device_t* gps_device = (gps_device_t *)device; - gGpsInterface = gps_device->get_gps_interface(gps_device); - assert(gGpsInterface); - - gAGpsInterface = (const AGpsInterface*)gGpsInterface->get_extension(AGPS_INTERFACE); - assert(gAGpsInterface); - - - gGpsInterface->init(&gps_callbacks); - gAGpsInterface->init(&agps_callbacks); - gAGpsInterface->set_server(AGPS_TYPE_SUPL, "supl.google.com", 7276); - - // gGpsInterface->delete_aiding_data(GPS_DELETE_ALL); - gGpsInterface->start(); - gGpsInterface->set_position_mode(GPS_POSITION_MODE_MS_BASED, - GPS_POSITION_RECURRENCE_PERIODIC, - 100, 0, 0); - -} - -void gps_destroy() { - delete pm; - gGpsInterface->stop(); - gGpsInterface->cleanup(); -} - -} - -int main() { - setpriority(PRIO_PROCESS, 0, -13); - - gps_init(); - - while(!do_exit) pause(); - - gps_destroy(); - - return 0; -} diff --git a/selfdrive/test/process_replay/process_replay.py b/selfdrive/test/process_replay/process_replay.py index 17a0a94f..5962665c 100755 --- a/selfdrive/test/process_replay/process_replay.py +++ b/selfdrive/test/process_replay/process_replay.py @@ -221,7 +221,7 @@ CONFIGS = [ proc_name="controlsd", pub_sub={ "can": ["controlsState", "carState", "carControl", "sendcan", "carEvents", "carParams"], - "thermal": [], "health": [], "liveCalibration": [], "driverMonitoringState": [], "longitudinalPlan": [], "lateralPlan": [], "gpsLocation": [], "liveLocationKalman": [], "liveParameters": [], "radarState": [], + "thermal": [], "health": [], "liveCalibration": [], "driverMonitoringState": [], "longitudinalPlan": [], "lateralPlan": [], "liveLocationKalman": [], "liveParameters": [], "radarState": [], "modelV2": [], "frontFrame": [], "frame": [], "ubloxRaw": [], "managerState": [], }, ignore=["logMonoTime", "valid", "controlsState.startMonoTime", "controlsState.cumLagMs"], diff --git a/selfdrive/test/test_onroad.py b/selfdrive/test/test_onroad.py index 8d1abc7c..a3353d58 100755 --- a/selfdrive/test/test_onroad.py +++ b/selfdrive/test/test_onroad.py @@ -31,7 +31,6 @@ PROCS = [ ("selfdrive.locationd.calibrationd", 2.0), ("selfdrive.monitoring.dmonitoringd", 1.90), ("./proclogd", 1.54), - ("./_gpsd", 0.09), ("./clocksd", 0.02), ("./ubloxd", 0.02), ("selfdrive.tombstoned", 0), diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index cc5f8148..03631c9d 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -167,7 +167,7 @@ def thermald_thread(): health_timeout = int(1000 * 2.5 * DT_TRML) # 2.5x the expected health frequency health_sock = messaging.sub_sock('health', timeout=health_timeout) - location_sock = messaging.sub_sock('gpsLocation') + location_sock = messaging.sub_sock('gpsLocationExternal') fan_speed = 0 count = 0 @@ -415,7 +415,7 @@ def thermald_thread(): cloudlog.event("STATUS_PACKET", count=count, health=(health.to_dict() if health else None), - location=(location.gpsLocation.to_dict() if location else None), + location=(location.gpsLocationExternal.to_dict() if location else None), thermal=msg.to_dict()) count += 1 diff --git a/tools/replay/unlogger.py b/tools/replay/unlogger.py index 8e530656..df137acd 100755 --- a/tools/replay/unlogger.py +++ b/tools/replay/unlogger.py @@ -314,7 +314,7 @@ def _get_address_mapping(args): if args.min is not None: services_to_mock = [ 'thermal', 'can', 'health', 'sensorEvents', 'gpsNMEA', 'frame', 'encodeIdx', - 'model', 'features', 'liveLocation', 'gpsLocation' + 'model', 'features', 'liveLocation', ] elif args.enabled is not None: services_to_mock = args.enabled diff --git a/tools/sim/lib/replay.sh b/tools/sim/lib/replay.sh index 6a48d041..e65a4b69 100755 --- a/tools/sim/lib/replay.sh +++ b/tools/sim/lib/replay.sh @@ -2,5 +2,5 @@ cd ~/openpilot/tools/nui -# vision, boardd, sensorsd, gpsd -ALLOW=frame,can,ubloxRaw,health,sensorEvents,gpsNMEA,gpsLocation ./nui "02ec6bea180a4d36/2019-10-25--10-18-09" +# vision, boardd, sensorsd +ALLOW=frame,can,ubloxRaw,health,sensorEvents,gpsNMEA,gpsLocationExternal ./nui "02ec6bea180a4d36/2019-10-25--10-18-09"