diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index f01c556e8f..0000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve openpilot -title: '' -labels: 'bug' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**How to reproduce or log data** -Steps to reproduce the behavior, or a explorer/cabana link to the exact drive and timestamp of when the bug occurred. - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Device/Version information (please complete the following information):** - - Device: [e.g. EON/EON Gold] - - Version: [e.g. 0.6.4], or commit hash when on devel - - Car make/model [e.g. Toyota Prius 2016] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 72e1845d7e..0000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,21 +0,0 @@ -Choose one of the templates below: - -# Fingerprint -This pull requests adds a fingerprint for . - -This is an explorer link to a drive with the stock system enabled: ... - -# Car support -This pull requests adds support for . - -This is an explorer link to a drive with the stock system enabled: ... -This is an explorer link to a drive with openpilot system enabled: ... - -# Feature -This pull requests adds feature X - -## Description -Explain what the feature does - -## Testing -Explain how the feature was tested. Either by the added unit tests, or what tests were performed while driving. diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 6ed87a3f85..0000000000 --- a/.gitignore +++ /dev/null @@ -1,59 +0,0 @@ -venv/ -.DS_Store -.tags -.ipynb_checkpoints -.idea -.overlay_init -.overlay_consistent -.sconsign.dblite -.vscode -model2.png -a.out - -*.dylib -*.DSYM -*.d -*.pyc -*.pyo -.*.swp -.*.swo -.*.un~ -*.tmp -*.o -*.os -*.so -*.a -*.clb -*.class -*.pyxbldc -*.vcd -config.json -clcache - -persist -board/obj/ -selfdrive/boardd/boardd -selfdrive/logcatd/logcatd -selfdrive/mapd/default_speeds_by_region.json -selfdrive/proclogd/proclogd -selfdrive/ui/_ui -selfdrive/test/longitudinal_maneuvers/out -selfdrive/visiond/visiond -selfdrive/loggerd/loggerd -selfdrive/sensord/_gpsd -selfdrive/sensord/_sensord -selfdrive/camerad/camerad -selfdrive/modeld/_modeld -selfdrive/modeld/_monitoringd -/src/ - -one -openpilot -notebooks -xx -panda_jungle - -.coverage* -htmlcov -pandaextra - diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 64a55daf8f..0000000000 --- a/.pylintrc +++ /dev/null @@ -1,585 +0,0 @@ -[MASTER] - -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code -extension-pkg-whitelist=scipy - -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=CVS - -# Add files or directories matching the regex patterns to the blacklist. The -# regex matches against base names, not paths. -ignore-patterns= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Use multiple processes to speed up Pylint. -jobs=4 - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - -# Pickle collected data for later comparisons. -persistent=yes - -# Specify a configuration file. -#rcfile= - -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages -suggestion-mode=yes - -# Allow loading of arbitrary C extensions. Extensions are imported into the -# active Python interpreter and may run arbitrary code. -unsafe-load-any-extension=no - - -[MESSAGES CONTROL] - -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED -confidence= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once).You can also use "--disable=all" to -# disable everything first and then reenable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use"--disable=all --enable=classes -# --disable=W" -disable=print-statement, - parameter-unpacking, - unpacking-in-except, - old-raise-syntax, - backtick, - long-suffix, - old-ne-operator, - old-octal-literal, - import-star-module-level, - non-ascii-bytes-literal, - raw-checker-failed, - bad-inline-option, - locally-disabled, - locally-enabled, - file-ignored, - suppressed-message, - useless-suppression, - deprecated-pragma, - apply-builtin, - basestring-builtin, - buffer-builtin, - cmp-builtin, - coerce-builtin, - execfile-builtin, - file-builtin, - long-builtin, - raw_input-builtin, - reduce-builtin, - standarderror-builtin, - unicode-builtin, - xrange-builtin, - coerce-method, - delslice-method, - getslice-method, - setslice-method, - no-absolute-import, - old-division, - dict-iter-method, - dict-view-method, - next-method-called, - metaclass-assignment, - indexing-exception, - raising-string, - reload-builtin, - oct-method, - hex-method, - nonzero-method, - cmp-method, - input-builtin, - round-builtin, - intern-builtin, - unichr-builtin, - map-builtin-not-iterating, - zip-builtin-not-iterating, - range-builtin-not-iterating, - filter-builtin-not-iterating, - using-cmp-argument, - eq-without-hash, - div-method, - idiv-method, - rdiv-method, - exception-message-attribute, - invalid-str-codec, - sys-max-int, - bad-python3-import, - deprecated-string-function, - deprecated-str-translate-call, - deprecated-itertools-function, - deprecated-types-field, - next-method-defined, - dict-items-not-iterating, - dict-keys-not-iterating, - dict-values-not-iterating, - bad-indentation, - line-too-long, - missing-docstring, - multiple-statements, - bad-continuation, - invalid-name, - too-many-arguments, - too-many-locals, - superfluous-parens, - bad-whitespace, - too-many-instance-attributes, - wrong-import-position, - ungrouped-imports, - wrong-import-order, - protected-access, - trailing-whitespace, - too-many-branches, - too-few-public-methods, - too-many-statements, - trailing-newlines, - attribute-defined-outside-init, - too-many-return-statements, - too-many-public-methods, - unused-argument, - old-style-class, - no-init, - len-as-condition, - unneeded-not, - no-self-use, - multiple-imports, - no-else-return, - logging-not-lazy, - fixme, - redefined-outer-name, - unused-variable, - unsubscriptable-object, - expression-not-assigned, - too-many-boolean-expressions, - consider-using-ternary, - invalid-unary-operand-type, - relative-import, - deprecated-lambda - - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). See also the "--disable" option for examples. -enable=c-extension-no-member - - -[REPORTS] - -# Python expression which should return a note less than 10 (10 is the highest -# note). You have access to the variables errors warning, statement which -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Template used to display messages. This is a python new-style format string -# used to format the message information. See doc for all details -#msg-template= - -# Set the output format. Available formats are text, parseable, colorized, json -# and msvs (visual studio).You can also give a reporter class, eg -# mypackage.mymodule.MyReporterClass. -output-format=text - -# Tells whether to display a full report or only the messages -reports=no - -# Activate the evaluation score. -score=yes - - -[REFACTORING] - -# Maximum number of nested blocks for function / method body -max-nested-blocks=5 - -# Complete name of functions that never returns. When checking for -# inconsistent-return-statements if a never returning function is called then -# it will be considered as an explicit return statement and no message will be -# printed. -never-returning-functions=optparse.Values,sys.exit - - -[LOGGING] - -# Logging modules to check that the string format arguments are in logging -# function parameter format -logging-modules=logging - - -[SPELLING] - -# Limits count of emitted suggestions for spelling mistakes -max-spelling-suggestions=4 - -# Spelling dictionary name. Available dictionaries: none. To make it working -# install python-enchant package. -spelling-dict= - -# List of comma separated words that should not be checked. -spelling-ignore-words= - -# A path to a file that contains private dictionary; one word per line. -spelling-private-dict-file= - -# Tells whether to store unknown words to indicated private dictionary in -# --spelling-private-dict-file option instead of raising a message. -spelling-store-unknown-words=no - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME, - XXX, - TODO - - -[SIMILARITIES] - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - -# Ignore imports when computing similarities. -ignore-imports=no - -# Minimum lines number of a similarity. -min-similarity-lines=4 - - -[TYPECHECK] - -# List of decorators that produce context managers, such as -# contextlib.contextmanager. Add to this list to register other decorators that -# produce valid context managers. -contextmanager-decorators=contextlib.contextmanager - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E1101 when accessed. Python regular -# expressions are accepted. -generated-members=capnp.* cereal.* pygame.* zmq.* setproctitle.* smbus2.* usb1.* serial.* cv2.* - -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# This flag controls whether pylint should warn about no-member and similar -# checks whenever an opaque object is returned when inferring. The inference -# can return multiple potential results while evaluating a Python object, but -# some branches might not be evaluated, which results in partial inference. In -# that case, it might be useful to still emit no-member and other checks for -# the rest of the inferred objects. -ignore-on-opaque-inference=yes - -# List of class names for which member attributes should not be checked (useful -# for classes with dynamically set attributes). This supports the use of -# qualified names. -ignored-classes=optparse.Values,thread._local,_thread._local - -# List of module names for which member attributes should not be checked -# (useful for modules/projects where namespaces are manipulated during runtime -# and thus existing member attributes cannot be deduced by static analysis. It -# supports qualified module names, as well as Unix pattern matching. -ignored-modules=flask setproctitle usb1 flask.ext.socketio smbus2 usb1.* - -# Show a hint with possible names when a member name was not found. The aspect -# of finding the hint is based on edit distance. -missing-member-hint=yes - -# The minimum edit distance a name should have in order to be considered a -# similar match for a missing member name. -missing-member-hint-distance=1 - -# The total number of similar names that should be taken in consideration when -# showing a hint for a missing member. -missing-member-max-choices=1 - - -[VARIABLES] - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - -# Tells whether unused global variables should be treated as a violation. -allow-global-unused-variables=yes - -# List of strings which can identify a callback function by name. A callback -# name must start or end with one of those strings. -callbacks=cb_, - _cb - -# A regular expression matching the name of dummy variables (i.e. expectedly -# not used). -dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore -ignored-argument-names=_.*|^ignored_|^unused_ - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# List of qualified module names which can have objects that can redefine -# builtins. -redefining-builtins-modules=six.moves,past.builtins,future.builtins - - -[FORMAT] - -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. -expected-line-ending-format= - -# Regexp for a line that is allowed to be longer than the limit. -ignore-long-lines=^\s*(# )??$ - -# Number of spaces of indent required inside a hanging or continued line. -indent-after-paren=4 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - -# Maximum number of characters on a single line. -max-line-length=100 - -# Maximum number of lines in a module -max-module-lines=1000 - -# List of optional constructs for which whitespace checking is disabled. `dict- -# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. -# `trailing-comma` allows a space between comma and closing bracket: (a, ). -# `empty-line` allows space-only lines. -no-space-check=trailing-comma, - dict-separator - -# Allow the body of a class to be on the same line as the declaration if body -# contains single statement. -single-line-class-stmt=no - -# Allow the body of an if to be on the same line as the test if there is no -# else. -single-line-if-stmt=no - - -[BASIC] - -# Naming style matching correct argument names -argument-naming-style=snake_case - -# Regular expression matching correct argument names. Overrides argument- -# naming-style -#argument-rgx= - -# Naming style matching correct attribute names -attr-naming-style=snake_case - -# Regular expression matching correct attribute names. Overrides attr-naming- -# style -#attr-rgx= - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo, - bar, - baz, - toto, - tutu, - tata - -# Naming style matching correct class attribute names -class-attribute-naming-style=any - -# Regular expression matching correct class attribute names. Overrides class- -# attribute-naming-style -#class-attribute-rgx= - -# Naming style matching correct class names -class-naming-style=PascalCase - -# Regular expression matching correct class names. Overrides class-naming-style -#class-rgx= - -# Naming style matching correct constant names -const-naming-style=UPPER_CASE - -# Regular expression matching correct constant names. Overrides const-naming- -# style -#const-rgx= - -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=-1 - -# Naming style matching correct function names -function-naming-style=snake_case - -# Regular expression matching correct function names. Overrides function- -# naming-style -#function-rgx= - -# Good variable names which should always be accepted, separated by a comma -good-names=i, - j, - k, - ex, - Run, - _ - -# Include a hint for the correct naming format with invalid-name -include-naming-hint=no - -# Naming style matching correct inline iteration names -inlinevar-naming-style=any - -# Regular expression matching correct inline iteration names. Overrides -# inlinevar-naming-style -#inlinevar-rgx= - -# Naming style matching correct method names -method-naming-style=snake_case - -# Regular expression matching correct method names. Overrides method-naming- -# style -#method-rgx= - -# Naming style matching correct module names -module-naming-style=snake_case - -# Regular expression matching correct module names. Overrides module-naming- -# style -#module-rgx= - -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. -name-group= - -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=^_ - -# List of decorators that produce properties, such as abc.abstractproperty. Add -# to this list to register other decorators that produce valid properties. -property-classes=abc.abstractproperty - -# Naming style matching correct variable names -variable-naming-style=snake_case - -# Regular expression matching correct variable names. Overrides variable- -# naming-style -#variable-rgx= - - -[DESIGN] - -# Maximum number of arguments for function / method -max-args=5 - -# Maximum number of attributes for a class (see R0902). -max-attributes=7 - -# Maximum number of boolean expressions in a if statement -max-bool-expr=5 - -# Maximum number of branch for function / method body -max-branches=12 - -# Maximum number of locals for function / method body -max-locals=15 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - -# Maximum number of return / yield for function / method body -max-returns=6 - -# Maximum number of statements in function / method body -max-statements=50 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 - - -[CLASSES] - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__, - __new__, - setUp - -# List of member names, which should be excluded from the protected access -# warning. -exclude-protected=_asdict, - _fields, - _replace, - _source, - _make - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls - -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg=mcs - - -[IMPORTS] - -# Allow wildcard imports from modules that define __all__. -allow-wildcard-with-all=no - -# Analyse import fallback blocks. This can be used to support both Python 2 and -# 3 compatible code, which means that the block might have code that exists -# only in one or another interpreter, leading to false positives when analysed. -analyse-fallback-blocks=no - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub, - TERMIOS, - Bastion, - rexec - -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= - -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled) -int-import-graph= - -# Force import order to recognize a module as part of the standard -# compatibility libraries. -known-standard-library= - -# Force import order to recognize a module as part of a third party library. -known-third-party=enchant - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception" -overgeneral-exceptions=Exception diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8683d8bee0..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -sudo: required - -services: - - docker - -script: - - ./run_docker_tests.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 738679aca5..0000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,31 +0,0 @@ -# How to contribute - -Our software is open source so you can solve your own problems without needing help from others. And if you solve a problem and are so kind, you can upstream it for the rest of the world to use. - -Most open source development activity is coordinated through our [Discord](https://discord.comma.ai). A lot of documentation is available on our [medium](https://medium.com/@comma_ai/) - -## Getting Started - - * Join our [Discord](https://discord.comma.ai) - * Make sure you have a [GitHub account](https://github.com/signup/free) - * Fork [our repositories](https://github.com/commaai) on GitHub - -## Testing - -### Local Testing - -You can test your changes on your machine by running `run_docker_tests.sh`. This will run some automated tests in docker against your code. - -### Automated Testing - -All PRs are automatically checked by travis. Check out `.travis.yml` for what travis runs. Any new tests sould be added to travis. - -### Code Style and Linting - -Code is automatically check for style by travis as part of the automated tests. You can also run these yourself by running `check_code_quality.sh`. - -## Car Ports (openpilot) - -We've released a [Model Port guide](https://medium.com/@comma_ai/openpilot-port-guide-for-toyota-models-e5467f4b5fe6) for porting to Toyota/Lexus models. - -If you port openpilot to a substantially new car brand, see this more generic [Brand Port guide](https://medium.com/@comma_ai/how-to-write-a-car-port-for-openpilot-7ce0785eda84). You might also be eligible for a bounty. See our bounties at [comma.ai/bounties.html](https://comma.ai/bounties.html) diff --git a/Dockerfile.openpilot b/Dockerfile.openpilot deleted file mode 100644 index 9faa5c282b..0000000000 --- a/Dockerfile.openpilot +++ /dev/null @@ -1,84 +0,0 @@ -FROM ubuntu:16.04 -ENV PYTHONUNBUFFERED 1 - -RUN apt-get update && apt-get install -y \ - autoconf \ - build-essential \ - bzip2 \ - clang \ - cmake \ - curl \ - ffmpeg \ - git \ - libarchive-dev \ - libbz2-dev \ - libcurl4-openssl-dev \ - libeigen3-dev \ - libffi-dev \ - libglew-dev \ - libgles2-mesa-dev \ - libglfw3-dev \ - libglib2.0-0 \ - liblzma-dev \ - libmysqlclient-dev \ - libomp-dev \ - libopencv-dev \ - libssl-dev \ - libsqlite3-dev \ - libtool \ - libusb-1.0-0-dev \ - libzmq5-dev \ - locales \ - ocl-icd-libopencl1 \ - ocl-icd-opencl-dev \ - opencl-headers \ - python-dev \ - python-pip \ - screen \ - sudo \ - vim \ - wget - - -RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 - -RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash - -ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}" -RUN pyenv install 3.7.3 -RUN pyenv global 3.7.3 -RUN pyenv rehash - -RUN pip install pipenv==2018.11.26 - -COPY Pipfile /tmp/ -COPY Pipfile.lock /tmp/ - -RUN python --version -RUN cd /tmp && pipenv install --system --deploy - -# Install subset of dev dependencies needed for CI -RUN pip install matplotlib==3.1.1 dictdiffer==0.8.0 fastcluster==1.1.25 aenum==2.2.1 scipy==1.3.1 lru-dict==1.1.6 tenacity==5.1.1 azure-common==1.1.23 azure-nspkg==3.0.2 azure-storage-blob==2.1.0 azure-storage-common==2.1.0 azure-storage-nspkg==3.1.0 pycurl==7.43.0.3 - -COPY phonelibs/install_capnp.sh /tmp/install_capnp.sh -RUN /tmp/install_capnp.sh - -RUN git clone --branch v0.7 https://github.com/commaai/openpilot-tools.git /tmp/openpilot/tools - -ENV PYTHONPATH /tmp/openpilot:${PYTHONPATH} -COPY ./.pylintrc /tmp/openpilot/.pylintrc -COPY ./common /tmp/openpilot/common -COPY ./cereal /tmp/openpilot/cereal -COPY ./opendbc /tmp/openpilot/opendbc -COPY ./selfdrive /tmp/openpilot/selfdrive -COPY ./phonelibs /tmp/openpilot/phonelibs -COPY ./pyextra /tmp/openpilot/pyextra -COPY ./panda /tmp/openpilot/panda - -COPY SConstruct /tmp/openpilot/SConstruct - -RUN mkdir -p /tmp/openpilot/selfdrive/test/out -RUN cd /tmp/openpilot && scons -j$(nproc) diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 7dafa9443b..0000000000 --- a/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2018, Comma.ai, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Makefile b/Makefile deleted file mode 100644 index 4f690b2e7e..0000000000 --- a/Makefile +++ /dev/null @@ -1,9 +0,0 @@ - -code_dir := $(shell pwd) - -# TODO: Add a global build system - -.PHONY: all -all: - cd selfdrive && PYTHONPATH=$(code_dir) PREPAREONLY=1 ./manager.py - diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 743d838efa..0000000000 --- a/Pipfile +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a1fd3e30b499e9e5387495544631cb334b62521a5be6668b98d52e3ef5d6e448 -size 2308 diff --git a/Pipfile.lock b/Pipfile.lock deleted file mode 100644 index 75878bac17..0000000000 --- a/Pipfile.lock +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:451e503913e7579c3241b5fec46c81f832735ecd9fc0ec6dffdf246852e146d1 -size 165792 diff --git a/README.md b/README.md deleted file mode 100644 index 013397a774..0000000000 --- a/README.md +++ /dev/null @@ -1,302 +0,0 @@ -[![](https://i.imgur.com/UetIFyH.jpg)](#) - -Table of Contents -======================= - -* [What is openpilot?](#what-is-openpilot) -* [Integration with Stock Features](#integration-with-stock-features) -* [Supported Hardware](#supported-hardware) -* [Supported Cars](#supported-cars) -* [Community Maintained Cars and Features](#community-maintained-cars-and-features) -* [Installation Instructions](#installation-instructions) -* [Limitations of openpilot ALC and LDW](#limitations-of-openpilot-alc-and-ldw) -* [Limitations of openpilot ACC and FCW](#limitations-of-openpilot-acc-and-fcw) -* [Limitations of openpilot DM](#limitations-of-openpilot-dm) -* [User Data and comma Account](#user-data-and-comma-account) -* [Safety and Testing](#safety-and-testing) -* [Testing on PC](#testing-on-pc) -* [Community and Contributing](#community-and-contributing) -* [Directory Structure](#directory-structure) -* [Licensing](#licensing) - ---- - -What is openpilot? ------- - -[openpilot](http://github.com/commaai/openpilot) is an open source driver assistance system. Currently, openpilot performs the functions of Adaptive Cruise Control (ACC), Automated Lane Centering (ALC), Forward Collision Warning (FCW) and Lane Departure Warning (LDW) for a growing variety of supported [car makes, models and model years](#supported-cars). In addition, while openpilot is engaged, a camera based Driver Monitoring (DM) feature alerts distracted and asleep drivers. - - - - - - - - - - - - - - -
- -Integration with Stock Features ------- - -In all supported cars: -* Stock Lane Keep Assist (LKA) and stock ALC are replaced by openpilot ALC, which only functions when openpilot is engaged by the user. -* Stock LDW is replaced by openpilot LDW. - -Additionally, on specific supported cars (see ACC column in [supported cars](#supported-cars)): -* Stock ACC is replaced by openpilot ACC. -* openpilot FCW operates in addition to stock FCW. - -openpilot should preserve all other vehicle's stock features, including, but are not limited to: FCW, Automatic Emergency Braking (AEB), auto high-beam, blind spot warning, and side collision warning. - -Supported Hardware ------- - -At the moment, openpilot supports the [EON DevKit](https://comma.ai/shop/products/eon-dashcam-devkit) and the [comma two](https://comma.ai/shop/products/comma-two-devkit). A [car harness](https://comma.ai/shop/products/car-harness) is recommended to connect the EON or comma two to the car. In the future, we'd like to support other platforms as well, like gaming PCs. - -Supported Cars ------- - -| Make | Model (US Market Reference) | Supported Package | ACC | No ACC accel below | No ALC below | -| ----------| ------------------------------| ------------------| -----------------| -------------------| -------------| -| Acura | ILX 2016-18 | AcuraWatch Plus | openpilot | 25mph5 | 25mph | -| Acura | RDX 2016-18 | AcuraWatch Plus | openpilot | 25mph5 | 12mph | -| Chrysler | Pacifica 2017-18 | Adaptive Cruise | Stock | 0mph | 9mph | -| Chrysler | Pacifica Hybrid 2017-18 | Adaptive Cruise | Stock | 0mph | 9mph | -| Chrysler | Pacifica Hybrid 2019 | Adaptive Cruise | Stock | 0mph | 39mph | -| Honda | Accord 2018-19 | All | Stock | 0mph | 3mph | -| Honda | Accord Hybrid 2018-19 | All | Stock | 0mph | 3mph | -| Honda | Civic Sedan/Coupe 2016-18 | Honda Sensing | openpilot | 0mph | 12mph | -| Honda | Civic Sedan/Coupe 2019 | Honda Sensing | Stock | 0mph | 2mph | -| Honda | Civic Hatchback 2017-19 | Honda Sensing | Stock | 0mph | 12mph | -| Honda | CR-V 2015-16 | Touring | openpilot | 25mph5 | 12mph | -| Honda | CR-V 2017-19 | Honda Sensing | Stock | 0mph | 12mph | -| Honda | CR-V Hybrid 2017-2019 | Honda Sensing | Stock | 0mph | 12mph | -| Honda | Fit 2018-19 | Honda Sensing | openpilot | 25mph5 | 12mph | -| Honda | Odyssey 2018-20 | Honda Sensing | openpilot | 25mph5 | 0mph | -| Honda | Passport 2019 | All | openpilot | 25mph5 | 12mph | -| Honda | Pilot 2016-18 | Honda Sensing | openpilot | 25mph5 | 12mph | -| Honda | Pilot 2019 | All | openpilot | 25mph5 | 12mph | -| Honda | Ridgeline 2017-19 | Honda Sensing | openpilot | 25mph5 | 12mph | -| Hyundai | Santa Fe 20191 | All | Stock | 0mph | 0mph | -| Hyundai | Elantra 2017-191 | SCC + LKAS | Stock | 19mph | 34mph | -| Hyundai | Genesis 20181 | All | Stock | 19mph | 34mph | -| Jeep | Grand Cherokee 2016-18 | Adaptive Cruise | Stock | 0mph | 9mph | -| Jeep | Grand Cherokee 2019 | Adaptive Cruise | Stock | 0mph | 39mph | -| Kia | Optima 20191 | SCC + LKAS | Stock | 0mph | 0mph | -| Kia | Sorento 20181 | All | Stock | 0mph | 0mph | -| Kia | Stinger 20181 | SCC + LKAS | Stock | 0mph | 0mph | -| Lexus | CT Hybrid 2017-18 | All | Stock4| 0mph | 0mph | -| Lexus | ES Hybrid 2019 | All | openpilot | 0mph | 0mph | -| Lexus | RX Hybrid 2016-19 | All | Stock4| 0mph | 0mph | -| Lexus | IS 2017-2019 | All | Stock | 22mph | 0mph | -| Lexus | IS Hybrid 2017 | All | Stock | 0mph | 0mph | -| Subaru | Crosstrek 2018-19 | EyeSight | Stock | 0mph | 0mph | -| Subaru | Impreza 2019-20 | EyeSight | Stock | 0mph | 0mph | -| Toyota | Avalon 2016 | TSS-P | Stock4| 20mph5 | 0mph | -| Toyota | Avalon 2017-18 | All | Stock4| 20mph5 | 0mph | -| Toyota | Camry 2018-19 | All | Stock | 0mph2 | 0mph | -| Toyota | Camry Hybrid 2018-19 | All | Stock | 0mph2 | 0mph | -| Toyota | C-HR 2017-19 | All | Stock | 0mph | 0mph | -| Toyota | C-HR Hybrid 2017-19 | All | Stock | 0mph | 0mph | -| Toyota | Corolla 2017-19 | All | Stock4| 20mph5 | 0mph | -| Toyota | Corolla 2020 | All | openpilot | 0mph | 0mph | -| Toyota | Corolla Hatchback 2019 | All | openpilot | 0mph | 0mph | -| Toyota | Corolla Hybrid 2020 | All | openpilot | 0mph | 0mph | -| Toyota | Highlander 2017-19 | All | Stock4| 0mph | 0mph | -| Toyota | Highlander Hybrid 2017-19 | All | Stock4| 0mph | 0mph | -| Toyota | Prius 2016 | TSS-P | Stock4| 0mph | 0mph | -| Toyota | Prius 2017-19 | All | Stock4| 0mph | 0mph | -| Toyota | Prius Prime 2017-20 | All | Stock4| 0mph | 0mph | -| Toyota | Rav4 2016 | TSS-P | Stock4| 20mph5 | 0mph | -| Toyota | Rav4 2017-18 | All | Stock4| 20mph5 | 0mph | -| Toyota | Rav4 2019 | All | openpilot | 0mph | 0mph | -| Toyota | Rav4 Hybrid 2016 | TSS-P | Stock4| 0mph | 0mph | -| Toyota | Rav4 Hybrid 2017-18 | All | Stock4| 0mph | 0mph | -| Toyota | Sienna 2018 | All | Stock4| 0mph | 0mph | -| Volkswagen| Golf 2016-193 | Driver Assistance | Stock | 0mph | 0mph | - -1Requires a [panda](https://comma.ai/shop/products/panda-obd-ii-dongle) and open sourced [Hyundai giraffe](https://github.com/commaai/neo/tree/master/giraffe/hyundai), designed for the 2019 Sante Fe; pinout may differ for other Hyundai and Kia models.
-228mph for Camry 4CYL L, 4CYL LE and 4CYL SE which don't have Full-Speed Range Dynamic Radar Cruise Control.
-3Requires a [custom connector](https://community.comma.ai/wiki/index.php/Volkswagen#Integration_at_R242_Camera) for the [car harness](https://comma.ai/shop/products/car-harness)
- -Community Maintained Cars and Features ------- - -| Make | Model (US Market Reference) | Supported Package | ACC | No ACC accel below | No ALC below | -| ----------| ------------------------------| ------------------| -----------------| -------------------| -------------| -| Buick | Regal 20186 | Adaptive Cruise | openpilot | 0mph | 7mph | -| Chevrolet | Malibu 20176 | Adaptive Cruise | openpilot | 0mph | 7mph | -| Chevrolet | Volt 2017-186 | Adaptive Cruise | openpilot | 0mph | 7mph | -| Cadillac | ATS 20186 | Adaptive Cruise | openpilot | 0mph | 7mph | -| GMC | Acadia Denali 20186| Adaptive Cruise | openpilot | 0mph | 7mph | -| Holden | Astra 20176 | Adaptive Cruise | openpilot | 0mph | 7mph | - -4When disconnecting the Driver Support Unit (DSU), openpilot ACC will replace stock ACC. For DSU locations, see [Toyota Wiki page](https://community.comma.ai/wiki/index.php/Toyota). ***NOTE: disconnecting the DSU disables Automatic Emergency Braking (AEB).***
-5[Comma Pedal](https://community.comma.ai/wiki/index.php/Comma_Pedal) is used to provide stop-and-go capability to some of the openpilot-supported cars that don't currently support stop-and-go. Here is how to [build a Comma Pedal](https://medium.com/@jfrux/comma-pedal-building-with-macrofab-6328bea791e8). ***NOTE: The Comma Pedal is not officially supported by [comma](https://comma.ai).***
-6Requires a [panda](https://comma.ai/shop/products/panda-obd-ii-dongle) and [community built giraffe](https://zoneos.com/volt/). ***NOTE: disconnecting the ASCM disables Automatic Emergency Braking (AEB).***
- -Community Maintained Cars and Features are not verified by comma to meet our [safety model](SAFETY.md). Be extra cautious using them. They are only available after enabling the toggle in `Settings->Developer->Enable Community Features`. - -Installation Instructions ------- - -Install openpilot on a EON by entering ``https://openpilot.comma.ai`` during the installer setup. - -Follow this [video instructions](https://youtu.be/3nlkomHathI) to properly mount the EON on the windshield. Note: openpilot features an automatic pose calibration routine and openpilot performance should not be affected by small pitch and yaw misalignments caused by imprecise EON mounting. - -Before placing the device on your windshield, check the state and local laws and ordinances where you drive. Some state laws prohibit or restrict the placement of objects on the windshield of a motor vehicle. - -You will be able to engage openpilot after reviewing the onboarding screens and finishing the calibration procedure. - -Limitations of openpilot ALC and LDW ------- - -openpilot ALC and openpilot LDW do not automatically drive the vehicle or reduce the amount of attention that must be paid to operate your vehicle. The driver must always keep control of the steering wheel and be ready to correct the openpilot ALC action at all times. - -While changing lanes, openpilot is not capable of looking next to you or checking your blind spot. Only nudge the wheel to initiate a lane change after you have confirmed it's safe to do so. - -Many factors can impact the performance of openpilot ALC and openpilot LDW, causing them to be unable to function as intended. These include, but are not limited to: - -* Poor visibility (heavy rain, snow, fog, etc.) or weather conditions that may interfere with sensor operation. -* The road facing camera is obstructed, covered or damaged by mud, ice, snow, etc. -* Obstruction caused by applying excessive paint or adhesive products (such as wraps, stickers, rubber coating, etc.) onto the vehicle. -* The EON is mounted incorrectly. -* When in sharp curves, like on-off ramps, intersections etc...; openpilot is designed to be limited in the amount of steering torque it can produce. -* In the presence of restricted lanes or construction zones. -* When driving on highly banked roads or in presence of strong cross-wind. -* Extremely hot or cold temperatures. -* Bright light (due to oncoming headlights, direct sunlight, etc.). -* Driving on hills, narrow, or winding roads. - -The list above does not represent an exhaustive list of situations that may interfere with proper operation of openpilot components. It is the driver's responsibility to be in control of the vehicle at all times. - -Limitations of openpilot ACC and FCW ------- - -openpilot ACC and openpilot FCW are not systems that allow careless or inattentive driving. It is still necessary for the driver to pay close attention to the vehicle’s surroundings and to be ready to re-take control of the gas and the brake at all times. - -Many factors can impact the performance of openpilot ACC and openpilot FCW, causing them to be unable to function as intended. These include, but are not limited to: - -* Poor visibility (heavy rain, snow, fog, etc.) or weather conditions that may interfere with sensor operation. -* The road facing camera or radar are obstructed, covered, or damaged by mud, ice, snow, etc. -* Obstruction caused by applying excessive paint or adhesive products (such as wraps, stickers, rubber coating, etc.) onto the vehicle. -* The EON is mounted incorrectly. -* Approaching a toll booth, a bridge or a large metal plate. -* When driving on roads with pedestrians, cyclists, etc... -* In presence of traffic signs or stop lights, which are not detected by openpilot at this time. -* When the posted speed limit is below the user selected set speed. openpilot does not detect speed limits at this time. -* In presence of vehicles in the same lane that are not moving. -* When abrupt braking maneuvers are required. openpilot is designed to be limited in the amount of deceleration and acceleration that it can produce. -* When surrounding vehicles perform close cut-ins from neighbor lanes. -* Driving on hills, narrow, or winding roads. -* Extremely hot or cold temperatures. -* Bright light (due to oncoming headlights, direct sunlight, etc.). -* Interference from other equipment that generates radar waves. - -The list above does not represent an exhaustive list of situations that may interfere with proper operation of openpilot components. It is the driver's responsibility to be in control of the vehicle at all times. - -Limitations of openpilot DM ------- - -openpilot DM should not be considered an exact measurements of the status of alertness of the driver. - -Many factors can impact the performance of openpilot DM, causing it to be unable to function as intended. These include, but are not limited to: - -* Low light conditions, such as driving at night or in dark tunnels. -* Bright light (due to oncoming headlights, direct sunlight, etc.). -* The driver face is partially or completely outside field of view of the driver facing camera. -* Right hand driving vehicles. -* The driver facing camera is obstructed, covered, or damaged. - -The list above does not represent an exhaustive list of situations that may interfere with proper operation of openpilot components. A driver should not rely on openpilot DM to assess their level of attention. - -User Data and comma Account ------- - -By default, openpilot uploads the driving data to our servers. You can also access your data by pairing with the comma connect app ([iOS](https://apps.apple.com/us/app/comma-connect/id1456551889), [Android](https://play.google.com/store/apps/details?id=ai.comma.connect&hl=en_US)). We use your data to train better models and improve openpilot for everyone. - -openpilot is open source software: the user is free to disable data collection if they wish to do so. - -openpilot logs the road facing camera, CAN, GPS, IMU, magnetometer, thermal sensors, crashes, and operating system logs. -The driver facing camera is only logged if you explicitly opt-in in settings. The microphone is not recorded. - -By using openpilot, you agree to [our Privacy Policy](https://my.comma.ai/privacy). You understand that use of this software or its related services will generate certain types of user data, which may be logged and stored at the sole discretion of comma. By accepting this agreement, you grant an irrevocable, perpetual, worldwide right to comma for the use of this data. - -Safety and Testing ----- - -* openpilot observes ISO26262 guidelines, see [SAFETY.md](SAFETY.md) for more detail. -* openpilot has software in the loop [tests](run_docker_tests.sh) that run on every commit. -* The safety model code lives in panda and is written in C, see [code rigor](https://github.com/commaai/panda#code-rigor) for more details. -* panda has software in the loop [safety tests](https://github.com/commaai/panda/tree/master/tests/safety). -* Internally, we have a hardware in the loop Jenkins test suite that builds and unit tests the various processes. -* panda has additional hardware in the loop [tests](https://github.com/commaai/panda/blob/master/Jenkinsfile). -* We run the latest openpilot in a testing closet containing 10 EONs continuously replaying routes. - -Testing on PC ------- - -Check out [openpilot-tools](https://github.com/commaai/openpilot-tools): lots of tools you can use to replay driving data, test and develop openpilot from your pc. - -Community and Contributing ------- - -openpilot is developed by [comma](https://comma.ai/) and by users like you. We welcome both pull requests and issues on [GitHub](http://github.com/commaai/openpilot). Bug fixes and new car ports are encouraged. - -You can add support for your car by following guides we have written for [Brand](https://medium.com/@comma_ai/how-to-write-a-car-port-for-openpilot-7ce0785eda84) and [Model](https://medium.com/@comma_ai/openpilot-port-guide-for-toyota-models-e5467f4b5fe6) ports. Generally, a car with adaptive cruise control and lane keep assist is a good candidate. [Join our Discord](https://discord.comma.ai) to discuss car ports: most car makes have a dedicated channel. - -Want to get paid to work on openpilot? [comma is hiring](https://comma.ai/jobs/). We also have a [bounty program](https://comma.ai/bounties.html). - -And [follow us on Twitter](https://twitter.com/comma_ai). - -Directory Structure ------- - . - ├── apk # The apk files used for the UI - ├── cereal # The messaging spec and libs used for all logs on EON - ├── common # Library like functionality we've developed here - ├── installer/updater # Manages auto-updates of openpilot - ├── opendbc # Files showing how to interpret data from cars - ├── panda # Code used to communicate on CAN - ├── phonelibs # Libraries used on EON - ├── pyextra # Libraries used on EON - └── selfdrive # Code needed to drive the car - ├── assets # Fonts and images for UI - ├── athena # Allows communication with the app - ├── boardd # Daemon to talk to the board - ├── camerad # Driver to capture images from the camera sensors - ├── car # Car specific code to read states and control actuators - ├── common # Shared C/C++ code for the daemons - ├── controls # Perception, planning and controls - ├── debug # Tools to help you debug and do car ports - ├── locationd # Soon to be home of precise location - ├── logcatd # Android logcat as a service - ├── loggerd # Logger and uploader of car data - ├── modeld # Driving and monitoring model runners - ├── proclogd # Logs information from proc - ├── sensord # IMU / GPS interface code - ├── tests # Unit tests, system tests and a car simulator - └── ui # The UI - -To understand how the services interact, see `cereal/service_list.yaml`. - -Licensing ------- - -openpilot is released under the MIT license. Some parts of the software are released under other licenses as specified. - -Any user of this software shall indemnify and hold harmless comma.ai, Inc. and its directors, officers, employees, agents, stockholders, affiliates, subcontractors and customers from and against all allegations, claims, actions, suits, demands, damages, liabilities, obligations, losses, settlements, judgments, costs and expenses (including without limitation attorneys’ fees and costs) which arise out of, relate to or result from any use of this software by user. - -**THIS IS ALPHA QUALITY SOFTWARE FOR RESEARCH PURPOSES ONLY. THIS IS NOT A PRODUCT. -YOU ARE RESPONSIBLE FOR COMPLYING WITH LOCAL LAWS AND REGULATIONS. -NO WARRANTY EXPRESSED OR IMPLIED.** - ---- - - diff --git a/RELEASES.md b/RELEASES.md deleted file mode 100644 index 1b4caf9634..0000000000 --- a/RELEASES.md +++ /dev/null @@ -1,500 +0,0 @@ -Version 0.7.1 (2020-01-20) -======================== - * comma two support! - * Lane Change Assist above 45 mph! - * Replace zmq with custom messaging library, msgq! - * Supercombo model: calibration and driving models are combined for better lead estimate - * More robust updater thanks to jyoung8607! Requires NEOS update - * Improve low speed ACC tuning - -Version 0.7 (2019-12-13) -======================== - * Move to SCons build system! - * Add Lane Departure Warning (LDW) for all supported vehicles! - * NEOS update: increase wifi speed thanks to jyoung8607! - * Adaptive driver monitoring based on scene - * New driving model trained end-to-end: improve lane lines and lead detection - * Smarter torque limit alerts for all cars - * Improve GM longitudinal control: proper computations for 15Hz radar - * Move GM port, Toyota with DSU removed, comma pedal in community features; toggle switch required - * Remove upload over cellular toggle: only upload qlog and qcamera files if not on wifi - * Refactor Panda code towards ISO26262 and SIL2 compliancy - * Forward stock FCW for Honda Nidec - * Volkswagen port now standard: comma Harness intercepts stock camera - -Version 0.6.6 (2019-11-05) -======================== - * Volkswagen support thanks to jyoung8607! - * Toyota Corolla Hybrid with TSS 2.0 support thanks to u8511049! - * Lexus ES with TSS 2.0 support thanks to energee! - * Fix GM ignition detection and lock safety mode not required anymore - * Log panda firmware and dongle ID thanks to martinl! - * New driving model: improve path prediction and lead detection - * New driver monitoring model, 4x smaller and running on DSP - * Display an alert and don't start openpilot if panda has wrong firmware - * Fix bug preventing EON from terminating processes after a drive - * Remove support for Toyota giraffe without the 120Ohm resistor - -Version 0.6.5 (2019-10-07) -======================== - * NEOS update: upgrade to Python3 and new installer! - * comma Harness support! - * New driving model: improve path prediction - * New driver monitoring model: more accurate face and eye detection - * Redesign offroad screen to display updates and alerts - * Increase maximum allowed acceleration - * Prevent car 12V battery drain by cutting off EON charge after 3 days of no drive - * Lexus CT Hybrid support thanks to thomaspich! - * Louder chime for critical alerts - * Add toggle to switch to dashcam mode - * Fix "invalid vehicle params" error on DSU-less Toyota - -Version 0.6.4 (2019-09-08) -======================== - * Forward stock AEB for Honda Nidec - * Improve lane centering on banked roads - * Always-on forward collision warning - * Always-on driver monitoring, except for right hand drive countries - * Driver monitoring learns the user's normal driving position - * Honda Fit support thanks to energee! - * Lexus IS support - -Version 0.6.3 (2019-08-12) -======================== - * Alert sounds from EON: requires NEOS update - * Improve driver monitoring: eye tracking and improved awareness logic - * Improve path prediction with new driving model - * Improve lane positioning with wide lanes and exits - * Improve lateral control on RAV4 - * Slow down for turns using model - * Open sourced regression test to verify outputs against reference logs - * Open sourced regression test to sanity check all car models - -Version 0.6.2 (2019-07-29) -======================== - * New driving model! - * Improve lane tracking with double lines - * Strongly improve stationary vehicle detection - * Strongly reduce cases of braking due to false leads - * Better lead tracking around turns - * Improve cut-in prediction by using neural network - * Improve lateral control on Toyota Camry and C-HR thanks to zorrobyte! - * Fix unintended openpilot disengagements on Jeep thanks to adhintz! - * Fix delayed transition to offroad when car is turned off - -Version 0.6.1 (2019-07-21) -======================== - * Remote SSH with comma prime and [ssh.comma.ai](https://ssh.comma.ai) - * Panda code Misra-c2012 compliance, tested against cppcheck coverage - * Lockout openpilot after 3 terminal alerts for driver distracted or unresponsive - * Toyota Sienna support thanks to wocsor! - -Version 0.6 (2019-07-01) -======================== - * New model, with double the pixels and ten times the temporal context! - * Car should not take exits when in the right lane - * openpilot uses only ~65% of the CPU (down from 75%) - * Routes visible in connect/explorer after only 0.2% is uploaded (qlogs) - * loggerd and sensord are open source, every line of openpilot is now open - * Panda safety code is MISRA compliant and ships with a signed version on release2 - * New NEOS is 500MB smaller and has a reproducible usr/pipenv - * Lexus ES Hybrid support thanks to wocsor! - * Improve tuning for supported Toyota with TSS 2.0 - * Various other stability improvements - -Version 0.5.13 (2019-05-31) -========================== - * Reduce panda power consumption by 70%, down to 80mW, when car is off (not for GM) - * Reduce EON power consumption by 40%, down to 1100mW, when car is off - * Reduce CPU utilization by 20% and improve stability - * Temporarily remove mapd functionalities to improve stability - * Add openpilot record-only mode for unsupported cars - * Synchronize controlsd to boardd to reduce latency - * Remove panda support for Subaru giraffe - -Version 0.5.12 (2019-05-16) -========================== - * Improve lateral control for the Prius and Prius Prime - * Compress logs before writing to disk - * Remove old driving data when storage reaches 90% full - * Fix small offset in following distance - * Various small CPU optimizations - * Improve offroad power consumption: require NEOS Update - * Add default speed limits for Estonia thanks to martinl! - * Subaru Crosstrek support thanks to martinl! - * Toyota Avalon support thanks to njbrown09! - * Toyota Rav4 with TSS 2.0 support thanks to wocsor! - * Toyota Corolla with TSS 2.0 support thanks to wocsor! - -Version 0.5.11 (2019-04-17) -======================== - * Add support for Subaru - * Reduce panda power consumption by 60% when car is off - * Fix controlsd lag every 6 minutes. This would sometimes cause disengagements - * Fix bug in controls with new angle-offset learner in MPC - * Reduce cpu consumption of ubloxd by rewriting it in C++ - * Improve driver monitoring model and face detection - * Improve performance of visiond and ui - * Honda Passport 2019 support - * Lexus RX Hybrid 2019 support thanks to schomems! - * Improve road selection heuristic in mapd - * Add Lane Departure Warning to dashboard for Toyota thanks to arne182 - -Version 0.5.10 (2019-03-19) -======================== - * Self-tuning vehicle parameters: steering offset, tire stiffness and steering ratio - * Improve longitudinal control at low speed when lead vehicle harshly decelerates - * Fix panda bug going unexpectedly in DCP mode when EON is connected - * Reduce white panda power consumption by 500mW when EON is disconnected by turning off WIFI - * New Driver Monitoring Model - * Support QR codes for login using comma connect - * Refactor comma pedal FW and use CRC-8 checksum algorithm for safety. Reflashing pedal is required. - Please see `#hw-pedal` on [discord](discord.comma.ai) for assistance updating comma pedal. - * Additional speed limit rules for Germany thanks to arne182 - * Allow negative speed limit offsets - -Version 0.5.9 (2019-02-10) -======================== - * Improve calibration using a dedicated neural network - * Abstract planner in its own process to remove lags in controls process - * Improve speed limits with country/region defaults by road type - * Reduce mapd data usage with gzip thanks to eFiniLan - * Zip log files in the background to reduce disk usage - * Kia Optima support thanks to emmertex! - * Buick Regal 2018 support thanks to HOYS! - * Comma pedal support for Toyota thanks to wocsor! Note: tuning needed and not maintained by comma - * Chrysler Pacifica and Jeep Grand Cherokee support thanks to adhintz! - -Version 0.5.8 (2019-01-17) -======================== - * Open sourced visiond - * Auto-slowdown for upcoming turns - * Chrysler/Jeep/Fiat support thanks to adhintz! - * Honda Civic 2019 support thanks to csouers! - * Improve use of car display in Toyota thanks to arne182! - * No data upload when connected to Android or iOS hotspots and "Enable Upload Over Cellular" setting is off - * EON stops charging when 12V battery drops below 11.8V - -Version 0.5.7 (2018-12-06) -======================== - * Speed limit from OpenStreetMap added to UI - * Highlight speed limit when speed exceeds road speed limit plus a delta - * Option to limit openpilot max speed to road speed limit plus a delta - * Cadillac ATS support thanks to vntarasov! - * GMC Acadia support thanks to CryptoKylan! - * Decrease GPU power consumption - * NEOSv8 autoupdate - -Version 0.5.6 (2018-11-16) -======================== - * Refresh settings layout and add feature descriptions - * In Honda, keep stock camera on for logging and extra stock features; new openpilot giraffe setting is 0111! - * In Toyota, option to keep stock camera on for logging and extra stock features (e.g. AHB); 120Ohm resistor required on giraffe. - * Improve camera calibration stability - * More tuning to Honda positive accelerations - * Reduce brake pump use on Hondas - * Chevrolet Malibu support thanks to tylergets! - * Holden Astra support thanks to AlexHill! - -Version 0.5.5 (2018-10-20) -======================== - * Increase allowed Honda positive accelerations - * Fix sporadic unexpected braking when passing semi-trucks in Toyota - * Fix gear reading bug in Hyundai Elantra thanks to emmertex! - -Version 0.5.4 (2018-09-25) -======================== - * New Driving Model - * New Driver Monitoring Model - * Improve longitudinal mpc in mid-low speed braking - * Honda Accord hybrid support thanks to energee! - * Ship mpc binaries and sensibly reduce build time - * Calibration more stable - * More Hyundai and Kia cars supported thanks to emmertex! - * Various GM Volt improvements thanks to vntarasov! - -Version 0.5.3 (2018-09-03) -======================== - * Hyundai Santa Fe support! - * Honda Pilot 2019 support thanks to energee! - * Toyota Highlander support thanks to daehahn! - * Improve steering tuning for Honda Odyssey - -Version 0.5.2 (2018-08-16) -======================== - * New calibration: more accurate, a lot faster, open source! - * Enable orbd - * Add little endian support to CAN packer - * Fix fingerprint for Honda Accord 1.5T - * Improve driver monitoring model - -Version 0.5.1 (2018-08-01) -======================== - * Fix radar error on Civic sedan 2018 - * Improve thermal management logic - * Alpha Toyota C-HR and Camry support! - * Auto-switch Driver Monitoring to 3 min counter when inaccurate - -Version 0.5 (2018-07-11) -======================== - * Driver Monitoring (beta) option in settings! - * Make visiond, loggerd and UI use less resources - * 60 FPS UI - * Better car parameters for most cars - * New sidebar with stats - * Remove Waze and Spotify to free up system resources - * Remove rear view mirror option - * Calibration 3x faster - -Version 0.4.7.2 (2018-06-25) -========================== - * Fix loggerd lag issue - * No longer prompt for updates - * Mitigate right lane hugging for properly mounted EON (procedure on wiki) - -Version 0.4.7.1 (2018-06-18) -========================== - * Fix Acura ILX steer faults - * Fix bug in mock car - -Version 0.4.7 (2018-06-15) -========================== - * New model! - * GM Volt (and CT6 lateral) support! - * Honda Bosch lateral support! - * Improve actuator modeling to reduce lateral wobble - * Minor refactor of car abstraction layer - * Hack around orbd startup issue - -Version 0.4.6 (2018-05-18) -========================== - * NEOSv6 required! Will autoupdate - * Stability improvements - * Fix all memory leaks - * Update C++ compiler to clang6 - * Improve front camera exposure - -Version 0.4.5 (2018-04-27) -========================== - * Release notes added to the update popup - * Improve auto shut-off logic to disallow empty battery - * Added onboarding instructions - * Include orbd, the first piece of new calibration algorithm - * Show remaining upload data instead of file numbers - * Fix UI bugs - * Fix memory leaks - -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 - * Improve driving when only one lane line is detected - * Added fingerprint for Toyota Corolla LE - * Fixed Toyota Corolla steer error - * Full-screen driving UI - * Improved path drawing - -Version 0.4.3.1 (2018-03-19) -============================ - * Improve autofocus - * Add check for MPC solution error - * Make first distracted warning visual only - -Version 0.4.3 (2018-03-13) -========================== - * Add HDR and autofocus - * Update UI aesthetic - * Grey panda works in Waze - * Add alpha support for 2017 Honda Pilot - * Slight increase in acceleration response from stop - * Switch CAN sending to use CANPacker - * Fix pulsing acceleration regression on Honda - * Fix openpilot bugs when stock system is in use - * Change starting logic for chffrplus to use battery voltage - -Version 0.4.2 (2018-02-05) -========================== - * Add alpha support for 2017 Lexus RX Hybrid - * Add alpha support for 2018 ACURA RDX - * Updated fingerprint to include Toyota Rav4 SE and Prius Prime - * Bugfixes for Acura ILX and Honda Odyssey - -Version 0.4.1 (2018-01-30) -========================== - * Add alpha support for 2017 Toyota Corolla - * Add alpha support for 2018 Honda Odyssey with Honda Sensing - * Add alpha support for Grey Panda - * Refactored car abstraction layer to make car ports easier - * Increased steering torque limit on Honda CR-V by 30% - -Version 0.4.0.2 (2018-01-18) -========================== - * Add focus adjustment slider - * Minor bugfixes - -Version 0.4.0.1 (2017-12-21) -========================== - * New UI to match chffrplus - * Improved lateral control tuning to fix oscillations on Civic - * Add alpha support for 2017 Toyota Rav4 Hybrid - * Reduced CPU usage - * Removed unnecessary utilization of fan at max speed - * Minor bug fixes - -Version 0.3.9 (2017-11-21) -========================== - * Add alpha support for 2017 Toyota Prius - * Improved longitudinal control using model predictive control - * Enable Forward Collision Warning - * Acura ILX now maintains openpilot engaged at standstill when brakes are applied - -Version 0.3.8.2 (2017-10-30) -========================== - * Add alpha support for 2017 Toyota RAV4 - * Smoother lateral control - * Stay silent if stock system is connected through giraffe - * Minor bug fixes - -Version 0.3.7 (2017-09-30) -========================== - * Improved lateral control using model predictive control - * Improved lane centering - * Improved GPS - * Reduced tendency of path deviation near right side exits - * Enable engagement while the accelerator pedal is pressed - * Enable engagement while the brake pedal is pressed, when stationary and with lead vehicle within 5m - * Disable engagement when park brake or brake hold are active - * Fixed sporadic longitudinal pulsing in Civic - * Cleanups to vehicle interface - -Version 0.3.6.1 (2017-08-15) -============================ - * Mitigate low speed steering oscillations on some vehicles - * Include board steering check for CR-V - -Version 0.3.6 (2017-08-08) -========================== - * Fix alpha CR-V support - * Improved GPS - * Fix display of target speed not always matching HUD - * Increased acceleration after stop - * Mitigated some vehicles driving too close to the right line - -Version 0.3.5 (2017-07-30) -========================== - * Fix bug where new devices would not begin calibration - * Minor robustness improvements - -Version 0.3.4 (2017-07-28) -========================== - * Improved model trained on more data - * Much improved controls tuning - * Performance improvements - * Bugfixes and improvements to calibration - * Driving log can play back video - * Acura only: system now stays engaged below 25mph as long as brakes are applied - -Version 0.3.3 (2017-06-28) -=========================== - * Improved model trained on more data - * Alpha CR-V support thanks to energee and johnnwvs! - * Using the opendbc project for DBC files - * Minor performance improvements - * UI update thanks to pjlao307 - * Power off button - * 6% more torque on the Civic - -Version 0.3.2 (2017-05-22) -=========================== - * Minor stability bugfixes - * Added metrics and rear view mirror disable to settings - * Update model with more crowdsourced data - -Version 0.3.1 (2017-05-17) -=========================== - * visiond stability bugfix - * Add logging for angle and flashing - -Version 0.3.0 (2017-05-12) -=========================== - * Add CarParams struct to improve the abstraction layer - * Refactor visiond IPC to support multiple clients - * Add raw GPS and beginning support for navigation - * Improve model in visiond using crowdsourced data - * Add improved system logging to diagnose instability - * Rewrite baseui in React Native - * Moved calibration to the cloud - -Version 0.2.9 (2017-03-01) -=========================== - * Retain compatibility with NEOS v1 - -Version 0.2.8 (2017-02-27) -=========================== - * Fix bug where frames were being dropped in minute 71 - -Version 0.2.7 (2017-02-08) -=========================== - * Better performance and pictures at night - * Fix ptr alignment issue in boardd - * Fix brake error light, fix crash if too cold - -Version 0.2.6 (2017-01-31) -=========================== - * Fix bug in visiond model execution - -Version 0.2.5 (2017-01-30) -=========================== - * Fix race condition in manager - -Version 0.2.4 (2017-01-27) -=========================== - * OnePlus 3T support - * Enable installation as NEOS app - * Various minor bugfixes - -Version 0.2.3 (2017-01-11) -=========================== - * Reduce space usage by 80% - * Add better logging - * Add Travis CI - -Version 0.2.2 (2017-01-10) -=========================== - * Board triggers started signal on CAN messages - * Improved autoexposure - * Handle out of space, improve upload status - -Version 0.2.1 (2016-12-14) -=========================== - * Performance improvements, removal of more numpy - * Fix boardd process priority - * Make counter timer reset on use of steering wheel - -Version 0.2 (2016-12-12) -========================= - * Car/Radar abstraction layers have shipped, see cereal/car.capnp - * controlsd has been refactored - * Shipped plant model and testing maneuvers - * visiond exits more gracefully now - * Hardware encoder in visiond should always init - * ui now turns off the screen after 30 seconds - * Switch to openpilot release branch for future releases - * Added preliminary Docker container to run tests on PC - -Version 0.1 (2016-11-29) -========================= - * Initial release of openpilot - * Adaptive cruise control is working - * Lane keep assist is working - * Support for Acura ILX 2016 with AcuraWatch Plus - * Support for Honda Civic 2016 Touring Edition diff --git a/SAFETY.md b/SAFETY.md deleted file mode 100644 index 5a3c287fe9..0000000000 --- a/SAFETY.md +++ /dev/null @@ -1,34 +0,0 @@ -openpilot Safety -====== - -openpilot is an Adaptive Cruise Control (ACC) and Automated Lane Centering (ALC) system. -Like other ACC and ALC systems, openpilot is a failsafe passive system and it requires the -driver to be alert and to pay attention at all times. - -In order to enforce driver alertness, openpilot includes a driver monitoring feature -that alerts the driver when distracted. - -However, even with an attentive driver, we must make further efforts for the system to be -safe. We repeat, **driver alertness is necessary, but not sufficient, for openpilot to be -used safely** and openpilot is provided with no warranty of fitness for any purpose. - -openpilot is developed in good faith to be compliant with FMVSS requirements and to follow -industry standards of safety for Level 2 Driver Assistance Systems. In particular, we observe -ISO26262 guidelines, including those from [pertinent documents](https://www.nhtsa.gov/sites/nhtsa.dot.gov/files/documents/13498a_812_573_alcsystemreport.pdf) -released by NHTSA. In addition, we impose strict coding guidelines (like [MISRA C : 2012](https://www.misra.org.uk/MISRAHome/MISRAC2012/tabid/196/Default.aspx)) -on parts of openpilot that are safety relevant. We also perform software-in-the-loop, -hardware-in-the-loop and in-vehicle tests before each software release. - -Following Hazard and Risk Analysis and FMEA, at a very high level, we have designed openpilot -ensuring two main safety requirements. - -1. The driver must always be capable to immediately retake manual control of the vehicle, - by stepping on either pedal or by pressing the cancel button. -2. The vehicle must not alter its trajectory too quickly for the driver to safely - react. This means that while the system is engaged, the actuators are constrained - to operate within reasonable limits. - -For vehicle specific implementation of the safety concept, refer to `panda/board/safety/`. - -**Extra note**: comma.ai strongly discourages the use of openpilot forks with safety code either missing or - not fully meeting the above requirements. diff --git a/SConstruct b/SConstruct deleted file mode 100644 index 404cc4491f..0000000000 --- a/SConstruct +++ /dev/null @@ -1,217 +0,0 @@ -import os -import subprocess -import sys - -AddOption('--test', - action='store_true', - help='build test files') - -AddOption('--asan', - action='store_true', - help='turn on ASAN') - -arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() - -if arch == "aarch64": - lenv = { - "LD_LIBRARY_PATH": '/data/data/com.termux/files/usr/lib', - "PATH": os.environ['PATH'], - "ANDROID_DATA": os.environ['ANDROID_DATA'], - "ANDROID_ROOT": os.environ['ANDROID_ROOT'], - } - - cpppath = [ - "#phonelibs/opencl/include", - ] - libpath = [ - "#phonelibs/snpe/aarch64-android-clang3.8", - "/usr/lib", - "/data/data/com.termux/files/usr/lib", - "/system/vendor/lib64", - "/system/comma/usr/lib", - "#phonelibs/yaml-cpp/lib", - "#phonelibs/nanovg", - "#phonelibs/libyuv/lib", - ] - - cflags = ["-DQCOM", "-mcpu=cortex-a57"] - cxxflags = ["-DQCOM", "-mcpu=cortex-a57"] - - rpath = ["/system/vendor/lib64"] -else: - lenv = { - "PATH": "#external/bin:" + os.environ['PATH'], - } - cpppath = [ - "#phonelibs/capnp-cpp/include", - "#phonelibs/capnp-c/include", - "#phonelibs/zmq/x64/include", - "#external/tensorflow/include", - ] - libpath = [ - "#phonelibs/capnp-cpp/x64/lib", - "#phonelibs/capnp-c/x64/lib", - "#phonelibs/yaml-cpp/x64/lib", - "#phonelibs/snpe/x86_64-linux-clang", - "#phonelibs/zmq/x64/lib", - "#phonelibs/libyuv/x64/lib", - "#external/zmq/lib", - "#external/tensorflow/lib", - "#cereal", - "#selfdrive/common", - "/usr/lib", - "/usr/local/lib", - ] - - rpath = ["phonelibs/capnp-cpp/x64/lib", - "external/tensorflow/lib", - "cereal", - "selfdrive/common"] - - # allows shared libraries to work globally - rpath = [os.path.join(os.getcwd(), x) for x in rpath] - - cflags = [] - cxxflags = [] - -ccflags_asan = ["-fsanitize=address", "-fno-omit-frame-pointer"] if GetOption('asan') else [] -ldflags_asan = ["-fsanitize=address"] if GetOption('asan') else [] - -# change pythonpath to this -lenv["PYTHONPATH"] = Dir("#").path - -env = Environment( - ENV=lenv, - CCFLAGS=[ - "-g", - "-fPIC", - "-O2", - "-Werror=implicit-function-declaration", - "-Werror=incompatible-pointer-types", - "-Werror=int-conversion", - "-Werror=return-type", - "-Werror=format-extra-args", - ] + cflags + ccflags_asan, - - CPPPATH=cpppath + [ - "#", - "#selfdrive", - "#phonelibs/bzip2", - "#phonelibs/libyuv/include", - "#phonelibs/yaml-cpp/include", - "#phonelibs/openmax/include", - "#phonelibs/json/src", - "#phonelibs/json11", - "#phonelibs/eigen", - "#phonelibs/curl/include", - "#phonelibs/opencv/include", - "#phonelibs/libgralloc/include", - "#phonelibs/android_frameworks_native/include", - "#phonelibs/android_hardware_libhardware/include", - "#phonelibs/android_system_core/include", - "#phonelibs/linux/include", - "#phonelibs/snpe/include", - "#phonelibs/nanovg", - "#selfdrive/common", - "#selfdrive/camerad", - "#selfdrive/camerad/include", - "#selfdrive/loggerd/include", - "#selfdrive/modeld", - "#cereal/messaging", - "#cereal", - "#opendbc/can", - ], - - CC='clang', - CXX='clang++', - LINKFLAGS=ldflags_asan, - - RPATH=rpath, - - CFLAGS=["-std=gnu11"] + cflags, - CXXFLAGS=["-std=c++14"] + cxxflags, - LIBPATH=libpath + - [ - "#cereal", - "#selfdrive/common", - "#phonelibs", - ] -) - -if os.environ.get('SCONS_CACHE'): - CacheDir('/tmp/scons_cache') - -node_interval = 5 -node_count = 0 -def progress_function(node): - global node_count - node_count += node_interval - sys.stderr.write("progress: %d\n" % node_count) - -if os.environ.get('SCONS_PROGRESS'): - Progress(progress_function, interval=node_interval) - -SHARED = False - -def abspath(x): - if arch == 'aarch64': - pth = os.path.join("/data/pythonpath", x[0].path) - env.Depends(pth, x) - return File(pth) - else: - # rpath works elsewhere - return x[0].path.rsplit("/", 1)[1][:-3] - -#zmq = 'zmq' -# still needed for apks -zmq = FindFile("libzmq.a", libpath) -Export('env', 'arch', 'zmq', 'SHARED') - -# cereal and messaging are shared with the system -SConscript(['cereal/SConscript']) -if SHARED: - cereal = abspath([File('cereal/libcereal_shared.so')]) - messaging = abspath([File('cereal/libmessaging_shared.so')]) -else: - cereal = [File('#cereal/libcereal.a')] - messaging = [File('#cereal/libmessaging.a')] -Export('cereal', 'messaging') - -SConscript(['selfdrive/common/SConscript']) -Import('_common', '_visionipc', '_gpucommon', '_gpu_libs') - -if SHARED: - common, visionipc, gpucommon = abspath(common), abspath(visionipc), abspath(gpucommon) -else: - common = [_common, 'json'] - visionipc = _visionipc - gpucommon = [_gpucommon] + _gpu_libs - -Export('common', 'visionipc', 'gpucommon') - -SConscript(['opendbc/can/SConscript']) - -SConscript(['common/SConscript']) -SConscript(['common/kalman/SConscript']) -SConscript(['phonelibs/SConscript']) - -SConscript(['selfdrive/modeld/SConscript']) -SConscript(['selfdrive/camerad/SConscript']) -SConscript(['selfdrive/controls/lib/cluster/SConscript']) -SConscript(['selfdrive/controls/lib/lateral_mpc/SConscript']) -SConscript(['selfdrive/controls/lib/longitudinal_mpc/SConscript']) - -SConscript(['selfdrive/boardd/SConscript']) -SConscript(['selfdrive/proclogd/SConscript']) - -SConscript(['selfdrive/ui/SConscript']) -SConscript(['selfdrive/loggerd/SConscript']) - -if arch == "aarch64": - SConscript(['selfdrive/logcatd/SConscript']) - SConscript(['selfdrive/sensord/SConscript']) - SConscript(['selfdrive/clocksd/SConscript']) - -SConscript(['selfdrive/locationd/SConscript']) - -# TODO: finish cereal, dbcbuilder, MPC diff --git a/apk/ai.comma.plus.black.apk b/apk/ai.comma.plus.black.apk deleted file mode 100644 index e0d0df3d96..0000000000 --- a/apk/ai.comma.plus.black.apk +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:309b46b7c38f10da52b18b0340eb3c57b633558a9a27c3ca4116474969ebb456 -size 84675 diff --git a/apk/ai.comma.plus.frame.apk b/apk/ai.comma.plus.frame.apk deleted file mode 100644 index e94dd3093e..0000000000 --- a/apk/ai.comma.plus.frame.apk +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:43243741214262f5229cc5a05fc220000987c9af2e66243ac465ffa405ce043a -size 2850138 diff --git a/apk/ai.comma.plus.offroad.apk b/apk/ai.comma.plus.offroad.apk deleted file mode 100644 index e72168e043..0000000000 --- a/apk/ai.comma.plus.offroad.apk +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7e5868c567d76e080768f4fda323d42f4dd889bb6002f8f84864f5a2e51069b5 -size 16726995 diff --git a/cereal/.dockerignore b/cereal/.dockerignore deleted file mode 100644 index 5b2d46270d..0000000000 --- a/cereal/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -.sconsign.dblite diff --git a/cereal/.gitignore b/cereal/.gitignore deleted file mode 100644 index e90f8c750f..0000000000 --- a/cereal/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -gen -node_modules -package-lock.json -*.pyc -__pycache__ -.*.swp -.*.swo -libcereal*.a -libmessaging.* -libmessaging_shared.* -services.h -.sconsign.dblite -libcereal_shared.* - diff --git a/cereal/Dockerfile b/cereal/Dockerfile deleted file mode 100644 index f681dce68f..0000000000 --- a/cereal/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -from ubuntu:16.04 - -RUN apt-get update && apt-get install -y libzmq3-dev clang wget git autoconf libtool curl make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl - -RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash -ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}" -RUN pyenv install 3.7.3 -RUN pyenv global 3.7.3 -RUN pyenv rehash -RUN pip3 install pyyaml==5.1.2 Cython==0.29.14 scons==3.1.1 pycapnp==0.6.4 - -WORKDIR /project/cereal -COPY install_capnp.sh . -RUN ./install_capnp.sh - -ENV PYTHONPATH=/project - -COPY . . -RUN scons -c && scons -j$(nproc) diff --git a/cereal/README.md b/cereal/README.md deleted file mode 100644 index ec0efc6762..0000000000 --- a/cereal/README.md +++ /dev/null @@ -1,42 +0,0 @@ -What is cereal? ----- - -cereal is both a messaging spec for robotics systems as well as generic high performance IPC pub sub messaging with a single publisher and multiple subscribers. - -Imagine this use case: -* A sensor process reads gyro measurements directly from an IMU and publishes a sensorEvents packet -* A calibration process subscribes to the sensorEvents packet to use the IMU -* A localization process subscribes to the sensorEvents packet to use the IMU also - - -Messaging Spec ----- - -You'll find the message types in [log.capnp](log.capnp). It uses [Cap'n proto](https://capnproto.org/capnp-tool.html) and defines one struct called Event. - -All Events have a logMonoTime and a valid. Then a big union defines the packet type. - - -Pub Sub Backends ----- - -cereal supports two backends, one based on [zmq](https://zeromq.org/), the other called msgq, a custom pub sub based on shared memory that doesn't require the bytes to pass through the kernel. - -Example ---- -```python -import cereal.messaging as messaging - -# in subscriber -sm = messaging.SubMaster(['sensorEvents']) -while 1: - sm.update() - print(sm['sensorEvents']) - -# in publisher -pm = messaging.PubMaster(['sensorEvents']) -dat = messaging.new_message() -dat.init('sensorEvents', 1) -dat.sensorEvents[0] = {"gyro": {"v": [0.1, -0.1, 0.1]}} -pm.send('sensorEvents', dat) -``` diff --git a/cereal/SConscript b/cereal/SConscript deleted file mode 100644 index e0c1b2b52c..0000000000 --- a/cereal/SConscript +++ /dev/null @@ -1,68 +0,0 @@ -Import('env', 'arch', 'zmq') - -gen_dir = Dir('gen') -messaging_dir = Dir('messaging') - -# TODO: remove src-prefix and cereal from command string. can we set working directory? -env.Command(["gen/c/include/c++.capnp.h", "gen/c/include/java.capnp.h"], [], "mkdir -p " + gen_dir.path + "/c/include && touch $TARGETS") -env.Command( - ['gen/c/car.capnp.c', 'gen/c/log.capnp.c', 'gen/c/car.capnp.h', 'gen/c/log.capnp.h'], - ['car.capnp', 'log.capnp'], - 'capnpc $SOURCES --src-prefix=cereal -o c:' + gen_dir.path + '/c/') -env.Command( - ['gen/cpp/car.capnp.c++', 'gen/cpp/log.capnp.c++', 'gen/cpp/car.capnp.h', 'gen/cpp/log.capnp.h'], - ['car.capnp', 'log.capnp'], - 'capnpc $SOURCES --src-prefix=cereal -o c++:' + gen_dir.path + '/cpp/') -import shutil -if shutil.which('capnpc-java'): - env.Command( - ['gen/java/Car.java', 'gen/java/Log.java'], - ['car.capnp', 'log.capnp'], - 'capnpc $SOURCES --src-prefix=cereal -o java:' + gen_dir.path + '/java/') - -# TODO: remove non shared cereal and messaging -cereal_objects = env.SharedObject([ - 'gen/c/car.capnp.c', - 'gen/c/log.capnp.c', - 'gen/cpp/car.capnp.c++', - 'gen/cpp/log.capnp.c++', - ]) - -env.Library('cereal', cereal_objects) -env.SharedLibrary('cereal_shared', cereal_objects, LIBS=["capnp_c"]) - -cereal_dir = Dir('.') -services_h = env.Command( - ['services.h'], - ['service_list.yaml', 'services.py'], - 'python3 ' + cereal_dir.path + '/services.py > $TARGET') - -messaging_objects = env.SharedObject([ - 'messaging/messaging.cc', - 'messaging/impl_zmq.cc', - 'messaging/impl_msgq.cc', - 'messaging/msgq.cc', -]) - -messaging_lib = env.Library('messaging', messaging_objects) -Depends('messaging/impl_zmq.cc', services_h) - -# note, this rebuilds the deps shared, zmq is statically linked to make APK happy -# TODO: get APK to load system zmq to remove the static link -shared_lib_shared_lib = [zmq, 'm', 'stdc++'] + ["gnustl_shared"] if arch == "aarch64" else [zmq] -env.SharedLibrary('messaging_shared', messaging_objects, LIBS=shared_lib_shared_lib) - -env.Program('messaging/bridge', ['messaging/bridge.cc'], LIBS=[messaging_lib, 'zmq']) -Depends('messaging/bridge.cc', services_h) - -# different target? -#env.Program('messaging/demo', ['messaging/demo.cc'], LIBS=[messaging_lib, 'zmq']) - - -env.Command(['messaging/messaging_pyx.so'], - [messaging_lib, 'messaging/messaging_pyx_setup.py', 'messaging/messaging_pyx.pyx', 'messaging/messaging.pxd'], - "cd " + messaging_dir.path + " && python3 messaging_pyx_setup.py build_ext --inplace") - - -if GetOption('test'): - env.Program('messaging/test_runner', ['messaging/test_runner.cc', 'messaging/msgq_tests.cc'], LIBS=[messaging_lib]) diff --git a/cereal/SConstruct b/cereal/SConstruct deleted file mode 100644 index a72286b279..0000000000 --- a/cereal/SConstruct +++ /dev/null @@ -1,49 +0,0 @@ -import os -import subprocess - -zmq = 'zmq' -arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() - -cereal_dir = Dir('.') - -cpppath = [ - cereal_dir, - '/usr/lib/include', -] - -AddOption('--test', - action='store_true', - help='build test files') - -AddOption('--asan', - action='store_true', - help='turn on ASAN') - -ccflags_asan = ["-fsanitize=address", "-fno-omit-frame-pointer"] if GetOption('asan') else [] -ldflags_asan = ["-fsanitize=address"] if GetOption('asan') else [] - -env = Environment( - ENV=os.environ, - CC='clang', - CXX='clang++', - CCFLAGS=[ - "-g", - "-fPIC", - "-O2", - "-Werror=implicit-function-declaration", - "-Werror=incompatible-pointer-types", - "-Werror=int-conversion", - "-Werror=return-type", - "-Werror=format-extra-args", - ] + ccflags_asan, - LDFLAGS=ldflags_asan, - LINKFLAGS=ldflags_asan, - - CFLAGS="-std=gnu11", - CXXFLAGS="-std=c++14", - CPPPATH=cpppath, -) - - -Export('env', 'zmq', 'arch') -SConscript(['SConscript']) diff --git a/cereal/__init__.py b/cereal/__init__.py deleted file mode 100644 index 2d3b48526b..0000000000 --- a/cereal/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -import os -import capnp - -CEREAL_PATH = os.path.dirname(os.path.abspath(__file__)) -capnp.remove_import_hook() - -log = capnp.load(os.path.join(CEREAL_PATH, "log.capnp")) -car = capnp.load(os.path.join(CEREAL_PATH, "car.capnp")) diff --git a/cereal/azure-pipelines.yml b/cereal/azure-pipelines.yml deleted file mode 100644 index c14526a5c1..0000000000 --- a/cereal/azure-pipelines.yml +++ /dev/null @@ -1,14 +0,0 @@ -pr: none - -pool: - vmImage: 'ubuntu-16.04' - -steps: -- script: | - set -e - docker build -t cereal . - docker run cereal bash -c "scons --test --asan -j$(nproc) && messaging/test_runner" - docker run cereal bash -c "ZMQ=1 python -m unittest discover ." - docker run cereal bash -c "MSGQ=1 python -m unittest discover ." - - displayName: 'Run Tests' diff --git a/cereal/car.capnp b/cereal/car.capnp deleted file mode 100644 index 48618a2780..0000000000 --- a/cereal/car.capnp +++ /dev/null @@ -1,468 +0,0 @@ -using Cxx = import "./include/c++.capnp"; -$Cxx.namespace("cereal"); - -using Java = import "./include/java.capnp"; -$Java.package("ai.comma.openpilot.cereal"); -$Java.outerClassname("Car"); - -@0x8e2af1e708af8b8d; - -# ******* events causing controls state machine transition ******* - -struct CarEvent @0x9b1657f34caf3ad3 { - name @0 :EventName; - enable @1 :Bool; - noEntry @2 :Bool; - warning @3 :Bool; - userDisable @4 :Bool; - softDisable @5 :Bool; - immediateDisable @6 :Bool; - preEnable @7 :Bool; - permanent @8 :Bool; - - enum EventName @0xbaa8c5d505f727de { - # TODO: copy from error list - canError @0; - steerUnavailable @1; - brakeUnavailable @2; - gasUnavailable @3; - wrongGear @4; - doorOpen @5; - seatbeltNotLatched @6; - espDisabled @7; - wrongCarMode @8; - steerTempUnavailable @9; - reverseGear @10; - buttonCancel @11; - buttonEnable @12; - pedalPressed @13; - cruiseDisabled @14; - radarCanError @15; - dataNeeded @16; - speedTooLow @17; - outOfSpace @18; - overheat @19; - calibrationIncomplete @20; - calibrationInvalid @21; - controlsMismatch @22; - pcmEnable @23; - pcmDisable @24; - noTarget @25; - radarFault @26; - modelCommIssueDEPRECATED @27; - brakeHold @28; - parkBrake @29; - manualRestart @30; - lowSpeedLockout @31; - plannerError @32; - ipasOverride @33; - debugAlert @34; - steerTempUnavailableMute @35; - resumeRequired @36; - preDriverDistracted @37; - promptDriverDistracted @38; - driverDistracted @39; - geofence @40; - driverMonitorOn @41; - driverMonitorOff @42; - preDriverUnresponsive @43; - promptDriverUnresponsive @44; - driverUnresponsive @45; - belowSteerSpeed @46; - calibrationProgress @47; - lowBattery @48; - invalidGiraffeHonda @49; - vehicleModelInvalid @50; - controlsFailed @51; - sensorDataInvalid @52; - commIssue @53; - tooDistracted @54; - posenetInvalid @55; - soundsUnavailable @56; - preLaneChangeLeft @57; - preLaneChangeRight @58; - laneChange @59; - invalidGiraffeToyota @60; - internetConnectivityNeeded @61; - communityFeatureDisallowed @62; - lowMemory @63; - stockAeb @64; - ldw @65; - carUnrecognized @66; - radarCommIssue @67; - } -} - -# ******* main car state @ 100hz ******* -# all speeds in m/s - -struct CarState { - errorsDEPRECATED @0 :List(CarEvent.EventName); - events @13 :List(CarEvent); - - # car speed - vEgo @1 :Float32; # best estimate of speed - aEgo @16 :Float32; # best estimate of acceleration - vEgoRaw @17 :Float32; # unfiltered speed from CAN sensors - yawRate @22 :Float32; # best estimate of yaw rate - standstill @18 :Bool; - wheelSpeeds @2 :WheelSpeeds; - - # gas pedal, 0.0-1.0 - gas @3 :Float32; # this is user + computer - gasPressed @4 :Bool; # this is user pedal only - - # brake pedal, 0.0-1.0 - brake @5 :Float32; # this is user pedal only - brakePressed @6 :Bool; # this is user pedal only - brakeLights @19 :Bool; - - # steering wheel - steeringAngle @7 :Float32; # deg - steeringRate @15 :Float32; # deg/s - steeringTorque @8 :Float32; # TODO: standardize units - steeringTorqueEps @27 :Float32; # TODO: standardize units - steeringPressed @9 :Bool; # if the user is using the steering wheel - steeringRateLimited @29 :Bool; # if the torque is limited by the rate limiter - stockAeb @30 :Bool; - stockFcw @31 :Bool; - - # cruise state - cruiseState @10 :CruiseState; - - # gear - gearShifter @14 :GearShifter; - - # button presses - buttonEvents @11 :List(ButtonEvent); - leftBlinker @20 :Bool; - rightBlinker @21 :Bool; - genericToggle @23 :Bool; - - # lock info - doorOpen @24 :Bool; - seatbeltUnlatched @25 :Bool; - canValid @26 :Bool; - - # clutch (manual transmission only) - clutchPressed @28 :Bool; - - # which packets this state came from - canMonoTimes @12: List(UInt64); - - struct WheelSpeeds { - # optional wheel speeds - fl @0 :Float32; - fr @1 :Float32; - rl @2 :Float32; - rr @3 :Float32; - } - - struct CruiseState { - enabled @0 :Bool; - speed @1 :Float32; - available @2 :Bool; - speedOffset @3 :Float32; - standstill @4 :Bool; - } - - enum GearShifter { - unknown @0; - park @1; - drive @2; - neutral @3; - reverse @4; - sport @5; - low @6; - brake @7; - eco @8; - manumatic @9; - } - - # send on change - struct ButtonEvent { - pressed @0 :Bool; - type @1 :Type; - - enum Type { - unknown @0; - leftBlinker @1; - rightBlinker @2; - accelCruise @3; - decelCruise @4; - cancel @5; - altButton1 @6; - altButton2 @7; - altButton3 @8; - setCruise @9; - resumeCruise @10; - gapAdjustCruise @11; - } - } -} - -# ******* radar state @ 20hz ******* - -struct RadarData @0x888ad6581cf0aacb { - errors @0 :List(Error); - points @1 :List(RadarPoint); - - # which packets this state came from - canMonoTimes @2 :List(UInt64); - - enum Error { - canError @0; - fault @1; - wrongConfig @2; - } - - # similar to LiveTracks - # is one timestamp valid for all? I think so - struct RadarPoint { - trackId @0 :UInt64; # no trackId reuse - - # these 3 are the minimum required - dRel @1 :Float32; # m from the front bumper of the car - yRel @2 :Float32; # m - vRel @3 :Float32; # m/s - - # these are optional and valid if they are not NaN - aRel @4 :Float32; # m/s^2 - yvRel @5 :Float32; # m/s - - # some radars flag measurements VS estimates - measured @6 :Bool; - } -} - -# ******* car controls @ 100hz ******* - -struct CarControl { - # must be true for any actuator commands to work - enabled @0 :Bool; - active @7 :Bool; - - gasDEPRECATED @1 :Float32; - brakeDEPRECATED @2 :Float32; - steeringTorqueDEPRECATED @3 :Float32; - - actuators @6 :Actuators; - - cruiseControl @4 :CruiseControl; - hudControl @5 :HUDControl; - - struct Actuators { - # range from 0.0 - 1.0 - gas @0: Float32; - brake @1: Float32; - # range from -1.0 - 1.0 - steer @2: Float32; - steerAngle @3: Float32; - } - - struct CruiseControl { - cancel @0: Bool; - override @1: Bool; - speedOverride @2: Float32; - accelOverride @3: Float32; - } - - struct HUDControl { - speedVisible @0: Bool; - setSpeed @1: Float32; - lanesVisible @2: Bool; - leadVisible @3: Bool; - visualAlert @4: VisualAlert; - audibleAlert @5: AudibleAlert; - rightLaneVisible @6: Bool; - leftLaneVisible @7: Bool; - rightLaneDepart @8: Bool; - leftLaneDepart @9: Bool; - - enum VisualAlert { - # these are the choices from the Honda - # map as good as you can for your car - none @0; - fcw @1; - steerRequired @2; - brakePressed @3; - wrongGear @4; - seatbeltUnbuckled @5; - speedTooHigh @6; - ldw @7; - } - - enum AudibleAlert { - # these are the choices from the Honda - # map as good as you can for your car - none @0; - chimeEngage @1; - chimeDisengage @2; - chimeError @3; - chimeWarning1 @4; - chimeWarning2 @5; - chimeWarningRepeat @6; - chimePrompt @7; - } - } -} - -# ****** car param ****** - -struct CarParams { - carName @0 :Text; - carFingerprint @1 :Text; - - enableGasInterceptor @2 :Bool; - enableCruise @3 :Bool; - enableCamera @4 :Bool; - enableDsu @5 :Bool; # driving support unit - enableApgs @6 :Bool; # advanced parking guidance system - - minEnableSpeed @7 :Float32; - minSteerSpeed @8 :Float32; - safetyModel @9 :SafetyModel; - safetyModelPassive @42 :SafetyModel = silent; - safetyParam @10 :Int16; - - steerMaxBP @11 :List(Float32); - steerMaxV @12 :List(Float32); - gasMaxBP @13 :List(Float32); - gasMaxV @14 :List(Float32); - brakeMaxBP @15 :List(Float32); - brakeMaxV @16 :List(Float32); - - # things about the car in the manual - mass @17 :Float32; # [kg] running weight - wheelbase @18 :Float32; # [m] distance from rear to front axle - centerToFront @19 :Float32; # [m] GC distance to front axle - steerRatio @20 :Float32; # [] ratio between front wheels and steering wheel angles - steerRatioRear @21 :Float32; # [] rear steering ratio wrt front steering (usually 0) - - # things we can derive - rotationalInertia @22 :Float32; # [kg*m2] body rotational inertia - tireStiffnessFront @23 :Float32; # [N/rad] front tire coeff of stiff - tireStiffnessRear @24 :Float32; # [N/rad] rear tire coeff of stiff - - longitudinalTuning @25 :LongitudinalPIDTuning; - lateralTuning :union { - pid @26 :LateralPIDTuning; - indi @27 :LateralINDITuning; - lqr @40 :LateralLQRTuning; - } - - steerLimitAlert @28 :Bool; - steerLimitTimer @47 :Float32; # time before steerLimitAlert is issued - - vEgoStopping @29 :Float32; # Speed at which the car goes into stopping state - directAccelControl @30 :Bool; # Does the car have direct accel control or just gas/brake - stoppingControl @31 :Bool; # Does the car allows full control even at lows speeds when stopping - startAccel @32 :Float32; # Required acceleraton to overcome creep braking - steerRateCost @33 :Float32; # Lateral MPC cost on steering rate - steerControlType @34 :SteerControlType; - radarOffCan @35 :Bool; # True when radar objects aren't visible on CAN - - steerActuatorDelay @36 :Float32; # Steering wheel actuator delay in seconds - openpilotLongitudinalControl @37 :Bool; # is openpilot doing the longitudinal control? - carVin @38 :Text; # VIN number queried during fingerprinting - isPandaBlack @39: Bool; - dashcamOnly @41: Bool; - transmissionType @43 :TransmissionType; - carFw @44 :List(CarFw); - radarTimeStep @45: Float32 = 0.05; # time delta between radar updates, 20Hz is very standard - communityFeature @46: Bool; # true if a community maintained feature is detected - - struct LateralPIDTuning { - kpBP @0 :List(Float32); - kpV @1 :List(Float32); - kiBP @2 :List(Float32); - kiV @3 :List(Float32); - kf @4 :Float32; - } - - struct LongitudinalPIDTuning { - kpBP @0 :List(Float32); - kpV @1 :List(Float32); - kiBP @2 :List(Float32); - kiV @3 :List(Float32); - deadzoneBP @4 :List(Float32); - deadzoneV @5 :List(Float32); - } - - struct LateralINDITuning { - outerLoopGain @0 :Float32; - innerLoopGain @1 :Float32; - timeConstant @2 :Float32; - actuatorEffectiveness @3 :Float32; - } - - struct LateralLQRTuning { - scale @0 :Float32; - ki @1 :Float32; - dcGain @2 :Float32; - - # State space system - a @3 :List(Float32); - b @4 :List(Float32); - c @5 :List(Float32); - - k @6 :List(Float32); # LQR gain - l @7 :List(Float32); # Kalman gain - } - - enum SafetyModel { - silent @0; - hondaNidec @1; - toyota @2; - elm327 @3; - gm @4; - hondaBoschGiraffe @5; - ford @6; - cadillac @7; - hyundai @8; - chrysler @9; - tesla @10; - subaru @11; - gmPassive @12; - mazda @13; - nissan @14; - volkswagen @15; - toyotaIpas @16; - allOutput @17; - gmAscm @18; - noOutput @19; # like silent but without silent CAN TXs - hondaBoschHarness @20; - volkswagenPq @21; - } - - enum SteerControlType { - torque @0; - angle @1; - } - - enum TransmissionType { - unknown @0; - automatic @1; - manual @2; - } - - struct CarFw { - ecu @0 :Ecu; - fwVersion @1 :Data; - address @2: UInt32; - subAddress @3: UInt8; - } - - enum Ecu { - eps @0; - esp @1; - fwdRadar @2; - fwdCamera @3; - engine @4; - unknown @5; - - # Toyota only - dsu @6; - apgs @7; - } -} diff --git a/cereal/generate_javascript.sh b/cereal/generate_javascript.sh deleted file mode 100755 index d6525a64d9..0000000000 --- a/cereal/generate_javascript.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -rm -r gen/ts -rm -r gen/js - -mkdir gen/ts -mkdir gen/js - -echo "Installing needed npm modules" -npm i capnpc-ts capnp-ts - -capnpc -o node_modules/.bin/capnpc-ts:gen/ts log.capnp car.capnp -capnpc -o node_modules/.bin/capnpc-ts:gen/ts car.capnp - -cat log.capnp | egrep '\([a-zA-Z]*\.[^\s]+\.[^s]+\)' | sed 's/^.*([a-zA-Z]*\.\([a-zA-Z.]*\)).*/\1/' | while read line -do - TOKEN=`echo $line | sed 's/\./_/g'` - ROOT=`echo $line | sed 's/\..*$//g'` - cat gen/ts/log.capnp.ts | grep '^import.*'${TOKEN} - if [[ "$?" == "1" ]] - then - sed -i 's/^\(import {.*\)'${ROOT}'\(,*\) \(.*\)$/\1'${ROOT}', '${TOKEN}'\2 \3/' ./gen/ts/log.capnp.ts - fi -done - -tsc ./gen/ts/* --lib es2015 --outDir ./gen/js diff --git a/cereal/include/c++.capnp b/cereal/include/c++.capnp deleted file mode 100644 index 2bda547179..0000000000 --- a/cereal/include/c++.capnp +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xbdf87d7bb8304e81; -$namespace("capnp::annotations"); - -annotation namespace(file): Text; -annotation name(field, enumerant, struct, enum, interface, method, param, group, union): Text; diff --git a/cereal/include/java.capnp b/cereal/include/java.capnp deleted file mode 100644 index cddf6eba3d..0000000000 --- a/cereal/include/java.capnp +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2013-2015 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xc5f1af96651f70ea; - -annotation package @0x9ee4c8f803b3b596 (file) : Text; -# Name of the package, such as "org.example.foo", in which the generated code will reside. - -annotation outerClassname @0x9b066bb4881f7cd3 (file) : Text; -# Name of the outer class that will wrap the generated code. diff --git a/cereal/install_capnp.sh b/cereal/install_capnp.sh deleted file mode 100755 index cc570b60ff..0000000000 --- a/cereal/install_capnp.sh +++ /dev/null @@ -1,40 +0,0 @@ -set -e -echo "Installing capnp" - -cd /tmp -VERSION=0.6.1 -wget https://capnproto.org/capnproto-c++-${VERSION}.tar.gz -tar xvf capnproto-c++-${VERSION}.tar.gz -cd capnproto-c++-${VERSION} -CXXFLAGS="-fPIC" ./configure - -make -j$(nproc) -make install - -# manually build binaries statically -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnp src/capnp/compiler/module-loader.o src/capnp/compiler/capnp.o ./.libs/libcapnpc.a ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnpc-c++ src/capnp/compiler/capnpc-c++.o ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnpc-capnp src/capnp/compiler/capnpc-capnp.o ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - -cp .libs/capnp /usr/local/bin/ -cp .libs/capnpc-c++ /usr/local/bin/ -cp .libs/capnpc-capnp /usr/local/bin/ -cp .libs/*.a /usr/local/lib - -cd /tmp -echo "Installing c-capnp" -git clone https://github.com/commaai/c-capnproto.git -cd c-capnproto -git submodule update --init --recursive -autoreconf -f -i -s -CXXFLAGS="-fPIC" ./configure -make -j$(nproc) -make install - -# manually build binaries statically -gcc -fPIC -o .libs/capnpc-c compiler/capnpc-c.o compiler/schema.capnp.o compiler/str.o ./.libs/libcapnp_c.a - -cp .libs/capnpc-c /usr/local/bin/ -cp .libs/*.a /usr/local/lib diff --git a/cereal/log.capnp b/cereal/log.capnp deleted file mode 100644 index bdd7ed1bb1..0000000000 --- a/cereal/log.capnp +++ /dev/null @@ -1,1904 +0,0 @@ -using Cxx = import "./include/c++.capnp"; -$Cxx.namespace("cereal"); - -using Java = import "./include/java.capnp"; -$Java.package("ai.comma.openpilot.cereal"); -$Java.outerClassname("Log"); - -using Car = import "car.capnp"; - -@0xf3b1f17e25a4285b; - -const logVersion :Int32 = 1; - -struct Map(Key, Value) { - entries @0 :List(Entry); - struct Entry { - key @0 :Key; - value @1 :Value; - } -} - -struct InitData { - kernelArgs @0 :List(Text); - kernelVersion @15 :Text; - - gctx @1 :Text; - dongleId @2 :Text; - - deviceType @3 :DeviceType; - version @4 :Text; - gitCommit @10 :Text; - gitBranch @11 :Text; - gitRemote @13 :Text; - - androidBuildInfo @5 :AndroidBuildInfo; - androidSensors @6 :List(AndroidSensor); - androidProperties @16 :Map(Text, Text); - chffrAndroidExtra @7 :ChffrAndroidExtra; - iosBuildInfo @14 :IosBuildInfo; - - pandaInfo @8 :PandaInfo; - - dirty @9 :Bool; - passive @12 :Bool; - params @17 :Map(Text, Text); - - enum DeviceType { - unknown @0; - neo @1; - chffrAndroid @2; - chffrIos @3; - } - - struct AndroidBuildInfo { - board @0 :Text; - bootloader @1 :Text; - brand @2 :Text; - device @3 :Text; - display @4 :Text; - fingerprint @5 :Text; - hardware @6 :Text; - host @7 :Text; - id @8 :Text; - manufacturer @9 :Text; - model @10 :Text; - product @11 :Text; - radioVersion @12 :Text; - serial @13 :Text; - supportedAbis @14 :List(Text); - tags @15 :Text; - time @16 :Int64; - type @17 :Text; - user @18 :Text; - - versionCodename @19 :Text; - versionRelease @20 :Text; - versionSdk @21 :Int32; - versionSecurityPatch @22 :Text; - } - - struct AndroidSensor { - id @0 :Int32; - name @1 :Text; - vendor @2 :Text; - version @3 :Int32; - handle @4 :Int32; - type @5 :Int32; - maxRange @6 :Float32; - resolution @7 :Float32; - power @8 :Float32; - minDelay @9 :Int32; - fifoReservedEventCount @10 :UInt32; - fifoMaxEventCount @11 :UInt32; - stringType @12 :Text; - maxDelay @13 :Int32; - } - - struct ChffrAndroidExtra { - allCameraCharacteristics @0 :Map(Text, Text); - } - - struct IosBuildInfo { - appVersion @0 :Text; - appBuild @1 :UInt32; - osVersion @2 :Text; - deviceModel @3 :Text; - } - - struct PandaInfo { - hasPanda @0 :Bool; - dongleId @1 :Text; - stVersion @2 :Text; - espVersion @3 :Text; - } -} - -struct FrameData { - frameId @0 :UInt32; - encodeId @1 :UInt32; # DEPRECATED - timestampEof @2 :UInt64; - frameLength @3 :Int32; - integLines @4 :Int32; - globalGain @5 :Int32; - lensPos @11 :Int32; - lensSag @12 :Float32; - lensErr @13 :Float32; - lensTruePos @14 :Float32; - image @6 :Data; - gainFrac @15 :Float32; - - frameType @7 :FrameType; - timestampSof @8 :UInt64; - transform @10 :List(Float32); - - androidCaptureResult @9 :AndroidCaptureResult; - - enum FrameType { - unknown @0; - neo @1; - chffrAndroid @2; - front @3; - } - - struct AndroidCaptureResult { - sensitivity @0 :Int32; - frameDuration @1 :Int64; - exposureTime @2 :Int64; - rollingShutterSkew @3 :UInt64; - colorCorrectionTransform @4 :List(Int32); - colorCorrectionGains @5 :List(Float32); - displayRotation @6 :Int8; - } -} - -struct Thumbnail { - frameId @0 :UInt32; - timestampEof @1 :UInt64; - thumbnail @2 :Data; -} - -struct GPSNMEAData { - timestamp @0 :Int64; - localWallTime @1 :UInt64; - nmea @2 :Text; -} - -# android sensor_event_t -struct SensorEventData { - version @0 :Int32; - sensor @1 :Int32; - type @2 :Int32; - timestamp @3 :Int64; - uncalibratedDEPRECATED @10 :Bool; - - union { - acceleration @4 :SensorVec; - magnetic @5 :SensorVec; - orientation @6 :SensorVec; - gyro @7 :SensorVec; - pressure @9 :SensorVec; - magneticUncalibrated @11 :SensorVec; - gyroUncalibrated @12 :SensorVec; - proximity @13: Float32; - light @14: Float32; - } - source @8 :SensorSource; - - struct SensorVec { - v @0 :List(Float32); - status @1 :Int8; - } - - enum SensorSource { - android @0; - iOS @1; - fiber @2; - velodyne @3; # Velodyne IMU - bno055 @4; # Bosch accelerometer - lsm6ds3 @5; # accelerometer (c2) - bmp280 @6; # barometer (c2) - mmc3416x @7; # magnetometer (c2) - } -} - -# android struct GpsLocation -struct GpsLocationData { - # Contains GpsLocationFlags bits. - flags @0 :UInt16; - - # Represents latitude in degrees. - latitude @1 :Float64; - - # Represents longitude in degrees. - longitude @2 :Float64; - - # Represents altitude in meters above the WGS 84 reference ellipsoid. - altitude @3 :Float64; - - # Represents speed in meters per second. - speed @4 :Float32; - - # Represents heading in degrees. - bearing @5 :Float32; - - # Represents expected accuracy in meters. (presumably 1 sigma?) - accuracy @6 :Float32; - - # Timestamp for the location fix. - # Milliseconds since January 1, 1970. - timestamp @7 :Int64; - - source @8 :SensorSource; - - # Represents NED velocity in m/s. - vNED @9 :List(Float32); - - # Represents expected vertical accuracy in meters. (presumably 1 sigma?) - verticalAccuracy @10 :Float32; - - # Represents bearing accuracy in degrees. (presumably 1 sigma?) - bearingAccuracy @11 :Float32; - - # Represents velocity accuracy in m/s. (presumably 1 sigma?) - speedAccuracy @12 :Float32; - - enum SensorSource { - android @0; - iOS @1; - car @2; - velodyne @3; # Velodyne IMU - fusion @4; - external @5; - ublox @6; - trimble @7; - } -} - -struct CanData { - address @0 :UInt32; - busTime @1 :UInt16; - dat @2 :Data; - src @3 :UInt8; -} - -struct ThermalData { - cpu0 @0 :UInt16; - cpu1 @1 :UInt16; - cpu2 @2 :UInt16; - cpu3 @3 :UInt16; - mem @4 :UInt16; - gpu @5 :UInt16; - bat @6 :UInt32; - pa0 @21 :UInt16; - - # not thermal - freeSpace @7 :Float32; - batteryPercent @8 :Int16; - batteryStatus @9 :Text; - batteryCurrent @15 :Int32; - batteryVoltage @16 :Int32; - usbOnline @12 :Bool; - - fanSpeed @10 :UInt16; - started @11 :Bool; - startedTs @13 :UInt64; - - thermalStatus @14 :ThermalStatus; - chargingError @17 :Bool; - chargingDisabled @18 :Bool; - - memUsedPercent @19 :Int8; - cpuPerc @20 :Int8; - - enum ThermalStatus { - green @0; # all processes run - yellow @1; # critical processes run (kill uploader), engage still allowed - red @2; # no engage, will disengage - danger @3; # immediate process shutdown - } -} - -struct HealthData { - # from can health - voltage @0 :UInt32; - current @1 :UInt32; - ignitionLine @2 :Bool; - controlsAllowed @3 :Bool; - gasInterceptorDetected @4 :Bool; - startedSignalDetectedDeprecated @5 :Bool; - hasGps @6 :Bool; - canSendErrs @7 :UInt32; - canFwdErrs @8 :UInt32; - canRxErrs @19 :UInt32; - gmlanSendErrs @9 :UInt32; - hwType @10 :HwType; - fanSpeedRpm @11 :UInt16; - usbPowerMode @12 :UsbPowerMode; - ignitionCan @13 :Bool; - safetyModel @14 :Car.CarParams.SafetyModel; - faultStatus @15 :FaultStatus; - powerSaveEnabled @16 :Bool; - uptime @17 :UInt32; - faults @18 :List(FaultType); - - enum FaultStatus { - none @0; - faultTemp @1; - faultPerm @2; - } - - enum FaultType { - relayMalfunction @0; - } - - enum HwType { - unknown @0; - whitePanda @1; - greyPanda @2; - blackPanda @3; - pedal @4; - uno @5; - } - - enum UsbPowerMode { - none @0; - client @1; - cdp @2; - dcp @3; - } -} - -struct LiveUI { - rearViewCam @0 :Bool; - alertText1 @1 :Text; - alertText2 @2 :Text; - awarenessStatus @3 :Float32; -} - -struct RadarState @0x9a185389d6fdd05f { - canMonoTimes @10 :List(UInt64); - mdMonoTime @6 :UInt64; - ftMonoTimeDEPRECATED @7 :UInt64; - controlsStateMonoTime @11 :UInt64; - radarErrors @12 :List(Car.RadarData.Error); - - # all deprecated - warpMatrixDEPRECATED @0 :List(Float32); - angleOffsetDEPRECATED @1 :Float32; - calStatusDEPRECATED @2 :Int8; - calCycleDEPRECATED @8 :Int32; - calPercDEPRECATED @9 :Int8; - - leadOne @3 :LeadData; - leadTwo @4 :LeadData; - cumLagMs @5 :Float32; - - struct LeadData { - dRel @0 :Float32; - yRel @1 :Float32; - vRel @2 :Float32; - aRel @3 :Float32; - vLead @4 :Float32; - aLeadDEPRECATED @5 :Float32; - dPath @6 :Float32; - vLat @7 :Float32; - vLeadK @8 :Float32; - aLeadK @9 :Float32; - fcw @10 :Bool; - status @11 :Bool; - aLeadTau @12 :Float32; - modelProb @13 :Float32; - radar @14 :Bool; - } -} - -struct LiveCalibrationData { - # deprecated - warpMatrix @0 :List(Float32); - # camera_frame_from_model_frame - warpMatrix2 @5 :List(Float32); - warpMatrixBig @6 :List(Float32); - calStatus @1 :Int8; - calCycle @2 :Int32; - calPerc @3 :Int8; - - # view_frame_from_road_frame - # ui's is inversed needs new - extrinsicMatrix @4 :List(Float32); - # the direction of travel vector in device frame - rpyCalib @7 :List(Float32); -} - -struct LiveTracks { - trackId @0 :Int32; - dRel @1 :Float32; - yRel @2 :Float32; - vRel @3 :Float32; - aRel @4 :Float32; - timeStamp @5 :Float32; - status @6 :Float32; - currentTime @7 :Float32; - stationary @8 :Bool; - oncoming @9 :Bool; -} - -struct ControlsState @0x97ff69c53601abf1 { - canMonoTimeDEPRECATED @16 :UInt64; - canMonoTimes @21 :List(UInt64); - radarStateMonoTimeDEPRECATED @17 :UInt64; - mdMonoTimeDEPRECATED @18 :UInt64; - planMonoTime @28 :UInt64; - pathPlanMonoTime @50 :UInt64; - - state @31 :OpenpilotState; - vEgo @0 :Float32; - vEgoRaw @32 :Float32; - aEgoDEPRECATED @1 :Float32; - longControlState @30 :LongControlState; - vPid @2 :Float32; - vTargetLead @3 :Float32; - upAccelCmd @4 :Float32; - uiAccelCmd @5 :Float32; - ufAccelCmd @33 :Float32; - yActualDEPRECATED @6 :Float32; - yDesDEPRECATED @7 :Float32; - upSteerDEPRECATED @8 :Float32; - uiSteerDEPRECATED @9 :Float32; - ufSteerDEPRECATED @34 :Float32; - aTargetMinDEPRECATED @10 :Float32; - aTargetMaxDEPRECATED @11 :Float32; - aTarget @35 :Float32; - jerkFactor @12 :Float32; - angleSteers @13 :Float32; # Steering angle in degrees. - angleSteersDes @29 :Float32; - curvature @37 :Float32; # path curvature from vehicle model - hudLeadDEPRECATED @14 :Int32; - cumLagMs @15 :Float32; - startMonoTime @48 :UInt64; - mapValid @49 :Bool; - forceDecel @51 :Bool; - - enabled @19 :Bool; - active @36 :Bool; - steerOverride @20 :Bool; - - vCruise @22 :Float32; - - rearViewCam @23 :Bool; - alertText1 @24 :Text; - alertText2 @25 :Text; - alertStatus @38 :AlertStatus; - alertSize @39 :AlertSize; - alertBlinkingRate @42 :Float32; - alertType @44 :Text; - alertSoundDEPRECATED @45 :Text; - alertSound @56 :Car.CarControl.HUDControl.AudibleAlert; - awarenessStatus @26 :Float32; - angleModelBiasDEPRECATED @27 :Float32; - gpsPlannerActive @40 :Bool; - engageable @41 :Bool; # can OP be engaged? - driverMonitoringOn @43 :Bool; - - # maps - vCurvature @46 :Float32; - decelForTurn @47 :Bool; - - decelForModel @54 :Bool; - canErrorCounter @57 :UInt32; - - lateralControlState :union { - indiState @52 :LateralINDIState; - pidState @53 :LateralPIDState; - lqrState @55 :LateralLQRState; - } - - enum OpenpilotState @0xdbe58b96d2d1ac61 { - disabled @0; - preEnabled @1; - enabled @2; - softDisabling @3; - } - - enum LongControlState { - off @0; - pid @1; - stopping @2; - starting @3; - } - - enum AlertStatus { - normal @0; # low priority alert for user's convenience - userPrompt @1; # mid piority alert that might require user intervention - critical @2; # high priority alert that needs immediate user intervention - } - - enum AlertSize { - none @0; # don't display the alert - small @1; # small box - mid @2; # mid screen - full @3; # full screen - } - - struct LateralINDIState { - active @0 :Bool; - steerAngle @1 :Float32; - steerRate @2 :Float32; - steerAccel @3 :Float32; - rateSetPoint @4 :Float32; - accelSetPoint @5 :Float32; - accelError @6 :Float32; - delayedOutput @7 :Float32; - delta @8 :Float32; - output @9 :Float32; - saturated @10 :Bool; - } - - struct LateralPIDState { - active @0 :Bool; - steerAngle @1 :Float32; - steerRate @2 :Float32; - angleError @3 :Float32; - p @4 :Float32; - i @5 :Float32; - f @6 :Float32; - output @7 :Float32; - saturated @8 :Bool; - } - - struct LateralLQRState { - active @0 :Bool; - steerAngle @1 :Float32; - i @2 :Float32; - output @3 :Float32; - lqrOutput @4 :Float32; - saturated @5 :Bool; - } - - -} - -struct LiveEventData { - name @0 :Text; - value @1 :Int32; -} - -struct ModelData { - frameId @0 :UInt32; - timestampEof @9 :UInt64; - - path @1 :PathData; - leftLane @2 :PathData; - rightLane @3 :PathData; - lead @4 :LeadData; - freePath @6 :List(Float32); - - settings @5 :ModelSettings; - leadFuture @7 :LeadData; - speed @8 :List(Float32); - meta @10 :MetaData; - longitudinal @11 :LongitudinalData; - - struct PathData { - points @0 :List(Float32); - prob @1 :Float32; - std @2 :Float32; - stds @3 :List(Float32); - poly @4 :List(Float32); - } - - struct LeadData { - dist @0 :Float32; - prob @1 :Float32; - std @2 :Float32; - relVel @3 :Float32; - relVelStd @4 :Float32; - relY @5 :Float32; - relYStd @6 :Float32; - relA @7 :Float32; - relAStd @8 :Float32; - } - - struct ModelSettings { - bigBoxX @0 :UInt16; - bigBoxY @1 :UInt16; - bigBoxWidth @2 :UInt16; - bigBoxHeight @3 :UInt16; - boxProjection @4 :List(Float32); - yuvCorrection @5 :List(Float32); - inputTransform @6 :List(Float32); - } - - struct MetaData { - engagedProb @0 :Float32; - desirePrediction @1 :List(Float32); - brakeDisengageProb @2 :Float32; - gasDisengageProb @3 :Float32; - steerOverrideProb @4 :Float32; - } - - struct LongitudinalData { - speeds @0 :List(Float32); - accelerations @1 :List(Float32); - } -} - -struct CalibrationFeatures { - frameId @0 :UInt32; - - p0 @1 :List(Float32); - p1 @2 :List(Float32); - status @3 :List(Int8); -} - -struct EncodeIndex { - # picture from camera - frameId @0 :UInt32; - type @1 :Type; - # index of encoder from start of route - encodeId @2 :UInt32; - # minute long segment this frame is in - segmentNum @3 :Int32; - # index into camera file in segment in presentation order - segmentId @4 :UInt32; - # index into camera file in segment in encode order - segmentIdEncode @5 :UInt32; - - enum Type { - bigBoxLossless @0; # rcamera.mkv - fullHEVC @1; # fcamera.hevc - bigBoxHEVC @2; # bcamera.hevc - chffrAndroidH264 @3; # acamera - fullLosslessClip @4; # prcamera.mkv - front @5; # dcamera.hevc - } -} - -struct AndroidLogEntry { - id @0 :UInt8; - ts @1 :UInt64; - priority @2 :UInt8; - pid @3 :Int32; - tid @4 :Int32; - tag @5 :Text; - message @6 :Text; -} - -struct LogRotate { - segmentNum @0 :Int32; - path @1 :Text; -} - -struct Plan { - mdMonoTime @9 :UInt64; - radarStateMonoTime @10 :UInt64; - commIssue @31 :Bool; - - eventsDEPRECATED @13 :List(Car.CarEvent); - - # lateral, 3rd order polynomial - lateralValidDEPRECATED @0 :Bool; - dPolyDEPRECATED @1 :List(Float32); - laneWidthDEPRECATED @11 :Float32; - - # longitudinal - longitudinalValidDEPRECATED @2 :Bool; - vCruise @16 :Float32; - aCruise @17 :Float32; - vTarget @3 :Float32; - vTargetFuture @14 :Float32; - vMax @20 :Float32; - aTargetMinDEPRECATED @4 :Float32; - aTargetMaxDEPRECATED @5 :Float32; - aTarget @18 :Float32; - - vStart @26 :Float32; - aStart @27 :Float32; - - jerkFactor @6 :Float32; - hasLead @7 :Bool; - hasLeftLaneDEPRECATED @23 :Bool; - hasRightLaneDEPRECATED @24 :Bool; - fcw @8 :Bool; - longitudinalPlanSource @15 :LongitudinalPlanSource; - - # gps trajectory in car frame - gpsTrajectory @12 :GpsTrajectory; - - gpsPlannerActive @19 :Bool; - - # maps - vCurvature @21 :Float32; - decelForTurn @22 :Bool; - mapValid @25 :Bool; - radarValid @28 :Bool; - radarCanError @30 :Bool; - - processingDelay @29 :Float32; - - - struct GpsTrajectory { - x @0 :List(Float32); - y @1 :List(Float32); - } - - enum LongitudinalPlanSource { - cruise @0; - mpc1 @1; - mpc2 @2; - mpc3 @3; - model @4; - } -} - -struct PathPlan { - laneWidth @0 :Float32; - - dPoly @1 :List(Float32); - cPoly @2 :List(Float32); - cProb @3 :Float32; - lPoly @4 :List(Float32); - lProb @5 :Float32; - rPoly @6 :List(Float32); - rProb @7 :Float32; - - angleSteers @8 :Float32; # deg - rateSteers @13 :Float32; # deg/s - mpcSolutionValid @9 :Bool; - paramsValid @10 :Bool; - modelValidDEPRECATED @12 :Bool; - angleOffset @11 :Float32; - sensorValid @14 :Bool; - commIssue @15 :Bool; - posenetValid @16 :Bool; - desire @17 :Desire; - laneChangeState @18 :LaneChangeState; - laneChangeDirection @19 :LaneChangeDirection; - - enum Desire { - none @0; - turnLeft @1; - turnRight @2; - laneChangeLeft @3; - laneChangeRight @4; - keepLeft @5; - keepRight @6; - } - - enum LaneChangeState { - off @0; - preLaneChange @1; - laneChangeStarting @2; - laneChangeFinishing @3; - } - - enum LaneChangeDirection { - none @0; - left @1; - right @2; - } -} - -struct LiveLocationData { - status @0 :UInt8; - - # 3D fix - lat @1 :Float64; - lon @2 :Float64; - alt @3 :Float32; # m - - # speed - speed @4 :Float32; # m/s - - # NED velocity components - vNED @5 :List(Float32); - - # roll, pitch, heading (x,y,z) - roll @6 :Float32; # WRT to center of earth? - pitch @7 :Float32; # WRT to center of earth? - heading @8 :Float32; # WRT to north? - - # what are these? - wanderAngle @9 :Float32; - trackAngle @10 :Float32; - - # car frame -- https://upload.wikimedia.org/wikipedia/commons/f/f5/RPY_angles_of_cars.png - - # gyro, in car frame, deg/s - gyro @11 :List(Float32); - - # accel, in car frame, m/s^2 - accel @12 :List(Float32); - - accuracy @13 :Accuracy; - - source @14 :SensorSource; - # if we are fixing a location in the past - fixMonoTime @15 :UInt64; - - gpsWeek @16 :Int32; - timeOfWeek @17 :Float64; - - positionECEF @18 :List(Float64); - poseQuatECEF @19 :List(Float32); - pitchCalibration @20 :Float32; - yawCalibration @21 :Float32; - imuFrame @22 :List(Float32); - - struct Accuracy { - pNEDError @0 :List(Float32); - vNEDError @1 :List(Float32); - rollError @2 :Float32; - pitchError @3 :Float32; - headingError @4 :Float32; - ellipsoidSemiMajorError @5 :Float32; - ellipsoidSemiMinorError @6 :Float32; - ellipsoidOrientationError @7 :Float32; - } - - enum SensorSource { - applanix @0; - kalman @1; - orbslam @2; - timing @3; - dummy @4; - } -} - -struct EthernetPacket { - pkt @0 :Data; - ts @1 :Float32; -} - -struct NavUpdate { - isNavigating @0 :Bool; - curSegment @1 :Int32; - segments @2 :List(Segment); - - struct LatLng { - lat @0 :Float64; - lng @1 :Float64; - } - - struct Segment { - from @0 :LatLng; - to @1 :LatLng; - updateTime @2 :Int32; - distance @3 :Int32; - crossTime @4 :Int32; - exitNo @5 :Int32; - instruction @6 :Instruction; - - parts @7 :List(LatLng); - - enum Instruction { - turnLeft @0; - turnRight @1; - keepLeft @2; - keepRight @3; - straight @4; - roundaboutExitNumber @5; - roundaboutExit @6; - roundaboutTurnLeft @7; - unkn8 @8; - roundaboutStraight @9; - unkn10 @10; - roundaboutTurnRight @11; - unkn12 @12; - roundaboutUturn @13; - unkn14 @14; - arrive @15; - exitLeft @16; - exitRight @17; - unkn18 @18; - uturn @19; - # ... - } - } -} - -struct NavStatus { - isNavigating @0 :Bool; - currentAddress @1 :Address; - - struct Address { - title @0 :Text; - lat @1 :Float64; - lng @2 :Float64; - house @3 :Text; - address @4 :Text; - street @5 :Text; - city @6 :Text; - state @7 :Text; - country @8 :Text; - } -} - -struct CellInfo { - timestamp @0 :UInt64; - repr @1 :Text; # android toString() for now -} - -struct WifiScan { - bssid @0 :Text; - ssid @1 :Text; - capabilities @2 :Text; - frequency @3 :Int32; - level @4 :Int32; - timestamp @5 :Int64; - - centerFreq0 @6 :Int32; - centerFreq1 @7 :Int32; - channelWidth @8 :ChannelWidth; - operatorFriendlyName @9 :Text; - venueName @10 :Text; - is80211mcResponder @11 :Bool; - passpoint @12 :Bool; - - distanceCm @13 :Int32; - distanceSdCm @14 :Int32; - - enum ChannelWidth { - w20Mhz @0; - w40Mhz @1; - w80Mhz @2; - w160Mhz @3; - w80Plus80Mhz @4; - } -} - -struct AndroidGnss { - union { - measurements @0 :Measurements; - navigationMessage @1 :NavigationMessage; - } - - struct Measurements { - clock @0 :Clock; - measurements @1 :List(Measurement); - - struct Clock { - timeNanos @0 :Int64; - hardwareClockDiscontinuityCount @1 :Int32; - - hasTimeUncertaintyNanos @2 :Bool; - timeUncertaintyNanos @3 :Float64; - - hasLeapSecond @4 :Bool; - leapSecond @5 :Int32; - - hasFullBiasNanos @6 :Bool; - fullBiasNanos @7 :Int64; - - hasBiasNanos @8 :Bool; - biasNanos @9 :Float64; - - hasBiasUncertaintyNanos @10 :Bool; - biasUncertaintyNanos @11 :Float64; - - hasDriftNanosPerSecond @12 :Bool; - driftNanosPerSecond @13 :Float64; - - hasDriftUncertaintyNanosPerSecond @14 :Bool; - driftUncertaintyNanosPerSecond @15 :Float64; - } - - struct Measurement { - svId @0 :Int32; - constellation @1 :Constellation; - - timeOffsetNanos @2 :Float64; - state @3 :Int32; - receivedSvTimeNanos @4 :Int64; - receivedSvTimeUncertaintyNanos @5 :Int64; - cn0DbHz @6 :Float64; - pseudorangeRateMetersPerSecond @7 :Float64; - pseudorangeRateUncertaintyMetersPerSecond @8 :Float64; - accumulatedDeltaRangeState @9 :Int32; - accumulatedDeltaRangeMeters @10 :Float64; - accumulatedDeltaRangeUncertaintyMeters @11 :Float64; - - hasCarrierFrequencyHz @12 :Bool; - carrierFrequencyHz @13 :Float32; - hasCarrierCycles @14 :Bool; - carrierCycles @15 :Int64; - hasCarrierPhase @16 :Bool; - carrierPhase @17 :Float64; - hasCarrierPhaseUncertainty @18 :Bool; - carrierPhaseUncertainty @19 :Float64; - hasSnrInDb @20 :Bool; - snrInDb @21 :Float64; - - multipathIndicator @22 :MultipathIndicator; - - enum Constellation { - unknown @0; - gps @1; - sbas @2; - glonass @3; - qzss @4; - beidou @5; - galileo @6; - } - - enum State { - unknown @0; - codeLock @1; - bitSync @2; - subframeSync @3; - towDecoded @4; - msecAmbiguous @5; - symbolSync @6; - gloStringSync @7; - gloTodDecoded @8; - bdsD2BitSync @9; - bdsD2SubframeSync @10; - galE1bcCodeLock @11; - galE1c2ndCodeLock @12; - galE1bPageSync @13; - sbasSync @14; - } - - enum MultipathIndicator { - unknown @0; - detected @1; - notDetected @2; - } - } - } - - struct NavigationMessage { - type @0 :Int32; - svId @1 :Int32; - messageId @2 :Int32; - submessageId @3 :Int32; - data @4 :Data; - status @5 :Status; - - enum Status { - unknown @0; - parityPassed @1; - parityRebuilt @2; - } - } -} - -struct QcomGnss { - logTs @0 :UInt64; - union { - measurementReport @1 :MeasurementReport; - clockReport @2 :ClockReport; - drMeasurementReport @3 :DrMeasurementReport; - drSvPoly @4 :DrSvPolyReport; - rawLog @5 :Data; - } - - enum MeasurementSource @0xd71a12b6faada7ee { - gps @0; - glonass @1; - beidou @2; - } - - enum SVObservationState @0xe81e829a0d6c83e9 { - idle @0; - search @1; - searchVerify @2; - bitEdge @3; - trackVerify @4; - track @5; - restart @6; - dpo @7; - glo10msBe @8; - glo10msAt @9; - } - - struct MeasurementStatus @0xe501010e1bcae83b { - subMillisecondIsValid @0 :Bool; - subBitTimeIsKnown @1 :Bool; - satelliteTimeIsKnown @2 :Bool; - bitEdgeConfirmedFromSignal @3 :Bool; - measuredVelocity @4 :Bool; - fineOrCoarseVelocity @5 :Bool; - lockPointValid @6 :Bool; - lockPointPositive @7 :Bool; - lastUpdateFromDifference @8 :Bool; - lastUpdateFromVelocityDifference @9 :Bool; - strongIndicationOfCrossCorelation @10 :Bool; - tentativeMeasurement @11 :Bool; - measurementNotUsable @12 :Bool; - sirCheckIsNeeded @13 :Bool; - probationMode @14 :Bool; - - glonassMeanderBitEdgeValid @15 :Bool; - glonassTimeMarkValid @16 :Bool; - - gpsRoundRobinRxDiversity @17 :Bool; - gpsRxDiversity @18 :Bool; - gpsLowBandwidthRxDiversityCombined @19 :Bool; - gpsHighBandwidthNu4 @20 :Bool; - gpsHighBandwidthNu8 @21 :Bool; - gpsHighBandwidthUniform @22 :Bool; - multipathIndicator @23 :Bool; - - imdJammingIndicator @24 :Bool; - lteB13TxJammingIndicator @25 :Bool; - freshMeasurementIndicator @26 :Bool; - - multipathEstimateIsValid @27 :Bool; - directionIsValid @28 :Bool; - } - - struct MeasurementReport { - source @0 :MeasurementSource; - - fCount @1 :UInt32; - - gpsWeek @2 :UInt16; - glonassCycleNumber @3 :UInt8; - glonassNumberOfDays @4 :UInt16; - - milliseconds @5 :UInt32; - timeBias @6 :Float32; - clockTimeUncertainty @7 :Float32; - clockFrequencyBias @8 :Float32; - clockFrequencyUncertainty @9 :Float32; - - sv @10 :List(SV); - - struct SV { - svId @0 :UInt8; - observationState @2 :SVObservationState; - observations @3 :UInt8; - goodObservations @4 :UInt8; - gpsParityErrorCount @5 :UInt16; - glonassFrequencyIndex @1 :Int8; - glonassHemmingErrorCount @6 :UInt8; - filterStages @7 :UInt8; - carrierNoise @8 :UInt16; - latency @9 :Int16; - predetectInterval @10 :UInt8; - postdetections @11 :UInt16; - - unfilteredMeasurementIntegral @12 :UInt32; - unfilteredMeasurementFraction @13 :Float32; - unfilteredTimeUncertainty @14 :Float32; - unfilteredSpeed @15 :Float32; - unfilteredSpeedUncertainty @16 :Float32; - measurementStatus @17 :MeasurementStatus; - multipathEstimate @18 :UInt32; - azimuth @19 :Float32; - elevation @20 :Float32; - carrierPhaseCyclesIntegral @21 :Int32; - carrierPhaseCyclesFraction @22 :UInt16; - fineSpeed @23 :Float32; - fineSpeedUncertainty @24 :Float32; - cycleSlipCount @25 :UInt8; - } - - } - - struct ClockReport { - hasFCount @0 :Bool; - fCount @1 :UInt32; - - hasGpsWeek @2 :Bool; - gpsWeek @3 :UInt16; - hasGpsMilliseconds @4 :Bool; - gpsMilliseconds @5 :UInt32; - gpsTimeBias @6 :Float32; - gpsClockTimeUncertainty @7 :Float32; - gpsClockSource @8 :UInt8; - - hasGlonassYear @9 :Bool; - glonassYear @10 :UInt8; - hasGlonassDay @11 :Bool; - glonassDay @12 :UInt16; - hasGlonassMilliseconds @13 :Bool; - glonassMilliseconds @14 :UInt32; - glonassTimeBias @15 :Float32; - glonassClockTimeUncertainty @16 :Float32; - glonassClockSource @17 :UInt8; - - bdsWeek @18 :UInt16; - bdsMilliseconds @19 :UInt32; - bdsTimeBias @20 :Float32; - bdsClockTimeUncertainty @21 :Float32; - bdsClockSource @22 :UInt8; - - galWeek @23 :UInt16; - galMilliseconds @24 :UInt32; - galTimeBias @25 :Float32; - galClockTimeUncertainty @26 :Float32; - galClockSource @27 :UInt8; - - clockFrequencyBias @28 :Float32; - clockFrequencyUncertainty @29 :Float32; - frequencySource @30 :UInt8; - gpsLeapSeconds @31 :UInt8; - gpsLeapSecondsUncertainty @32 :UInt8; - gpsLeapSecondsSource @33 :UInt8; - - gpsToGlonassTimeBiasMilliseconds @34 :Float32; - gpsToGlonassTimeBiasMillisecondsUncertainty @35 :Float32; - gpsToBdsTimeBiasMilliseconds @36 :Float32; - gpsToBdsTimeBiasMillisecondsUncertainty @37 :Float32; - bdsToGloTimeBiasMilliseconds @38 :Float32; - bdsToGloTimeBiasMillisecondsUncertainty @39 :Float32; - gpsToGalTimeBiasMilliseconds @40 :Float32; - gpsToGalTimeBiasMillisecondsUncertainty @41 :Float32; - galToGloTimeBiasMilliseconds @42 :Float32; - galToGloTimeBiasMillisecondsUncertainty @43 :Float32; - galToBdsTimeBiasMilliseconds @44 :Float32; - galToBdsTimeBiasMillisecondsUncertainty @45 :Float32; - - hasRtcTime @46 :Bool; - systemRtcTime @47 :UInt32; - fCountOffset @48 :UInt32; - lpmRtcCount @49 :UInt32; - clockResets @50 :UInt32; - } - - struct DrMeasurementReport { - - reason @0 :UInt8; - seqNum @1 :UInt8; - seqMax @2 :UInt8; - rfLoss @3 :UInt16; - - systemRtcValid @4 :Bool; - fCount @5 :UInt32; - clockResets @6 :UInt32; - systemRtcTime @7 :UInt64; - - gpsLeapSeconds @8 :UInt8; - gpsLeapSecondsUncertainty @9 :UInt8; - gpsToGlonassTimeBiasMilliseconds @10 :Float32; - gpsToGlonassTimeBiasMillisecondsUncertainty @11 :Float32; - - gpsWeek @12 :UInt16; - gpsMilliseconds @13 :UInt32; - gpsTimeBiasMs @14 :UInt32; - gpsClockTimeUncertaintyMs @15 :UInt32; - gpsClockSource @16 :UInt8; - - glonassClockSource @17 :UInt8; - glonassYear @18 :UInt8; - glonassDay @19 :UInt16; - glonassMilliseconds @20 :UInt32; - glonassTimeBias @21 :Float32; - glonassClockTimeUncertainty @22 :Float32; - - clockFrequencyBias @23 :Float32; - clockFrequencyUncertainty @24 :Float32; - frequencySource @25 :UInt8; - - source @26 :MeasurementSource; - - sv @27 :List(SV); - - struct SV { - svId @0 :UInt8; - glonassFrequencyIndex @1 :Int8; - observationState @2 :SVObservationState; - observations @3 :UInt8; - goodObservations @4 :UInt8; - filterStages @5 :UInt8; - predetectInterval @6 :UInt8; - cycleSlipCount @7 :UInt8; - postdetections @8 :UInt16; - - measurementStatus @9 :MeasurementStatus; - - carrierNoise @10 :UInt16; - rfLoss @11 :UInt16; - latency @12 :Int16; - - filteredMeasurementFraction @13 :Float32; - filteredMeasurementIntegral @14 :UInt32; - filteredTimeUncertainty @15 :Float32; - filteredSpeed @16 :Float32; - filteredSpeedUncertainty @17 :Float32; - - unfilteredMeasurementFraction @18 :Float32; - unfilteredMeasurementIntegral @19 :UInt32; - unfilteredTimeUncertainty @20 :Float32; - unfilteredSpeed @21 :Float32; - unfilteredSpeedUncertainty @22 :Float32; - - multipathEstimate @23 :UInt32; - azimuth @24 :Float32; - elevation @25 :Float32; - dopplerAcceleration @26 :Float32; - fineSpeed @27 :Float32; - fineSpeedUncertainty @28 :Float32; - - carrierPhase @29 :Float64; - fCount @30 :UInt32; - - parityErrorCount @31 :UInt16; - goodParity @32 :Bool; - } - } - - struct DrSvPolyReport { - svId @0 :UInt16; - frequencyIndex @1 :Int8; - - hasPosition @2 :Bool; - hasIono @3 :Bool; - hasTropo @4 :Bool; - hasElevation @5 :Bool; - polyFromXtra @6 :Bool; - hasSbasIono @7 :Bool; - - iode @8 :UInt16; - t0 @9 :Float64; - xyz0 @10 :List(Float64); - xyzN @11 :List(Float64); - other @12 :List(Float32); - - positionUncertainty @13 :Float32; - ionoDelay @14 :Float32; - ionoDot @15 :Float32; - sbasIonoDelay @16 :Float32; - sbasIonoDot @17 :Float32; - tropoDelay @18 :Float32; - elevation @19 :Float32; - elevationDot @20 :Float32; - elevationUncertainty @21 :Float32; - - velocityCoeff @22 :List(Float64); - - } -} - -struct LidarPts { - r @0 :List(UInt16); # uint16 m*500.0 - theta @1 :List(UInt16); # uint16 deg*100.0 - reflect @2 :List(UInt8); # uint8 0-255 - - # For storing out of file. - idx @3 :UInt64; - - # For storing in file - pkt @4 :Data; -} - -struct ProcLog { - cpuTimes @0 :List(CPUTimes); - mem @1 :Mem; - procs @2 :List(Process); - - struct Process { - pid @0 :Int32; - name @1 :Text; - state @2 :UInt8; - ppid @3 :Int32; - - cpuUser @4 :Float32; - cpuSystem @5 :Float32; - cpuChildrenUser @6 :Float32; - cpuChildrenSystem @7 :Float32; - priority @8 :Int64; - nice @9 :Int32; - numThreads @10 :Int32; - startTime @11 :Float64; - - memVms @12 :UInt64; - memRss @13 :UInt64; - - processor @14 :Int32; - - cmdline @15 :List(Text); - exe @16 :Text; - } - - struct CPUTimes { - cpuNum @0 :Int64; - user @1 :Float32; - nice @2 :Float32; - system @3 :Float32; - idle @4 :Float32; - iowait @5 :Float32; - irq @6 :Float32; - softirq @7 :Float32; - } - - struct Mem { - total @0 :UInt64; - free @1 :UInt64; - available @2 :UInt64; - buffers @3 :UInt64; - cached @4 :UInt64; - active @5 :UInt64; - inactive @6 :UInt64; - shared @7 :UInt64; - } - -} - -struct UbloxGnss { - union { - measurementReport @0 :MeasurementReport; - ephemeris @1 :Ephemeris; - ionoData @2 :IonoData; - } - - struct MeasurementReport { - #received time of week in gps time in seconds and gps week - rcvTow @0 :Float64; - gpsWeek @1 :UInt16; - # leap seconds in seconds - leapSeconds @2 :UInt16; - # receiver status - receiverStatus @3 :ReceiverStatus; - # num of measurements to follow - numMeas @4 :UInt8; - measurements @5 :List(Measurement); - - struct ReceiverStatus { - # leap seconds have been determined - leapSecValid @0 :Bool; - # Clock reset applied - clkReset @1 :Bool; - } - - struct Measurement { - svId @0 :UInt8; - trackingStatus @1 :TrackingStatus; - # pseudorange in meters - pseudorange @2 :Float64; - # carrier phase measurement in cycles - carrierCycles @3 :Float64; - # doppler measurement in Hz - doppler @4 :Float32; - # GNSS id, 0 is gps - gnssId @5 :UInt8; - glonassFrequencyIndex @6 :UInt8; - # carrier phase locktime counter in ms - locktime @7 :UInt16; - # Carrier-to-noise density ratio (signal strength) in dBHz - cno @8 :UInt8; - # pseudorange standard deviation in meters - pseudorangeStdev @9 :Float32; - # carrier phase standard deviation in cycles - carrierPhaseStdev @10 :Float32; - # doppler standard deviation in Hz - dopplerStdev @11 :Float32; - sigId @12 :UInt8; - - struct TrackingStatus { - # pseudorange valid - pseudorangeValid @0 :Bool; - # carrier phase valid - carrierPhaseValid @1 :Bool; - # half cycle valid - halfCycleValid @2 :Bool; - # half sycle subtracted from phase - halfCycleSubtracted @3 :Bool; - } - } - } - - struct Ephemeris { - # This is according to the rinex (2?) format - svId @0 :UInt16; - year @1 :UInt16; - month @2 :UInt16; - day @3 :UInt16; - hour @4 :UInt16; - minute @5 :UInt16; - second @6 :Float32; - af0 @7 :Float64; - af1 @8 :Float64; - af2 @9 :Float64; - - iode @10 :Float64; - crs @11 :Float64; - deltaN @12 :Float64; - m0 @13 :Float64; - - cuc @14 :Float64; - ecc @15 :Float64; - cus @16 :Float64; - a @17 :Float64; # note that this is not the root!! - - toe @18 :Float64; - cic @19 :Float64; - omega0 @20 :Float64; - cis @21 :Float64; - - i0 @22 :Float64; - crc @23 :Float64; - omega @24 :Float64; - omegaDot @25 :Float64; - - iDot @26 :Float64; - codesL2 @27 :Float64; - gpsWeek @28 :Float64; - l2 @29 :Float64; - - svAcc @30 :Float64; - svHealth @31 :Float64; - tgd @32 :Float64; - iodc @33 :Float64; - - transmissionTime @34 :Float64; - fitInterval @35 :Float64; - - toc @36 :Float64; - - ionoCoeffsValid @37 :Bool; - ionoAlpha @38 :List(Float64); - ionoBeta @39 :List(Float64); - - } - - struct IonoData { - svHealth @0 :UInt32; - tow @1 :Float64; - gpsWeek @2 :Float64; - - ionoAlpha @3 :List(Float64); - ionoBeta @4 :List(Float64); - - healthValid @5 :Bool; - ionoCoeffsValid @6 :Bool; - } -} - - -struct Clocks { - bootTimeNanos @0 :UInt64; - monotonicNanos @1 :UInt64; - monotonicRawNanos @2 :UInt64; - wallTimeNanos @3 :UInt64; - modemUptimeMillis @4 :UInt64; -} - -struct LiveMpcData { - x @0 :List(Float32); - y @1 :List(Float32); - psi @2 :List(Float32); - delta @3 :List(Float32); - qpIterations @4 :UInt32; - calculationTime @5 :UInt64; - cost @6 :Float64; -} - -struct LiveLongitudinalMpcData { - xEgo @0 :List(Float32); - vEgo @1 :List(Float32); - aEgo @2 :List(Float32); - xLead @3 :List(Float32); - vLead @4 :List(Float32); - aLead @5 :List(Float32); - aLeadTau @6 :Float32; # lead accel time constant - qpIterations @7 :UInt32; - mpcId @8 :UInt32; - calculationTime @9 :UInt64; - cost @10 :Float64; -} - - -struct ECEFPointDEPRECATED @0xe10e21168db0c7f7 { - x @0 :Float32; - y @1 :Float32; - z @2 :Float32; -} - -struct ECEFPoint @0xc25bbbd524983447 { - x @0 :Float64; - y @1 :Float64; - z @2 :Float64; -} - -struct GPSPlannerPoints { - curPosDEPRECATED @0 :ECEFPointDEPRECATED; - pointsDEPRECATED @1 :List(ECEFPointDEPRECATED); - curPos @6 :ECEFPoint; - points @7 :List(ECEFPoint); - valid @2 :Bool; - trackName @3 :Text; - speedLimit @4 :Float32; - accelTarget @5 :Float32; -} - -struct GPSPlannerPlan { - valid @0 :Bool; - poly @1 :List(Float32); - trackName @2 :Text; - speed @3 :Float32; - acceleration @4 :Float32; - pointsDEPRECATED @5 :List(ECEFPointDEPRECATED); - points @6 :List(ECEFPoint); - xLookahead @7 :Float32; -} - -struct TrafficEvent @0xacfa74a094e62626 { - type @0 :Type; - distance @1 :Float32; - action @2 :Action; - resuming @3 :Bool; - - enum Type { - stopSign @0; - lightRed @1; - lightYellow @2; - lightGreen @3; - stopLight @4; - } - - enum Action { - none @0; - yield @1; - stop @2; - resumeReady @3; - } - -} - -struct OrbslamCorrection { - correctionMonoTime @0 :UInt64; - prePositionECEF @1 :List(Float64); - postPositionECEF @2 :List(Float64); - prePoseQuatECEF @3 :List(Float32); - postPoseQuatECEF @4 :List(Float32); - numInliers @5 :UInt32; -} - -struct OrbObservation { - observationMonoTime @0 :UInt64; - normalizedCoordinates @1 :List(Float32); - locationECEF @2 :List(Float64); - matchDistance @3: UInt32; -} - -struct UiNavigationEvent { - type @0: Type; - status @1: Status; - distanceTo @2: Float32; - endRoadPointDEPRECATED @3: ECEFPointDEPRECATED; - endRoadPoint @4: ECEFPoint; - - enum Type { - none @0; - laneChangeLeft @1; - laneChangeRight @2; - mergeLeft @3; - mergeRight @4; - turnLeft @5; - turnRight @6; - } - - enum Status { - none @0; - passive @1; - approaching @2; - active @3; - } -} - -struct UiLayoutState { - activeApp @0 :App; - sidebarCollapsed @1 :Bool; - mapEnabled @2 :Bool; - - enum App { - home @0; - music @1; - nav @2; - settings @3; - } -} - -struct Joystick { - # convenient for debug and live tuning - axes @0: List(Float32); - buttons @1: List(Bool); -} - -struct OrbOdometry { - # timing first - startMonoTime @0 :UInt64; - endMonoTime @1 :UInt64; - - # fundamental matrix and error - f @2: List(Float64); - err @3: Float64; - - # number of inlier points - inliers @4: Int32; - - # for debug only - # indexed by endMonoTime features - # value is startMonoTime feature match - # -1 if no match - matches @5: List(Int16); -} - -struct OrbFeatures { - timestampEof @0 :UInt64; - # transposed arrays of normalized image coordinates - # len(xs) == len(ys) == len(descriptors) * 32 - xs @1 :List(Float32); - ys @2 :List(Float32); - descriptors @3 :Data; - octaves @4 :List(Int8); - - # match index to last OrbFeatures - # -1 if no match - timestampLastEof @5 :UInt64; - matches @6: List(Int16); -} - -struct OrbFeaturesSummary { - timestampEof @0 :UInt64; - timestampLastEof @1 :UInt64; - - featureCount @2 :UInt16; - matchCount @3 :UInt16; - computeNs @4 :UInt64; -} - -struct OrbKeyFrame { - # this is a globally unique id for the KeyFrame - id @0: UInt64; - - # this is the location of the KeyFrame - pos @1: ECEFPoint; - - # these are the features in the world - # len(dpos) == len(descriptors) * 32 - dpos @2 :List(ECEFPoint); - descriptors @3 :Data; -} - -struct DriverMonitoring { - frameId @0 :UInt32; - descriptorDEPRECATED @1 :List(Float32); - stdDEPRECATED @2 :Float32; - faceOrientation @3 :List(Float32); - facePosition @4 :List(Float32); - faceProb @5 :Float32; - leftEyeProb @6 :Float32; - rightEyeProb @7 :Float32; - leftBlinkProb @8 :Float32; - rightBlinkProb @9 :Float32; - irPwrDEPRECATED @10 :Float32; - faceOrientationStd @11 :List(Float32); - facePositionStd @12 :List(Float32); -} - -struct Boot { - wallTimeNanos @0 :UInt64; - lastKmsg @1 :Data; - lastPmsg @2 :Data; -} - -struct LiveParametersData { - valid @0 :Bool; - gyroBias @1 :Float32; - angleOffset @2 :Float32; - angleOffsetAverage @3 :Float32; - stiffnessFactor @4 :Float32; - steerRatio @5 :Float32; - sensorValid @6 :Bool; - yawRate @7 :Float32; - posenetSpeed @8 :Float32; - posenetValid @9 :Bool; -} - -struct LiveMapData { - speedLimitValid @0 :Bool; - speedLimit @1 :Float32; - speedAdvisoryValid @12 :Bool; - speedAdvisory @13 :Float32; - speedLimitAheadValid @14 :Bool; - speedLimitAhead @15 :Float32; - speedLimitAheadDistance @16 :Float32; - curvatureValid @2 :Bool; - curvature @3 :Float32; - wayId @4 :UInt64; - roadX @5 :List(Float32); - roadY @6 :List(Float32); - lastGps @7: GpsLocationData; - roadCurvatureX @8 :List(Float32); - roadCurvature @9 :List(Float32); - distToTurn @10 :Float32; - mapValid @11 :Bool; -} - -struct CameraOdometry { - frameId @4 :UInt32; - timestampEof @5 :UInt64; - trans @0 :List(Float32); # m/s in device frame - rot @1 :List(Float32); # rad/s in device frame - transStd @2 :List(Float32); # std m/s in device frame - rotStd @3 :List(Float32); # std rad/s in device frame -} - -struct KalmanOdometry { - trans @0 :List(Float32); # m/s in device frame - rot @1 :List(Float32); # rad/s in device frame - transStd @2 :List(Float32); # std m/s in device frame - rotStd @3 :List(Float32); # std rad/s in device frame -} - -struct Event { - # in nanoseconds? - logMonoTime @0 :UInt64; - valid @67 :Bool = true; - - union { - initData @1 :InitData; - frame @2 :FrameData; - gpsNMEA @3 :GPSNMEAData; - sensorEventDEPRECATED @4 :SensorEventData; - can @5 :List(CanData); - thermal @6 :ThermalData; - controlsState @7 :ControlsState; - liveEventDEPRECATED @8 :List(LiveEventData); - model @9 :ModelData; - features @10 :CalibrationFeatures; - sensorEvents @11 :List(SensorEventData); - health @12 :HealthData; - radarState @13 :RadarState; - liveUIDEPRECATED @14 :LiveUI; - encodeIdx @15 :EncodeIndex; - liveTracks @16 :List(LiveTracks); - sendcan @17 :List(CanData); - logMessage @18 :Text; - liveCalibration @19 :LiveCalibrationData; - androidLogEntry @20 :AndroidLogEntry; - gpsLocation @21 :GpsLocationData; - carState @22 :Car.CarState; - carControl @23 :Car.CarControl; - plan @24 :Plan; - liveLocation @25 :LiveLocationData; - ethernetData @26 :List(EthernetPacket); - navUpdate @27 :NavUpdate; - cellInfo @28 :List(CellInfo); - wifiScan @29 :List(WifiScan); - androidGnss @30 :AndroidGnss; - qcomGnss @31 :QcomGnss; - lidarPts @32 :LidarPts; - procLog @33 :ProcLog; - ubloxGnss @34 :UbloxGnss; - clocks @35 :Clocks; - liveMpc @36 :LiveMpcData; - liveLongitudinalMpc @37 :LiveLongitudinalMpcData; - navStatus @38 :NavStatus; - ubloxRaw @39 :Data; - gpsPlannerPoints @40 :GPSPlannerPoints; - gpsPlannerPlan @41 :GPSPlannerPlan; - applanixRaw @42 :Data; - trafficEvents @43 :List(TrafficEvent); - liveLocationTiming @44 :LiveLocationData; - orbslamCorrectionDEPRECATED @45 :OrbslamCorrection; - liveLocationCorrected @46 :LiveLocationData; - orbObservation @47 :List(OrbObservation); - gpsLocationExternal @48 :GpsLocationData; - location @49 :LiveLocationData; - uiNavigationEvent @50 :UiNavigationEvent; - liveLocationKalman @51 :LiveLocationData; - testJoystick @52 :Joystick; - orbOdometry @53 :OrbOdometry; - orbFeatures @54 :OrbFeatures; - applanixLocation @55 :LiveLocationData; - orbKeyFrame @56 :OrbKeyFrame; - uiLayoutState @57 :UiLayoutState; - orbFeaturesSummary @58 :OrbFeaturesSummary; - driverMonitoring @59 :DriverMonitoring; - boot @60 :Boot; - liveParameters @61 :LiveParametersData; - liveMapData @62 :LiveMapData; - cameraOdometry @63 :CameraOdometry; - pathPlan @64 :PathPlan; - kalmanOdometry @65 :KalmanOdometry; - thumbnail @66: Thumbnail; - carEvents @68: List(Car.CarEvent); - carParams @69: Car.CarParams; - frontFrame @70: FrameData; - } -} diff --git a/cereal/maptile.capnp b/cereal/maptile.capnp deleted file mode 100644 index 336901392a..0000000000 --- a/cereal/maptile.capnp +++ /dev/null @@ -1,53 +0,0 @@ -using Cxx = import "./include/c++.capnp"; -$Cxx.namespace("cereal"); - -using Java = import "./include/java.capnp"; -$Java.package("ai.comma.openpilot.cereal"); -$Java.outerClassname("Map"); - -@0xa086df597ef5d7a0; - -# Geometry -struct Point { - x @0: Float64; - y @1: Float64; - z @2: Float64; -} - -struct PolyLine { - points @0: List(Point); -} - -# Map features -struct Lane { - id @0 :Text; - - leftBoundary @1 :LaneBoundary; - rightBoundary @2 :LaneBoundary; - - leftAdjacentId @3 :Text; - rightAdjacentId @4 :Text; - - inboundIds @5 :List(Text); - outboundIds @6 :List(Text); - - struct LaneBoundary { - polyLine @0 :PolyLine; - startHeading @1 :Float32; # WRT north - } -} - -# Map tiles -struct TileSummary { - version @0 :Text; - updatedAt @1 :UInt64; # Millis since epoch - - level @2 :UInt8; - x @3 :UInt16; - y @4 :UInt16; -} - -struct MapTile { - summary @0 :TileSummary; - lanes @1 :List(Lane); -} diff --git a/cereal/messaging/.gitignore b/cereal/messaging/.gitignore deleted file mode 100644 index dbbe8e22ae..0000000000 --- a/cereal/messaging/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -demo -bridge -test_runner -*.o -*.os -*.d -*.a -*.so -messaging_pyx.cpp -build/ diff --git a/cereal/messaging/__init__.py b/cereal/messaging/__init__.py deleted file mode 100644 index e5a004740d..0000000000 --- a/cereal/messaging/__init__.py +++ /dev/null @@ -1,221 +0,0 @@ -# must be build with scons -from .messaging_pyx import Context, Poller, SubSocket, PubSocket # pylint: disable=no-name-in-module, import-error -from .messaging_pyx import MultiplePublishersError, MessagingError # pylint: disable=no-name-in-module, import-error -import capnp - -assert MultiplePublishersError -assert MessagingError - -from cereal import log -from cereal.services import service_list - -# sec_since_boot is faster, but allow to run standalone too -try: - from common.realtime import sec_since_boot -except ImportError: - import time - sec_since_boot = time.time - print("Warning, using python time.time() instead of faster sec_since_boot") - -context = Context() - -def new_message(): - dat = log.Event.new_message() - dat.logMonoTime = int(sec_since_boot() * 1e9) - dat.valid = True - return dat - -def pub_sock(endpoint): - sock = PubSocket() - sock.connect(context, endpoint) - return sock - -def sub_sock(endpoint, poller=None, addr="127.0.0.1", conflate=False, timeout=None): - sock = SubSocket() - addr = addr.encode('utf8') - sock.connect(context, endpoint, addr, conflate) - - if timeout is not None: - sock.setTimeout(timeout) - - if poller is not None: - poller.registerSocket(sock) - return sock - - -def drain_sock_raw(sock, wait_for_one=False): - """Receive all message currently available on the queue""" - ret = [] - while 1: - if wait_for_one and len(ret) == 0: - dat = sock.receive() - else: - dat = sock.receive(non_blocking=True) - - if dat is None: - break - - ret.append(dat) - - return ret - -def drain_sock(sock, wait_for_one=False): - """Receive all message currently available on the queue""" - ret = [] - while 1: - if wait_for_one and len(ret) == 0: - dat = sock.receive() - else: - dat = sock.receive(non_blocking=True) - - if dat is None: # Timeout hit - break - - dat = log.Event.from_bytes(dat) - ret.append(dat) - - return ret - - -# TODO: print when we drop packets? -def recv_sock(sock, wait=False): - """Same as drain sock, but only returns latest message. Consider using conflate instead.""" - dat = None - - while 1: - if wait and dat is None: - rcv = sock.receive() - else: - rcv = sock.receive(non_blocking=True) - - if rcv is None: # Timeout hit - break - - dat = rcv - - if dat is not None: - dat = log.Event.from_bytes(dat) - - return dat - -def recv_one(sock): - dat = sock.receive() - if dat is not None: - dat = log.Event.from_bytes(dat) - return dat - -def recv_one_or_none(sock): - dat = sock.receive(non_blocking=True) - if dat is not None: - dat = log.Event.from_bytes(dat) - return dat - -def recv_one_retry(sock): - """Keep receiving until we get a message""" - while True: - dat = sock.receive() - if dat is not None: - return log.Event.from_bytes(dat) - -# TODO: This does not belong in messaging -def get_one_can(logcan): - while True: - can = recv_one_retry(logcan) - if len(can.can) > 0: - return can - -class SubMaster(): - def __init__(self, services, ignore_alive=None, addr="127.0.0.1"): - self.poller = Poller() - self.frame = -1 - self.updated = {s : False for s in services} - self.rcv_time = {s : 0. for s in services} - self.rcv_frame = {s : 0 for s in services} - self.alive = {s : False for s in services} - self.sock = {} - self.freq = {} - self.data = {} - self.logMonoTime = {} - self.valid = {} - - if ignore_alive is not None: - self.ignore_alive = ignore_alive - else: - self.ignore_alive = [] - - for s in services: - if addr is not None: - self.sock[s] = sub_sock(s, poller=self.poller, addr=addr, conflate=True) - self.freq[s] = service_list[s].frequency - - data = new_message() - try: - data.init(s) - except capnp.lib.capnp.KjException: - # lists - data.init(s, 0) - - self.data[s] = getattr(data, s) - self.logMonoTime[s] = 0 - self.valid[s] = data.valid - - def __getitem__(self, s): - return self.data[s] - - def update(self, timeout=1000): - msgs = [] - for sock in self.poller.poll(timeout): - msgs.append(recv_one_or_none(sock)) - self.update_msgs(sec_since_boot(), msgs) - - def update_msgs(self, cur_time, msgs): - # TODO: add optional input that specify the service to wait for - self.frame += 1 - self.updated = dict.fromkeys(self.updated, False) - for msg in msgs: - if msg is None: - continue - - s = msg.which() - self.updated[s] = True - self.rcv_time[s] = cur_time - self.rcv_frame[s] = self.frame - self.data[s] = getattr(msg, s) - self.logMonoTime[s] = msg.logMonoTime - self.valid[s] = msg.valid - - for s in self.data: - # arbitrary small number to avoid float comparison. If freq is 0, we can skip the check - if self.freq[s] > 1e-5: - # alive if delay is within 10x the expected frequency - self.alive[s] = (cur_time - self.rcv_time[s]) < (10. / self.freq[s]) - else: - self.alive[s] = True - - def all_alive(self, service_list=None): - if service_list is None: # check all - service_list = self.alive.keys() - return all(self.alive[s] for s in service_list if s not in self.ignore_alive) - - def all_valid(self, service_list=None): - if service_list is None: # check all - service_list = self.valid.keys() - return all(self.valid[s] for s in service_list) - - def all_alive_and_valid(self, service_list=None): - if service_list is None: # check all - service_list = self.alive.keys() - return self.all_alive(service_list=service_list) and self.all_valid(service_list=service_list) - - -class PubMaster(): - def __init__(self, services): - self.sock = {} - for s in services: - self.sock[s] = pub_sock(s) - - def send(self, s, dat): - # accept either bytes or capnp builder - if not isinstance(dat, bytes): - dat = dat.to_bytes() - self.sock[s].send(dat) diff --git a/cereal/messaging/bridge.cc b/cereal/messaging/bridge.cc deleted file mode 100644 index 8e29566ca2..0000000000 --- a/cereal/messaging/bridge.cc +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include -#include -#include -#include - -typedef void (*sighandler_t)(int sig); - -#include "services.h" - -#include "impl_msgq.hpp" -#include "impl_zmq.hpp" - -void sigpipe_handler(int sig) { - assert(sig == SIGPIPE); - std::cout << "SIGPIPE received" << std::endl; -} - -static std::vector get_services() { - std::vector name_list; - - for (const auto& it : services) { - std::string name = it.name; - if (name == "plusFrame" || name == "uiLayoutState") continue; - name_list.push_back(name); - } - - return name_list; -} - - -int main(void){ - signal(SIGPIPE, (sighandler_t)sigpipe_handler); - - auto endpoints = get_services(); - - std::map sub2pub; - - Context *zmq_context = new ZMQContext(); - Context *msgq_context = new MSGQContext(); - Poller *poller = new MSGQPoller(); - - for (auto endpoint: endpoints){ - SubSocket * msgq_sock = new MSGQSubSocket(); - msgq_sock->connect(msgq_context, endpoint, "127.0.0.1", false); - poller->registerSocket(msgq_sock); - - PubSocket * zmq_sock = new ZMQPubSocket(); - zmq_sock->connect(zmq_context, endpoint); - - sub2pub[msgq_sock] = zmq_sock; - } - - - while (true){ - for (auto sub_sock : poller->poll(100)){ - Message * msg = sub_sock->receive(); - if (msg == NULL) continue; - sub2pub[sub_sock]->sendMessage(msg); - delete msg; - } - } - return 0; -} diff --git a/cereal/messaging/catch2/catch.hpp b/cereal/messaging/catch2/catch.hpp deleted file mode 100644 index 5feb2a4bea..0000000000 --- a/cereal/messaging/catch2/catch.hpp +++ /dev/null @@ -1,17075 +0,0 @@ -/* - * Catch v2.9.2 - * Generated: 2019-08-08 13:35:12.279703 - * ---------------------------------------------------------- - * This file has been merged from multiple headers. Please don't edit it directly - * Copyright (c) 2019 Two Blue Cubes Ltd. All rights reserved. - * - * Distributed under the Boost Software License, Version 1.0. (See accompanying - * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - */ -#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED -#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED -// start catch.hpp - - -#define CATCH_VERSION_MAJOR 2 -#define CATCH_VERSION_MINOR 9 -#define CATCH_VERSION_PATCH 2 - -#ifdef __clang__ -# pragma clang system_header -#elif defined __GNUC__ -# pragma GCC system_header -#endif - -// start catch_suppress_warnings.h - -#ifdef __clang__ -# ifdef __ICC // icpc defines the __clang__ macro -# pragma warning(push) -# pragma warning(disable: 161 1682) -# else // __ICC -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wpadded" -# pragma clang diagnostic ignored "-Wswitch-enum" -# pragma clang diagnostic ignored "-Wcovered-switch-default" -# endif -#elif defined __GNUC__ - // Because REQUIREs trigger GCC's -Wparentheses, and because still - // supported version of g++ have only buggy support for _Pragmas, - // Wparentheses have to be suppressed globally. -# pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details - -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunused-variable" -# pragma GCC diagnostic ignored "-Wpadded" -#endif -// end catch_suppress_warnings.h -#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) -# define CATCH_IMPL -# define CATCH_CONFIG_ALL_PARTS -#endif - -// In the impl file, we want to have access to all parts of the headers -// Can also be used to sanely support PCHs -#if defined(CATCH_CONFIG_ALL_PARTS) -# define CATCH_CONFIG_EXTERNAL_INTERFACES -# if defined(CATCH_CONFIG_DISABLE_MATCHERS) -# undef CATCH_CONFIG_DISABLE_MATCHERS -# endif -# if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) -# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER -# endif -#endif - -#if !defined(CATCH_CONFIG_IMPL_ONLY) -// start catch_platform.h - -#ifdef __APPLE__ -# include -# if TARGET_OS_OSX == 1 -# define CATCH_PLATFORM_MAC -# elif TARGET_OS_IPHONE == 1 -# define CATCH_PLATFORM_IPHONE -# endif - -#elif defined(linux) || defined(__linux) || defined(__linux__) -# define CATCH_PLATFORM_LINUX - -#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) -# define CATCH_PLATFORM_WINDOWS -#endif - -// end catch_platform.h - -#ifdef CATCH_IMPL -# ifndef CLARA_CONFIG_MAIN -# define CLARA_CONFIG_MAIN_NOT_DEFINED -# define CLARA_CONFIG_MAIN -# endif -#endif - -// start catch_user_interfaces.h - -namespace Catch { - unsigned int rngSeed(); -} - -// end catch_user_interfaces.h -// start catch_tag_alias_autoregistrar.h - -// start catch_common.h - -// start catch_compiler_capabilities.h - -// Detect a number of compiler features - by compiler -// The following features are defined: -// -// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported? -// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported? -// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported? -// CATCH_CONFIG_DISABLE_EXCEPTIONS : Are exceptions enabled? -// **************** -// Note to maintainers: if new toggles are added please document them -// in configuration.md, too -// **************** - -// In general each macro has a _NO_ form -// (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature. -// Many features, at point of detection, define an _INTERNAL_ macro, so they -// can be combined, en-mass, with the _NO_ forms later. - -#ifdef __cplusplus - -# if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) -# define CATCH_CPP14_OR_GREATER -# endif - -# if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) -# define CATCH_CPP17_OR_GREATER -# endif - -#endif - -#if defined(CATCH_CPP17_OR_GREATER) -# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS -#endif - -#ifdef __clang__ - -# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - _Pragma( "clang diagnostic push" ) \ - _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ - _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") -# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ - _Pragma( "clang diagnostic pop" ) - -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ - _Pragma( "clang diagnostic push" ) \ - _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) -# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ - _Pragma( "clang diagnostic pop" ) - -# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ - _Pragma( "clang diagnostic push" ) \ - _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" ) -# define CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS \ - _Pragma( "clang diagnostic pop" ) - -# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ - _Pragma( "clang diagnostic push" ) \ - _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" ) -# define CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \ - _Pragma( "clang diagnostic pop" ) - -#endif // __clang__ - -//////////////////////////////////////////////////////////////////////////////// -// Assume that non-Windows platforms support posix signals by default -#if !defined(CATCH_PLATFORM_WINDOWS) - #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS -#endif - -//////////////////////////////////////////////////////////////////////////////// -// We know some environments not to support full POSIX signals -#if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) - #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS -#endif - -#ifdef __OS400__ -# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS -# define CATCH_CONFIG_COLOUR_NONE -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Android somehow still does not support std::to_string -#if defined(__ANDROID__) -# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Not all Windows environments support SEH properly -#if defined(__MINGW32__) -# define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH -#endif - -//////////////////////////////////////////////////////////////////////////////// -// PS4 -#if defined(__ORBIS__) -# define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Cygwin -#ifdef __CYGWIN__ - -// Required for some versions of Cygwin to declare gettimeofday -// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin -# define _BSD_SOURCE -// some versions of cygwin (most) do not support std::to_string. Use the libstd check. -// https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813 -# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ - && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) - -# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING - -# endif -#endif // __CYGWIN__ - -//////////////////////////////////////////////////////////////////////////////// -// Visual C++ -#ifdef _MSC_VER - -# if _MSC_VER >= 1900 // Visual Studio 2015 or newer -# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS -# endif - -// Universal Windows platform does not support SEH -// Or console colours (or console at all...) -# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) -# define CATCH_CONFIG_COLOUR_NONE -# else -# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH -# endif - -// MSVC traditional preprocessor needs some workaround for __VA_ARGS__ -// _MSVC_TRADITIONAL == 0 means new conformant preprocessor -// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor -# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) -# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -# endif -#endif // _MSC_VER - -#if defined(_REENTRANT) || defined(_MSC_VER) -// Enable async processing, as -pthread is specified or no additional linking is required -# define CATCH_INTERNAL_CONFIG_USE_ASYNC -#endif // _MSC_VER - -//////////////////////////////////////////////////////////////////////////////// -// Check if we are compiled with -fno-exceptions or equivalent -#if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND) -# define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED -#endif - -//////////////////////////////////////////////////////////////////////////////// -// DJGPP -#ifdef __DJGPP__ -# define CATCH_INTERNAL_CONFIG_NO_WCHAR -#endif // __DJGPP__ - -//////////////////////////////////////////////////////////////////////////////// -// Embarcadero C++Build -#if defined(__BORLANDC__) - #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN -#endif - -//////////////////////////////////////////////////////////////////////////////// - -// Use of __COUNTER__ is suppressed during code analysis in -// CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly -// handled by it. -// Otherwise all supported compilers support COUNTER macro, -// but user still might want to turn it off -#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L ) - #define CATCH_INTERNAL_CONFIG_COUNTER -#endif - -//////////////////////////////////////////////////////////////////////////////// - -// RTX is a special version of Windows that is real time. -// This means that it is detected as Windows, but does not provide -// the same set of capabilities as real Windows does. -#if defined(UNDER_RTSS) || defined(RTX64_BUILD) - #define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH - #define CATCH_INTERNAL_CONFIG_NO_ASYNC - #define CATCH_CONFIG_COLOUR_NONE -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Check if string_view is available and usable -// The check is split apart to work around v140 (VS2015) preprocessor issue... -#if defined(__has_include) -#if __has_include() && defined(CATCH_CPP17_OR_GREATER) -# define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW -#endif -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Check if optional is available and usable -#if defined(__has_include) -# if __has_include() && defined(CATCH_CPP17_OR_GREATER) -# define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL -# endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) -#endif // __has_include - -//////////////////////////////////////////////////////////////////////////////// -// Check if byte is available and usable -#if defined(__has_include) -# if __has_include() && defined(CATCH_CPP17_OR_GREATER) -# define CATCH_INTERNAL_CONFIG_CPP17_BYTE -# endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) -#endif // __has_include - -//////////////////////////////////////////////////////////////////////////////// -// Check if variant is available and usable -#if defined(__has_include) -# if __has_include() && defined(CATCH_CPP17_OR_GREATER) -# if defined(__clang__) && (__clang_major__ < 8) - // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 - // fix should be in clang 8, workaround in libstdc++ 8.2 -# include -# if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) -# define CATCH_CONFIG_NO_CPP17_VARIANT -# else -# define CATCH_INTERNAL_CONFIG_CPP17_VARIANT -# endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) -# else -# define CATCH_INTERNAL_CONFIG_CPP17_VARIANT -# endif // defined(__clang__) && (__clang_major__ < 8) -# endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) -#endif // __has_include - -#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) -# define CATCH_CONFIG_COUNTER -#endif -#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH) -# define CATCH_CONFIG_WINDOWS_SEH -#endif -// This is set by default, because we assume that unix compilers are posix-signal-compatible by default. -#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) -# define CATCH_CONFIG_POSIX_SIGNALS -#endif -// This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions. -#if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR) -# define CATCH_CONFIG_WCHAR -#endif - -#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) -# define CATCH_CONFIG_CPP11_TO_STRING -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL) -# define CATCH_CONFIG_CPP17_OPTIONAL -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) -# define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW) -# define CATCH_CONFIG_CPP17_STRING_VIEW -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT) -# define CATCH_CONFIG_CPP17_VARIANT -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE) -# define CATCH_CONFIG_CPP17_BYTE -#endif - -#if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) -# define CATCH_INTERNAL_CONFIG_NEW_CAPTURE -#endif - -#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE) -# define CATCH_CONFIG_NEW_CAPTURE -#endif - -#if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -# define CATCH_CONFIG_DISABLE_EXCEPTIONS -#endif - -#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN) -# define CATCH_CONFIG_POLYFILL_ISNAN -#endif - -#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC) -# define CATCH_CONFIG_USE_ASYNC -#endif - -#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS -# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS -# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS -# define CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS -# define CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS -#endif - -#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -#define CATCH_TRY if ((true)) -#define CATCH_CATCH_ALL if ((false)) -#define CATCH_CATCH_ANON(type) if ((false)) -#else -#define CATCH_TRY try -#define CATCH_CATCH_ALL catch (...) -#define CATCH_CATCH_ANON(type) catch (type) -#endif - -#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) -#define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#endif - -// end catch_compiler_capabilities.h -#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line -#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) -#ifdef CATCH_CONFIG_COUNTER -# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ ) -#else -# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) -#endif - -#include -#include -#include - -// We need a dummy global operator<< so we can bring it into Catch namespace later -struct Catch_global_namespace_dummy {}; -std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); - -namespace Catch { - - struct CaseSensitive { enum Choice { - Yes, - No - }; }; - - class NonCopyable { - NonCopyable( NonCopyable const& ) = delete; - NonCopyable( NonCopyable && ) = delete; - NonCopyable& operator = ( NonCopyable const& ) = delete; - NonCopyable& operator = ( NonCopyable && ) = delete; - - protected: - NonCopyable(); - virtual ~NonCopyable(); - }; - - struct SourceLineInfo { - - SourceLineInfo() = delete; - SourceLineInfo( char const* _file, std::size_t _line ) noexcept - : file( _file ), - line( _line ) - {} - - SourceLineInfo( SourceLineInfo const& other ) = default; - SourceLineInfo& operator = ( SourceLineInfo const& ) = default; - SourceLineInfo( SourceLineInfo&& ) noexcept = default; - SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default; - - bool empty() const noexcept; - bool operator == ( SourceLineInfo const& other ) const noexcept; - bool operator < ( SourceLineInfo const& other ) const noexcept; - - char const* file; - std::size_t line; - }; - - std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); - - // Bring in operator<< from global namespace into Catch namespace - // This is necessary because the overload of operator<< above makes - // lookup stop at namespace Catch - using ::operator<<; - - // Use this in variadic streaming macros to allow - // >> +StreamEndStop - // as well as - // >> stuff +StreamEndStop - struct StreamEndStop { - std::string operator+() const; - }; - template - T const& operator + ( T const& value, StreamEndStop ) { - return value; - } -} - -#define CATCH_INTERNAL_LINEINFO \ - ::Catch::SourceLineInfo( __FILE__, static_cast( __LINE__ ) ) - -// end catch_common.h -namespace Catch { - - struct RegistrarForTagAliases { - RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); - }; - -} // end namespace Catch - -#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS - -// end catch_tag_alias_autoregistrar.h -// start catch_test_registry.h - -// start catch_interfaces_testcase.h - -#include - -namespace Catch { - - class TestSpec; - - struct ITestInvoker { - virtual void invoke () const = 0; - virtual ~ITestInvoker(); - }; - - class TestCase; - struct IConfig; - - struct ITestCaseRegistry { - virtual ~ITestCaseRegistry(); - virtual std::vector const& getAllTests() const = 0; - virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0; - }; - - bool isThrowSafe( TestCase const& testCase, IConfig const& config ); - bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); - std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); - std::vector const& getAllTestCasesSorted( IConfig const& config ); - -} - -// end catch_interfaces_testcase.h -// start catch_stringref.h - -#include -#include -#include - -namespace Catch { - - /// A non-owning string class (similar to the forthcoming std::string_view) - /// Note that, because a StringRef may be a substring of another string, - /// it may not be null terminated. c_str() must return a null terminated - /// string, however, and so the StringRef will internally take ownership - /// (taking a copy), if necessary. In theory this ownership is not externally - /// visible - but it does mean (substring) StringRefs should not be shared between - /// threads. - class StringRef { - public: - using size_type = std::size_t; - - private: - friend struct StringRefTestAccess; - - char const* m_start; - size_type m_size; - - char* m_data = nullptr; - - void takeOwnership(); - - static constexpr char const* const s_empty = ""; - - public: // construction/ assignment - StringRef() noexcept - : StringRef( s_empty, 0 ) - {} - - StringRef( StringRef const& other ) noexcept - : m_start( other.m_start ), - m_size( other.m_size ) - {} - - StringRef( StringRef&& other ) noexcept - : m_start( other.m_start ), - m_size( other.m_size ), - m_data( other.m_data ) - { - other.m_data = nullptr; - } - - StringRef( char const* rawChars ) noexcept; - - StringRef( char const* rawChars, size_type size ) noexcept - : m_start( rawChars ), - m_size( size ) - {} - - StringRef( std::string const& stdString ) noexcept - : m_start( stdString.c_str() ), - m_size( stdString.size() ) - {} - - ~StringRef() noexcept { - delete[] m_data; - } - - auto operator = ( StringRef const &other ) noexcept -> StringRef& { - delete[] m_data; - m_data = nullptr; - m_start = other.m_start; - m_size = other.m_size; - return *this; - } - - operator std::string() const; - - void swap( StringRef& other ) noexcept; - - public: // operators - auto operator == ( StringRef const& other ) const noexcept -> bool; - auto operator != ( StringRef const& other ) const noexcept -> bool; - - auto operator[] ( size_type index ) const noexcept -> char; - - public: // named queries - auto empty() const noexcept -> bool { - return m_size == 0; - } - auto size() const noexcept -> size_type { - return m_size; - } - - auto numberOfCharacters() const noexcept -> size_type; - auto c_str() const -> char const*; - - public: // substrings and searches - auto substr( size_type start, size_type size ) const noexcept -> StringRef; - - // Returns the current start pointer. - // Note that the pointer can change when if the StringRef is a substring - auto currentData() const noexcept -> char const*; - - private: // ownership queries - may not be consistent between calls - auto isOwned() const noexcept -> bool; - auto isSubstring() const noexcept -> bool; - }; - - auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string; - auto operator + ( StringRef const& lhs, char const* rhs ) -> std::string; - auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string; - - auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&; - auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&; - - inline auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { - return StringRef( rawChars, size ); - } - -} // namespace Catch - -inline auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { - return Catch::StringRef( rawChars, size ); -} - -// end catch_stringref.h -// start catch_type_traits.hpp - - -#include - -namespace Catch{ - -#ifdef CATCH_CPP17_OR_GREATER - template - inline constexpr auto is_unique = std::true_type{}; - - template - inline constexpr auto is_unique = std::bool_constant< - (!std::is_same_v && ...) && is_unique - >{}; -#else - -template -struct is_unique : std::true_type{}; - -template -struct is_unique : std::integral_constant -::value - && is_unique::value - && is_unique::value ->{}; - -#endif -} - -// end catch_type_traits.hpp -// start catch_preprocessor.hpp - - -#define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__ -#define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__))) - -#ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__ -// MSVC needs more evaluations -#define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__))) -#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__)) -#else -#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__) -#endif - -#define CATCH_REC_END(...) -#define CATCH_REC_OUT - -#define CATCH_EMPTY() -#define CATCH_DEFER(id) id CATCH_EMPTY() - -#define CATCH_REC_GET_END2() 0, CATCH_REC_END -#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2 -#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1 -#define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT -#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0) -#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next) - -#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) - -#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) - -// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results, -// and passes userdata as the first parameter to each invocation, -// e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c) -#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) - -#define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) - -#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param) -#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__ -#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__ -#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF -#define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__) -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__ -#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) -#else -// MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF -#define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__) -#define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__ -#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1) -#endif - -#define INTERNAL_CATCH_MAKE_NAMESPACE2(...) ns_##__VA_ARGS__ -#define INTERNAL_CATCH_MAKE_NAMESPACE(name) INTERNAL_CATCH_MAKE_NAMESPACE2(name) - -#define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__) - -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper()) -#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)) -#else -#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper())) -#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))) -#endif - -#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...)\ - CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,__VA_ARGS__) - -#define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0) -#define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1) -#define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2) -#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3) -#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4) -#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5) -#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _4, _5, _6) -#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7) -#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8) -#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9) -#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) - -#define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N - -#define INTERNAL_CATCH_TYPE_GEN\ - template struct TypeList {};\ - template\ - constexpr auto get_wrapper() noexcept -> TypeList { return {}; }\ - \ - template class L1, typename...E1, template class L2, typename...E2> \ - constexpr auto append(L1, L2) noexcept -> L1 { return {}; }\ - template< template class L1, typename...E1, template class L2, typename...E2, typename...Rest>\ - constexpr auto append(L1, L2, Rest...) noexcept -> decltype(append(L1{}, Rest{}...)) { return {}; }\ - template< template class L1, typename...E1, typename...Rest>\ - constexpr auto append(L1, TypeList, Rest...) noexcept -> L1 { return {}; }\ - \ - template< template class Container, template class List, typename...elems>\ - constexpr auto rewrap(List) noexcept -> TypeList> { return {}; }\ - template< template class Container, template class List, class...Elems, typename...Elements>\ - constexpr auto rewrap(List,Elements...) noexcept -> decltype(append(TypeList>{}, rewrap(Elements{}...))) { return {}; }\ - \ - template