diff --git a/README.md b/README.md index 1222bdf9aa..c5d51f499e 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Here are [some](https://www.youtube.com/watch?v=9OwTJFuDI7g) [videos](https://ww Hardware ------ -Right now openpilot supports the [NEO research platform](http://github.com/commaai/neo) and the [EON Dashcam DevKit](https://shop.comma.ai/products/eon-dashcam-devkit). We'd like to support other platforms as well. +Right now openpilot supports the [EON Dashcam DevKit](https://shop.comma.ai/products/eon-dashcam-devkit). We'd like to support other platforms as well. Install openpilot on a neo device by entering ``https://openpilot.comma.ai`` during NEOS setup. diff --git a/RELEASES.md b/RELEASES.md index bd55709de6..2c63e90833 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,13 @@ +Version 0.4.4 (2018-04-13) +========================== + * EON are flipped! Flip your EON's mount! + * Alpha Honda Ridgeline support thanks to energee! + * Support optional front camera recording + * Upload over cellular toggle now applies to all files, not just video + * Increase acceleration when closing lead gap + * User now prompted for future updates + * NEO no longer supported :( + Version 0.4.3.2 (2018-03-29) ============================ * Improve autofocus diff --git a/apk/ai.comma.plus.frame.apk b/apk/ai.comma.plus.frame.apk index 64df31e0cb..ed96c2bd4f 100644 Binary files a/apk/ai.comma.plus.frame.apk and b/apk/ai.comma.plus.frame.apk differ diff --git a/apk/ai.comma.plus.offroad.apk b/apk/ai.comma.plus.offroad.apk index 449fa568d1..78d7529d9e 100644 Binary files a/apk/ai.comma.plus.offroad.apk and b/apk/ai.comma.plus.offroad.apk differ diff --git a/cereal/car.capnp b/cereal/car.capnp index beb6e8a783..7e94de7ed0 100644 --- a/cereal/car.capnp +++ b/cereal/car.capnp @@ -55,6 +55,8 @@ struct CarEvent @0x9b1657f34caf3ad3 { manualRestart @30; lowSpeedLockout @31; plannerError @32; + ipasOverride @33; + debugAlert @34; } } @@ -192,6 +194,7 @@ struct RadarState { struct CarControl { # must be true for any actuator commands to work enabled @0 :Bool; + active @7 :Bool; gasDEPRECATED @1 :Float32; brakeDEPRECATED @2 :Float32; diff --git a/cereal/log.capnp b/cereal/log.capnp index 2d3b50bfad..5d001a611e 100644 --- a/cereal/log.capnp +++ b/cereal/log.capnp @@ -485,6 +485,7 @@ struct EncodeIndex { bigBoxHEVC @2; # bcamera.hevc chffrAndroidH264 @3; # acamera fullLosslessClip @4; # prcamera.mkv + front @5; # dcamera.hevc } } @@ -542,6 +543,7 @@ struct Plan { cruise @0; mpc1 @1; mpc2 @2; + mpc3 @3; } } @@ -1376,6 +1378,7 @@ struct GPSPlannerPlan { acceleration @4 :Float32; pointsDEPRECATED @5 :List(ECEFPointDEPRECATED); points @6 :List(ECEFPoint); + xLookahead @7 :Float32; } struct TrafficEvent @0xacfa74a094e62626 { diff --git a/cereal/mapd.capnp b/cereal/mapd.capnp index 868d9dd32b..2fbf286dd4 100644 --- a/cereal/mapd.capnp +++ b/cereal/mapd.capnp @@ -3,7 +3,7 @@ $Cxx.namespace("cereal"); using Java = import "java.capnp"; $Java.package("ai.comma.openpilot.cereal"); -$Java.outerClassname("Log"); +$Java.outerClassname("Map"); using Log = import "log.capnp"; diff --git a/common/fingerprints.py b/common/fingerprints.py index be85de8c42..f7724312af 100644 --- a/common/fingerprints.py +++ b/common/fingerprints.py @@ -15,6 +15,9 @@ class TOYOTA: COROLLA = "TOYOTA COROLLA 2017" LEXUS_RXH = "LEXUS RX HYBRID 2017" +class GM: + VOLT = "CHEVROLET VOLT PREMIER 2017" + _DEBUG_ADDRESS = {1880: 8} # reserved for debug purposes _FINGERPRINTS = { @@ -76,6 +79,9 @@ _FINGERPRINTS = { TOYOTA.LEXUS_RXH: [{ 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 5, 643: 7, 658: 8, 713: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 812: 3, 814: 8, 830: 7, 835: 8, 836: 8, 845: 5, 863: 8, 869: 7, 870: 7, 871: 2, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 6, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1005: 2, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1059: 1, 1063: 8, 1071: 8, 1077: 8, 1082: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1264: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1575: 8, 1595: 8, 1777: 8, 1779: 8, 1808: 8, 1810: 8, 1816: 8, 1818: 8, 1840: 8, 1848: 8, 1904: 8, 1912: 8, 1940: 8, 1941: 8, 1948: 8, 1949: 8, 1952: 8, 1956: 8, 1960: 8, 1964: 8, 1986: 8, 1990: 8, 1994: 8, 1998: 8, 2004: 8, 2012: 8 }], + GM.VOLT: [{ + 170: 8, 171: 8, 189: 7, 190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 209: 7, 211: 2, 241: 6, 288: 5, 289: 8, 298: 8, 304: 1, 308: 4, 309: 8, 311: 8, 313: 8, 320: 3, 328: 1, 352: 5, 381: 6, 386: 8, 388: 8, 389: 2, 390: 7, 417: 7, 419: 1, 426: 7, 451: 8, 452: 8, 453: 6, 454: 8, 456: 8, 479: 3, 481: 7, 485: 8, 489: 8, 493: 8, 495: 4, 497: 8, 499: 3, 500: 6, 501: 8, 508: 8, 528: 4, 532: 6, 546: 7, 550: 8, 554: 3, 558: 8, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 566: 5, 567: 3, 568: 1, 573: 1, 577: 8, 647: 3, 707: 8, 711: 6, 761: 7, 810: 8, 840: 5, 842: 5, 844: 8, 866: 4, 961: 8, 969: 8, 977: 8, 979: 7, 988: 6, 989: 8, 995: 7, 1001: 8, 1005: 6, 1009: 8, 1017: 8, 1019: 2, 1020: 8, 1105: 6, 1187: 4, 1217: 8, 1221: 5, 1223: 3, 1225: 7, 1227: 4, 1233: 8, 1249: 8, 1257: 6, 1265: 8, 1267: 1, 1273: 3, 1275: 3, 1280: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1417: 8, 1601: 8, 1905: 7, 1906: 7, 1907: 7, 1910: 7, 1912: 7, 1922: 7, 1927: 7, 1928: 7, 2016: 8, 2020: 8, 2024: 8, 2028: 8 + }], } # support additional internal only fingerprints diff --git a/common/params.py b/common/params.py index 3ef3d1d668..7955c88ed9 100755 --- a/common/params.py +++ b/common/params.py @@ -74,6 +74,8 @@ keys = { "DoUninstall": TxType.CLEAR_ON_MANAGER_START, "ShouldDoUpdate": TxType.CLEAR_ON_MANAGER_START, "IsUpdateAvailable": TxType.PERSISTANT, + + "RecordFront": TxType.PERSISTANT, } def fsync_dir(path): diff --git a/selfdrive/car/__init__.py b/selfdrive/car/__init__.py index bdc123c612..388af85f9f 100644 --- a/selfdrive/car/__init__.py +++ b/selfdrive/car/__init__.py @@ -5,41 +5,26 @@ from common.fingerprints import eliminate_incompatible_cars, all_known_cars from selfdrive.swaglog import cloudlog import selfdrive.messaging as messaging -from selfdrive.car.honda.interface import CarInterface as HondaInterface -from selfdrive.car.toyota.interface import CarInterface as ToyotaInterface -from selfdrive.car.mock.interface import CarInterface as MockInterface -from common.fingerprints import HONDA, TOYOTA - -try: - from .simulator.interface import CarInterface as SimInterface -except ImportError: - SimInterface = None - -try: - from .simulator2.interface import CarInterface as Sim2Interface -except ImportError: - Sim2Interface = None - - -interfaces = { - HONDA.CIVIC: HondaInterface, - HONDA.ACURA_ILX: HondaInterface, - HONDA.CRV: HondaInterface, - HONDA.ODYSSEY: HondaInterface, - HONDA.ACURA_RDX: HondaInterface, - HONDA.PILOT: HondaInterface, - HONDA.RIDGELINE: HondaInterface, - - - TOYOTA.PRIUS: ToyotaInterface, - TOYOTA.RAV4: ToyotaInterface, - TOYOTA.RAV4H: ToyotaInterface, - TOYOTA.COROLLA: ToyotaInterface, - TOYOTA.LEXUS_RXH: ToyotaInterface, - - "simulator2": Sim2Interface, - "mock": MockInterface -} +from common.fingerprints import HONDA, TOYOTA, GM + +def load_interfaces(x): + ret = {} + for interface in x: + try: + imp = __import__('selfdrive.car.%s.interface' % interface, fromlist=['CarInterface']).CarInterface + except ImportError: + imp = None + for car in x[interface]: + ret[car] = imp + return ret + +# imports from directory selfdrive/car// +interfaces = load_interfaces({ + 'honda': [HONDA.CIVIC, HONDA.ACURA_ILX, HONDA.CRV, HONDA.ODYSSEY, HONDA.ACURA_RDX, HONDA.PILOT, HONDA.RIDGELINE], + 'toyota': [TOYOTA.PRIUS, TOYOTA.RAV4, TOYOTA.RAV4H, TOYOTA.COROLLA, TOYOTA.LEXUS_RXH], + 'gm': [GM.VOLT], + 'simulator2': ['simulator2'], + 'mock': ['mock']}) # **** for use live only **** def fingerprint(logcan, timeout): @@ -92,6 +77,10 @@ def get_car(logcan, sendcan=None, passive=True): return None, None interface_cls = interfaces[candidate] + if interface_cls is None: + cloudlog.warning("car matched %s, but interface wasn't available" % candidate) + return None, None + params = interface_cls.get_params(candidate, fingerprints) return interface_cls(params, sendcan), params diff --git a/selfdrive/car/toyota/carcontroller.py b/selfdrive/car/toyota/carcontroller.py index 6dd7732def..50ce557faa 100644 --- a/selfdrive/car/toyota/carcontroller.py +++ b/selfdrive/car/toyota/carcontroller.py @@ -157,9 +157,9 @@ class CarController(object): # windup slower if self.last_angle * apply_angle > 0. and abs(apply_angle) > abs(self.last_angle): - angle_rate_lim = interp(CS.v_ego, ANGLE_MAX_BP, ANGLE_DELTA_V) + angle_rate_lim = interp(CS.v_ego, ANGLE_DELTA_BP, ANGLE_DELTA_V) else: - angle_rate_lim = interp(CS.v_ego, ANGLE_MAX_BP, ANGLE_DELTA_VU) + angle_rate_lim = interp(CS.v_ego, ANGLE_DELTA_BP, ANGLE_DELTA_VU) apply_angle = clip(apply_angle, self.last_angle - angle_rate_lim, self.last_angle + angle_rate_lim) else: @@ -195,11 +195,11 @@ class CarController(object): else: can_sends.append(create_steer_command(self.packer, apply_steer, frame)) - if ECU.APGS in self.fake_ecus: - if self.angle_control: - can_sends.append(create_ipas_steer_command(self.packer, apply_angle, self.steer_angle_enabled)) - else: - can_sends.append(create_ipas_steer_command(self.packer, 0, 0)) + if self.angle_control: + can_sends.append(create_ipas_steer_command(self.packer, apply_angle, self.steer_angle_enabled, + ECU.APGS in self.fake_ecus)) + elif ECU.APGS in self.fake_ecus: + can_sends.append(create_ipas_steer_command(self.packer, 0, 0, True)) # accel cmd comes from DSU, but we can spam can to cancel the system even if we are using lat only control if (frame % 3 == 0 and ECU.DSU in self.fake_ecus) or (pcm_cancel_cmd and ECU.CAM in self.fake_ecus): diff --git a/selfdrive/car/toyota/carstate.py b/selfdrive/car/toyota/carstate.py index dede0bf01d..3c9a54bb58 100644 --- a/selfdrive/car/toyota/carstate.py +++ b/selfdrive/car/toyota/carstate.py @@ -36,17 +36,6 @@ def parse_gear_shifter(can_gear, car_fingerprint): def get_can_parser(CP): - # this function generates lists for signal, messages and initial values - if CP.carFingerprint == CAR.PRIUS: - dbc_f = 'toyota_prius_2017_pt_generated.dbc' - elif CP.carFingerprint == CAR.RAV4H: - dbc_f = 'toyota_rav4_hybrid_2017_pt_generated.dbc' - elif CP.carFingerprint == CAR.RAV4: - dbc_f = 'toyota_rav4_2017_pt_generated.dbc' - elif CP.carFingerprint == CAR.COROLLA: - dbc_f = 'toyota_corolla_2017_pt_generated.dbc' - elif CP.carFingerprint == CAR.LEXUS_RXH: - dbc_f = 'lexus_rx_hybrid_2017_pt_generated.dbc' signals = [ # sig_name, sig_address, default @@ -91,6 +80,19 @@ def get_can_parser(CP): ("EPS_STATUS", 25), ] + # this function generates lists for signal, messages and initial values + if CP.carFingerprint == CAR.PRIUS: + dbc_f = 'toyota_prius_2017_pt_generated.dbc' + signals += [("STATE", "AUTOPARK_STATUS", 0)] + elif CP.carFingerprint == CAR.RAV4H: + dbc_f = 'toyota_rav4_hybrid_2017_pt_generated.dbc' + elif CP.carFingerprint == CAR.RAV4: + dbc_f = 'toyota_rav4_2017_pt_generated.dbc' + elif CP.carFingerprint == CAR.COROLLA: + dbc_f = 'toyota_corolla_2017_pt_generated.dbc' + elif CP.carFingerprint == CAR.LEXUS_RXH: + dbc_f = 'lexus_rx_hybrid_2017_pt_generated.dbc' + return CANParser(os.path.splitext(dbc_f)[0], signals, checks, 0) @@ -172,4 +174,7 @@ class CarState(object): self.gas_pressed = not cp.vl["PCM_CRUISE"]['GAS_RELEASED'] self.low_speed_lockout = cp.vl["PCM_CRUISE_2"]['LOW_SPEED_LOCKOUT'] == 2 self.brake_lights = bool(cp.vl["ESP_CONTROL"]['BRAKE_LIGHTS_ACC'] or self.brake_pressed) - self.generic_toggle = bool(cp.vl["LIGHT_STALK"]['AUTO_HIGH_BEAM']) + if self.CP.carFingerprint == CAR.PRIUS: + self.generic_toggle = cp.vl["AUTOPARK_STATUS"]['STATE'] != 0 + else: + self.generic_toggle = bool(cp.vl["LIGHT_STALK"]['AUTO_HIGH_BEAM']) diff --git a/selfdrive/car/toyota/toyotacan.py b/selfdrive/car/toyota/toyotacan.py index 4cb2c0c85c..150167b9e6 100644 --- a/selfdrive/car/toyota/toyotacan.py +++ b/selfdrive/car/toyota/toyotacan.py @@ -28,7 +28,7 @@ def create_video_target(frame, addr): return make_can_msg(addr, msg, 1, True) -def create_ipas_steer_command(packer, steer, enabled): +def create_ipas_steer_command(packer, steer, enabled, apgs_enabled): """Creates a CAN message for the Toyota Steer Command.""" if steer < 0: direction = 3 @@ -46,7 +46,10 @@ def create_ipas_steer_command(packer, steer, enabled): "SET_ME_X10": 0x10, "SET_ME_X40": 0x40 } - return packer.make_can_msg("STEERING_IPAS", 0, values) + if apgs_enabled: + return packer.make_can_msg("STEERING_IPAS", 0, values) + else: + return packer.make_can_msg("STEERING_IPAS_COMMA", 0, values) def create_steer_command(packer, steer, raw_cnt): diff --git a/selfdrive/common/framebuffer.cc b/selfdrive/common/framebuffer.cc index 0bee19b74e..757c2a1ead 100644 --- a/selfdrive/common/framebuffer.cc +++ b/selfdrive/common/framebuffer.cc @@ -56,8 +56,8 @@ extern "C" FramebufferState* framebuffer_init( status = SurfaceComposerClient::getDisplayInfo(s->dtoken, &s->dinfo); assert(status == 0); - int orientation = 3; // rotate framebuffer 270 degrees - //int orientation = 1; // rotate framebuffer 90 degrees + //int orientation = 3; // rotate framebuffer 270 degrees + int orientation = 1; // rotate framebuffer 90 degrees if(orientation == 1 || orientation == 3) { int temp = s->dinfo.h; s->dinfo.h = s->dinfo.w; diff --git a/selfdrive/common/version.h b/selfdrive/common/version.h index 52556d2e4f..136faef674 100644 --- a/selfdrive/common/version.h +++ b/selfdrive/common/version.h @@ -1 +1 @@ -#define COMMA_VERSION "0.4.3.2-release" +#define COMMA_VERSION "0.4.4-release" diff --git a/selfdrive/common/visionipc.c b/selfdrive/common/visionipc.c index 4299f512f9..d56fbdd773 100644 --- a/selfdrive/common/visionipc.c +++ b/selfdrive/common/visionipc.c @@ -193,6 +193,21 @@ int visionstream_init(VisionStream *s, VisionStreamType type, bool tbuffer, Visi return 0; } +void visionstream_release(VisionStream *s) { + int err; + if (s->last_idx >= 0) { + VisionPacket rep = { + .type = VIPC_STREAM_RELEASE, + .d = { .stream_rel = { + .type = s->last_type, + .idx = s->last_idx, + }} + }; + err = vipc_send(s->ipc_fd, &rep); + s->last_idx = -1; + } +} + VIPCBuf* visionstream_get(VisionStream *s, VIPCBufExtra *out_extra) { int err; @@ -207,7 +222,7 @@ VIPCBuf* visionstream_get(VisionStream *s, VIPCBufExtra *out_extra) { VisionPacket rep = { .type = VIPC_STREAM_RELEASE, .d = { .stream_rel = { - .type = rp.d.stream_acq.type, + .type = s->last_type, .idx = s->last_idx, }} }; @@ -217,6 +232,7 @@ VIPCBuf* visionstream_get(VisionStream *s, VIPCBufExtra *out_extra) { } } + s->last_type = rp.d.stream_acq.type; s->last_idx = rp.d.stream_acq.idx; assert(s->last_idx < s->num_bufs); @@ -228,6 +244,20 @@ VIPCBuf* visionstream_get(VisionStream *s, VIPCBufExtra *out_extra) { } void visionstream_destroy(VisionStream *s) { + int err; + + if (s->last_idx >= 0) { + VisionPacket rep = { + .type = VIPC_STREAM_RELEASE, + .d = { .stream_rel = { + .type = s->last_type, + .idx = s->last_idx, + }} + }; + err = vipc_send(s->ipc_fd, &rep); + s->last_idx = -1; + } + for (int i=0; inum_bufs; i++) { if (s->bufs[i].addr) { munmap(s->bufs[i].addr, s->bufs[i].len); diff --git a/selfdrive/common/visionipc.h b/selfdrive/common/visionipc.h index 2f116a4d01..8bd0dd152f 100644 --- a/selfdrive/common/visionipc.h +++ b/selfdrive/common/visionipc.h @@ -24,6 +24,7 @@ typedef enum VisionStreamType { VISION_STREAM_UI_BACK, VISION_STREAM_UI_FRONT, VISION_STREAM_YUV, + VISION_STREAM_YUV_FRONT, VISION_STREAM_MAX, } VisionStreamType; @@ -94,12 +95,14 @@ void vipc_bufs_load(VIPCBuf *bufs, const VisionStreamBufs *stream_bufs, typedef struct VisionStream { int ipc_fd; int last_idx; + int last_type; int num_bufs; VisionStreamBufs bufs_info; VIPCBuf *bufs; } VisionStream; int visionstream_init(VisionStream *s, VisionStreamType type, bool tbuffer, VisionStreamBufs *out_bufs_info); +void visionstream_release(VisionStream *s); VIPCBuf* visionstream_get(VisionStream *s, VIPCBufExtra *out_extra); void visionstream_destroy(VisionStream *s); diff --git a/selfdrive/controls/lib/alertmanager.py b/selfdrive/controls/lib/alertmanager.py index 5e704982d6..f67976222f 100644 --- a/selfdrive/controls/lib/alertmanager.py +++ b/selfdrive/controls/lib/alertmanager.py @@ -101,8 +101,8 @@ class AlertManager(object): Priority.MID, "steerRequired", "chimeRepeated", .1, .1, .1), "startup": Alert( - "Always keep hands on wheel", "Be ready to take over at any time", + "Always keep hands on wheel and eyes on road", AlertStatus.normal, AlertSize.mid, Priority.LOWEST, None, None, 0., 0., 15.), diff --git a/selfdrive/controls/lib/longitudinal_mpc/generator.cpp b/selfdrive/controls/lib/longitudinal_mpc/generator.cpp index d21dc585bc..30b0bd858a 100644 --- a/selfdrive/controls/lib/longitudinal_mpc/generator.cpp +++ b/selfdrive/controls/lib/longitudinal_mpc/generator.cpp @@ -39,9 +39,9 @@ int main( ) // Running cost Function h; h << exp(0.3 * NORM_RW_ERROR(v_ego, v_l, d_l)) - exp(0.3 * NORM_RW_ERROR(v_ego, v_l, desired)); - h << (d_l - desired) / (0.1 * v_ego + 0.5); - h << a_ego * (1.0 + v_ego / 10.0); - h << j_ego * (1.0 + v_ego / 10.0); + h << (d_l - desired) / (0.05 * v_ego + 0.5); + h << a_ego * (0.1 * v_ego + 1.0); + h << j_ego * (0.1 * v_ego + 1.0); // Weights are defined in mpc. BMatrix Q(4,4); Q.setAll(true); @@ -49,8 +49,8 @@ int main( ) // Terminal cost Function hN; hN << exp(0.3 * NORM_RW_ERROR(v_ego, v_l, d_l)) - exp(0.3 * NORM_RW_ERROR(v_ego, v_l, desired)); - hN << (d_l - desired) / (0.1 * v_ego + 0.5); - hN << a_ego * (1.0 + v_ego / 10.0); + hN << (d_l - desired) / (0.05 * v_ego + 0.5); + hN << a_ego * (0.1 * v_ego + 1.0); // Weights are defined in mpc. BMatrix QN(3,3); QN.setAll(true); diff --git a/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_common.h b/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_common.h index 2c0ab64ef1..1f1c21e6e0 100644 --- a/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_common.h +++ b/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_common.h @@ -181,8 +181,8 @@ real_t evGx[ 720 ]; /** Column vector of size: 120 */ real_t evGu[ 120 ]; -/** Column vector of size: 32 */ -real_t objAuxVar[ 32 ]; +/** Column vector of size: 30 */ +real_t objAuxVar[ 30 ]; /** Row vector of size: 8 */ real_t objValueIn[ 8 ]; diff --git a/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_solver.c b/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_solver.c index 94aef8c05c..a06e4a38d6 100644 --- a/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_solver.c +++ b/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_solver.c @@ -107,7 +107,7 @@ void acado_evaluateLSQ(const real_t* in, real_t* out) { const real_t* xd = in; const real_t* u = in + 6; -/* Vector of auxiliary variables; number of elements: 32. */ +/* Vector of auxiliary variables; number of elements: 30. */ real_t* a = acadoWorkspace.objAuxVar; /* Compute intermediate quantities: */ @@ -137,18 +137,16 @@ a[22] = (((real_t)(2.9999999999999999e-01)*((((real_t)(0.0000000000000000e+00)-( a[23] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); a[24] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); a[25] = (((real_t)(2.9999999999999999e-01)*(((((real_t)(0.0000000000000000e+00)-(real_t)(1.8000000000000000e+00))-((xd[4]+xd[4])*a[23]))-(((real_t)(0.0000000000000000e+00)-(real_t)(1.8000000000000000e+00))-((xd[4]+xd[4])*a[24])))*a[14]))*a[18]); -a[26] = ((real_t)(1.0000000000000000e+00)/(((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(5.0000000000000000e-01))); +a[26] = ((real_t)(1.0000000000000000e+00)/(((real_t)(5.0000000000000003e-02)*xd[1])+(real_t)(5.0000000000000000e-01))); a[27] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); a[28] = (a[26]*a[26]); a[29] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); -a[30] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.0000000000000000e+01)); -a[31] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.0000000000000000e+01)); /* Compute outputs: */ out[0] = (a[1]-a[3]); -out[1] = (((xd[3]-xd[0])-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))/(((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(5.0000000000000000e-01))); -out[2] = (xd[2]*((real_t)(1.0000000000000000e+00)+(xd[1]/(real_t)(1.0000000000000000e+01)))); -out[3] = (u[0]*((real_t)(1.0000000000000000e+00)+(xd[1]/(real_t)(1.0000000000000000e+01)))); +out[1] = (((xd[3]-xd[0])-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))/(((real_t)(5.0000000000000003e-02)*xd[1])+(real_t)(5.0000000000000000e-01))); +out[2] = (xd[2]*(((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00))); +out[3] = (u[0]*(((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00))); out[4] = a[6]; out[5] = (a[11]-a[19]); out[6] = (real_t)(0.0000000000000000e+00); @@ -156,19 +154,19 @@ out[7] = a[20]; out[8] = (a[22]-a[25]); out[9] = (real_t)(0.0000000000000000e+00); out[10] = (((real_t)(0.0000000000000000e+00)-(real_t)(1.0000000000000000e+00))*a[26]); -out[11] = ((((real_t)(0.0000000000000000e+00)-(((real_t)(1.8000000000000000e+00)-((real_t)(-1.8000000000000000e+00)))+((xd[1]+xd[1])*a[27])))*a[26])-((((xd[3]-xd[0])-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))*(real_t)(1.0000000000000001e-01))*a[28])); +out[11] = ((((real_t)(0.0000000000000000e+00)-(((real_t)(1.8000000000000000e+00)-((real_t)(-1.8000000000000000e+00)))+((xd[1]+xd[1])*a[27])))*a[26])-((((xd[3]-xd[0])-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))*(real_t)(5.0000000000000003e-02))*a[28])); out[12] = (real_t)(0.0000000000000000e+00); out[13] = a[26]; out[14] = (((real_t)(0.0000000000000000e+00)-(((real_t)(0.0000000000000000e+00)-(real_t)(1.8000000000000000e+00))-((xd[4]+xd[4])*a[29])))*a[26]); out[15] = (real_t)(0.0000000000000000e+00); out[16] = (real_t)(0.0000000000000000e+00); -out[17] = (xd[2]*a[30]); -out[18] = ((real_t)(1.0000000000000000e+00)+(xd[1]/(real_t)(1.0000000000000000e+01))); +out[17] = (xd[2]*(real_t)(1.0000000000000001e-01)); +out[18] = (((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00)); out[19] = (real_t)(0.0000000000000000e+00); out[20] = (real_t)(0.0000000000000000e+00); out[21] = (real_t)(0.0000000000000000e+00); out[22] = (real_t)(0.0000000000000000e+00); -out[23] = (u[0]*a[31]); +out[23] = (u[0]*(real_t)(1.0000000000000001e-01)); out[24] = (real_t)(0.0000000000000000e+00); out[25] = (real_t)(0.0000000000000000e+00); out[26] = (real_t)(0.0000000000000000e+00); @@ -176,13 +174,13 @@ out[27] = (real_t)(0.0000000000000000e+00); out[28] = (real_t)(0.0000000000000000e+00); out[29] = (real_t)(0.0000000000000000e+00); out[30] = (real_t)(0.0000000000000000e+00); -out[31] = ((real_t)(1.0000000000000000e+00)+(xd[1]/(real_t)(1.0000000000000000e+01))); +out[31] = (((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00)); } void acado_evaluateLSQEndTerm(const real_t* in, real_t* out) { const real_t* xd = in; -/* Vector of auxiliary variables; number of elements: 31. */ +/* Vector of auxiliary variables; number of elements: 30. */ real_t* a = acadoWorkspace.objAuxVar; /* Compute intermediate quantities: */ @@ -212,16 +210,15 @@ a[22] = (((real_t)(2.9999999999999999e-01)*((((real_t)(0.0000000000000000e+00)-( a[23] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); a[24] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); a[25] = (((real_t)(2.9999999999999999e-01)*(((((real_t)(0.0000000000000000e+00)-(real_t)(1.8000000000000000e+00))-((xd[4]+xd[4])*a[23]))-(((real_t)(0.0000000000000000e+00)-(real_t)(1.8000000000000000e+00))-((xd[4]+xd[4])*a[24])))*a[14]))*a[18]); -a[26] = ((real_t)(1.0000000000000000e+00)/(((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(5.0000000000000000e-01))); +a[26] = ((real_t)(1.0000000000000000e+00)/(((real_t)(5.0000000000000003e-02)*xd[1])+(real_t)(5.0000000000000000e-01))); a[27] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); a[28] = (a[26]*a[26]); a[29] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); -a[30] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.0000000000000000e+01)); /* Compute outputs: */ out[0] = (a[1]-a[3]); -out[1] = (((xd[3]-xd[0])-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))/(((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(5.0000000000000000e-01))); -out[2] = (xd[2]*((real_t)(1.0000000000000000e+00)+(xd[1]/(real_t)(1.0000000000000000e+01)))); +out[1] = (((xd[3]-xd[0])-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))/(((real_t)(5.0000000000000003e-02)*xd[1])+(real_t)(5.0000000000000000e-01))); +out[2] = (xd[2]*(((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00))); out[3] = a[6]; out[4] = (a[11]-a[19]); out[5] = (real_t)(0.0000000000000000e+00); @@ -229,14 +226,14 @@ out[6] = a[20]; out[7] = (a[22]-a[25]); out[8] = (real_t)(0.0000000000000000e+00); out[9] = (((real_t)(0.0000000000000000e+00)-(real_t)(1.0000000000000000e+00))*a[26]); -out[10] = ((((real_t)(0.0000000000000000e+00)-(((real_t)(1.8000000000000000e+00)-((real_t)(-1.8000000000000000e+00)))+((xd[1]+xd[1])*a[27])))*a[26])-((((xd[3]-xd[0])-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))*(real_t)(1.0000000000000001e-01))*a[28])); +out[10] = ((((real_t)(0.0000000000000000e+00)-(((real_t)(1.8000000000000000e+00)-((real_t)(-1.8000000000000000e+00)))+((xd[1]+xd[1])*a[27])))*a[26])-((((xd[3]-xd[0])-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))*(real_t)(5.0000000000000003e-02))*a[28])); out[11] = (real_t)(0.0000000000000000e+00); out[12] = a[26]; out[13] = (((real_t)(0.0000000000000000e+00)-(((real_t)(0.0000000000000000e+00)-(real_t)(1.8000000000000000e+00))-((xd[4]+xd[4])*a[29])))*a[26]); out[14] = (real_t)(0.0000000000000000e+00); out[15] = (real_t)(0.0000000000000000e+00); -out[16] = (xd[2]*a[30]); -out[17] = ((real_t)(1.0000000000000000e+00)+(xd[1]/(real_t)(1.0000000000000000e+01))); +out[16] = (xd[2]*(real_t)(1.0000000000000001e-01)); +out[17] = (((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00)); out[18] = (real_t)(0.0000000000000000e+00); out[19] = (real_t)(0.0000000000000000e+00); out[20] = (real_t)(0.0000000000000000e+00); diff --git a/selfdrive/loggerd/loggerd b/selfdrive/loggerd/loggerd index ea5e4a6e1e..95ad92524e 100755 Binary files a/selfdrive/loggerd/loggerd and b/selfdrive/loggerd/loggerd differ diff --git a/selfdrive/loggerd/uploader.py b/selfdrive/loggerd/uploader.py index 04e4dddbff..1d9c69cc2d 100644 --- a/selfdrive/loggerd/uploader.py +++ b/selfdrive/loggerd/uploader.py @@ -155,7 +155,7 @@ class Uploader(object): self.last_resp = FakeResponse() else: with open(fn, "rb") as f: - self.last_resp = requests.put(url, data=f, headers=headers) + self.last_resp = requests.put(url, data=f, headers=headers, timeout=10) except Exception as e: self.last_exc = (e, traceback.format_exc()) raise @@ -251,12 +251,16 @@ def uploader_fn(exit_event): backoff = 0.1 while True: - upload_video = (params.get("IsUploadVideoOverCellularEnabled") != "0") or is_on_wifi() + should_upload = (params.get("IsUploadVideoOverCellularEnabled") != "0") or is_on_wifi() if exit_event.is_set(): return - d = uploader.next_file_to_upload(upload_video) + if not should_upload: + time.sleep(5) + continue + + d = uploader.next_file_to_upload(with_video=True) if d is None: time.sleep(5) continue diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 5481a48e99..f010c632a4 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -609,6 +609,9 @@ def uninstall(): os.system("service call power 16 i32 0 s16 recovery i32 1") def main(): + # the flippening! + os.system('LD_LIBRARY_PATH="" content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1') + if os.getenv("NOLOG") is not None: del managed_processes['loggerd'] del managed_processes['tombstoned'] @@ -640,6 +643,8 @@ def main(): # set unset params if params.get("IsMetric") is None: params.put("IsMetric", "0") + if params.get("RecordFront") is None: + params.put("RecordFront", "0") if params.get("IsRearViewMirror") is None: params.put("IsRearViewMirror", "0") if params.get("IsFcwEnabled") is None: diff --git a/selfdrive/sensord/gpsd b/selfdrive/sensord/gpsd index 2db4fa042a..3ae7a6f8ba 100755 Binary files a/selfdrive/sensord/gpsd and b/selfdrive/sensord/gpsd differ diff --git a/selfdrive/sensord/sensord b/selfdrive/sensord/sensord index f4f685225a..c972dab8d2 100755 Binary files a/selfdrive/sensord/sensord and b/selfdrive/sensord/sensord differ diff --git a/selfdrive/service_list.yaml b/selfdrive/service_list.yaml index 897df4425b..55c77e4cc9 100644 --- a/selfdrive/service_list.yaml +++ b/selfdrive/service_list.yaml @@ -67,6 +67,7 @@ orbOdometry: [8057, true] orbFeatures: [8058, true] orbKeyFrame: [8059, true] uiLayoutState: [8060, true] +frontEncodeIdx: [8061, true] testModel: [8040, false] testLiveLocation: [8045, false] diff --git a/selfdrive/test/tests/plant/test_longitudinal.py b/selfdrive/test/tests/plant/test_longitudinal.py index 73380022b8..e6f4a22507 100755 --- a/selfdrive/test/tests/plant/test_longitudinal.py +++ b/selfdrive/test/tests/plant/test_longitudinal.py @@ -94,6 +94,16 @@ maneuvers = [ speed_lead_breakpoints = [0., 15., 25.0], cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3)] ), + Maneuver( + 'steady state following a car at 20m/s, then lead decel to 0mph at 3m/s^2', + duration=50., + initial_speed = 20., + lead_relevancy=True, + initial_distance_lead=35., + speed_lead_values = [20., 20., 0.], + speed_lead_breakpoints = [0., 15., 21.66], + cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3)] + ), Maneuver( 'starting at 0mph, approaching a stopped car 100m away', duration=30., diff --git a/selfdrive/ui/spinner/spinner b/selfdrive/ui/spinner/spinner index 5e9a473389..7fc8c69170 100755 Binary files a/selfdrive/ui/spinner/spinner and b/selfdrive/ui/spinner/spinner differ diff --git a/selfdrive/ui/ui.c b/selfdrive/ui/ui.c index 75ca53ab3d..78441856db 100644 --- a/selfdrive/ui/ui.c +++ b/selfdrive/ui/ui.c @@ -762,7 +762,7 @@ static void ui_draw_track(UIState *s, bool is_mpc) { if (!started) { nvgMoveTo(s->vg, x, y); track_start_x = x; - track_start_y = y; + track_start_y = vwp_h; started = true; } else { nvgLineTo(s->vg, x, y); @@ -770,7 +770,7 @@ static void ui_draw_track(UIState *s, bool is_mpc) { } // right side down - for (int i=path_height; i>0; i--) { + for (int i=path_height-1; i>0; i--) { float px, py; if (is_mpc) { px = mpc_x_coords[i]; @@ -790,7 +790,7 @@ static void ui_draw_track(UIState *s, bool is_mpc) { if (!started) { nvgMoveTo(s->vg, x, y); - track_end_y = y; + track_end_y = vwp_h; track_end_x = x; started = true; } else { @@ -833,10 +833,10 @@ static void draw_frame(UIState *s) { if (s->scene.frontview) { out_mat = device_transform; // full 16/9 // flip horizontally so it looks like a mirror - x2 = (float)scene->front_box_x / s->rgb_front_width; - x1 = (float)(scene->front_box_x + scene->front_box_width) / s->rgb_front_width; - y1 = (float)scene->front_box_y / s->rgb_front_height; - y2 = (float)(scene->front_box_y + scene->front_box_height) / s->rgb_front_height; + x1 = (float)scene->front_box_x / s->rgb_front_width; + x2 = (float)(scene->front_box_x + scene->front_box_width) / s->rgb_front_width; + y2 = (float)scene->front_box_y / s->rgb_front_height; + y1 = (float)(scene->front_box_y + scene->front_box_height) / s->rgb_front_height; } else { out_mat = matmul(device_transform, frame_transform); x1 = 1.0; diff --git a/selfdrive/version.py b/selfdrive/version.py index e1f9e27fa8..cbef487ac7 100644 --- a/selfdrive/version.py +++ b/selfdrive/version.py @@ -5,14 +5,14 @@ with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "common", "ve try: origin = subprocess.check_output(["git", "config", "--get", "remote.origin.url"]) - if "-private" in origin: - upstream = "origin/master" - else: - if 'chffrplus' in origin: - upstream = "origin/release" + if origin.startswith('git@github.com:commaai'): + if origin.endswith('/one.git'): + dirty = True else: - upstream = "origin/release2" - - dirty = subprocess.call(["git", "diff-index", "--quiet", upstream, "--"]) != 0 + branch = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).rstrip() + branch = 'origin/' + branch + dirty = subprocess.call(["git", "diff-index", "--quiet", branch, "--"]) != 0 + else: + dirty = True except subprocess.CalledProcessError: dirty = True diff --git a/selfdrive/visiond/visiond b/selfdrive/visiond/visiond index 3e4151d0b4..e454dd6ac7 100755 Binary files a/selfdrive/visiond/visiond and b/selfdrive/visiond/visiond differ