remove gpsd (#20027)

albatross
Adeeb Shihadeh 2021-02-10 16:39:39 -08:00 committed by GitHub
parent 012fa35096
commit fe7f3f0ec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 10 additions and 175 deletions

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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:

View File

@ -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',

View File

@ -1,3 +0,0 @@
#!/bin/sh
export LD_LIBRARY_PATH="/system/lib64:$LD_LIBRARY_PATH"
exec ./_gpsd

View File

@ -1,155 +0,0 @@
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <sys/time.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/resource.h>
#include <pthread.h>
#include <cutils/log.h>
#include <hardware/gps.h>
#include <utils/Timers.h>
#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;
}

View File

@ -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"],

View File

@ -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),

View File

@ -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

View File

@ -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

View File

@ -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"