mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-12 18:34:25 +08:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
693bcb0f83 | ||
|
|
95a349abcc | ||
|
|
c6ba5dc539 | ||
|
|
6c3afeec0f | ||
|
|
29c58b4588 | ||
|
|
ecc565aa3f | ||
|
|
db61810f98 | ||
|
|
48f203ad5b | ||
|
|
6ab4ac2dfb | ||
|
|
9cb3c7b6e6 | ||
|
|
adaa4ed350 | ||
|
|
a64b9aa9b8 | ||
|
|
0138eca61d | ||
|
|
139a40de29 | ||
|
|
17d9becd3c | ||
|
|
449b482cc3 | ||
|
|
a7e099c946 | ||
|
|
610462be5a | ||
|
|
207d32668f |
22
.gitignore
vendored
Normal file
22
.gitignore
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
.DS_Store
|
||||
.tags
|
||||
.ipynb_checkpoints
|
||||
|
||||
*.pyc
|
||||
.*.swp
|
||||
.*.swo
|
||||
.*.un~
|
||||
*.o
|
||||
*.d
|
||||
*.so
|
||||
*.a
|
||||
*.clb
|
||||
config.json
|
||||
clcache
|
||||
|
||||
board/obj/
|
||||
selfdrive/boardd/boardd
|
||||
selfdrive/logcatd/logcatd
|
||||
selfdrive/sensord/sensord
|
||||
selfdrive/ui/ui
|
||||
|
||||
13
.travis.yml
Normal file
13
.travis.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
sudo: required
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
install:
|
||||
- docker build -t tmppilot -f Dockerfile.openpilot .
|
||||
|
||||
script:
|
||||
- docker run --rm
|
||||
-v "$(pwd)"/selfdrive/test/plant/out:/tmp/openpilot/selfdrive/test/plant/out
|
||||
tmppilot /bin/sh -c 'cd /tmp/openpilot/selfdrive/test/plant && ./runtest.sh'
|
||||
|
||||
19
Dockerfile.openpilot
Normal file
19
Dockerfile.openpilot
Normal file
@@ -0,0 +1,19 @@
|
||||
FROM ubuntu:14.04
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
RUN apt-get update && apt-get install -y build-essential screen wget bzip2 git libglib2.0-0
|
||||
|
||||
RUN wget -nv -O /tmp/anaconda.sh https://repo.continuum.io/archive/Anaconda2-4.2.0-Linux-x86_64.sh && \
|
||||
/bin/bash /tmp/anaconda.sh -b -p /opt/conda && \
|
||||
rm /tmp/anaconda.sh
|
||||
|
||||
ENV PATH /opt/conda/bin:$PATH
|
||||
|
||||
RUN conda install numpy==1.11.2 && conda install scipy==0.18.1
|
||||
|
||||
COPY requirements_openpilot.txt /tmp/
|
||||
RUN pip install -r /tmp/requirements_openpilot.txt
|
||||
|
||||
ENV PYTHONPATH /tmp/openpilot:$PYTHONPATH
|
||||
|
||||
COPY . /tmp/openpilot
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2016, comma.ai
|
||||
Copyright (c) 2016, 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:
|
||||
|
||||
|
||||
6
Makefile
Normal file
6
Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
.PHONY: all
|
||||
|
||||
# TODO: Add a global build system to openpilot
|
||||
all:
|
||||
cd /data/openpilot/selfdrive && PYTHONPATH=/data/openpilot PREPAREONLY=1 /data/openpilot/selfdrive/manager.py
|
||||
|
||||
35
README.md
35
README.md
@@ -10,15 +10,9 @@ The openpilot codebase has been written to be concise and enable rapid prototypi
|
||||
Hardware
|
||||
------
|
||||
|
||||
Right now openpilot supports the [neo research platform](http://github.com/commaai/neo) for vehicle control. We'd like to support [Open Source Car Control](https://github.com/PolySync/OSCC) as well.
|
||||
Right now openpilot supports the [neo research platform](http://github.com/commaai/neo) for vehicle control. We'd like to support other platforms as well.
|
||||
|
||||
To install it on the NEO:
|
||||
|
||||
```bash
|
||||
# Requires working adb in PATH
|
||||
cd installation
|
||||
./install.sh
|
||||
```
|
||||
Install openpilot on a neo device by entering ``https://openpilot.comma.ai`` during NEOS setup.
|
||||
|
||||
Supported Cars
|
||||
------
|
||||
@@ -26,7 +20,7 @@ Supported Cars
|
||||
- Acura ILX 2016 with AcuraWatch Plus
|
||||
- Limitations: Due to use of the cruise control for gas, it can only be enabled above 25 mph
|
||||
|
||||
- Honda Civic 2016 Touring Edition
|
||||
- Honda Civic 2016 with Honda Sensing
|
||||
- Limitations: Due to limitations in steering firmware, steering is disabled below 18 mph
|
||||
|
||||
Directory structure
|
||||
@@ -36,32 +30,47 @@ Directory structure
|
||||
- cereal -- The messaging spec used for all logs on the phone
|
||||
- common -- Library like functionality we've developed here
|
||||
- dbcs -- Files showing how to interpret data from cars
|
||||
- installation -- Installation on the neo platform
|
||||
- phonelibs -- Libraries used on the phone
|
||||
- selfdrive -- Code needed to drive the car
|
||||
- assets -- Fonts for ui
|
||||
- boardd -- Daemon to talk to the board
|
||||
- calibrationd -- Camera calibration server
|
||||
- car -- Code that talks to the car and implements CarInterface
|
||||
- common -- Shared C/C++ code for the daemons
|
||||
- controls -- Python controls (PID loops etc) for the car
|
||||
- logcatd -- Android logcat as a service
|
||||
- loggerd -- Logger and uploader of car data
|
||||
- radar -- Code that talks to the radar and implements RadarInterface
|
||||
- sensord -- IMU / GPS interface code
|
||||
- test/plant -- Car simulator running code through virtual maneuvers
|
||||
- ui -- The UI
|
||||
- visiond -- embedded vision pipeline
|
||||
|
||||
To understand how the services interact, see `common/services.py`
|
||||
|
||||
Testing on PC
|
||||
------
|
||||
|
||||
There is rudimentary infrastructure to run a basic simulation and generate a report of openpilot's behavior in different scenarios.
|
||||
|
||||
```bash
|
||||
# Requires working docker
|
||||
./run_docker_tests.sh
|
||||
```
|
||||
|
||||
The results are written to `selfdrive/test/plant/out/index.html`
|
||||
|
||||
More extensive testing infrastructure and simulation environments are coming soon.
|
||||
|
||||
Adding Car Support
|
||||
------
|
||||
|
||||
It should be relatively easy to add support for the Honda CR-V Touring. The brake message is the same. Steering has a slightly different message with a different message id. Sniff CAN while using LKAS to find it.
|
||||
|
||||
The Honda Accord uses different signalling for the steering and probably requires new hardware.
|
||||
The Honda Accord uses different signaling for the steering and probably requires new hardware.
|
||||
|
||||
Adding other manufacturers besides Honda/Acura is doable but will be more of an undertaking.
|
||||
|
||||
|
||||
User Data / chffr Account / Crash Reporting
|
||||
------
|
||||
|
||||
@@ -81,7 +90,7 @@ We welcome both pull requests and issues on
|
||||
[github](http://github.com/commaai/openpilot). See the TODO file for a list of
|
||||
good places to start.
|
||||
|
||||
|
||||
Want to get paid to work on openpilot? [comma.ai is hiring](http://comma.ai/hiring.html)
|
||||
|
||||
Licensing
|
||||
------
|
||||
|
||||
65
RELEASES.md
Normal file
65
RELEASES.md
Normal file
@@ -0,0 +1,65 @@
|
||||
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
|
||||
|
||||
14
TODO.md
14
TODO.md
@@ -1,14 +0,0 @@
|
||||
TODO
|
||||
======
|
||||
|
||||
An incomplete list of known issues and desired featues.
|
||||
|
||||
- TX and RX amounts on UI are wrong for a few frames at startup because we
|
||||
subtract (total sent - 0). We should initialize sent bytes before displaying.
|
||||
|
||||
- Rewrite common/dbc.py to be faster and cleaner, potentially in C++.
|
||||
|
||||
- Add module and class level documentation where appropriate.
|
||||
|
||||
- Fix lock file cleanup so there isn't always 1 pending upload when the vehicle
|
||||
shuts off.
|
||||
@@ -1,4 +1,13 @@
|
||||
void can_init(CAN_TypeDef *CAN) {
|
||||
// enable CAN busses
|
||||
if (CAN == CAN1) {
|
||||
// CAN1_EN
|
||||
GPIOB->ODR |= (1 << 3);
|
||||
} else if (CAN == CAN2) {
|
||||
// CAN2_EN
|
||||
GPIOB->ODR |= (1 << 4);
|
||||
}
|
||||
|
||||
CAN->MCR = CAN_MCR_TTCM | CAN_MCR_INRQ;
|
||||
while((CAN->MSR & CAN_MSR_INAK) != CAN_MSR_INAK);
|
||||
puts("CAN initting\n");
|
||||
|
||||
148
board/inc/stm32f2xx_hal_def.h
Normal file
148
board/inc/stm32f2xx_hal_def.h
Normal file
@@ -0,0 +1,148 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f2xx_hal_def.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.1
|
||||
* @date 25-March-2014
|
||||
* @brief This file contains HAL common defines, enumeration, macros and
|
||||
* structures definitions.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F2xx_HAL_DEF
|
||||
#define __STM32F2xx_HAL_DEF
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f2xx.h"
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief HAL Status structures definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_OK = 0x00,
|
||||
HAL_ERROR = 0x01,
|
||||
HAL_BUSY = 0x02,
|
||||
HAL_TIMEOUT = 0x03
|
||||
} HAL_StatusTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL Lock structures definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_UNLOCKED = 0x00,
|
||||
HAL_LOCKED = 0x01
|
||||
} HAL_LockTypeDef;
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
#ifndef NULL
|
||||
#define NULL (void *) 0
|
||||
#endif
|
||||
|
||||
#define HAL_MAX_DELAY 0xFFFFFFFF
|
||||
|
||||
#define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
|
||||
#define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)
|
||||
|
||||
#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_) \
|
||||
do{ \
|
||||
(__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \
|
||||
(__DMA_HANDLE_).Parent = (__HANDLE__); \
|
||||
} while(0)
|
||||
|
||||
#if (USE_RTOS == 1)
|
||||
/* Reserved for future use */
|
||||
#else
|
||||
#define __HAL_LOCK(__HANDLE__) \
|
||||
do{ \
|
||||
if((__HANDLE__)->Lock == HAL_LOCKED) \
|
||||
{ \
|
||||
return HAL_BUSY; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(__HANDLE__)->Lock = HAL_LOCKED; \
|
||||
} \
|
||||
}while (0)
|
||||
|
||||
#define __HAL_UNLOCK(__HANDLE__) \
|
||||
do{ \
|
||||
(__HANDLE__)->Lock = HAL_UNLOCKED; \
|
||||
}while (0)
|
||||
#endif /* USE_RTOS */
|
||||
|
||||
#if defined ( __GNUC__ )
|
||||
#ifndef __weak
|
||||
#define __weak __attribute__((weak))
|
||||
#endif /* __weak */
|
||||
#ifndef __packed
|
||||
#define __packed __attribute__((__packed__))
|
||||
#endif /* __packed */
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
|
||||
/* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
|
||||
#if defined (__GNUC__) /* GNU Compiler */
|
||||
#ifndef __ALIGN_END
|
||||
#define __ALIGN_END __attribute__ ((aligned (4)))
|
||||
#endif /* __ALIGN_END */
|
||||
#ifndef __ALIGN_BEGIN
|
||||
#define __ALIGN_BEGIN
|
||||
#endif /* __ALIGN_BEGIN */
|
||||
#else
|
||||
#ifndef __ALIGN_END
|
||||
#define __ALIGN_END
|
||||
#endif /* __ALIGN_END */
|
||||
#ifndef __ALIGN_BEGIN
|
||||
#if defined (__CC_ARM) /* ARM Compiler */
|
||||
#define __ALIGN_BEGIN __align(4)
|
||||
#elif defined (__ICCARM__) /* IAR Compiler */
|
||||
#define __ALIGN_BEGIN
|
||||
#elif defined (__TASKING__) /* TASKING Compiler */
|
||||
#define __ALIGN_BEGIN __align(4)
|
||||
#endif /* __CC_ARM */
|
||||
#endif /* __ALIGN_BEGIN */
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ___STM32F2xx_HAL_DEF */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
236
board/inc/stm32f2xx_hal_gpio_ex.h
Normal file
236
board/inc/stm32f2xx_hal_gpio_ex.h
Normal file
@@ -0,0 +1,236 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f2xx_hal_gpio_ex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.1
|
||||
* @date 25-March-2014
|
||||
* @brief Header file of GPIO HAL Extension module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F2xx_HAL_GPIO_EX_H
|
||||
#define __STM32F2xx_HAL_GPIO_EX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f2xx_hal_def.h"
|
||||
|
||||
/** @addtogroup STM32F2xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup GPIO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup GPIO_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup GPIO_Alternat_function_selection
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief AF 0 selection
|
||||
*/
|
||||
#define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
|
||||
#define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
|
||||
#define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
|
||||
#define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
|
||||
#define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
|
||||
|
||||
/**
|
||||
* @brief AF 1 selection
|
||||
*/
|
||||
#define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
|
||||
#define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
|
||||
|
||||
/**
|
||||
* @brief AF 2 selection
|
||||
*/
|
||||
#define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
|
||||
#define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
|
||||
#define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
|
||||
|
||||
/**
|
||||
* @brief AF 3 selection
|
||||
*/
|
||||
#define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
|
||||
#define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
|
||||
#define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
|
||||
#define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
|
||||
|
||||
/**
|
||||
* @brief AF 4 selection
|
||||
*/
|
||||
#define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
|
||||
#define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
|
||||
#define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
|
||||
|
||||
/**
|
||||
* @brief AF 5 selection
|
||||
*/
|
||||
#define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
|
||||
#define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
|
||||
/**
|
||||
* @brief AF 6 selection
|
||||
*/
|
||||
#define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
|
||||
|
||||
/**
|
||||
* @brief AF 7 selection
|
||||
*/
|
||||
#define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
|
||||
#define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
|
||||
#define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
|
||||
|
||||
/**
|
||||
* @brief AF 8 selection
|
||||
*/
|
||||
#define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
|
||||
#define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
|
||||
#define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
|
||||
|
||||
/**
|
||||
* @brief AF 9 selection
|
||||
*/
|
||||
#define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
|
||||
#define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */
|
||||
#define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
|
||||
#define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
|
||||
#define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
|
||||
|
||||
/**
|
||||
* @brief AF 10 selection
|
||||
*/
|
||||
#define GPIO_AF10_OTG_FS ((uint8_t)0xA) /* OTG_FS Alternate Function mapping */
|
||||
#define GPIO_AF10_OTG_HS ((uint8_t)0xA) /* OTG_HS Alternate Function mapping */
|
||||
|
||||
/**
|
||||
* @brief AF 11 selection
|
||||
*/
|
||||
#if defined(STM32F207xx) || defined(STM32F217xx)
|
||||
#define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */
|
||||
#endif /* STM32F207xx || STM32F217xx */
|
||||
|
||||
/**
|
||||
* @brief AF 12 selection
|
||||
*/
|
||||
#define GPIO_AF12_FSMC ((uint8_t)0xC) /* FSMC Alternate Function mapping */
|
||||
#define GPIO_AF12_OTG_HS_FS ((uint8_t)0xC) /* OTG HS configured in FS, Alternate Function mapping */
|
||||
#define GPIO_AF12_SDIO ((uint8_t)0xC) /* SDIO Alternate Function mapping */
|
||||
|
||||
/**
|
||||
* @brief AF 13 selection
|
||||
*/
|
||||
#if defined(STM32F207xx) || defined(STM32F217xx)
|
||||
#define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */
|
||||
#endif /* STM32F207xx || STM32F217xx */
|
||||
|
||||
/**
|
||||
* @brief AF 15 selection
|
||||
*/
|
||||
#define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
|
||||
|
||||
#if defined(STM32F207xx) || defined(STM32F217xx)
|
||||
#define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
|
||||
((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
|
||||
((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
|
||||
((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
|
||||
((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
|
||||
((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
|
||||
((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
|
||||
((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
|
||||
((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \
|
||||
((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \
|
||||
((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
|
||||
((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \
|
||||
((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \
|
||||
((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
|
||||
((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \
|
||||
((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \
|
||||
((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \
|
||||
((AF) == GPIO_AF12_FSMC) || ((AF) == GPIO_AF15_EVENTOUT))
|
||||
#else /* STM32F207xx || STM32F217xx */
|
||||
#define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
|
||||
((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
|
||||
((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
|
||||
((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
|
||||
((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
|
||||
((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
|
||||
((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
|
||||
((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
|
||||
((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \
|
||||
((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \
|
||||
((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
|
||||
((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \
|
||||
((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \
|
||||
((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
|
||||
((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \
|
||||
((AF) == GPIO_AF12_OTG_HS_FS) || ((AF) == GPIO_AF12_SDIO) || \
|
||||
((AF) == GPIO_AF12_FSMC) || ((AF) == GPIO_AF15_EVENTOUT))
|
||||
#endif /* STM32F207xx || STM32F217xx */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32F2xx_HAL_GPIO_EX_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
41
board/libc.h
41
board/libc.h
@@ -13,19 +13,7 @@
|
||||
#define __DIVFRAQ(_PCLK_, _BAUD_) (((__DIV((_PCLK_), (_BAUD_)) - (__DIVMANT((_PCLK_), (_BAUD_)) * 100)) * 16 + 50) / 100)
|
||||
#define __USART_BRR(_PCLK_, _BAUD_) ((__DIVMANT((_PCLK_), (_BAUD_)) << 4)|(__DIVFRAQ((_PCLK_), (_BAUD_)) & 0x0F))
|
||||
|
||||
#define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
|
||||
#define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
|
||||
#define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
|
||||
#define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
|
||||
#define GPIO_AF10_OTG_FS ((uint8_t)0xA) /* OTG_FS Alternate Function mapping */
|
||||
#define GPIO_AF12_OTG_HS_FS ((uint8_t)0xC) /* OTG HS configured in FS */
|
||||
|
||||
#ifdef OLD_BOARD
|
||||
#define USART USART2
|
||||
#else
|
||||
#define USART USART3
|
||||
#endif
|
||||
|
||||
#include "stm32f2xx_hal_gpio_ex.h"
|
||||
|
||||
// **** shitty libc ****
|
||||
|
||||
@@ -68,15 +56,20 @@ void clock_init() {
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN;
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN;
|
||||
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_DMA2EN;
|
||||
|
||||
RCC->APB1ENR |= RCC_APB1ENR_USART2EN;
|
||||
RCC->APB1ENR |= RCC_APB1ENR_USART3EN;
|
||||
RCC->APB1ENR |= RCC_APB1ENR_CAN1EN;
|
||||
RCC->APB1ENR |= RCC_APB1ENR_CAN2EN;
|
||||
RCC->APB1ENR |= RCC_APB1ENR_DACEN;
|
||||
RCC->APB1ENR |= RCC_APB1ENR_TIM3EN;
|
||||
//RCC->APB1ENR |= RCC_APB1ENR_TIM4EN;
|
||||
RCC->AHB2ENR |= RCC_AHB2ENR_OTGFSEN;
|
||||
//RCC->APB2ENR |= RCC_APB2ENR_TIM1EN;
|
||||
RCC->APB2ENR |= RCC_APB2ENR_TIM1EN;
|
||||
RCC->APB2ENR |= RCC_APB2ENR_ADC1EN;
|
||||
RCC->APB2ENR |= RCC_APB2ENR_SPI1EN;
|
||||
|
||||
// turn on alt USB
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_OTGHSEN;
|
||||
@@ -101,7 +94,7 @@ void gpio_init() {
|
||||
// IGNITION on C13
|
||||
|
||||
// set mode for LEDs and CAN
|
||||
GPIOB->MODER = GPIO_MODER_MODER10_0 | GPIO_MODER_MODER11_0;
|
||||
GPIOB->MODER = GPIO_MODER_MODER10_0 | GPIO_MODER_MODER11_0 | GPIO_MODER_MODER12_0;
|
||||
// CAN 2
|
||||
GPIOB->MODER |= GPIO_MODER_MODER5_1 | GPIO_MODER_MODER6_1;
|
||||
// CAN 1
|
||||
@@ -125,6 +118,12 @@ void gpio_init() {
|
||||
|
||||
GPIOA->PUPDR = GPIO_PUPDR_PUPDR2_0 | GPIO_PUPDR_PUPDR3_0;
|
||||
|
||||
// setup SPI
|
||||
GPIOA->MODER |= GPIO_MODER_MODER4_1 | GPIO_MODER_MODER5_1 |
|
||||
GPIO_MODER_MODER6_1 | GPIO_MODER_MODER7_1;
|
||||
GPIOA->AFR[0] |= GPIO_AF5_SPI1 << (4*4) | GPIO_AF5_SPI1 << (5*4) |
|
||||
GPIO_AF5_SPI1 << (6*4) | GPIO_AF5_SPI1 << (7*4);
|
||||
|
||||
// set mode for CAN / USB_HS pins
|
||||
GPIOB->AFR[0] = GPIO_AF9_CAN1 << (5*4) | GPIO_AF9_CAN1 << (6*4);
|
||||
GPIOB->AFR[1] = GPIO_AF9_CAN1 << ((8-8)*4) | GPIO_AF9_CAN1 << ((9-8)*4);
|
||||
@@ -136,9 +135,6 @@ void gpio_init() {
|
||||
|
||||
GPIOB->OSPEEDR = GPIO_OSPEEDER_OSPEEDR14 | GPIO_OSPEEDER_OSPEEDR15;
|
||||
|
||||
// enable CAN busses
|
||||
GPIOB->ODR |= (1 << 3) | (1 << 4);
|
||||
|
||||
// enable OTG out tied to ground
|
||||
GPIOA->ODR = 0;
|
||||
GPIOA->MODER |= GPIO_MODER_MODER1_0;
|
||||
@@ -223,4 +219,13 @@ void *memcpy(void *dest, const void *src, unsigned int n) {
|
||||
return dest;
|
||||
}
|
||||
|
||||
void set_led(int led_num, int state) {
|
||||
if (state) {
|
||||
// turn on
|
||||
GPIOB->ODR &= ~(1 << (10 + led_num));
|
||||
} else {
|
||||
// turn off
|
||||
GPIOB->ODR |= (1 << (10 + led_num));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
111
board/main.c
111
board/main.c
@@ -2,6 +2,12 @@
|
||||
//#define CAN_LOOPBACK_MODE
|
||||
//#define USE_INTERNAL_OSC
|
||||
//#define OLD_BOARD
|
||||
//#define ENABLE_CURRENT_SENSOR
|
||||
//#define ENABLE_SPI
|
||||
|
||||
// choose serial port for debugging
|
||||
//#define USART USART2
|
||||
#define USART USART3
|
||||
|
||||
#define USB_VID 0xbbaa
|
||||
#define USB_PID 0xddcc
|
||||
@@ -21,10 +27,16 @@ USB_OTG_GlobalTypeDef *USBx = USB_OTG_FS;
|
||||
#include "timer.h"
|
||||
#include "usb.h"
|
||||
#include "can.h"
|
||||
#include "spi.h"
|
||||
|
||||
// debug safety check: is controls allowed?
|
||||
int controls_allowed = 0;
|
||||
int started = 0;
|
||||
int can_live = 0, pending_can_live = 0;
|
||||
|
||||
// optional features
|
||||
int gas_interceptor_detected = 0;
|
||||
int started_signal_detected = 0;
|
||||
|
||||
// ********************* instantiate queues *********************
|
||||
|
||||
@@ -146,6 +158,9 @@ void CAN2_TX_IRQHandler() {
|
||||
// CAN receive handlers
|
||||
void can_rx(CAN_TypeDef *CAN, int can_number) {
|
||||
while (CAN->RF0R & CAN_RF0R_FMP0) {
|
||||
// can is live
|
||||
pending_can_live = 1;
|
||||
|
||||
// add to my fifo
|
||||
CAN_FIFOMailBox_TypeDef to_push;
|
||||
to_push.RIR = CAN->sFIFOMailBox[0].RIR;
|
||||
@@ -255,12 +270,20 @@ int get_health_pkt(void *dat) {
|
||||
uint8_t started;
|
||||
uint8_t controls_allowed;
|
||||
uint8_t gas_interceptor_detected;
|
||||
uint8_t started_signal_detected;
|
||||
} *health = dat;
|
||||
health->voltage = adc_get(ADCCHAN_VOLTAGE);
|
||||
#ifdef ENABLE_CURRENT_SENSOR
|
||||
health->current = adc_get(ADCCHAN_CURRENT);
|
||||
health->started = (GPIOC->IDR & (1 << 13)) != 0;
|
||||
#else
|
||||
health->current = 0;
|
||||
#endif
|
||||
health->started = started;
|
||||
|
||||
health->controls_allowed = controls_allowed;
|
||||
|
||||
health->gas_interceptor_detected = gas_interceptor_detected;
|
||||
health->started_signal_detected = started_signal_detected;
|
||||
return sizeof(*health);
|
||||
}
|
||||
|
||||
@@ -377,6 +400,48 @@ void ADC_IRQHandler(void) {
|
||||
puts("ADC_IRQ\n");
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SPI
|
||||
|
||||
#define SPI_BUF_SIZE 128
|
||||
uint8_t spi_buf[SPI_BUF_SIZE];
|
||||
int spi_buf_count = 0;
|
||||
uint8_t spi_tx_buf[0x10];
|
||||
|
||||
void DMA2_Stream3_IRQHandler(void) {
|
||||
#ifdef DEBUG
|
||||
puts("DMA2\n");
|
||||
#endif
|
||||
DMA2->LIFCR = DMA_LIFCR_CTCIF3;
|
||||
|
||||
pop(&can_rx_q, spi_tx_buf);
|
||||
spi_tx_dma(spi_tx_buf, 0x10);
|
||||
}
|
||||
|
||||
void SPI1_IRQHandler(void) {
|
||||
// status is 0x43
|
||||
if (SPI1->SR & SPI_SR_RXNE) {
|
||||
uint8_t dat = SPI1->DR;
|
||||
/*spi_buf[spi_buf_count] = dat;
|
||||
if (spi_buf_count < SPI_BUF_SIZE-1) {
|
||||
spi_buf_count += 1;
|
||||
}*/
|
||||
}
|
||||
|
||||
if (SPI1->SR & SPI_SR_TXE) {
|
||||
// all i send is U U U no matter what
|
||||
//SPI1->DR = 'U';
|
||||
}
|
||||
|
||||
int stat = SPI1->SR;
|
||||
if (stat & ((~SPI_SR_RXNE) & (~SPI_SR_TXE) & (~SPI_SR_BSY))) {
|
||||
puts("SPI status: ");
|
||||
puth(stat);
|
||||
puts("\n");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ***************************** main code *****************************
|
||||
|
||||
void __initialize_hardware_early() {
|
||||
@@ -411,11 +476,6 @@ int main() {
|
||||
// init devices
|
||||
clock_init();
|
||||
|
||||
// test the USB choice before GPIO init
|
||||
if (GPIOA->IDR & (1 << 12)) {
|
||||
USBx = USB_OTG_HS;
|
||||
}
|
||||
|
||||
gpio_init();
|
||||
uart_init();
|
||||
usb_init();
|
||||
@@ -423,6 +483,14 @@ int main() {
|
||||
can_init(CAN2);
|
||||
adc_init();
|
||||
|
||||
#ifdef ENABLE_SPI
|
||||
spi_init();
|
||||
|
||||
// set up DMA
|
||||
memset(spi_tx_buf, 0, 0x10);
|
||||
spi_tx_dma(spi_tx_buf, 0x10);
|
||||
#endif
|
||||
|
||||
// timer for fan PWM
|
||||
#ifdef OLD_BOARD
|
||||
TIM3->CCMR2 = TIM_CCMR2_OC4M_2 | TIM_CCMR2_OC4M_1;
|
||||
@@ -458,11 +526,22 @@ int main() {
|
||||
NVIC_EnableIRQ(CAN2_TX_IRQn);
|
||||
NVIC_EnableIRQ(CAN2_RX0_IRQn);
|
||||
NVIC_EnableIRQ(CAN2_SCE_IRQn);
|
||||
|
||||
#ifdef ENABLE_SPI
|
||||
NVIC_EnableIRQ(DMA2_Stream3_IRQn);
|
||||
NVIC_EnableIRQ(SPI1_IRQn);
|
||||
#endif
|
||||
__enable_irq();
|
||||
|
||||
|
||||
// LED should keep on blinking all the time
|
||||
while (1) {
|
||||
int cnt;
|
||||
for (cnt=0;;cnt++) {
|
||||
can_live = pending_can_live;
|
||||
|
||||
// reset this every 16th pass
|
||||
if ((cnt&0xF) == 0) pending_can_live = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
puts("** blink ");
|
||||
puth(can_rx_q.r_ptr); puts(" "); puth(can_rx_q.w_ptr); puts(" ");
|
||||
@@ -484,14 +563,28 @@ int main() {
|
||||
GPIOB->ODR &= ~(1 << 10);
|
||||
delay(1000000);
|
||||
|
||||
if (GPIOC->IDR & (1 << 13)) {
|
||||
#ifdef ENABLE_SPI
|
||||
if (spi_buf_count > 0) {
|
||||
hexdump(spi_buf, spi_buf_count);
|
||||
spi_buf_count = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
// started logic
|
||||
int started_signal = (GPIOC->IDR & (1 << 13)) != 0;
|
||||
if (started_signal) { started_signal_detected = 1; }
|
||||
|
||||
if (started_signal || (!started_signal_detected && can_live)) {
|
||||
started = 1;
|
||||
|
||||
// turn on fan at half speed
|
||||
set_fan_speed(32768);
|
||||
} else {
|
||||
started = 0;
|
||||
|
||||
// turn off fan
|
||||
set_fan_speed(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
23
board/spi.h
Normal file
23
board/spi.h
Normal file
@@ -0,0 +1,23 @@
|
||||
void spi_init() {
|
||||
puts("SPI init\n");
|
||||
SPI1->CR1 = SPI_CR1_SPE;
|
||||
SPI1->CR2 = SPI_CR2_RXNEIE | SPI_CR2_ERRIE | SPI_CR2_TXEIE;
|
||||
}
|
||||
|
||||
void spi_tx_dma(void *addr, int len) {
|
||||
// disable DMA
|
||||
SPI1->CR2 &= ~SPI_CR2_TXDMAEN;
|
||||
DMA2_Stream3->CR &= ~DMA_SxCR_EN;
|
||||
|
||||
// DMA2, stream 3, channel 3
|
||||
DMA2_Stream3->M0AR = addr;
|
||||
DMA2_Stream3->NDTR = len;
|
||||
DMA2_Stream3->PAR = &(SPI1->DR);
|
||||
|
||||
// channel3, increment memory, memory -> periph, enable
|
||||
DMA2_Stream3->CR = DMA_SxCR_CHSEL_1 | DMA_SxCR_CHSEL_0 | DMA_SxCR_MINC | DMA_SxCR_DIR_0 | DMA_SxCR_EN;
|
||||
DMA2_Stream3->CR |= DMA_SxCR_TCIE;
|
||||
|
||||
SPI1->CR2 |= SPI_CR2_TXDMAEN;
|
||||
}
|
||||
|
||||
@@ -4,4 +4,5 @@ capnp.remove_import_hook()
|
||||
|
||||
CEREAL_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||
log = capnp.load(os.path.join(CEREAL_PATH, "log.capnp"))
|
||||
car = capnp.load(os.path.join(CEREAL_PATH, "car.capnp"))
|
||||
|
||||
|
||||
172
cereal/car.capnp
Normal file
172
cereal/car.capnp
Normal file
@@ -0,0 +1,172 @@
|
||||
using Cxx = import "c++.capnp";
|
||||
$Cxx.namespace("cereal");
|
||||
|
||||
@0x8e2af1e708af8b8d;
|
||||
|
||||
# ******* main car state @ 100hz *******
|
||||
# all speeds in m/s
|
||||
|
||||
struct CarState {
|
||||
errors @0: List(Error);
|
||||
|
||||
# car speed
|
||||
vEgo @1 :Float32; # best estimate of speed
|
||||
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
|
||||
|
||||
# steering wheel
|
||||
steeringAngle @7 :Float32; # deg
|
||||
steeringTorque @8 :Float32; # TODO: standardize units
|
||||
steeringPressed @9 :Bool; # if the user is using the steering wheel
|
||||
|
||||
# cruise state
|
||||
cruiseState @10 :CruiseState;
|
||||
|
||||
# button presses
|
||||
buttonEvents @11 :List(ButtonEvent);
|
||||
|
||||
# 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;
|
||||
}
|
||||
|
||||
enum Error {
|
||||
# TODO: copy from error list
|
||||
commIssue @0;
|
||||
steerUnavailable @1;
|
||||
brakeUnavailable @2;
|
||||
gasUnavailable @3;
|
||||
wrongGear @4;
|
||||
doorOpen @5;
|
||||
seatbeltNotLatched @6;
|
||||
espDisabled @7;
|
||||
wrongCarMode @8;
|
||||
steerTemporarilyUnavailable @9;
|
||||
reverseGear @10;
|
||||
# ...
|
||||
}
|
||||
|
||||
# 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ******* radar state @ 20hz *******
|
||||
|
||||
struct RadarState {
|
||||
errors @0: List(Error);
|
||||
points @1: List(RadarPoint);
|
||||
|
||||
# which packets this state came from
|
||||
canMonoTimes @2: List(UInt64);
|
||||
|
||||
enum Error {
|
||||
notValid @0;
|
||||
}
|
||||
|
||||
# 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
|
||||
}
|
||||
}
|
||||
|
||||
# ******* car controls @ 100hz *******
|
||||
|
||||
struct CarControl {
|
||||
# must be true for any actuator commands to work
|
||||
enabled @0: Bool;
|
||||
|
||||
# range from 0.0 - 1.0
|
||||
gas @1: Float32;
|
||||
brake @2: Float32;
|
||||
|
||||
# range from -1.0 - 1.0
|
||||
steeringTorque @3 :Float32;
|
||||
|
||||
cruiseControl @4: CruiseControl;
|
||||
hudControl @5: HUDControl;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
enum AudibleAlert {
|
||||
# these are the choices from the Honda
|
||||
# map as good as you can for your car
|
||||
none @0;
|
||||
beepSingle @1;
|
||||
beepTriple @2;
|
||||
beepRepeated @3;
|
||||
chimeSingle @4;
|
||||
chimeDouble @5;
|
||||
chimeRepeated @6;
|
||||
chimeContinuous @7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
337
cereal/gen/c/car.capnp.c
Normal file
337
cereal/gen/c/car.capnp.c
Normal file
@@ -0,0 +1,337 @@
|
||||
#include "car.capnp.h"
|
||||
/* AUTO GENERATED - DO NOT EDIT */
|
||||
|
||||
cereal_CarState_ptr cereal_new_CarState(struct capn_segment *s) {
|
||||
cereal_CarState_ptr p;
|
||||
p.p = capn_new_struct(s, 24, 5);
|
||||
return p;
|
||||
}
|
||||
cereal_CarState_list cereal_new_CarState_list(struct capn_segment *s, int len) {
|
||||
cereal_CarState_list p;
|
||||
p.p = capn_new_list(s, len, 24, 5);
|
||||
return p;
|
||||
}
|
||||
void cereal_read_CarState(struct cereal_CarState *s, cereal_CarState_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
s->errors.p = capn_getp(p.p, 0, 0);
|
||||
s->vEgo = capn_to_f32(capn_read32(p.p, 0));
|
||||
s->wheelSpeeds.p = capn_getp(p.p, 1, 0);
|
||||
s->gas = capn_to_f32(capn_read32(p.p, 4));
|
||||
s->gasPressed = (capn_read8(p.p, 8) & 1) != 0;
|
||||
s->brake = capn_to_f32(capn_read32(p.p, 12));
|
||||
s->brakePressed = (capn_read8(p.p, 8) & 2) != 0;
|
||||
s->steeringAngle = capn_to_f32(capn_read32(p.p, 16));
|
||||
s->steeringTorque = capn_to_f32(capn_read32(p.p, 20));
|
||||
s->steeringPressed = (capn_read8(p.p, 8) & 4) != 0;
|
||||
s->cruiseState.p = capn_getp(p.p, 2, 0);
|
||||
s->buttonEvents.p = capn_getp(p.p, 3, 0);
|
||||
s->canMonoTimes.p = capn_getp(p.p, 4, 0);
|
||||
}
|
||||
void cereal_write_CarState(const struct cereal_CarState *s, cereal_CarState_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
capn_setp(p.p, 0, s->errors.p);
|
||||
capn_write32(p.p, 0, capn_from_f32(s->vEgo));
|
||||
capn_setp(p.p, 1, s->wheelSpeeds.p);
|
||||
capn_write32(p.p, 4, capn_from_f32(s->gas));
|
||||
capn_write1(p.p, 64, s->gasPressed != 0);
|
||||
capn_write32(p.p, 12, capn_from_f32(s->brake));
|
||||
capn_write1(p.p, 65, s->brakePressed != 0);
|
||||
capn_write32(p.p, 16, capn_from_f32(s->steeringAngle));
|
||||
capn_write32(p.p, 20, capn_from_f32(s->steeringTorque));
|
||||
capn_write1(p.p, 66, s->steeringPressed != 0);
|
||||
capn_setp(p.p, 2, s->cruiseState.p);
|
||||
capn_setp(p.p, 3, s->buttonEvents.p);
|
||||
capn_setp(p.p, 4, s->canMonoTimes.p);
|
||||
}
|
||||
void cereal_get_CarState(struct cereal_CarState *s, cereal_CarState_list l, int i) {
|
||||
cereal_CarState_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_read_CarState(s, p);
|
||||
}
|
||||
void cereal_set_CarState(const struct cereal_CarState *s, cereal_CarState_list l, int i) {
|
||||
cereal_CarState_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_write_CarState(s, p);
|
||||
}
|
||||
|
||||
cereal_CarState_WheelSpeeds_ptr cereal_new_CarState_WheelSpeeds(struct capn_segment *s) {
|
||||
cereal_CarState_WheelSpeeds_ptr p;
|
||||
p.p = capn_new_struct(s, 16, 0);
|
||||
return p;
|
||||
}
|
||||
cereal_CarState_WheelSpeeds_list cereal_new_CarState_WheelSpeeds_list(struct capn_segment *s, int len) {
|
||||
cereal_CarState_WheelSpeeds_list p;
|
||||
p.p = capn_new_list(s, len, 16, 0);
|
||||
return p;
|
||||
}
|
||||
void cereal_read_CarState_WheelSpeeds(struct cereal_CarState_WheelSpeeds *s, cereal_CarState_WheelSpeeds_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
s->fl = capn_to_f32(capn_read32(p.p, 0));
|
||||
s->fr = capn_to_f32(capn_read32(p.p, 4));
|
||||
s->rl = capn_to_f32(capn_read32(p.p, 8));
|
||||
s->rr = capn_to_f32(capn_read32(p.p, 12));
|
||||
}
|
||||
void cereal_write_CarState_WheelSpeeds(const struct cereal_CarState_WheelSpeeds *s, cereal_CarState_WheelSpeeds_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
capn_write32(p.p, 0, capn_from_f32(s->fl));
|
||||
capn_write32(p.p, 4, capn_from_f32(s->fr));
|
||||
capn_write32(p.p, 8, capn_from_f32(s->rl));
|
||||
capn_write32(p.p, 12, capn_from_f32(s->rr));
|
||||
}
|
||||
void cereal_get_CarState_WheelSpeeds(struct cereal_CarState_WheelSpeeds *s, cereal_CarState_WheelSpeeds_list l, int i) {
|
||||
cereal_CarState_WheelSpeeds_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_read_CarState_WheelSpeeds(s, p);
|
||||
}
|
||||
void cereal_set_CarState_WheelSpeeds(const struct cereal_CarState_WheelSpeeds *s, cereal_CarState_WheelSpeeds_list l, int i) {
|
||||
cereal_CarState_WheelSpeeds_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_write_CarState_WheelSpeeds(s, p);
|
||||
}
|
||||
|
||||
cereal_CarState_CruiseState_ptr cereal_new_CarState_CruiseState(struct capn_segment *s) {
|
||||
cereal_CarState_CruiseState_ptr p;
|
||||
p.p = capn_new_struct(s, 8, 0);
|
||||
return p;
|
||||
}
|
||||
cereal_CarState_CruiseState_list cereal_new_CarState_CruiseState_list(struct capn_segment *s, int len) {
|
||||
cereal_CarState_CruiseState_list p;
|
||||
p.p = capn_new_list(s, len, 8, 0);
|
||||
return p;
|
||||
}
|
||||
void cereal_read_CarState_CruiseState(struct cereal_CarState_CruiseState *s, cereal_CarState_CruiseState_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
s->enabled = (capn_read8(p.p, 0) & 1) != 0;
|
||||
s->speed = capn_to_f32(capn_read32(p.p, 4));
|
||||
}
|
||||
void cereal_write_CarState_CruiseState(const struct cereal_CarState_CruiseState *s, cereal_CarState_CruiseState_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
capn_write1(p.p, 0, s->enabled != 0);
|
||||
capn_write32(p.p, 4, capn_from_f32(s->speed));
|
||||
}
|
||||
void cereal_get_CarState_CruiseState(struct cereal_CarState_CruiseState *s, cereal_CarState_CruiseState_list l, int i) {
|
||||
cereal_CarState_CruiseState_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_read_CarState_CruiseState(s, p);
|
||||
}
|
||||
void cereal_set_CarState_CruiseState(const struct cereal_CarState_CruiseState *s, cereal_CarState_CruiseState_list l, int i) {
|
||||
cereal_CarState_CruiseState_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_write_CarState_CruiseState(s, p);
|
||||
}
|
||||
|
||||
cereal_CarState_ButtonEvent_ptr cereal_new_CarState_ButtonEvent(struct capn_segment *s) {
|
||||
cereal_CarState_ButtonEvent_ptr p;
|
||||
p.p = capn_new_struct(s, 8, 0);
|
||||
return p;
|
||||
}
|
||||
cereal_CarState_ButtonEvent_list cereal_new_CarState_ButtonEvent_list(struct capn_segment *s, int len) {
|
||||
cereal_CarState_ButtonEvent_list p;
|
||||
p.p = capn_new_list(s, len, 8, 0);
|
||||
return p;
|
||||
}
|
||||
void cereal_read_CarState_ButtonEvent(struct cereal_CarState_ButtonEvent *s, cereal_CarState_ButtonEvent_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
s->pressed = (capn_read8(p.p, 0) & 1) != 0;
|
||||
s->type = (enum cereal_CarState_ButtonEvent_Type)(int) capn_read16(p.p, 2);
|
||||
}
|
||||
void cereal_write_CarState_ButtonEvent(const struct cereal_CarState_ButtonEvent *s, cereal_CarState_ButtonEvent_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
capn_write1(p.p, 0, s->pressed != 0);
|
||||
capn_write16(p.p, 2, (uint16_t) (s->type));
|
||||
}
|
||||
void cereal_get_CarState_ButtonEvent(struct cereal_CarState_ButtonEvent *s, cereal_CarState_ButtonEvent_list l, int i) {
|
||||
cereal_CarState_ButtonEvent_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_read_CarState_ButtonEvent(s, p);
|
||||
}
|
||||
void cereal_set_CarState_ButtonEvent(const struct cereal_CarState_ButtonEvent *s, cereal_CarState_ButtonEvent_list l, int i) {
|
||||
cereal_CarState_ButtonEvent_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_write_CarState_ButtonEvent(s, p);
|
||||
}
|
||||
|
||||
cereal_RadarState_ptr cereal_new_RadarState(struct capn_segment *s) {
|
||||
cereal_RadarState_ptr p;
|
||||
p.p = capn_new_struct(s, 0, 3);
|
||||
return p;
|
||||
}
|
||||
cereal_RadarState_list cereal_new_RadarState_list(struct capn_segment *s, int len) {
|
||||
cereal_RadarState_list p;
|
||||
p.p = capn_new_list(s, len, 0, 3);
|
||||
return p;
|
||||
}
|
||||
void cereal_read_RadarState(struct cereal_RadarState *s, cereal_RadarState_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
s->errors.p = capn_getp(p.p, 0, 0);
|
||||
s->points.p = capn_getp(p.p, 1, 0);
|
||||
s->canMonoTimes.p = capn_getp(p.p, 2, 0);
|
||||
}
|
||||
void cereal_write_RadarState(const struct cereal_RadarState *s, cereal_RadarState_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
capn_setp(p.p, 0, s->errors.p);
|
||||
capn_setp(p.p, 1, s->points.p);
|
||||
capn_setp(p.p, 2, s->canMonoTimes.p);
|
||||
}
|
||||
void cereal_get_RadarState(struct cereal_RadarState *s, cereal_RadarState_list l, int i) {
|
||||
cereal_RadarState_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_read_RadarState(s, p);
|
||||
}
|
||||
void cereal_set_RadarState(const struct cereal_RadarState *s, cereal_RadarState_list l, int i) {
|
||||
cereal_RadarState_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_write_RadarState(s, p);
|
||||
}
|
||||
|
||||
cereal_RadarState_RadarPoint_ptr cereal_new_RadarState_RadarPoint(struct capn_segment *s) {
|
||||
cereal_RadarState_RadarPoint_ptr p;
|
||||
p.p = capn_new_struct(s, 32, 0);
|
||||
return p;
|
||||
}
|
||||
cereal_RadarState_RadarPoint_list cereal_new_RadarState_RadarPoint_list(struct capn_segment *s, int len) {
|
||||
cereal_RadarState_RadarPoint_list p;
|
||||
p.p = capn_new_list(s, len, 32, 0);
|
||||
return p;
|
||||
}
|
||||
void cereal_read_RadarState_RadarPoint(struct cereal_RadarState_RadarPoint *s, cereal_RadarState_RadarPoint_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
s->trackId = capn_read64(p.p, 0);
|
||||
s->dRel = capn_to_f32(capn_read32(p.p, 8));
|
||||
s->yRel = capn_to_f32(capn_read32(p.p, 12));
|
||||
s->vRel = capn_to_f32(capn_read32(p.p, 16));
|
||||
s->aRel = capn_to_f32(capn_read32(p.p, 20));
|
||||
s->yvRel = capn_to_f32(capn_read32(p.p, 24));
|
||||
}
|
||||
void cereal_write_RadarState_RadarPoint(const struct cereal_RadarState_RadarPoint *s, cereal_RadarState_RadarPoint_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
capn_write64(p.p, 0, s->trackId);
|
||||
capn_write32(p.p, 8, capn_from_f32(s->dRel));
|
||||
capn_write32(p.p, 12, capn_from_f32(s->yRel));
|
||||
capn_write32(p.p, 16, capn_from_f32(s->vRel));
|
||||
capn_write32(p.p, 20, capn_from_f32(s->aRel));
|
||||
capn_write32(p.p, 24, capn_from_f32(s->yvRel));
|
||||
}
|
||||
void cereal_get_RadarState_RadarPoint(struct cereal_RadarState_RadarPoint *s, cereal_RadarState_RadarPoint_list l, int i) {
|
||||
cereal_RadarState_RadarPoint_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_read_RadarState_RadarPoint(s, p);
|
||||
}
|
||||
void cereal_set_RadarState_RadarPoint(const struct cereal_RadarState_RadarPoint *s, cereal_RadarState_RadarPoint_list l, int i) {
|
||||
cereal_RadarState_RadarPoint_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_write_RadarState_RadarPoint(s, p);
|
||||
}
|
||||
|
||||
cereal_CarControl_ptr cereal_new_CarControl(struct capn_segment *s) {
|
||||
cereal_CarControl_ptr p;
|
||||
p.p = capn_new_struct(s, 16, 2);
|
||||
return p;
|
||||
}
|
||||
cereal_CarControl_list cereal_new_CarControl_list(struct capn_segment *s, int len) {
|
||||
cereal_CarControl_list p;
|
||||
p.p = capn_new_list(s, len, 16, 2);
|
||||
return p;
|
||||
}
|
||||
void cereal_read_CarControl(struct cereal_CarControl *s, cereal_CarControl_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
s->enabled = (capn_read8(p.p, 0) & 1) != 0;
|
||||
s->gas = capn_to_f32(capn_read32(p.p, 4));
|
||||
s->brake = capn_to_f32(capn_read32(p.p, 8));
|
||||
s->steeringTorque = capn_to_f32(capn_read32(p.p, 12));
|
||||
s->cruiseControl.p = capn_getp(p.p, 0, 0);
|
||||
s->hudControl.p = capn_getp(p.p, 1, 0);
|
||||
}
|
||||
void cereal_write_CarControl(const struct cereal_CarControl *s, cereal_CarControl_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
capn_write1(p.p, 0, s->enabled != 0);
|
||||
capn_write32(p.p, 4, capn_from_f32(s->gas));
|
||||
capn_write32(p.p, 8, capn_from_f32(s->brake));
|
||||
capn_write32(p.p, 12, capn_from_f32(s->steeringTorque));
|
||||
capn_setp(p.p, 0, s->cruiseControl.p);
|
||||
capn_setp(p.p, 1, s->hudControl.p);
|
||||
}
|
||||
void cereal_get_CarControl(struct cereal_CarControl *s, cereal_CarControl_list l, int i) {
|
||||
cereal_CarControl_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_read_CarControl(s, p);
|
||||
}
|
||||
void cereal_set_CarControl(const struct cereal_CarControl *s, cereal_CarControl_list l, int i) {
|
||||
cereal_CarControl_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_write_CarControl(s, p);
|
||||
}
|
||||
|
||||
cereal_CarControl_CruiseControl_ptr cereal_new_CarControl_CruiseControl(struct capn_segment *s) {
|
||||
cereal_CarControl_CruiseControl_ptr p;
|
||||
p.p = capn_new_struct(s, 16, 0);
|
||||
return p;
|
||||
}
|
||||
cereal_CarControl_CruiseControl_list cereal_new_CarControl_CruiseControl_list(struct capn_segment *s, int len) {
|
||||
cereal_CarControl_CruiseControl_list p;
|
||||
p.p = capn_new_list(s, len, 16, 0);
|
||||
return p;
|
||||
}
|
||||
void cereal_read_CarControl_CruiseControl(struct cereal_CarControl_CruiseControl *s, cereal_CarControl_CruiseControl_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
s->cancel = (capn_read8(p.p, 0) & 1) != 0;
|
||||
s->override = (capn_read8(p.p, 0) & 2) != 0;
|
||||
s->speedOverride = capn_to_f32(capn_read32(p.p, 4));
|
||||
s->accelOverride = capn_to_f32(capn_read32(p.p, 8));
|
||||
}
|
||||
void cereal_write_CarControl_CruiseControl(const struct cereal_CarControl_CruiseControl *s, cereal_CarControl_CruiseControl_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
capn_write1(p.p, 0, s->cancel != 0);
|
||||
capn_write1(p.p, 1, s->override != 0);
|
||||
capn_write32(p.p, 4, capn_from_f32(s->speedOverride));
|
||||
capn_write32(p.p, 8, capn_from_f32(s->accelOverride));
|
||||
}
|
||||
void cereal_get_CarControl_CruiseControl(struct cereal_CarControl_CruiseControl *s, cereal_CarControl_CruiseControl_list l, int i) {
|
||||
cereal_CarControl_CruiseControl_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_read_CarControl_CruiseControl(s, p);
|
||||
}
|
||||
void cereal_set_CarControl_CruiseControl(const struct cereal_CarControl_CruiseControl *s, cereal_CarControl_CruiseControl_list l, int i) {
|
||||
cereal_CarControl_CruiseControl_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_write_CarControl_CruiseControl(s, p);
|
||||
}
|
||||
|
||||
cereal_CarControl_HUDControl_ptr cereal_new_CarControl_HUDControl(struct capn_segment *s) {
|
||||
cereal_CarControl_HUDControl_ptr p;
|
||||
p.p = capn_new_struct(s, 16, 0);
|
||||
return p;
|
||||
}
|
||||
cereal_CarControl_HUDControl_list cereal_new_CarControl_HUDControl_list(struct capn_segment *s, int len) {
|
||||
cereal_CarControl_HUDControl_list p;
|
||||
p.p = capn_new_list(s, len, 16, 0);
|
||||
return p;
|
||||
}
|
||||
void cereal_read_CarControl_HUDControl(struct cereal_CarControl_HUDControl *s, cereal_CarControl_HUDControl_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
s->speedVisible = (capn_read8(p.p, 0) & 1) != 0;
|
||||
s->setSpeed = capn_to_f32(capn_read32(p.p, 4));
|
||||
s->lanesVisible = (capn_read8(p.p, 0) & 2) != 0;
|
||||
s->leadVisible = (capn_read8(p.p, 0) & 4) != 0;
|
||||
s->visualAlert = (enum cereal_CarControl_HUDControl_VisualAlert)(int) capn_read16(p.p, 2);
|
||||
s->audibleAlert = (enum cereal_CarControl_HUDControl_AudibleAlert)(int) capn_read16(p.p, 8);
|
||||
}
|
||||
void cereal_write_CarControl_HUDControl(const struct cereal_CarControl_HUDControl *s, cereal_CarControl_HUDControl_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
capn_write1(p.p, 0, s->speedVisible != 0);
|
||||
capn_write32(p.p, 4, capn_from_f32(s->setSpeed));
|
||||
capn_write1(p.p, 1, s->lanesVisible != 0);
|
||||
capn_write1(p.p, 2, s->leadVisible != 0);
|
||||
capn_write16(p.p, 2, (uint16_t) (s->visualAlert));
|
||||
capn_write16(p.p, 8, (uint16_t) (s->audibleAlert));
|
||||
}
|
||||
void cereal_get_CarControl_HUDControl(struct cereal_CarControl_HUDControl *s, cereal_CarControl_HUDControl_list l, int i) {
|
||||
cereal_CarControl_HUDControl_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_read_CarControl_HUDControl(s, p);
|
||||
}
|
||||
void cereal_set_CarControl_HUDControl(const struct cereal_CarControl_HUDControl *s, cereal_CarControl_HUDControl_list l, int i) {
|
||||
cereal_CarControl_HUDControl_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_write_CarControl_HUDControl(s, p);
|
||||
}
|
||||
287
cereal/gen/c/car.capnp.h
Normal file
287
cereal/gen/c/car.capnp.h
Normal file
@@ -0,0 +1,287 @@
|
||||
#ifndef CAPN_8E2AF1E78AF8B8D
|
||||
#define CAPN_8E2AF1E78AF8B8D
|
||||
/* AUTO GENERATED - DO NOT EDIT */
|
||||
#include <capnp_c.h>
|
||||
|
||||
#if CAPN_VERSION != 1
|
||||
#error "version mismatch between capnp_c.h and generated code"
|
||||
#endif
|
||||
|
||||
#include "c++.capnp.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct cereal_CarState;
|
||||
struct cereal_CarState_WheelSpeeds;
|
||||
struct cereal_CarState_CruiseState;
|
||||
struct cereal_CarState_ButtonEvent;
|
||||
struct cereal_RadarState;
|
||||
struct cereal_RadarState_RadarPoint;
|
||||
struct cereal_CarControl;
|
||||
struct cereal_CarControl_CruiseControl;
|
||||
struct cereal_CarControl_HUDControl;
|
||||
|
||||
typedef struct {capn_ptr p;} cereal_CarState_ptr;
|
||||
typedef struct {capn_ptr p;} cereal_CarState_WheelSpeeds_ptr;
|
||||
typedef struct {capn_ptr p;} cereal_CarState_CruiseState_ptr;
|
||||
typedef struct {capn_ptr p;} cereal_CarState_ButtonEvent_ptr;
|
||||
typedef struct {capn_ptr p;} cereal_RadarState_ptr;
|
||||
typedef struct {capn_ptr p;} cereal_RadarState_RadarPoint_ptr;
|
||||
typedef struct {capn_ptr p;} cereal_CarControl_ptr;
|
||||
typedef struct {capn_ptr p;} cereal_CarControl_CruiseControl_ptr;
|
||||
typedef struct {capn_ptr p;} cereal_CarControl_HUDControl_ptr;
|
||||
|
||||
typedef struct {capn_ptr p;} cereal_CarState_list;
|
||||
typedef struct {capn_ptr p;} cereal_CarState_WheelSpeeds_list;
|
||||
typedef struct {capn_ptr p;} cereal_CarState_CruiseState_list;
|
||||
typedef struct {capn_ptr p;} cereal_CarState_ButtonEvent_list;
|
||||
typedef struct {capn_ptr p;} cereal_RadarState_list;
|
||||
typedef struct {capn_ptr p;} cereal_RadarState_RadarPoint_list;
|
||||
typedef struct {capn_ptr p;} cereal_CarControl_list;
|
||||
typedef struct {capn_ptr p;} cereal_CarControl_CruiseControl_list;
|
||||
typedef struct {capn_ptr p;} cereal_CarControl_HUDControl_list;
|
||||
|
||||
enum cereal_CarState_Error {
|
||||
cereal_CarState_Error_commIssue = 0,
|
||||
cereal_CarState_Error_steerUnavailable = 1,
|
||||
cereal_CarState_Error_brakeUnavailable = 2,
|
||||
cereal_CarState_Error_gasUnavailable = 3,
|
||||
cereal_CarState_Error_wrongGear = 4,
|
||||
cereal_CarState_Error_doorOpen = 5,
|
||||
cereal_CarState_Error_seatbeltNotLatched = 6,
|
||||
cereal_CarState_Error_espDisabled = 7,
|
||||
cereal_CarState_Error_wrongCarMode = 8,
|
||||
cereal_CarState_Error_steerTemporarilyUnavailable = 9,
|
||||
cereal_CarState_Error_reverseGear = 10
|
||||
};
|
||||
|
||||
enum cereal_CarState_ButtonEvent_Type {
|
||||
cereal_CarState_ButtonEvent_Type_unknown = 0,
|
||||
cereal_CarState_ButtonEvent_Type_leftBlinker = 1,
|
||||
cereal_CarState_ButtonEvent_Type_rightBlinker = 2,
|
||||
cereal_CarState_ButtonEvent_Type_accelCruise = 3,
|
||||
cereal_CarState_ButtonEvent_Type_decelCruise = 4,
|
||||
cereal_CarState_ButtonEvent_Type_cancel = 5,
|
||||
cereal_CarState_ButtonEvent_Type_altButton1 = 6,
|
||||
cereal_CarState_ButtonEvent_Type_altButton2 = 7,
|
||||
cereal_CarState_ButtonEvent_Type_altButton3 = 8
|
||||
};
|
||||
|
||||
enum cereal_RadarState_Error {
|
||||
cereal_RadarState_Error_notValid = 0
|
||||
};
|
||||
|
||||
enum cereal_CarControl_HUDControl_VisualAlert {
|
||||
cereal_CarControl_HUDControl_VisualAlert_none = 0,
|
||||
cereal_CarControl_HUDControl_VisualAlert_fcw = 1,
|
||||
cereal_CarControl_HUDControl_VisualAlert_steerRequired = 2,
|
||||
cereal_CarControl_HUDControl_VisualAlert_brakePressed = 3,
|
||||
cereal_CarControl_HUDControl_VisualAlert_wrongGear = 4,
|
||||
cereal_CarControl_HUDControl_VisualAlert_seatbeltUnbuckled = 5,
|
||||
cereal_CarControl_HUDControl_VisualAlert_speedTooHigh = 6
|
||||
};
|
||||
|
||||
enum cereal_CarControl_HUDControl_AudibleAlert {
|
||||
cereal_CarControl_HUDControl_AudibleAlert_none = 0,
|
||||
cereal_CarControl_HUDControl_AudibleAlert_beepSingle = 1,
|
||||
cereal_CarControl_HUDControl_AudibleAlert_beepTriple = 2,
|
||||
cereal_CarControl_HUDControl_AudibleAlert_beepRepeated = 3,
|
||||
cereal_CarControl_HUDControl_AudibleAlert_chimeSingle = 4,
|
||||
cereal_CarControl_HUDControl_AudibleAlert_chimeDouble = 5,
|
||||
cereal_CarControl_HUDControl_AudibleAlert_chimeRepeated = 6,
|
||||
cereal_CarControl_HUDControl_AudibleAlert_chimeContinuous = 7
|
||||
};
|
||||
|
||||
struct cereal_CarState {
|
||||
capn_list16 errors;
|
||||
float vEgo;
|
||||
cereal_CarState_WheelSpeeds_ptr wheelSpeeds;
|
||||
float gas;
|
||||
unsigned gasPressed : 1;
|
||||
float brake;
|
||||
unsigned brakePressed : 1;
|
||||
float steeringAngle;
|
||||
float steeringTorque;
|
||||
unsigned steeringPressed : 1;
|
||||
cereal_CarState_CruiseState_ptr cruiseState;
|
||||
cereal_CarState_ButtonEvent_list buttonEvents;
|
||||
capn_list64 canMonoTimes;
|
||||
};
|
||||
|
||||
static const size_t cereal_CarState_word_count = 3;
|
||||
|
||||
static const size_t cereal_CarState_pointer_count = 5;
|
||||
|
||||
static const size_t cereal_CarState_struct_bytes_count = 64;
|
||||
|
||||
struct cereal_CarState_WheelSpeeds {
|
||||
float fl;
|
||||
float fr;
|
||||
float rl;
|
||||
float rr;
|
||||
};
|
||||
|
||||
static const size_t cereal_CarState_WheelSpeeds_word_count = 2;
|
||||
|
||||
static const size_t cereal_CarState_WheelSpeeds_pointer_count = 0;
|
||||
|
||||
static const size_t cereal_CarState_WheelSpeeds_struct_bytes_count = 16;
|
||||
|
||||
struct cereal_CarState_CruiseState {
|
||||
unsigned enabled : 1;
|
||||
float speed;
|
||||
};
|
||||
|
||||
static const size_t cereal_CarState_CruiseState_word_count = 1;
|
||||
|
||||
static const size_t cereal_CarState_CruiseState_pointer_count = 0;
|
||||
|
||||
static const size_t cereal_CarState_CruiseState_struct_bytes_count = 8;
|
||||
|
||||
struct cereal_CarState_ButtonEvent {
|
||||
unsigned pressed : 1;
|
||||
enum cereal_CarState_ButtonEvent_Type type;
|
||||
};
|
||||
|
||||
static const size_t cereal_CarState_ButtonEvent_word_count = 1;
|
||||
|
||||
static const size_t cereal_CarState_ButtonEvent_pointer_count = 0;
|
||||
|
||||
static const size_t cereal_CarState_ButtonEvent_struct_bytes_count = 8;
|
||||
|
||||
struct cereal_RadarState {
|
||||
capn_list16 errors;
|
||||
cereal_RadarState_RadarPoint_list points;
|
||||
capn_list64 canMonoTimes;
|
||||
};
|
||||
|
||||
static const size_t cereal_RadarState_word_count = 0;
|
||||
|
||||
static const size_t cereal_RadarState_pointer_count = 3;
|
||||
|
||||
static const size_t cereal_RadarState_struct_bytes_count = 24;
|
||||
|
||||
struct cereal_RadarState_RadarPoint {
|
||||
uint64_t trackId;
|
||||
float dRel;
|
||||
float yRel;
|
||||
float vRel;
|
||||
float aRel;
|
||||
float yvRel;
|
||||
};
|
||||
|
||||
static const size_t cereal_RadarState_RadarPoint_word_count = 4;
|
||||
|
||||
static const size_t cereal_RadarState_RadarPoint_pointer_count = 0;
|
||||
|
||||
static const size_t cereal_RadarState_RadarPoint_struct_bytes_count = 32;
|
||||
|
||||
struct cereal_CarControl {
|
||||
unsigned enabled : 1;
|
||||
float gas;
|
||||
float brake;
|
||||
float steeringTorque;
|
||||
cereal_CarControl_CruiseControl_ptr cruiseControl;
|
||||
cereal_CarControl_HUDControl_ptr hudControl;
|
||||
};
|
||||
|
||||
static const size_t cereal_CarControl_word_count = 2;
|
||||
|
||||
static const size_t cereal_CarControl_pointer_count = 2;
|
||||
|
||||
static const size_t cereal_CarControl_struct_bytes_count = 32;
|
||||
|
||||
struct cereal_CarControl_CruiseControl {
|
||||
unsigned cancel : 1;
|
||||
unsigned override : 1;
|
||||
float speedOverride;
|
||||
float accelOverride;
|
||||
};
|
||||
|
||||
static const size_t cereal_CarControl_CruiseControl_word_count = 2;
|
||||
|
||||
static const size_t cereal_CarControl_CruiseControl_pointer_count = 0;
|
||||
|
||||
static const size_t cereal_CarControl_CruiseControl_struct_bytes_count = 16;
|
||||
|
||||
struct cereal_CarControl_HUDControl {
|
||||
unsigned speedVisible : 1;
|
||||
float setSpeed;
|
||||
unsigned lanesVisible : 1;
|
||||
unsigned leadVisible : 1;
|
||||
enum cereal_CarControl_HUDControl_VisualAlert visualAlert;
|
||||
enum cereal_CarControl_HUDControl_AudibleAlert audibleAlert;
|
||||
};
|
||||
|
||||
static const size_t cereal_CarControl_HUDControl_word_count = 2;
|
||||
|
||||
static const size_t cereal_CarControl_HUDControl_pointer_count = 0;
|
||||
|
||||
static const size_t cereal_CarControl_HUDControl_struct_bytes_count = 16;
|
||||
|
||||
cereal_CarState_ptr cereal_new_CarState(struct capn_segment*);
|
||||
cereal_CarState_WheelSpeeds_ptr cereal_new_CarState_WheelSpeeds(struct capn_segment*);
|
||||
cereal_CarState_CruiseState_ptr cereal_new_CarState_CruiseState(struct capn_segment*);
|
||||
cereal_CarState_ButtonEvent_ptr cereal_new_CarState_ButtonEvent(struct capn_segment*);
|
||||
cereal_RadarState_ptr cereal_new_RadarState(struct capn_segment*);
|
||||
cereal_RadarState_RadarPoint_ptr cereal_new_RadarState_RadarPoint(struct capn_segment*);
|
||||
cereal_CarControl_ptr cereal_new_CarControl(struct capn_segment*);
|
||||
cereal_CarControl_CruiseControl_ptr cereal_new_CarControl_CruiseControl(struct capn_segment*);
|
||||
cereal_CarControl_HUDControl_ptr cereal_new_CarControl_HUDControl(struct capn_segment*);
|
||||
|
||||
cereal_CarState_list cereal_new_CarState_list(struct capn_segment*, int len);
|
||||
cereal_CarState_WheelSpeeds_list cereal_new_CarState_WheelSpeeds_list(struct capn_segment*, int len);
|
||||
cereal_CarState_CruiseState_list cereal_new_CarState_CruiseState_list(struct capn_segment*, int len);
|
||||
cereal_CarState_ButtonEvent_list cereal_new_CarState_ButtonEvent_list(struct capn_segment*, int len);
|
||||
cereal_RadarState_list cereal_new_RadarState_list(struct capn_segment*, int len);
|
||||
cereal_RadarState_RadarPoint_list cereal_new_RadarState_RadarPoint_list(struct capn_segment*, int len);
|
||||
cereal_CarControl_list cereal_new_CarControl_list(struct capn_segment*, int len);
|
||||
cereal_CarControl_CruiseControl_list cereal_new_CarControl_CruiseControl_list(struct capn_segment*, int len);
|
||||
cereal_CarControl_HUDControl_list cereal_new_CarControl_HUDControl_list(struct capn_segment*, int len);
|
||||
|
||||
void cereal_read_CarState(struct cereal_CarState*, cereal_CarState_ptr);
|
||||
void cereal_read_CarState_WheelSpeeds(struct cereal_CarState_WheelSpeeds*, cereal_CarState_WheelSpeeds_ptr);
|
||||
void cereal_read_CarState_CruiseState(struct cereal_CarState_CruiseState*, cereal_CarState_CruiseState_ptr);
|
||||
void cereal_read_CarState_ButtonEvent(struct cereal_CarState_ButtonEvent*, cereal_CarState_ButtonEvent_ptr);
|
||||
void cereal_read_RadarState(struct cereal_RadarState*, cereal_RadarState_ptr);
|
||||
void cereal_read_RadarState_RadarPoint(struct cereal_RadarState_RadarPoint*, cereal_RadarState_RadarPoint_ptr);
|
||||
void cereal_read_CarControl(struct cereal_CarControl*, cereal_CarControl_ptr);
|
||||
void cereal_read_CarControl_CruiseControl(struct cereal_CarControl_CruiseControl*, cereal_CarControl_CruiseControl_ptr);
|
||||
void cereal_read_CarControl_HUDControl(struct cereal_CarControl_HUDControl*, cereal_CarControl_HUDControl_ptr);
|
||||
|
||||
void cereal_write_CarState(const struct cereal_CarState*, cereal_CarState_ptr);
|
||||
void cereal_write_CarState_WheelSpeeds(const struct cereal_CarState_WheelSpeeds*, cereal_CarState_WheelSpeeds_ptr);
|
||||
void cereal_write_CarState_CruiseState(const struct cereal_CarState_CruiseState*, cereal_CarState_CruiseState_ptr);
|
||||
void cereal_write_CarState_ButtonEvent(const struct cereal_CarState_ButtonEvent*, cereal_CarState_ButtonEvent_ptr);
|
||||
void cereal_write_RadarState(const struct cereal_RadarState*, cereal_RadarState_ptr);
|
||||
void cereal_write_RadarState_RadarPoint(const struct cereal_RadarState_RadarPoint*, cereal_RadarState_RadarPoint_ptr);
|
||||
void cereal_write_CarControl(const struct cereal_CarControl*, cereal_CarControl_ptr);
|
||||
void cereal_write_CarControl_CruiseControl(const struct cereal_CarControl_CruiseControl*, cereal_CarControl_CruiseControl_ptr);
|
||||
void cereal_write_CarControl_HUDControl(const struct cereal_CarControl_HUDControl*, cereal_CarControl_HUDControl_ptr);
|
||||
|
||||
void cereal_get_CarState(struct cereal_CarState*, cereal_CarState_list, int i);
|
||||
void cereal_get_CarState_WheelSpeeds(struct cereal_CarState_WheelSpeeds*, cereal_CarState_WheelSpeeds_list, int i);
|
||||
void cereal_get_CarState_CruiseState(struct cereal_CarState_CruiseState*, cereal_CarState_CruiseState_list, int i);
|
||||
void cereal_get_CarState_ButtonEvent(struct cereal_CarState_ButtonEvent*, cereal_CarState_ButtonEvent_list, int i);
|
||||
void cereal_get_RadarState(struct cereal_RadarState*, cereal_RadarState_list, int i);
|
||||
void cereal_get_RadarState_RadarPoint(struct cereal_RadarState_RadarPoint*, cereal_RadarState_RadarPoint_list, int i);
|
||||
void cereal_get_CarControl(struct cereal_CarControl*, cereal_CarControl_list, int i);
|
||||
void cereal_get_CarControl_CruiseControl(struct cereal_CarControl_CruiseControl*, cereal_CarControl_CruiseControl_list, int i);
|
||||
void cereal_get_CarControl_HUDControl(struct cereal_CarControl_HUDControl*, cereal_CarControl_HUDControl_list, int i);
|
||||
|
||||
void cereal_set_CarState(const struct cereal_CarState*, cereal_CarState_list, int i);
|
||||
void cereal_set_CarState_WheelSpeeds(const struct cereal_CarState_WheelSpeeds*, cereal_CarState_WheelSpeeds_list, int i);
|
||||
void cereal_set_CarState_CruiseState(const struct cereal_CarState_CruiseState*, cereal_CarState_CruiseState_list, int i);
|
||||
void cereal_set_CarState_ButtonEvent(const struct cereal_CarState_ButtonEvent*, cereal_CarState_ButtonEvent_list, int i);
|
||||
void cereal_set_RadarState(const struct cereal_RadarState*, cereal_RadarState_list, int i);
|
||||
void cereal_set_RadarState_RadarPoint(const struct cereal_RadarState_RadarPoint*, cereal_RadarState_RadarPoint_list, int i);
|
||||
void cereal_set_CarControl(const struct cereal_CarControl*, cereal_CarControl_list, int i);
|
||||
void cereal_set_CarControl_CruiseControl(const struct cereal_CarControl_CruiseControl*, cereal_CarControl_CruiseControl_list, int i);
|
||||
void cereal_set_CarControl_HUDControl(const struct cereal_CarControl_HUDControl*, cereal_CarControl_HUDControl_list, int i);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -137,6 +137,7 @@ void cereal_read_SensorEventData(struct cereal_SensorEventData *s, cereal_Sensor
|
||||
default:
|
||||
break;
|
||||
}
|
||||
s->source = (enum cereal_SensorEventData_SensorSource)(int) capn_read16(p.p, 14);
|
||||
}
|
||||
void cereal_write_SensorEventData(const struct cereal_SensorEventData *s, cereal_SensorEventData_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
@@ -155,6 +156,7 @@ void cereal_write_SensorEventData(const struct cereal_SensorEventData *s, cereal
|
||||
default:
|
||||
break;
|
||||
}
|
||||
capn_write16(p.p, 14, (uint16_t) (s->source));
|
||||
}
|
||||
void cereal_get_SensorEventData(struct cereal_SensorEventData *s, cereal_SensorEventData_list l, int i) {
|
||||
cereal_SensorEventData_ptr p;
|
||||
@@ -198,6 +200,49 @@ void cereal_set_SensorEventData_SensorVec(const struct cereal_SensorEventData_Se
|
||||
cereal_write_SensorEventData_SensorVec(s, p);
|
||||
}
|
||||
|
||||
cereal_GpsLocationData_ptr cereal_new_GpsLocationData(struct capn_segment *s) {
|
||||
cereal_GpsLocationData_ptr p;
|
||||
p.p = capn_new_struct(s, 48, 0);
|
||||
return p;
|
||||
}
|
||||
cereal_GpsLocationData_list cereal_new_GpsLocationData_list(struct capn_segment *s, int len) {
|
||||
cereal_GpsLocationData_list p;
|
||||
p.p = capn_new_list(s, len, 48, 0);
|
||||
return p;
|
||||
}
|
||||
void cereal_read_GpsLocationData(struct cereal_GpsLocationData *s, cereal_GpsLocationData_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
s->flags = capn_read16(p.p, 0);
|
||||
s->latitude = capn_to_f64(capn_read64(p.p, 8));
|
||||
s->longitude = capn_to_f64(capn_read64(p.p, 16));
|
||||
s->altitude = capn_to_f64(capn_read64(p.p, 24));
|
||||
s->speed = capn_to_f32(capn_read32(p.p, 4));
|
||||
s->bearing = capn_to_f32(capn_read32(p.p, 32));
|
||||
s->accuracy = capn_to_f32(capn_read32(p.p, 36));
|
||||
s->timestamp = (int64_t) ((int64_t)(capn_read64(p.p, 40)));
|
||||
}
|
||||
void cereal_write_GpsLocationData(const struct cereal_GpsLocationData *s, cereal_GpsLocationData_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
capn_write16(p.p, 0, s->flags);
|
||||
capn_write64(p.p, 8, capn_from_f64(s->latitude));
|
||||
capn_write64(p.p, 16, capn_from_f64(s->longitude));
|
||||
capn_write64(p.p, 24, capn_from_f64(s->altitude));
|
||||
capn_write32(p.p, 4, capn_from_f32(s->speed));
|
||||
capn_write32(p.p, 32, capn_from_f32(s->bearing));
|
||||
capn_write32(p.p, 36, capn_from_f32(s->accuracy));
|
||||
capn_write64(p.p, 40, (uint64_t) (s->timestamp));
|
||||
}
|
||||
void cereal_get_GpsLocationData(struct cereal_GpsLocationData *s, cereal_GpsLocationData_list l, int i) {
|
||||
cereal_GpsLocationData_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_read_GpsLocationData(s, p);
|
||||
}
|
||||
void cereal_set_GpsLocationData(const struct cereal_GpsLocationData *s, cereal_GpsLocationData_list l, int i) {
|
||||
cereal_GpsLocationData_ptr p;
|
||||
p.p = capn_getp(l.p, i, 0);
|
||||
cereal_write_GpsLocationData(s, p);
|
||||
}
|
||||
|
||||
cereal_CanData_ptr cereal_new_CanData(struct capn_segment *s) {
|
||||
cereal_CanData_ptr p;
|
||||
p.p = capn_new_struct(s, 8, 1);
|
||||
@@ -235,12 +280,12 @@ void cereal_set_CanData(const struct cereal_CanData *s, cereal_CanData_list l, i
|
||||
|
||||
cereal_ThermalData_ptr cereal_new_ThermalData(struct capn_segment *s) {
|
||||
cereal_ThermalData_ptr p;
|
||||
p.p = capn_new_struct(s, 16, 0);
|
||||
p.p = capn_new_struct(s, 24, 1);
|
||||
return p;
|
||||
}
|
||||
cereal_ThermalData_list cereal_new_ThermalData_list(struct capn_segment *s, int len) {
|
||||
cereal_ThermalData_list p;
|
||||
p.p = capn_new_list(s, len, 16, 0);
|
||||
p.p = capn_new_list(s, len, 24, 1);
|
||||
return p;
|
||||
}
|
||||
void cereal_read_ThermalData(struct cereal_ThermalData *s, cereal_ThermalData_ptr p) {
|
||||
@@ -252,6 +297,9 @@ void cereal_read_ThermalData(struct cereal_ThermalData *s, cereal_ThermalData_pt
|
||||
s->mem = capn_read16(p.p, 8);
|
||||
s->gpu = capn_read16(p.p, 10);
|
||||
s->bat = capn_read32(p.p, 12);
|
||||
s->freeSpace = capn_to_f32(capn_read32(p.p, 16));
|
||||
s->batteryPercent = (int16_t) ((int16_t)capn_read16(p.p, 20));
|
||||
s->batteryStatus = capn_get_text(p.p, 0, capn_val0);
|
||||
}
|
||||
void cereal_write_ThermalData(const struct cereal_ThermalData *s, cereal_ThermalData_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
@@ -262,6 +310,9 @@ void cereal_write_ThermalData(const struct cereal_ThermalData *s, cereal_Thermal
|
||||
capn_write16(p.p, 8, s->mem);
|
||||
capn_write16(p.p, 10, s->gpu);
|
||||
capn_write32(p.p, 12, s->bat);
|
||||
capn_write32(p.p, 16, capn_from_f32(s->freeSpace));
|
||||
capn_write16(p.p, 20, (uint16_t) (s->batteryPercent));
|
||||
capn_set_text(p.p, 0, s->batteryStatus);
|
||||
}
|
||||
void cereal_get_ThermalData(struct cereal_ThermalData *s, cereal_ThermalData_list l, int i) {
|
||||
cereal_ThermalData_ptr p;
|
||||
@@ -291,6 +342,7 @@ void cereal_read_HealthData(struct cereal_HealthData *s, cereal_HealthData_ptr p
|
||||
s->started = (capn_read8(p.p, 8) & 1) != 0;
|
||||
s->controlsAllowed = (capn_read8(p.p, 8) & 2) != 0;
|
||||
s->gasInterceptorDetected = (capn_read8(p.p, 8) & 4) != 0;
|
||||
s->startedSignalDetected = (capn_read8(p.p, 8) & 8) != 0;
|
||||
}
|
||||
void cereal_write_HealthData(const struct cereal_HealthData *s, cereal_HealthData_ptr p) {
|
||||
capn_resolve(&p.p);
|
||||
@@ -299,6 +351,7 @@ void cereal_write_HealthData(const struct cereal_HealthData *s, cereal_HealthDat
|
||||
capn_write1(p.p, 64, s->started != 0);
|
||||
capn_write1(p.p, 65, s->controlsAllowed != 0);
|
||||
capn_write1(p.p, 66, s->gasInterceptorDetected != 0);
|
||||
capn_write1(p.p, 67, s->startedSignalDetected != 0);
|
||||
}
|
||||
void cereal_get_HealthData(struct cereal_HealthData *s, cereal_HealthData_list l, int i) {
|
||||
cereal_HealthData_ptr p;
|
||||
@@ -361,11 +414,11 @@ void cereal_read_Live20Data(struct cereal_Live20Data *s, cereal_Live20Data_ptr p
|
||||
s->canMonoTimes.p = capn_getp(p.p, 3, 0);
|
||||
s->mdMonoTime = capn_read64(p.p, 16);
|
||||
s->ftMonoTime = capn_read64(p.p, 24);
|
||||
s->warpMatrix.p = capn_getp(p.p, 0, 0);
|
||||
s->angleOffset = capn_to_f32(capn_read32(p.p, 0));
|
||||
s->calStatus = (int8_t) ((int8_t)capn_read8(p.p, 4));
|
||||
s->calCycle = (int32_t) ((int32_t)capn_read32(p.p, 12));
|
||||
s->calPerc = (int8_t) ((int8_t)capn_read8(p.p, 5));
|
||||
s->warpMatrixDEPRECATED.p = capn_getp(p.p, 0, 0);
|
||||
s->angleOffsetDEPRECATED = capn_to_f32(capn_read32(p.p, 0));
|
||||
s->calStatusDEPRECATED = (int8_t) ((int8_t)capn_read8(p.p, 4));
|
||||
s->calCycleDEPRECATED = (int32_t) ((int32_t)capn_read32(p.p, 12));
|
||||
s->calPercDEPRECATED = (int8_t) ((int8_t)capn_read8(p.p, 5));
|
||||
s->leadOne.p = capn_getp(p.p, 1, 0);
|
||||
s->leadTwo.p = capn_getp(p.p, 2, 0);
|
||||
s->cumLagMs = capn_to_f32(capn_read32(p.p, 8));
|
||||
@@ -375,11 +428,11 @@ void cereal_write_Live20Data(const struct cereal_Live20Data *s, cereal_Live20Dat
|
||||
capn_setp(p.p, 3, s->canMonoTimes.p);
|
||||
capn_write64(p.p, 16, s->mdMonoTime);
|
||||
capn_write64(p.p, 24, s->ftMonoTime);
|
||||
capn_setp(p.p, 0, s->warpMatrix.p);
|
||||
capn_write32(p.p, 0, capn_from_f32(s->angleOffset));
|
||||
capn_write8(p.p, 4, (uint8_t) (s->calStatus));
|
||||
capn_write32(p.p, 12, (uint32_t) (s->calCycle));
|
||||
capn_write8(p.p, 5, (uint8_t) (s->calPerc));
|
||||
capn_setp(p.p, 0, s->warpMatrixDEPRECATED.p);
|
||||
capn_write32(p.p, 0, capn_from_f32(s->angleOffsetDEPRECATED));
|
||||
capn_write8(p.p, 4, (uint8_t) (s->calStatusDEPRECATED));
|
||||
capn_write32(p.p, 12, (uint32_t) (s->calCycleDEPRECATED));
|
||||
capn_write8(p.p, 5, (uint8_t) (s->calPercDEPRECATED));
|
||||
capn_setp(p.p, 1, s->leadOne.p);
|
||||
capn_setp(p.p, 2, s->leadTwo.p);
|
||||
capn_write32(p.p, 8, capn_from_f32(s->cumLagMs));
|
||||
@@ -545,7 +598,7 @@ void cereal_read_Live100Data(struct cereal_Live100Data *s, cereal_Live100Data_pt
|
||||
s->l20MonoTime = capn_read64(p.p, 72);
|
||||
s->mdMonoTime = capn_read64(p.p, 80);
|
||||
s->vEgo = capn_to_f32(capn_read32(p.p, 0));
|
||||
s->aEgo = capn_to_f32(capn_read32(p.p, 4));
|
||||
s->aEgoDEPRECATED = capn_to_f32(capn_read32(p.p, 4));
|
||||
s->vPid = capn_to_f32(capn_read32(p.p, 8));
|
||||
s->vTargetLead = capn_to_f32(capn_read32(p.p, 12));
|
||||
s->upAccelCmd = capn_to_f32(capn_read32(p.p, 16));
|
||||
@@ -558,7 +611,7 @@ void cereal_read_Live100Data(struct cereal_Live100Data *s, cereal_Live100Data_pt
|
||||
s->aTargetMax = capn_to_f32(capn_read32(p.p, 44));
|
||||
s->jerkFactor = capn_to_f32(capn_read32(p.p, 48));
|
||||
s->angleSteers = capn_to_f32(capn_read32(p.p, 52));
|
||||
s->hudLead = (int32_t) ((int32_t)capn_read32(p.p, 56));
|
||||
s->hudLeadDEPRECATED = (int32_t) ((int32_t)capn_read32(p.p, 56));
|
||||
s->cumLagMs = capn_to_f32(capn_read32(p.p, 60));
|
||||
s->enabled = (capn_read8(p.p, 88) & 1) != 0;
|
||||
s->steerOverride = (capn_read8(p.p, 88) & 2) != 0;
|
||||
@@ -575,7 +628,7 @@ void cereal_write_Live100Data(const struct cereal_Live100Data *s, cereal_Live100
|
||||
capn_write64(p.p, 72, s->l20MonoTime);
|
||||
capn_write64(p.p, 80, s->mdMonoTime);
|
||||
capn_write32(p.p, 0, capn_from_f32(s->vEgo));
|
||||
capn_write32(p.p, 4, capn_from_f32(s->aEgo));
|
||||
capn_write32(p.p, 4, capn_from_f32(s->aEgoDEPRECATED));
|
||||
capn_write32(p.p, 8, capn_from_f32(s->vPid));
|
||||
capn_write32(p.p, 12, capn_from_f32(s->vTargetLead));
|
||||
capn_write32(p.p, 16, capn_from_f32(s->upAccelCmd));
|
||||
@@ -588,7 +641,7 @@ void cereal_write_Live100Data(const struct cereal_Live100Data *s, cereal_Live100
|
||||
capn_write32(p.p, 44, capn_from_f32(s->aTargetMax));
|
||||
capn_write32(p.p, 48, capn_from_f32(s->jerkFactor));
|
||||
capn_write32(p.p, 52, capn_from_f32(s->angleSteers));
|
||||
capn_write32(p.p, 56, (uint32_t) (s->hudLead));
|
||||
capn_write32(p.p, 56, (uint32_t) (s->hudLeadDEPRECATED));
|
||||
capn_write32(p.p, 60, capn_from_f32(s->cumLagMs));
|
||||
capn_write1(p.p, 704, s->enabled != 0);
|
||||
capn_write1(p.p, 705, s->steerOverride != 0);
|
||||
@@ -965,7 +1018,10 @@ void cereal_read_Event(struct cereal_Event *s, cereal_Event_ptr p) {
|
||||
case cereal_Event_sendcan:
|
||||
case cereal_Event_liveCalibration:
|
||||
case cereal_Event_androidLogEntry:
|
||||
s->androidLogEntry.p = capn_getp(p.p, 0, 0);
|
||||
case cereal_Event_gpsLocation:
|
||||
case cereal_Event_carState:
|
||||
case cereal_Event_carControl:
|
||||
s->carControl.p = capn_getp(p.p, 0, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -998,7 +1054,10 @@ void cereal_write_Event(const struct cereal_Event *s, cereal_Event_ptr p) {
|
||||
case cereal_Event_sendcan:
|
||||
case cereal_Event_liveCalibration:
|
||||
case cereal_Event_androidLogEntry:
|
||||
capn_setp(p.p, 0, s->androidLogEntry.p);
|
||||
case cereal_Event_gpsLocation:
|
||||
case cereal_Event_carState:
|
||||
case cereal_Event_carControl:
|
||||
capn_setp(p.p, 0, s->carControl.p);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#endif
|
||||
|
||||
#include "c++.capnp.h"
|
||||
#include "car.capnp.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -18,6 +19,7 @@ struct cereal_FrameData;
|
||||
struct cereal_GPSNMEAData;
|
||||
struct cereal_SensorEventData;
|
||||
struct cereal_SensorEventData_SensorVec;
|
||||
struct cereal_GpsLocationData;
|
||||
struct cereal_CanData;
|
||||
struct cereal_ThermalData;
|
||||
struct cereal_HealthData;
|
||||
@@ -43,6 +45,7 @@ typedef struct {capn_ptr p;} cereal_FrameData_ptr;
|
||||
typedef struct {capn_ptr p;} cereal_GPSNMEAData_ptr;
|
||||
typedef struct {capn_ptr p;} cereal_SensorEventData_ptr;
|
||||
typedef struct {capn_ptr p;} cereal_SensorEventData_SensorVec_ptr;
|
||||
typedef struct {capn_ptr p;} cereal_GpsLocationData_ptr;
|
||||
typedef struct {capn_ptr p;} cereal_CanData_ptr;
|
||||
typedef struct {capn_ptr p;} cereal_ThermalData_ptr;
|
||||
typedef struct {capn_ptr p;} cereal_HealthData_ptr;
|
||||
@@ -68,6 +71,7 @@ typedef struct {capn_ptr p;} cereal_FrameData_list;
|
||||
typedef struct {capn_ptr p;} cereal_GPSNMEAData_list;
|
||||
typedef struct {capn_ptr p;} cereal_SensorEventData_list;
|
||||
typedef struct {capn_ptr p;} cereal_SensorEventData_SensorVec_list;
|
||||
typedef struct {capn_ptr p;} cereal_GpsLocationData_list;
|
||||
typedef struct {capn_ptr p;} cereal_CanData_list;
|
||||
typedef struct {capn_ptr p;} cereal_ThermalData_list;
|
||||
typedef struct {capn_ptr p;} cereal_HealthData_list;
|
||||
@@ -88,6 +92,13 @@ typedef struct {capn_ptr p;} cereal_AndroidLogEntry_list;
|
||||
typedef struct {capn_ptr p;} cereal_LogRotate_list;
|
||||
typedef struct {capn_ptr p;} cereal_Event_list;
|
||||
|
||||
enum cereal_SensorEventData_SensorSource {
|
||||
cereal_SensorEventData_SensorSource_android = 0,
|
||||
cereal_SensorEventData_SensorSource_iOS = 1,
|
||||
cereal_SensorEventData_SensorSource_fiber = 2,
|
||||
cereal_SensorEventData_SensorSource_velodyne = 3
|
||||
};
|
||||
|
||||
enum cereal_EncodeIndex_Type {
|
||||
cereal_EncodeIndex_Type_bigBoxLossless = 0,
|
||||
cereal_EncodeIndex_Type_fullHEVC = 1,
|
||||
@@ -153,6 +164,7 @@ struct cereal_SensorEventData {
|
||||
cereal_SensorEventData_SensorVec_ptr orientation;
|
||||
cereal_SensorEventData_SensorVec_ptr gyro;
|
||||
};
|
||||
enum cereal_SensorEventData_SensorSource source;
|
||||
};
|
||||
|
||||
static const size_t cereal_SensorEventData_word_count = 3;
|
||||
@@ -172,6 +184,23 @@ static const size_t cereal_SensorEventData_SensorVec_pointer_count = 1;
|
||||
|
||||
static const size_t cereal_SensorEventData_SensorVec_struct_bytes_count = 16;
|
||||
|
||||
struct cereal_GpsLocationData {
|
||||
uint16_t flags;
|
||||
double latitude;
|
||||
double longitude;
|
||||
double altitude;
|
||||
float speed;
|
||||
float bearing;
|
||||
float accuracy;
|
||||
int64_t timestamp;
|
||||
};
|
||||
|
||||
static const size_t cereal_GpsLocationData_word_count = 6;
|
||||
|
||||
static const size_t cereal_GpsLocationData_pointer_count = 0;
|
||||
|
||||
static const size_t cereal_GpsLocationData_struct_bytes_count = 48;
|
||||
|
||||
struct cereal_CanData {
|
||||
uint32_t address;
|
||||
uint16_t busTime;
|
||||
@@ -193,13 +222,16 @@ struct cereal_ThermalData {
|
||||
uint16_t mem;
|
||||
uint16_t gpu;
|
||||
uint32_t bat;
|
||||
float freeSpace;
|
||||
int16_t batteryPercent;
|
||||
capn_text batteryStatus;
|
||||
};
|
||||
|
||||
static const size_t cereal_ThermalData_word_count = 2;
|
||||
static const size_t cereal_ThermalData_word_count = 3;
|
||||
|
||||
static const size_t cereal_ThermalData_pointer_count = 0;
|
||||
static const size_t cereal_ThermalData_pointer_count = 1;
|
||||
|
||||
static const size_t cereal_ThermalData_struct_bytes_count = 16;
|
||||
static const size_t cereal_ThermalData_struct_bytes_count = 32;
|
||||
|
||||
struct cereal_HealthData {
|
||||
uint32_t voltage;
|
||||
@@ -207,6 +239,7 @@ struct cereal_HealthData {
|
||||
unsigned started : 1;
|
||||
unsigned controlsAllowed : 1;
|
||||
unsigned gasInterceptorDetected : 1;
|
||||
unsigned startedSignalDetected : 1;
|
||||
};
|
||||
|
||||
static const size_t cereal_HealthData_word_count = 2;
|
||||
@@ -232,11 +265,11 @@ struct cereal_Live20Data {
|
||||
capn_list64 canMonoTimes;
|
||||
uint64_t mdMonoTime;
|
||||
uint64_t ftMonoTime;
|
||||
capn_list32 warpMatrix;
|
||||
float angleOffset;
|
||||
int8_t calStatus;
|
||||
int32_t calCycle;
|
||||
int8_t calPerc;
|
||||
capn_list32 warpMatrixDEPRECATED;
|
||||
float angleOffsetDEPRECATED;
|
||||
int8_t calStatusDEPRECATED;
|
||||
int32_t calCycleDEPRECATED;
|
||||
int8_t calPercDEPRECATED;
|
||||
cereal_Live20Data_LeadData_ptr leadOne;
|
||||
cereal_Live20Data_LeadData_ptr leadTwo;
|
||||
float cumLagMs;
|
||||
@@ -307,7 +340,7 @@ struct cereal_Live100Data {
|
||||
uint64_t l20MonoTime;
|
||||
uint64_t mdMonoTime;
|
||||
float vEgo;
|
||||
float aEgo;
|
||||
float aEgoDEPRECATED;
|
||||
float vPid;
|
||||
float vTargetLead;
|
||||
float upAccelCmd;
|
||||
@@ -320,7 +353,7 @@ struct cereal_Live100Data {
|
||||
float aTargetMax;
|
||||
float jerkFactor;
|
||||
float angleSteers;
|
||||
int32_t hudLead;
|
||||
int32_t hudLeadDEPRECATED;
|
||||
float cumLagMs;
|
||||
unsigned enabled : 1;
|
||||
unsigned steerOverride : 1;
|
||||
@@ -475,7 +508,10 @@ enum cereal_Event_which {
|
||||
cereal_Event_sendcan = 16,
|
||||
cereal_Event_logMessage = 17,
|
||||
cereal_Event_liveCalibration = 18,
|
||||
cereal_Event_androidLogEntry = 19
|
||||
cereal_Event_androidLogEntry = 19,
|
||||
cereal_Event_gpsLocation = 20,
|
||||
cereal_Event_carState = 21,
|
||||
cereal_Event_carControl = 22
|
||||
};
|
||||
|
||||
struct cereal_Event {
|
||||
@@ -502,6 +538,9 @@ struct cereal_Event {
|
||||
capn_text logMessage;
|
||||
cereal_LiveCalibrationData_ptr liveCalibration;
|
||||
cereal_AndroidLogEntry_ptr androidLogEntry;
|
||||
cereal_GpsLocationData_ptr gpsLocation;
|
||||
cereal_CarState_ptr carState;
|
||||
cereal_CarControl_ptr carControl;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -516,6 +555,7 @@ cereal_FrameData_ptr cereal_new_FrameData(struct capn_segment*);
|
||||
cereal_GPSNMEAData_ptr cereal_new_GPSNMEAData(struct capn_segment*);
|
||||
cereal_SensorEventData_ptr cereal_new_SensorEventData(struct capn_segment*);
|
||||
cereal_SensorEventData_SensorVec_ptr cereal_new_SensorEventData_SensorVec(struct capn_segment*);
|
||||
cereal_GpsLocationData_ptr cereal_new_GpsLocationData(struct capn_segment*);
|
||||
cereal_CanData_ptr cereal_new_CanData(struct capn_segment*);
|
||||
cereal_ThermalData_ptr cereal_new_ThermalData(struct capn_segment*);
|
||||
cereal_HealthData_ptr cereal_new_HealthData(struct capn_segment*);
|
||||
@@ -541,6 +581,7 @@ cereal_FrameData_list cereal_new_FrameData_list(struct capn_segment*, int len);
|
||||
cereal_GPSNMEAData_list cereal_new_GPSNMEAData_list(struct capn_segment*, int len);
|
||||
cereal_SensorEventData_list cereal_new_SensorEventData_list(struct capn_segment*, int len);
|
||||
cereal_SensorEventData_SensorVec_list cereal_new_SensorEventData_SensorVec_list(struct capn_segment*, int len);
|
||||
cereal_GpsLocationData_list cereal_new_GpsLocationData_list(struct capn_segment*, int len);
|
||||
cereal_CanData_list cereal_new_CanData_list(struct capn_segment*, int len);
|
||||
cereal_ThermalData_list cereal_new_ThermalData_list(struct capn_segment*, int len);
|
||||
cereal_HealthData_list cereal_new_HealthData_list(struct capn_segment*, int len);
|
||||
@@ -566,6 +607,7 @@ void cereal_read_FrameData(struct cereal_FrameData*, cereal_FrameData_ptr);
|
||||
void cereal_read_GPSNMEAData(struct cereal_GPSNMEAData*, cereal_GPSNMEAData_ptr);
|
||||
void cereal_read_SensorEventData(struct cereal_SensorEventData*, cereal_SensorEventData_ptr);
|
||||
void cereal_read_SensorEventData_SensorVec(struct cereal_SensorEventData_SensorVec*, cereal_SensorEventData_SensorVec_ptr);
|
||||
void cereal_read_GpsLocationData(struct cereal_GpsLocationData*, cereal_GpsLocationData_ptr);
|
||||
void cereal_read_CanData(struct cereal_CanData*, cereal_CanData_ptr);
|
||||
void cereal_read_ThermalData(struct cereal_ThermalData*, cereal_ThermalData_ptr);
|
||||
void cereal_read_HealthData(struct cereal_HealthData*, cereal_HealthData_ptr);
|
||||
@@ -591,6 +633,7 @@ void cereal_write_FrameData(const struct cereal_FrameData*, cereal_FrameData_ptr
|
||||
void cereal_write_GPSNMEAData(const struct cereal_GPSNMEAData*, cereal_GPSNMEAData_ptr);
|
||||
void cereal_write_SensorEventData(const struct cereal_SensorEventData*, cereal_SensorEventData_ptr);
|
||||
void cereal_write_SensorEventData_SensorVec(const struct cereal_SensorEventData_SensorVec*, cereal_SensorEventData_SensorVec_ptr);
|
||||
void cereal_write_GpsLocationData(const struct cereal_GpsLocationData*, cereal_GpsLocationData_ptr);
|
||||
void cereal_write_CanData(const struct cereal_CanData*, cereal_CanData_ptr);
|
||||
void cereal_write_ThermalData(const struct cereal_ThermalData*, cereal_ThermalData_ptr);
|
||||
void cereal_write_HealthData(const struct cereal_HealthData*, cereal_HealthData_ptr);
|
||||
@@ -616,6 +659,7 @@ void cereal_get_FrameData(struct cereal_FrameData*, cereal_FrameData_list, int i
|
||||
void cereal_get_GPSNMEAData(struct cereal_GPSNMEAData*, cereal_GPSNMEAData_list, int i);
|
||||
void cereal_get_SensorEventData(struct cereal_SensorEventData*, cereal_SensorEventData_list, int i);
|
||||
void cereal_get_SensorEventData_SensorVec(struct cereal_SensorEventData_SensorVec*, cereal_SensorEventData_SensorVec_list, int i);
|
||||
void cereal_get_GpsLocationData(struct cereal_GpsLocationData*, cereal_GpsLocationData_list, int i);
|
||||
void cereal_get_CanData(struct cereal_CanData*, cereal_CanData_list, int i);
|
||||
void cereal_get_ThermalData(struct cereal_ThermalData*, cereal_ThermalData_list, int i);
|
||||
void cereal_get_HealthData(struct cereal_HealthData*, cereal_HealthData_list, int i);
|
||||
@@ -641,6 +685,7 @@ void cereal_set_FrameData(const struct cereal_FrameData*, cereal_FrameData_list,
|
||||
void cereal_set_GPSNMEAData(const struct cereal_GPSNMEAData*, cereal_GPSNMEAData_list, int i);
|
||||
void cereal_set_SensorEventData(const struct cereal_SensorEventData*, cereal_SensorEventData_list, int i);
|
||||
void cereal_set_SensorEventData_SensorVec(const struct cereal_SensorEventData_SensorVec*, cereal_SensorEventData_SensorVec_list, int i);
|
||||
void cereal_set_GpsLocationData(const struct cereal_GpsLocationData*, cereal_GpsLocationData_list, int i);
|
||||
void cereal_set_CanData(const struct cereal_CanData*, cereal_CanData_list, int i);
|
||||
void cereal_set_ThermalData(const struct cereal_ThermalData*, cereal_ThermalData_list, int i);
|
||||
void cereal_set_HealthData(const struct cereal_HealthData*, cereal_HealthData_list, int i);
|
||||
|
||||
1504
cereal/gen/cpp/car.capnp.c++
Normal file
1504
cereal/gen/cpp/car.capnp.c++
Normal file
File diff suppressed because it is too large
Load Diff
2032
cereal/gen/cpp/car.capnp.h
Normal file
2032
cereal/gen/cpp/car.capnp.h
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,7 @@
|
||||
#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library."
|
||||
#endif
|
||||
|
||||
#include "car.capnp.h"
|
||||
|
||||
namespace capnp {
|
||||
namespace schemas {
|
||||
@@ -20,6 +21,15 @@ CAPNP_DECLARE_SCHEMA(ea0245f695ae0a33);
|
||||
CAPNP_DECLARE_SCHEMA(9d291d7813ba4a88);
|
||||
CAPNP_DECLARE_SCHEMA(a2b29a69d44529a1);
|
||||
CAPNP_DECLARE_SCHEMA(a43429bd2bfc24fc);
|
||||
CAPNP_DECLARE_SCHEMA(e49b3ce8f7f48d0d);
|
||||
enum class SensorSource_e49b3ce8f7f48d0d: uint16_t {
|
||||
ANDROID,
|
||||
I_O_S,
|
||||
FIBER,
|
||||
VELODYNE,
|
||||
};
|
||||
CAPNP_DECLARE_ENUM(SensorSource, e49b3ce8f7f48d0d);
|
||||
CAPNP_DECLARE_SCHEMA(e946524859add50e);
|
||||
CAPNP_DECLARE_SCHEMA(8785009a964c7c59);
|
||||
CAPNP_DECLARE_SCHEMA(8d8231a40b7fe6e0);
|
||||
CAPNP_DECLARE_SCHEMA(cfa2b0c2c82af1e4);
|
||||
@@ -111,6 +121,8 @@ struct SensorEventData {
|
||||
GYRO,
|
||||
};
|
||||
struct SensorVec;
|
||||
typedef ::capnp::schemas::SensorSource_e49b3ce8f7f48d0d SensorSource;
|
||||
|
||||
|
||||
struct _capnpPrivate {
|
||||
CAPNP_DECLARE_STRUCT_HEADER(a2b29a69d44529a1, 3, 1)
|
||||
@@ -135,6 +147,21 @@ struct SensorEventData::SensorVec {
|
||||
};
|
||||
};
|
||||
|
||||
struct GpsLocationData {
|
||||
GpsLocationData() = delete;
|
||||
|
||||
class Reader;
|
||||
class Builder;
|
||||
class Pipeline;
|
||||
|
||||
struct _capnpPrivate {
|
||||
CAPNP_DECLARE_STRUCT_HEADER(e946524859add50e, 6, 0)
|
||||
#if !CAPNP_LITE
|
||||
static constexpr ::capnp::_::RawBrandedSchema const* brand = &schema->defaultBrand;
|
||||
#endif // !CAPNP_LITE
|
||||
};
|
||||
};
|
||||
|
||||
struct CanData {
|
||||
CanData() = delete;
|
||||
|
||||
@@ -158,7 +185,7 @@ struct ThermalData {
|
||||
class Pipeline;
|
||||
|
||||
struct _capnpPrivate {
|
||||
CAPNP_DECLARE_STRUCT_HEADER(8d8231a40b7fe6e0, 2, 0)
|
||||
CAPNP_DECLARE_STRUCT_HEADER(8d8231a40b7fe6e0, 3, 1)
|
||||
#if !CAPNP_LITE
|
||||
static constexpr ::capnp::_::RawBrandedSchema const* brand = &schema->defaultBrand;
|
||||
#endif // !CAPNP_LITE
|
||||
@@ -438,6 +465,9 @@ struct Event {
|
||||
LOG_MESSAGE,
|
||||
LIVE_CALIBRATION,
|
||||
ANDROID_LOG_ENTRY,
|
||||
GPS_LOCATION,
|
||||
CAR_STATE,
|
||||
CAR_CONTROL,
|
||||
};
|
||||
|
||||
struct _capnpPrivate {
|
||||
@@ -796,6 +826,8 @@ public:
|
||||
inline bool hasGyro() const;
|
||||
inline ::cereal::SensorEventData::SensorVec::Reader getGyro() const;
|
||||
|
||||
inline ::cereal::SensorEventData::SensorSource getSource() const;
|
||||
|
||||
private:
|
||||
::capnp::_::StructReader _reader;
|
||||
template <typename, ::capnp::Kind>
|
||||
@@ -869,6 +901,9 @@ public:
|
||||
inline void adoptGyro(::capnp::Orphan< ::cereal::SensorEventData::SensorVec>&& value);
|
||||
inline ::capnp::Orphan< ::cereal::SensorEventData::SensorVec> disownGyro();
|
||||
|
||||
inline ::cereal::SensorEventData::SensorSource getSource();
|
||||
inline void setSource( ::cereal::SensorEventData::SensorSource value);
|
||||
|
||||
private:
|
||||
::capnp::_::StructBuilder _builder;
|
||||
template <typename, ::capnp::Kind>
|
||||
@@ -982,6 +1017,117 @@ private:
|
||||
};
|
||||
#endif // !CAPNP_LITE
|
||||
|
||||
class GpsLocationData::Reader {
|
||||
public:
|
||||
typedef GpsLocationData Reads;
|
||||
|
||||
Reader() = default;
|
||||
inline explicit Reader(::capnp::_::StructReader base): _reader(base) {}
|
||||
|
||||
inline ::capnp::MessageSize totalSize() const {
|
||||
return _reader.totalSize().asPublic();
|
||||
}
|
||||
|
||||
#if !CAPNP_LITE
|
||||
inline ::kj::StringTree toString() const {
|
||||
return ::capnp::_::structString(_reader, *_capnpPrivate::brand);
|
||||
}
|
||||
#endif // !CAPNP_LITE
|
||||
|
||||
inline ::uint16_t getFlags() const;
|
||||
|
||||
inline double getLatitude() const;
|
||||
|
||||
inline double getLongitude() const;
|
||||
|
||||
inline double getAltitude() const;
|
||||
|
||||
inline float getSpeed() const;
|
||||
|
||||
inline float getBearing() const;
|
||||
|
||||
inline float getAccuracy() const;
|
||||
|
||||
inline ::int64_t getTimestamp() const;
|
||||
|
||||
private:
|
||||
::capnp::_::StructReader _reader;
|
||||
template <typename, ::capnp::Kind>
|
||||
friend struct ::capnp::ToDynamic_;
|
||||
template <typename, ::capnp::Kind>
|
||||
friend struct ::capnp::_::PointerHelpers;
|
||||
template <typename, ::capnp::Kind>
|
||||
friend struct ::capnp::List;
|
||||
friend class ::capnp::MessageBuilder;
|
||||
friend class ::capnp::Orphanage;
|
||||
};
|
||||
|
||||
class GpsLocationData::Builder {
|
||||
public:
|
||||
typedef GpsLocationData Builds;
|
||||
|
||||
Builder() = delete; // Deleted to discourage incorrect usage.
|
||||
// You can explicitly initialize to nullptr instead.
|
||||
inline Builder(decltype(nullptr)) {}
|
||||
inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {}
|
||||
inline operator Reader() const { return Reader(_builder.asReader()); }
|
||||
inline Reader asReader() const { return *this; }
|
||||
|
||||
inline ::capnp::MessageSize totalSize() const { return asReader().totalSize(); }
|
||||
#if !CAPNP_LITE
|
||||
inline ::kj::StringTree toString() const { return asReader().toString(); }
|
||||
#endif // !CAPNP_LITE
|
||||
|
||||
inline ::uint16_t getFlags();
|
||||
inline void setFlags( ::uint16_t value);
|
||||
|
||||
inline double getLatitude();
|
||||
inline void setLatitude(double value);
|
||||
|
||||
inline double getLongitude();
|
||||
inline void setLongitude(double value);
|
||||
|
||||
inline double getAltitude();
|
||||
inline void setAltitude(double value);
|
||||
|
||||
inline float getSpeed();
|
||||
inline void setSpeed(float value);
|
||||
|
||||
inline float getBearing();
|
||||
inline void setBearing(float value);
|
||||
|
||||
inline float getAccuracy();
|
||||
inline void setAccuracy(float value);
|
||||
|
||||
inline ::int64_t getTimestamp();
|
||||
inline void setTimestamp( ::int64_t value);
|
||||
|
||||
private:
|
||||
::capnp::_::StructBuilder _builder;
|
||||
template <typename, ::capnp::Kind>
|
||||
friend struct ::capnp::ToDynamic_;
|
||||
friend class ::capnp::Orphanage;
|
||||
template <typename, ::capnp::Kind>
|
||||
friend struct ::capnp::_::PointerHelpers;
|
||||
};
|
||||
|
||||
#if !CAPNP_LITE
|
||||
class GpsLocationData::Pipeline {
|
||||
public:
|
||||
typedef GpsLocationData Pipelines;
|
||||
|
||||
inline Pipeline(decltype(nullptr)): _typeless(nullptr) {}
|
||||
inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless)
|
||||
: _typeless(kj::mv(typeless)) {}
|
||||
|
||||
private:
|
||||
::capnp::AnyPointer::Pipeline _typeless;
|
||||
friend class ::capnp::PipelineHook;
|
||||
template <typename, ::capnp::Kind>
|
||||
friend struct ::capnp::ToDynamic_;
|
||||
};
|
||||
#endif // !CAPNP_LITE
|
||||
|
||||
class CanData::Reader {
|
||||
public:
|
||||
typedef CanData Reads;
|
||||
@@ -1109,6 +1255,13 @@ public:
|
||||
|
||||
inline ::uint32_t getBat() const;
|
||||
|
||||
inline float getFreeSpace() const;
|
||||
|
||||
inline ::int16_t getBatteryPercent() const;
|
||||
|
||||
inline bool hasBatteryStatus() const;
|
||||
inline ::capnp::Text::Reader getBatteryStatus() const;
|
||||
|
||||
private:
|
||||
::capnp::_::StructReader _reader;
|
||||
template <typename, ::capnp::Kind>
|
||||
@@ -1158,6 +1311,19 @@ public:
|
||||
inline ::uint32_t getBat();
|
||||
inline void setBat( ::uint32_t value);
|
||||
|
||||
inline float getFreeSpace();
|
||||
inline void setFreeSpace(float value);
|
||||
|
||||
inline ::int16_t getBatteryPercent();
|
||||
inline void setBatteryPercent( ::int16_t value);
|
||||
|
||||
inline bool hasBatteryStatus();
|
||||
inline ::capnp::Text::Builder getBatteryStatus();
|
||||
inline void setBatteryStatus( ::capnp::Text::Reader value);
|
||||
inline ::capnp::Text::Builder initBatteryStatus(unsigned int size);
|
||||
inline void adoptBatteryStatus(::capnp::Orphan< ::capnp::Text>&& value);
|
||||
inline ::capnp::Orphan< ::capnp::Text> disownBatteryStatus();
|
||||
|
||||
private:
|
||||
::capnp::_::StructBuilder _builder;
|
||||
template <typename, ::capnp::Kind>
|
||||
@@ -1211,6 +1377,8 @@ public:
|
||||
|
||||
inline bool getGasInterceptorDetected() const;
|
||||
|
||||
inline bool getStartedSignalDetected() const;
|
||||
|
||||
private:
|
||||
::capnp::_::StructReader _reader;
|
||||
template <typename, ::capnp::Kind>
|
||||
@@ -1254,6 +1422,9 @@ public:
|
||||
inline bool getGasInterceptorDetected();
|
||||
inline void setGasInterceptorDetected(bool value);
|
||||
|
||||
inline bool getStartedSignalDetected();
|
||||
inline void setStartedSignalDetected(bool value);
|
||||
|
||||
private:
|
||||
::capnp::_::StructBuilder _builder;
|
||||
template <typename, ::capnp::Kind>
|
||||
@@ -1398,12 +1569,12 @@ public:
|
||||
}
|
||||
#endif // !CAPNP_LITE
|
||||
|
||||
inline bool hasWarpMatrix() const;
|
||||
inline ::capnp::List<float>::Reader getWarpMatrix() const;
|
||||
inline bool hasWarpMatrixDEPRECATED() const;
|
||||
inline ::capnp::List<float>::Reader getWarpMatrixDEPRECATED() const;
|
||||
|
||||
inline float getAngleOffset() const;
|
||||
inline float getAngleOffsetDEPRECATED() const;
|
||||
|
||||
inline ::int8_t getCalStatus() const;
|
||||
inline ::int8_t getCalStatusDEPRECATED() const;
|
||||
|
||||
inline bool hasLeadOne() const;
|
||||
inline ::cereal::Live20Data::LeadData::Reader getLeadOne() const;
|
||||
@@ -1417,9 +1588,9 @@ public:
|
||||
|
||||
inline ::uint64_t getFtMonoTime() const;
|
||||
|
||||
inline ::int32_t getCalCycle() const;
|
||||
inline ::int32_t getCalCycleDEPRECATED() const;
|
||||
|
||||
inline ::int8_t getCalPerc() const;
|
||||
inline ::int8_t getCalPercDEPRECATED() const;
|
||||
|
||||
inline bool hasCanMonoTimes() const;
|
||||
inline ::capnp::List< ::uint64_t>::Reader getCanMonoTimes() const;
|
||||
@@ -1452,19 +1623,19 @@ public:
|
||||
inline ::kj::StringTree toString() const { return asReader().toString(); }
|
||||
#endif // !CAPNP_LITE
|
||||
|
||||
inline bool hasWarpMatrix();
|
||||
inline ::capnp::List<float>::Builder getWarpMatrix();
|
||||
inline void setWarpMatrix( ::capnp::List<float>::Reader value);
|
||||
inline void setWarpMatrix(::kj::ArrayPtr<const float> value);
|
||||
inline ::capnp::List<float>::Builder initWarpMatrix(unsigned int size);
|
||||
inline void adoptWarpMatrix(::capnp::Orphan< ::capnp::List<float>>&& value);
|
||||
inline ::capnp::Orphan< ::capnp::List<float>> disownWarpMatrix();
|
||||
inline bool hasWarpMatrixDEPRECATED();
|
||||
inline ::capnp::List<float>::Builder getWarpMatrixDEPRECATED();
|
||||
inline void setWarpMatrixDEPRECATED( ::capnp::List<float>::Reader value);
|
||||
inline void setWarpMatrixDEPRECATED(::kj::ArrayPtr<const float> value);
|
||||
inline ::capnp::List<float>::Builder initWarpMatrixDEPRECATED(unsigned int size);
|
||||
inline void adoptWarpMatrixDEPRECATED(::capnp::Orphan< ::capnp::List<float>>&& value);
|
||||
inline ::capnp::Orphan< ::capnp::List<float>> disownWarpMatrixDEPRECATED();
|
||||
|
||||
inline float getAngleOffset();
|
||||
inline void setAngleOffset(float value);
|
||||
inline float getAngleOffsetDEPRECATED();
|
||||
inline void setAngleOffsetDEPRECATED(float value);
|
||||
|
||||
inline ::int8_t getCalStatus();
|
||||
inline void setCalStatus( ::int8_t value);
|
||||
inline ::int8_t getCalStatusDEPRECATED();
|
||||
inline void setCalStatusDEPRECATED( ::int8_t value);
|
||||
|
||||
inline bool hasLeadOne();
|
||||
inline ::cereal::Live20Data::LeadData::Builder getLeadOne();
|
||||
@@ -1489,11 +1660,11 @@ public:
|
||||
inline ::uint64_t getFtMonoTime();
|
||||
inline void setFtMonoTime( ::uint64_t value);
|
||||
|
||||
inline ::int32_t getCalCycle();
|
||||
inline void setCalCycle( ::int32_t value);
|
||||
inline ::int32_t getCalCycleDEPRECATED();
|
||||
inline void setCalCycleDEPRECATED( ::int32_t value);
|
||||
|
||||
inline ::int8_t getCalPerc();
|
||||
inline void setCalPerc( ::int8_t value);
|
||||
inline ::int8_t getCalPercDEPRECATED();
|
||||
inline void setCalPercDEPRECATED( ::int8_t value);
|
||||
|
||||
inline bool hasCanMonoTimes();
|
||||
inline ::capnp::List< ::uint64_t>::Builder getCanMonoTimes();
|
||||
@@ -1899,7 +2070,7 @@ public:
|
||||
|
||||
inline float getVEgo() const;
|
||||
|
||||
inline float getAEgo() const;
|
||||
inline float getAEgoDEPRECATED() const;
|
||||
|
||||
inline float getVPid() const;
|
||||
|
||||
@@ -1925,7 +2096,7 @@ public:
|
||||
|
||||
inline float getAngleSteers() const;
|
||||
|
||||
inline ::int32_t getHudLead() const;
|
||||
inline ::int32_t getHudLeadDEPRECATED() const;
|
||||
|
||||
inline float getCumLagMs() const;
|
||||
|
||||
@@ -1985,8 +2156,8 @@ public:
|
||||
inline float getVEgo();
|
||||
inline void setVEgo(float value);
|
||||
|
||||
inline float getAEgo();
|
||||
inline void setAEgo(float value);
|
||||
inline float getAEgoDEPRECATED();
|
||||
inline void setAEgoDEPRECATED(float value);
|
||||
|
||||
inline float getVPid();
|
||||
inline void setVPid(float value);
|
||||
@@ -2024,8 +2195,8 @@ public:
|
||||
inline float getAngleSteers();
|
||||
inline void setAngleSteers(float value);
|
||||
|
||||
inline ::int32_t getHudLead();
|
||||
inline void setHudLead( ::int32_t value);
|
||||
inline ::int32_t getHudLeadDEPRECATED();
|
||||
inline void setHudLeadDEPRECATED( ::int32_t value);
|
||||
|
||||
inline float getCumLagMs();
|
||||
inline void setCumLagMs(float value);
|
||||
@@ -3117,6 +3288,18 @@ public:
|
||||
inline bool hasAndroidLogEntry() const;
|
||||
inline ::cereal::AndroidLogEntry::Reader getAndroidLogEntry() const;
|
||||
|
||||
inline bool isGpsLocation() const;
|
||||
inline bool hasGpsLocation() const;
|
||||
inline ::cereal::GpsLocationData::Reader getGpsLocation() const;
|
||||
|
||||
inline bool isCarState() const;
|
||||
inline bool hasCarState() const;
|
||||
inline ::cereal::CarState::Reader getCarState() const;
|
||||
|
||||
inline bool isCarControl() const;
|
||||
inline bool hasCarControl() const;
|
||||
inline ::cereal::CarControl::Reader getCarControl() const;
|
||||
|
||||
private:
|
||||
::capnp::_::StructReader _reader;
|
||||
template <typename, ::capnp::Kind>
|
||||
@@ -3309,6 +3492,30 @@ public:
|
||||
inline void adoptAndroidLogEntry(::capnp::Orphan< ::cereal::AndroidLogEntry>&& value);
|
||||
inline ::capnp::Orphan< ::cereal::AndroidLogEntry> disownAndroidLogEntry();
|
||||
|
||||
inline bool isGpsLocation();
|
||||
inline bool hasGpsLocation();
|
||||
inline ::cereal::GpsLocationData::Builder getGpsLocation();
|
||||
inline void setGpsLocation( ::cereal::GpsLocationData::Reader value);
|
||||
inline ::cereal::GpsLocationData::Builder initGpsLocation();
|
||||
inline void adoptGpsLocation(::capnp::Orphan< ::cereal::GpsLocationData>&& value);
|
||||
inline ::capnp::Orphan< ::cereal::GpsLocationData> disownGpsLocation();
|
||||
|
||||
inline bool isCarState();
|
||||
inline bool hasCarState();
|
||||
inline ::cereal::CarState::Builder getCarState();
|
||||
inline void setCarState( ::cereal::CarState::Reader value);
|
||||
inline ::cereal::CarState::Builder initCarState();
|
||||
inline void adoptCarState(::capnp::Orphan< ::cereal::CarState>&& value);
|
||||
inline ::capnp::Orphan< ::cereal::CarState> disownCarState();
|
||||
|
||||
inline bool isCarControl();
|
||||
inline bool hasCarControl();
|
||||
inline ::cereal::CarControl::Builder getCarControl();
|
||||
inline void setCarControl( ::cereal::CarControl::Reader value);
|
||||
inline ::cereal::CarControl::Builder initCarControl();
|
||||
inline void adoptCarControl(::capnp::Orphan< ::cereal::CarControl>&& value);
|
||||
inline ::capnp::Orphan< ::cereal::CarControl> disownCarControl();
|
||||
|
||||
private:
|
||||
::capnp::_::StructBuilder _builder;
|
||||
template <typename, ::capnp::Kind>
|
||||
@@ -3884,6 +4091,20 @@ inline ::capnp::Orphan< ::cereal::SensorEventData::SensorVec> SensorEventData::B
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
|
||||
inline ::cereal::SensorEventData::SensorSource SensorEventData::Reader::getSource() const {
|
||||
return _reader.getDataField< ::cereal::SensorEventData::SensorSource>(
|
||||
7 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline ::cereal::SensorEventData::SensorSource SensorEventData::Builder::getSource() {
|
||||
return _builder.getDataField< ::cereal::SensorEventData::SensorSource>(
|
||||
7 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void SensorEventData::Builder::setSource( ::cereal::SensorEventData::SensorSource value) {
|
||||
_builder.setDataField< ::cereal::SensorEventData::SensorSource>(
|
||||
7 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline bool SensorEventData::SensorVec::Reader::hasV() const {
|
||||
return !_reader.getPointerField(0 * ::capnp::POINTERS).isNull();
|
||||
}
|
||||
@@ -3934,6 +4155,118 @@ inline void SensorEventData::SensorVec::Builder::setStatus( ::int8_t value) {
|
||||
0 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline ::uint16_t GpsLocationData::Reader::getFlags() const {
|
||||
return _reader.getDataField< ::uint16_t>(
|
||||
0 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline ::uint16_t GpsLocationData::Builder::getFlags() {
|
||||
return _builder.getDataField< ::uint16_t>(
|
||||
0 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void GpsLocationData::Builder::setFlags( ::uint16_t value) {
|
||||
_builder.setDataField< ::uint16_t>(
|
||||
0 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline double GpsLocationData::Reader::getLatitude() const {
|
||||
return _reader.getDataField<double>(
|
||||
1 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline double GpsLocationData::Builder::getLatitude() {
|
||||
return _builder.getDataField<double>(
|
||||
1 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void GpsLocationData::Builder::setLatitude(double value) {
|
||||
_builder.setDataField<double>(
|
||||
1 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline double GpsLocationData::Reader::getLongitude() const {
|
||||
return _reader.getDataField<double>(
|
||||
2 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline double GpsLocationData::Builder::getLongitude() {
|
||||
return _builder.getDataField<double>(
|
||||
2 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void GpsLocationData::Builder::setLongitude(double value) {
|
||||
_builder.setDataField<double>(
|
||||
2 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline double GpsLocationData::Reader::getAltitude() const {
|
||||
return _reader.getDataField<double>(
|
||||
3 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline double GpsLocationData::Builder::getAltitude() {
|
||||
return _builder.getDataField<double>(
|
||||
3 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void GpsLocationData::Builder::setAltitude(double value) {
|
||||
_builder.setDataField<double>(
|
||||
3 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline float GpsLocationData::Reader::getSpeed() const {
|
||||
return _reader.getDataField<float>(
|
||||
1 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline float GpsLocationData::Builder::getSpeed() {
|
||||
return _builder.getDataField<float>(
|
||||
1 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void GpsLocationData::Builder::setSpeed(float value) {
|
||||
_builder.setDataField<float>(
|
||||
1 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline float GpsLocationData::Reader::getBearing() const {
|
||||
return _reader.getDataField<float>(
|
||||
8 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline float GpsLocationData::Builder::getBearing() {
|
||||
return _builder.getDataField<float>(
|
||||
8 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void GpsLocationData::Builder::setBearing(float value) {
|
||||
_builder.setDataField<float>(
|
||||
8 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline float GpsLocationData::Reader::getAccuracy() const {
|
||||
return _reader.getDataField<float>(
|
||||
9 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline float GpsLocationData::Builder::getAccuracy() {
|
||||
return _builder.getDataField<float>(
|
||||
9 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void GpsLocationData::Builder::setAccuracy(float value) {
|
||||
_builder.setDataField<float>(
|
||||
9 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline ::int64_t GpsLocationData::Reader::getTimestamp() const {
|
||||
return _reader.getDataField< ::int64_t>(
|
||||
5 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline ::int64_t GpsLocationData::Builder::getTimestamp() {
|
||||
return _builder.getDataField< ::int64_t>(
|
||||
5 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void GpsLocationData::Builder::setTimestamp( ::int64_t value) {
|
||||
_builder.setDataField< ::int64_t>(
|
||||
5 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline ::uint32_t CanData::Reader::getAddress() const {
|
||||
return _reader.getDataField< ::uint32_t>(
|
||||
0 * ::capnp::ELEMENTS);
|
||||
@@ -4106,6 +4439,66 @@ inline void ThermalData::Builder::setBat( ::uint32_t value) {
|
||||
3 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline float ThermalData::Reader::getFreeSpace() const {
|
||||
return _reader.getDataField<float>(
|
||||
4 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline float ThermalData::Builder::getFreeSpace() {
|
||||
return _builder.getDataField<float>(
|
||||
4 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void ThermalData::Builder::setFreeSpace(float value) {
|
||||
_builder.setDataField<float>(
|
||||
4 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline ::int16_t ThermalData::Reader::getBatteryPercent() const {
|
||||
return _reader.getDataField< ::int16_t>(
|
||||
10 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline ::int16_t ThermalData::Builder::getBatteryPercent() {
|
||||
return _builder.getDataField< ::int16_t>(
|
||||
10 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void ThermalData::Builder::setBatteryPercent( ::int16_t value) {
|
||||
_builder.setDataField< ::int16_t>(
|
||||
10 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline bool ThermalData::Reader::hasBatteryStatus() const {
|
||||
return !_reader.getPointerField(0 * ::capnp::POINTERS).isNull();
|
||||
}
|
||||
inline bool ThermalData::Builder::hasBatteryStatus() {
|
||||
return !_builder.getPointerField(0 * ::capnp::POINTERS).isNull();
|
||||
}
|
||||
inline ::capnp::Text::Reader ThermalData::Reader::getBatteryStatus() const {
|
||||
return ::capnp::_::PointerHelpers< ::capnp::Text>::get(
|
||||
_reader.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
inline ::capnp::Text::Builder ThermalData::Builder::getBatteryStatus() {
|
||||
return ::capnp::_::PointerHelpers< ::capnp::Text>::get(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
inline void ThermalData::Builder::setBatteryStatus( ::capnp::Text::Reader value) {
|
||||
::capnp::_::PointerHelpers< ::capnp::Text>::set(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS), value);
|
||||
}
|
||||
inline ::capnp::Text::Builder ThermalData::Builder::initBatteryStatus(unsigned int size) {
|
||||
return ::capnp::_::PointerHelpers< ::capnp::Text>::init(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS), size);
|
||||
}
|
||||
inline void ThermalData::Builder::adoptBatteryStatus(
|
||||
::capnp::Orphan< ::capnp::Text>&& value) {
|
||||
::capnp::_::PointerHelpers< ::capnp::Text>::adopt(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS), kj::mv(value));
|
||||
}
|
||||
inline ::capnp::Orphan< ::capnp::Text> ThermalData::Builder::disownBatteryStatus() {
|
||||
return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
|
||||
inline ::uint32_t HealthData::Reader::getVoltage() const {
|
||||
return _reader.getDataField< ::uint32_t>(
|
||||
0 * ::capnp::ELEMENTS);
|
||||
@@ -4176,6 +4569,20 @@ inline void HealthData::Builder::setGasInterceptorDetected(bool value) {
|
||||
66 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline bool HealthData::Reader::getStartedSignalDetected() const {
|
||||
return _reader.getDataField<bool>(
|
||||
67 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline bool HealthData::Builder::getStartedSignalDetected() {
|
||||
return _builder.getDataField<bool>(
|
||||
67 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void HealthData::Builder::setStartedSignalDetected(bool value) {
|
||||
_builder.setDataField<bool>(
|
||||
67 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline bool LiveUI::Reader::getRearViewCam() const {
|
||||
return _reader.getDataField<bool>(
|
||||
0 * ::capnp::ELEMENTS);
|
||||
@@ -4268,66 +4675,66 @@ inline void LiveUI::Builder::setAwarenessStatus(float value) {
|
||||
1 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline bool Live20Data::Reader::hasWarpMatrix() const {
|
||||
inline bool Live20Data::Reader::hasWarpMatrixDEPRECATED() const {
|
||||
return !_reader.getPointerField(0 * ::capnp::POINTERS).isNull();
|
||||
}
|
||||
inline bool Live20Data::Builder::hasWarpMatrix() {
|
||||
inline bool Live20Data::Builder::hasWarpMatrixDEPRECATED() {
|
||||
return !_builder.getPointerField(0 * ::capnp::POINTERS).isNull();
|
||||
}
|
||||
inline ::capnp::List<float>::Reader Live20Data::Reader::getWarpMatrix() const {
|
||||
inline ::capnp::List<float>::Reader Live20Data::Reader::getWarpMatrixDEPRECATED() const {
|
||||
return ::capnp::_::PointerHelpers< ::capnp::List<float>>::get(
|
||||
_reader.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
inline ::capnp::List<float>::Builder Live20Data::Builder::getWarpMatrix() {
|
||||
inline ::capnp::List<float>::Builder Live20Data::Builder::getWarpMatrixDEPRECATED() {
|
||||
return ::capnp::_::PointerHelpers< ::capnp::List<float>>::get(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
inline void Live20Data::Builder::setWarpMatrix( ::capnp::List<float>::Reader value) {
|
||||
inline void Live20Data::Builder::setWarpMatrixDEPRECATED( ::capnp::List<float>::Reader value) {
|
||||
::capnp::_::PointerHelpers< ::capnp::List<float>>::set(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS), value);
|
||||
}
|
||||
inline void Live20Data::Builder::setWarpMatrix(::kj::ArrayPtr<const float> value) {
|
||||
inline void Live20Data::Builder::setWarpMatrixDEPRECATED(::kj::ArrayPtr<const float> value) {
|
||||
::capnp::_::PointerHelpers< ::capnp::List<float>>::set(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS), value);
|
||||
}
|
||||
inline ::capnp::List<float>::Builder Live20Data::Builder::initWarpMatrix(unsigned int size) {
|
||||
inline ::capnp::List<float>::Builder Live20Data::Builder::initWarpMatrixDEPRECATED(unsigned int size) {
|
||||
return ::capnp::_::PointerHelpers< ::capnp::List<float>>::init(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS), size);
|
||||
}
|
||||
inline void Live20Data::Builder::adoptWarpMatrix(
|
||||
inline void Live20Data::Builder::adoptWarpMatrixDEPRECATED(
|
||||
::capnp::Orphan< ::capnp::List<float>>&& value) {
|
||||
::capnp::_::PointerHelpers< ::capnp::List<float>>::adopt(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS), kj::mv(value));
|
||||
}
|
||||
inline ::capnp::Orphan< ::capnp::List<float>> Live20Data::Builder::disownWarpMatrix() {
|
||||
inline ::capnp::Orphan< ::capnp::List<float>> Live20Data::Builder::disownWarpMatrixDEPRECATED() {
|
||||
return ::capnp::_::PointerHelpers< ::capnp::List<float>>::disown(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
|
||||
inline float Live20Data::Reader::getAngleOffset() const {
|
||||
inline float Live20Data::Reader::getAngleOffsetDEPRECATED() const {
|
||||
return _reader.getDataField<float>(
|
||||
0 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline float Live20Data::Builder::getAngleOffset() {
|
||||
inline float Live20Data::Builder::getAngleOffsetDEPRECATED() {
|
||||
return _builder.getDataField<float>(
|
||||
0 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void Live20Data::Builder::setAngleOffset(float value) {
|
||||
inline void Live20Data::Builder::setAngleOffsetDEPRECATED(float value) {
|
||||
_builder.setDataField<float>(
|
||||
0 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline ::int8_t Live20Data::Reader::getCalStatus() const {
|
||||
inline ::int8_t Live20Data::Reader::getCalStatusDEPRECATED() const {
|
||||
return _reader.getDataField< ::int8_t>(
|
||||
4 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline ::int8_t Live20Data::Builder::getCalStatus() {
|
||||
inline ::int8_t Live20Data::Builder::getCalStatusDEPRECATED() {
|
||||
return _builder.getDataField< ::int8_t>(
|
||||
4 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void Live20Data::Builder::setCalStatus( ::int8_t value) {
|
||||
inline void Live20Data::Builder::setCalStatusDEPRECATED( ::int8_t value) {
|
||||
_builder.setDataField< ::int8_t>(
|
||||
4 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
@@ -4448,30 +4855,30 @@ inline void Live20Data::Builder::setFtMonoTime( ::uint64_t value) {
|
||||
3 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline ::int32_t Live20Data::Reader::getCalCycle() const {
|
||||
inline ::int32_t Live20Data::Reader::getCalCycleDEPRECATED() const {
|
||||
return _reader.getDataField< ::int32_t>(
|
||||
3 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline ::int32_t Live20Data::Builder::getCalCycle() {
|
||||
inline ::int32_t Live20Data::Builder::getCalCycleDEPRECATED() {
|
||||
return _builder.getDataField< ::int32_t>(
|
||||
3 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void Live20Data::Builder::setCalCycle( ::int32_t value) {
|
||||
inline void Live20Data::Builder::setCalCycleDEPRECATED( ::int32_t value) {
|
||||
_builder.setDataField< ::int32_t>(
|
||||
3 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline ::int8_t Live20Data::Reader::getCalPerc() const {
|
||||
inline ::int8_t Live20Data::Reader::getCalPercDEPRECATED() const {
|
||||
return _reader.getDataField< ::int8_t>(
|
||||
5 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline ::int8_t Live20Data::Builder::getCalPerc() {
|
||||
inline ::int8_t Live20Data::Builder::getCalPercDEPRECATED() {
|
||||
return _builder.getDataField< ::int8_t>(
|
||||
5 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void Live20Data::Builder::setCalPerc( ::int8_t value) {
|
||||
inline void Live20Data::Builder::setCalPercDEPRECATED( ::int8_t value) {
|
||||
_builder.setDataField< ::int8_t>(
|
||||
5 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
@@ -4912,16 +5319,16 @@ inline void Live100Data::Builder::setVEgo(float value) {
|
||||
0 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline float Live100Data::Reader::getAEgo() const {
|
||||
inline float Live100Data::Reader::getAEgoDEPRECATED() const {
|
||||
return _reader.getDataField<float>(
|
||||
1 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline float Live100Data::Builder::getAEgo() {
|
||||
inline float Live100Data::Builder::getAEgoDEPRECATED() {
|
||||
return _builder.getDataField<float>(
|
||||
1 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void Live100Data::Builder::setAEgo(float value) {
|
||||
inline void Live100Data::Builder::setAEgoDEPRECATED(float value) {
|
||||
_builder.setDataField<float>(
|
||||
1 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
@@ -5094,16 +5501,16 @@ inline void Live100Data::Builder::setAngleSteers(float value) {
|
||||
13 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
|
||||
inline ::int32_t Live100Data::Reader::getHudLead() const {
|
||||
inline ::int32_t Live100Data::Reader::getHudLeadDEPRECATED() const {
|
||||
return _reader.getDataField< ::int32_t>(
|
||||
14 * ::capnp::ELEMENTS);
|
||||
}
|
||||
|
||||
inline ::int32_t Live100Data::Builder::getHudLead() {
|
||||
inline ::int32_t Live100Data::Builder::getHudLeadDEPRECATED() {
|
||||
return _builder.getDataField< ::int32_t>(
|
||||
14 * ::capnp::ELEMENTS);
|
||||
}
|
||||
inline void Live100Data::Builder::setHudLead( ::int32_t value) {
|
||||
inline void Live100Data::Builder::setHudLeadDEPRECATED( ::int32_t value) {
|
||||
_builder.setDataField< ::int32_t>(
|
||||
14 * ::capnp::ELEMENTS, value);
|
||||
}
|
||||
@@ -7246,6 +7653,162 @@ inline ::capnp::Orphan< ::cereal::AndroidLogEntry> Event::Builder::disownAndroid
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
|
||||
inline bool Event::Reader::isGpsLocation() const {
|
||||
return which() == Event::GPS_LOCATION;
|
||||
}
|
||||
inline bool Event::Builder::isGpsLocation() {
|
||||
return which() == Event::GPS_LOCATION;
|
||||
}
|
||||
inline bool Event::Reader::hasGpsLocation() const {
|
||||
if (which() != Event::GPS_LOCATION) return false;
|
||||
return !_reader.getPointerField(0 * ::capnp::POINTERS).isNull();
|
||||
}
|
||||
inline bool Event::Builder::hasGpsLocation() {
|
||||
if (which() != Event::GPS_LOCATION) return false;
|
||||
return !_builder.getPointerField(0 * ::capnp::POINTERS).isNull();
|
||||
}
|
||||
inline ::cereal::GpsLocationData::Reader Event::Reader::getGpsLocation() const {
|
||||
KJ_IREQUIRE(which() == Event::GPS_LOCATION,
|
||||
"Must check which() before get()ing a union member.");
|
||||
return ::capnp::_::PointerHelpers< ::cereal::GpsLocationData>::get(
|
||||
_reader.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
inline ::cereal::GpsLocationData::Builder Event::Builder::getGpsLocation() {
|
||||
KJ_IREQUIRE(which() == Event::GPS_LOCATION,
|
||||
"Must check which() before get()ing a union member.");
|
||||
return ::capnp::_::PointerHelpers< ::cereal::GpsLocationData>::get(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
inline void Event::Builder::setGpsLocation( ::cereal::GpsLocationData::Reader value) {
|
||||
_builder.setDataField<Event::Which>(
|
||||
4 * ::capnp::ELEMENTS, Event::GPS_LOCATION);
|
||||
::capnp::_::PointerHelpers< ::cereal::GpsLocationData>::set(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS), value);
|
||||
}
|
||||
inline ::cereal::GpsLocationData::Builder Event::Builder::initGpsLocation() {
|
||||
_builder.setDataField<Event::Which>(
|
||||
4 * ::capnp::ELEMENTS, Event::GPS_LOCATION);
|
||||
return ::capnp::_::PointerHelpers< ::cereal::GpsLocationData>::init(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
inline void Event::Builder::adoptGpsLocation(
|
||||
::capnp::Orphan< ::cereal::GpsLocationData>&& value) {
|
||||
_builder.setDataField<Event::Which>(
|
||||
4 * ::capnp::ELEMENTS, Event::GPS_LOCATION);
|
||||
::capnp::_::PointerHelpers< ::cereal::GpsLocationData>::adopt(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS), kj::mv(value));
|
||||
}
|
||||
inline ::capnp::Orphan< ::cereal::GpsLocationData> Event::Builder::disownGpsLocation() {
|
||||
KJ_IREQUIRE(which() == Event::GPS_LOCATION,
|
||||
"Must check which() before get()ing a union member.");
|
||||
return ::capnp::_::PointerHelpers< ::cereal::GpsLocationData>::disown(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
|
||||
inline bool Event::Reader::isCarState() const {
|
||||
return which() == Event::CAR_STATE;
|
||||
}
|
||||
inline bool Event::Builder::isCarState() {
|
||||
return which() == Event::CAR_STATE;
|
||||
}
|
||||
inline bool Event::Reader::hasCarState() const {
|
||||
if (which() != Event::CAR_STATE) return false;
|
||||
return !_reader.getPointerField(0 * ::capnp::POINTERS).isNull();
|
||||
}
|
||||
inline bool Event::Builder::hasCarState() {
|
||||
if (which() != Event::CAR_STATE) return false;
|
||||
return !_builder.getPointerField(0 * ::capnp::POINTERS).isNull();
|
||||
}
|
||||
inline ::cereal::CarState::Reader Event::Reader::getCarState() const {
|
||||
KJ_IREQUIRE(which() == Event::CAR_STATE,
|
||||
"Must check which() before get()ing a union member.");
|
||||
return ::capnp::_::PointerHelpers< ::cereal::CarState>::get(
|
||||
_reader.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
inline ::cereal::CarState::Builder Event::Builder::getCarState() {
|
||||
KJ_IREQUIRE(which() == Event::CAR_STATE,
|
||||
"Must check which() before get()ing a union member.");
|
||||
return ::capnp::_::PointerHelpers< ::cereal::CarState>::get(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
inline void Event::Builder::setCarState( ::cereal::CarState::Reader value) {
|
||||
_builder.setDataField<Event::Which>(
|
||||
4 * ::capnp::ELEMENTS, Event::CAR_STATE);
|
||||
::capnp::_::PointerHelpers< ::cereal::CarState>::set(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS), value);
|
||||
}
|
||||
inline ::cereal::CarState::Builder Event::Builder::initCarState() {
|
||||
_builder.setDataField<Event::Which>(
|
||||
4 * ::capnp::ELEMENTS, Event::CAR_STATE);
|
||||
return ::capnp::_::PointerHelpers< ::cereal::CarState>::init(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
inline void Event::Builder::adoptCarState(
|
||||
::capnp::Orphan< ::cereal::CarState>&& value) {
|
||||
_builder.setDataField<Event::Which>(
|
||||
4 * ::capnp::ELEMENTS, Event::CAR_STATE);
|
||||
::capnp::_::PointerHelpers< ::cereal::CarState>::adopt(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS), kj::mv(value));
|
||||
}
|
||||
inline ::capnp::Orphan< ::cereal::CarState> Event::Builder::disownCarState() {
|
||||
KJ_IREQUIRE(which() == Event::CAR_STATE,
|
||||
"Must check which() before get()ing a union member.");
|
||||
return ::capnp::_::PointerHelpers< ::cereal::CarState>::disown(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
|
||||
inline bool Event::Reader::isCarControl() const {
|
||||
return which() == Event::CAR_CONTROL;
|
||||
}
|
||||
inline bool Event::Builder::isCarControl() {
|
||||
return which() == Event::CAR_CONTROL;
|
||||
}
|
||||
inline bool Event::Reader::hasCarControl() const {
|
||||
if (which() != Event::CAR_CONTROL) return false;
|
||||
return !_reader.getPointerField(0 * ::capnp::POINTERS).isNull();
|
||||
}
|
||||
inline bool Event::Builder::hasCarControl() {
|
||||
if (which() != Event::CAR_CONTROL) return false;
|
||||
return !_builder.getPointerField(0 * ::capnp::POINTERS).isNull();
|
||||
}
|
||||
inline ::cereal::CarControl::Reader Event::Reader::getCarControl() const {
|
||||
KJ_IREQUIRE(which() == Event::CAR_CONTROL,
|
||||
"Must check which() before get()ing a union member.");
|
||||
return ::capnp::_::PointerHelpers< ::cereal::CarControl>::get(
|
||||
_reader.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
inline ::cereal::CarControl::Builder Event::Builder::getCarControl() {
|
||||
KJ_IREQUIRE(which() == Event::CAR_CONTROL,
|
||||
"Must check which() before get()ing a union member.");
|
||||
return ::capnp::_::PointerHelpers< ::cereal::CarControl>::get(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
inline void Event::Builder::setCarControl( ::cereal::CarControl::Reader value) {
|
||||
_builder.setDataField<Event::Which>(
|
||||
4 * ::capnp::ELEMENTS, Event::CAR_CONTROL);
|
||||
::capnp::_::PointerHelpers< ::cereal::CarControl>::set(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS), value);
|
||||
}
|
||||
inline ::cereal::CarControl::Builder Event::Builder::initCarControl() {
|
||||
_builder.setDataField<Event::Which>(
|
||||
4 * ::capnp::ELEMENTS, Event::CAR_CONTROL);
|
||||
return ::capnp::_::PointerHelpers< ::cereal::CarControl>::init(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
inline void Event::Builder::adoptCarControl(
|
||||
::capnp::Orphan< ::cereal::CarControl>&& value) {
|
||||
_builder.setDataField<Event::Which>(
|
||||
4 * ::capnp::ELEMENTS, Event::CAR_CONTROL);
|
||||
::capnp::_::PointerHelpers< ::cereal::CarControl>::adopt(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS), kj::mv(value));
|
||||
}
|
||||
inline ::capnp::Orphan< ::cereal::CarControl> Event::Builder::disownCarControl() {
|
||||
KJ_IREQUIRE(which() == Event::CAR_CONTROL,
|
||||
"Must check which() before get()ing a union member.");
|
||||
return ::capnp::_::PointerHelpers< ::cereal::CarControl>::disown(
|
||||
_builder.getPointerField(0 * ::capnp::POINTERS));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // CAPNP_INCLUDED_f3b1f17e25a4285b_
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Cxx = import "c++.capnp";
|
||||
$Cxx.namespace("cereal");
|
||||
|
||||
using Car = import "car.capnp";
|
||||
|
||||
@0xf3b1f17e25a4285b;
|
||||
|
||||
const logVersion :Int32 = 1;
|
||||
@@ -39,11 +41,47 @@ struct SensorEventData {
|
||||
orientation @6 :SensorVec;
|
||||
gyro @7 :SensorVec;
|
||||
}
|
||||
source @8 :SensorSource;
|
||||
|
||||
struct SensorVec {
|
||||
v @0 :List(Float32);
|
||||
status @1 :Int8;
|
||||
}
|
||||
|
||||
enum SensorSource {
|
||||
android @0;
|
||||
iOS @1;
|
||||
fiber @2;
|
||||
velodyne @3; # Velodyne IMU
|
||||
}
|
||||
}
|
||||
|
||||
# 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.
|
||||
accuracy @6 :Float32;
|
||||
|
||||
# Timestamp for the location fix.
|
||||
# Milliseconds since January 1, 1970.
|
||||
timestamp @7 :Int64;
|
||||
}
|
||||
|
||||
struct CanData {
|
||||
@@ -61,6 +99,11 @@ struct ThermalData {
|
||||
mem @4 :UInt16;
|
||||
gpu @5 :UInt16;
|
||||
bat @6 :UInt32;
|
||||
|
||||
# not thermal
|
||||
freeSpace @7 :Float32;
|
||||
batteryPercent @8 :Int16;
|
||||
batteryStatus @9: Text;
|
||||
}
|
||||
|
||||
struct HealthData {
|
||||
@@ -70,6 +113,7 @@ struct HealthData {
|
||||
started @2 :Bool;
|
||||
controlsAllowed @3 :Bool;
|
||||
gasInterceptorDetected @4 :Bool;
|
||||
startedSignalDetected @5 :Bool;
|
||||
}
|
||||
|
||||
struct LiveUI {
|
||||
@@ -85,11 +129,11 @@ struct Live20Data {
|
||||
ftMonoTime @7 :UInt64;
|
||||
|
||||
# all deprecated
|
||||
warpMatrix @0 :List(Float32);
|
||||
angleOffset @1 :Float32;
|
||||
calStatus @2 :Int8;
|
||||
calCycle @8 :Int32;
|
||||
calPerc @9 :Int8;
|
||||
warpMatrixDEPRECATED @0 :List(Float32);
|
||||
angleOffsetDEPRECATED @1 :Float32;
|
||||
calStatusDEPRECATED @2 :Int8;
|
||||
calCycleDEPRECATED @8 :Int32;
|
||||
calPercDEPRECATED @9 :Int8;
|
||||
|
||||
leadOne @3 :LeadData;
|
||||
leadTwo @4 :LeadData;
|
||||
@@ -138,7 +182,7 @@ struct Live100Data {
|
||||
mdMonoTime @18 :UInt64;
|
||||
|
||||
vEgo @0 :Float32;
|
||||
aEgo @1 :Float32;
|
||||
aEgoDEPRECATED @1 :Float32;
|
||||
vPid @2 :Float32;
|
||||
vTargetLead @3 :Float32;
|
||||
upAccelCmd @4 :Float32;
|
||||
@@ -151,7 +195,7 @@ struct Live100Data {
|
||||
aTargetMax @11 :Float32;
|
||||
jerkFactor @12 :Float32;
|
||||
angleSteers @13 :Float32;
|
||||
hudLead @14 :Int32;
|
||||
hudLeadDEPRECATED @14 :Int32;
|
||||
cumLagMs @15 :Float32;
|
||||
|
||||
enabled @19: Bool;
|
||||
@@ -268,5 +312,8 @@ struct Event {
|
||||
logMessage @18 :Text;
|
||||
liveCalibration @19 :LiveCalibrationData;
|
||||
androidLogEntry @20 :AndroidLogEntry;
|
||||
gpsLocation @21 :GpsLocationData;
|
||||
carState @22 :Car.CarState;
|
||||
carControl @23 :Car.CarControl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@ import requests
|
||||
def api_get(endpoint, method='GET', timeout=None, **params):
|
||||
backend = "https://api.commadotai.com/"
|
||||
|
||||
params['_version'] = "OPENPILOTv0.0"
|
||||
params['_version'] = "OPENPILOTv0.2"
|
||||
|
||||
return requests.request(method, backend+endpoint, timeout=timeout, params=params)
|
||||
|
||||
@@ -5,6 +5,8 @@ import sys
|
||||
if os.getenv("NOLOG"):
|
||||
def capture_exception(*exc_info):
|
||||
pass
|
||||
def bind_user(**kwargs):
|
||||
pass
|
||||
def install():
|
||||
pass
|
||||
else:
|
||||
@@ -16,6 +18,9 @@ else:
|
||||
|
||||
capture_exception = client.captureException
|
||||
|
||||
def bind_user(**kwargs):
|
||||
client.user_context(kwargs)
|
||||
|
||||
def install():
|
||||
# installs a sys.excepthook
|
||||
__excepthook__ = sys.excepthook
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import re
|
||||
from collections import namedtuple
|
||||
import bitstring
|
||||
from binascii import hexlify
|
||||
from collections import namedtuple
|
||||
|
||||
def int_or_float(s):
|
||||
# return number, trying to maintain int format
|
||||
@@ -15,7 +16,8 @@ DBCSignal = namedtuple(
|
||||
|
||||
class dbc(object):
|
||||
def __init__(self, fn):
|
||||
self.txt = open(fn).read().split("\n")
|
||||
with open(fn) as f:
|
||||
self.txt = f.read().split("\n")
|
||||
self._warned_addresses = set()
|
||||
|
||||
# regexps from https://github.com/ebroecker/canmatrix/blob/master/canmatrix/importdbc.py
|
||||
@@ -148,8 +150,8 @@ class dbc(object):
|
||||
if debug:
|
||||
print name
|
||||
|
||||
blen = (len(x[2])/2)*8
|
||||
x2_int = int(x[2], 16)
|
||||
blen = 8*len(x[2])
|
||||
x2_int = int(hexlify(x[2]), 16)
|
||||
|
||||
for s in msg[1]:
|
||||
if arr is not None and s[0] not in arr:
|
||||
|
||||
@@ -1,2 +1,25 @@
|
||||
def clip(x, lo, hi):
|
||||
return max(lo, min(hi, x))
|
||||
|
||||
|
||||
def interp(x, xp, fp):
|
||||
N = len(xp)
|
||||
if not hasattr(x, '__iter__'):
|
||||
hi = 0
|
||||
while hi < N and x > xp[hi]:
|
||||
hi += 1
|
||||
low = hi - 1
|
||||
return fp[-1] if hi == N and x > xp[low] else (
|
||||
fp[0] if hi == 0 else
|
||||
(x - xp[low]) * (fp[hi] - fp[low]) / (xp[hi] - xp[low]) + fp[low])
|
||||
|
||||
result = []
|
||||
for v in x:
|
||||
hi = 0
|
||||
while hi < N and v > xp[hi]:
|
||||
hi += 1
|
||||
low = hi - 1
|
||||
result.append(fp[-1] if hi == N and v > xp[low] else (fp[
|
||||
0] if hi == 0 else (v - xp[low]) * (fp[hi] - fp[low]) / (xp[hi] - xp[low]
|
||||
) + fp[low]))
|
||||
return result
|
||||
|
||||
26
common/profiler.py
Normal file
26
common/profiler.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from common.realtime import sec_since_boot
|
||||
|
||||
class Profiler(object):
|
||||
def __init__(self, enabled=False):
|
||||
self.enabled = enabled
|
||||
self.cp = []
|
||||
self.start_time = sec_since_boot()
|
||||
self.last_time = self.start_time
|
||||
|
||||
def checkpoint(self, name):
|
||||
if not self.enabled:
|
||||
return
|
||||
tt = sec_since_boot()
|
||||
self.cp.append((name, tt - self.last_time))
|
||||
self.last_time = tt
|
||||
|
||||
def display(self):
|
||||
if not self.enabled:
|
||||
return
|
||||
print "******* Profiling *******"
|
||||
tot = 0.0
|
||||
for n, ms in self.cp:
|
||||
print "%30s: %7.2f" % (n, ms*1000.0)
|
||||
tot += ms
|
||||
print " TOTAL: %7.2f" % (tot*1000.0)
|
||||
|
||||
@@ -6,6 +6,9 @@ import subprocess
|
||||
import multiprocessing
|
||||
import os
|
||||
|
||||
from ctypes.util import find_library
|
||||
|
||||
|
||||
CLOCK_MONOTONIC_RAW = 4 # see <linux/time.h>
|
||||
CLOCK_BOOTTIME = 7
|
||||
|
||||
@@ -15,28 +18,30 @@ class timespec(ctypes.Structure):
|
||||
('tv_nsec', ctypes.c_long),
|
||||
]
|
||||
|
||||
libc_name = find_library('c')
|
||||
if libc_name is None:
|
||||
platform_name = platform.system()
|
||||
if platform_name.startswith('linux'):
|
||||
libc_name = 'libc.so.6'
|
||||
if platform_name.startswith(('freebsd', 'netbsd')):
|
||||
libc_name = 'libc.so'
|
||||
elif platform_name.lower() == 'darwin':
|
||||
libc_name = 'libc.dylib'
|
||||
|
||||
try:
|
||||
libc = ctypes.CDLL('libc.so', use_errno=True)
|
||||
libc = ctypes.CDLL(libc_name, use_errno=True)
|
||||
except OSError:
|
||||
try:
|
||||
libc = ctypes.CDLL('libc.so.6', use_errno=True)
|
||||
except OSError:
|
||||
libc = None
|
||||
libc = None
|
||||
|
||||
if libc is not None:
|
||||
libc.clock_gettime.argtypes = [ctypes.c_int, ctypes.POINTER(timespec)]
|
||||
|
||||
def clock_gettime(clk_id):
|
||||
if platform.system() == "darwin":
|
||||
# TODO: fix this
|
||||
return time.time()
|
||||
else:
|
||||
t = timespec()
|
||||
if libc.clock_gettime(clk_id, ctypes.pointer(t)) != 0:
|
||||
errno_ = ctypes.get_errno()
|
||||
raise OSError(errno_, os.strerror(errno_))
|
||||
return t.tv_sec + t.tv_nsec * 1e-9
|
||||
t = timespec()
|
||||
if libc.clock_gettime(clk_id, ctypes.pointer(t)) != 0:
|
||||
errno_ = ctypes.get_errno()
|
||||
raise OSError(errno_, os.strerror(errno_))
|
||||
return t.tv_sec + t.tv_nsec * 1e-9
|
||||
|
||||
def monotonic_time():
|
||||
return clock_gettime(CLOCK_MONOTONIC_RAW)
|
||||
@@ -47,7 +52,7 @@ def sec_since_boot():
|
||||
|
||||
def set_realtime_priority(level):
|
||||
if os.getuid() != 0:
|
||||
print "not setting priority, not root"
|
||||
print("not setting priority, not root")
|
||||
return
|
||||
if platform.machine() == "x86_64":
|
||||
NR_gettid = 186
|
||||
@@ -57,7 +62,7 @@ def set_realtime_priority(level):
|
||||
raise NotImplementedError
|
||||
|
||||
tid = libc.syscall(NR_gettid)
|
||||
subprocess.check_call(['chrt', '-f', '-p', str(level), str(tid)])
|
||||
return subprocess.call(['chrt', '-f', '-p', str(level), str(tid)])
|
||||
|
||||
|
||||
class Ratekeeper(object):
|
||||
@@ -80,15 +85,19 @@ class Ratekeeper(object):
|
||||
|
||||
# Maintain loop rate by calling this at the end of each loop
|
||||
def keep_time(self):
|
||||
self.monitor_time()
|
||||
lagged = self.monitor_time()
|
||||
if self._remaining > 0:
|
||||
time.sleep(self._remaining)
|
||||
return lagged
|
||||
|
||||
# this only monitor the cumulative lag, but does not enforce a rate
|
||||
def monitor_time(self):
|
||||
lagged = False
|
||||
remaining = self._next_frame_time - sec_since_boot()
|
||||
self._next_frame_time += self._interval
|
||||
if remaining < -self._print_delay_threshold:
|
||||
print self._process_name, "lagging by", round(-remaining * 1000, 2), "ms"
|
||||
print("%s lagging by %.2f ms" % (self._process_name, -remaining * 1000))
|
||||
lagged = True
|
||||
self._frame += 1
|
||||
self._remaining = remaining
|
||||
return lagged
|
||||
|
||||
@@ -33,31 +33,38 @@ service_list = {
|
||||
"logMessage": Service(8018, True),
|
||||
"liveCalibration": Service(8019, True),
|
||||
"androidLog": Service(8020, True),
|
||||
"carState": Service(8021, True),
|
||||
# 8022 is reserved for sshd
|
||||
"carControl": Service(8023, True),
|
||||
}
|
||||
|
||||
# manager -- base process to manage starting and stopping of all others
|
||||
# subscribes: health
|
||||
# publishes: thermal
|
||||
|
||||
# **** processes that communicate with the outside world ****
|
||||
|
||||
# boardd -- communicates with the car
|
||||
# subscribes: sendcan
|
||||
# publishes: can, health
|
||||
|
||||
# sensord -- publishes the IMU and GPS
|
||||
# publishes: sensorEvents, gpsNMEA
|
||||
|
||||
# visiond -- talks to the cameras, runs the model, saves the videos
|
||||
# subscribes: liveCalibration, sensorEvents
|
||||
# publishes: frame, encodeIdx, model, features
|
||||
|
||||
# **** stateful data transformers ****
|
||||
|
||||
# controlsd -- actually drives the car
|
||||
# subscribes: can, thermal, model, live20
|
||||
# publishes: sendcan, live100
|
||||
# publishes: carState, carControl, sendcan, live100
|
||||
|
||||
# radard -- processes the radar data
|
||||
# subscribes: can, live100, model
|
||||
# publishes: live20, liveTracks
|
||||
|
||||
# sensord -- publishes the IMU and GPS
|
||||
# publishes: sensorEvents, gpsNMEA
|
||||
|
||||
# calibrationd -- places the camera box
|
||||
# subscribes: features, live100
|
||||
# publishes: liveCalibration
|
||||
@@ -80,3 +87,4 @@ service_list = {
|
||||
|
||||
# logcatd -- fetches logcat info from android
|
||||
# publishes: androidLog
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ NS_ :
|
||||
ENVVAR_DATA_
|
||||
SGTYPE_
|
||||
SGTYPE_VAL_
|
||||
BA_DEF_SGTYPE_
|
||||
BA_DEF_SGTYPE_
|
||||
BA_SGTYPE_
|
||||
SIG_TYPE_REF_
|
||||
VAL_TABLE_
|
||||
@@ -33,263 +33,292 @@ NS_ :
|
||||
|
||||
BS_:
|
||||
|
||||
BO_ 0x039 XXX: 3 XXX
|
||||
|
||||
BO_ 0x091 XXX: 8 XXX
|
||||
SG_ LAT_ACCEL : 0|10@1+ (0.02,-512) [-20|20] "m/s2" Vector__XXX
|
||||
|
||||
BO_ 0x0E4 STEERING_CONTROL: 5 ADAS
|
||||
SG_ STEER_TORQUE : 0|16@1- (1,0) [-3840|3840] "" Vector__XXX
|
||||
SG_ STEER_TORQUE_REQUEST : 16|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ SET_ME_X00 : 17|7@1+ (1,0) [0|127] "" Vector__XXX
|
||||
SG_ SET_ME_X00 : 24|8@1+ (1,0) [0|0] "" Vector__XXX
|
||||
SG_ COUNTER : 34|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 36|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x130 GAS_PEDAL2: 8 PCM
|
||||
SG_ ENGINE_TORQUE_ESTIMATE : 0|16@1- (1,0) [-1000|1000] "Nm" Vector__XXX
|
||||
SG_ ENGINE_TORQUE_REQUEST : 16|16@1- (1,0) [-1000|1000] "Nm" Vector__XXX
|
||||
SG_ CAR_GAS : 32|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
|
||||
BO_ 0x13C GAS_PEDAL: 8 PCM
|
||||
SG_ CAR_GAS : 32|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
|
||||
BO_ 0x156 STEERING_SENSORS: 6 EPS
|
||||
SG_ STEER_ANGLE : 0|16@1- (-0.1,0) [-500|500] "deg" Vector__XXX
|
||||
SG_ STEER_ANGLE_RATE : 16|16@1- (1,0) [-3000|3000] "deg/s" Vector__XXX
|
||||
SG_ COUNTER : 42|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 44|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x158 POWERTRAIN_DATA: 8 PCM
|
||||
SG_ XMISSION_SPEED : 0|16@1+ (0.002759506,0) [0|70] "m/s" Vector__XXX
|
||||
SG_ ENGINE_RPM : 16|16@1+ (1,0) [0|15000] "rpm" Vector__XXX
|
||||
SG_ XMISSION_SPEED2 : 32|16@1+ (0.002759506,0) [0|70] "m/s" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x17C POWERTRAIN_DATA2: 8 PCM
|
||||
SG_ PEDAL_GAS : 0|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ ENGINE_RPM : 16|16@1+ (1,0) [0|15000] "rpm" Vector__XXX
|
||||
SG_ GAS_PRESSED : 32|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ ACC_STATUS : 33|1@1+ (1,0) [0|1] "rpm" Vector__XXX
|
||||
SG_ BOH_17C : 34|5@1+ (1,0) [0|1] "rpm" Vector__XXX
|
||||
SG_ BRAKE_LIGHTS_ON : 39|1@1+ (1,0) [0|1] "rpm" Vector__XXX
|
||||
SG_ BOH2_17C : 40|10@1+ (1,0) [0|1] "rpm" Vector__XXX
|
||||
SG_ BRAKE_PRESSED : 50|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ BOH3_17C : 51|5@1+ (1,0) [0|1] "rpm" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x18E XXX: 3 XXX
|
||||
|
||||
BO_ 0x18F STEER_STATUS: 7 EPS
|
||||
SG_ STEER_TORQUE_SENSOR : 0|16@1- (1,0) [-31000|31000] "tbd" Vector__XXX
|
||||
SG_ STEER_TORQUE_MOTOR : 16|16@1- (1,0) [-31000|31000] "tbd" Vector__XXX
|
||||
SG_ STEER_STATUS : 32|4@1+ (1,0) [0|15] "" Vector__XXX
|
||||
SG_ STEER_CONTROL_ACTIVE : 36|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ COUNTER : 50|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 52|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x1A3 GEARBOX: 8 PCM
|
||||
SG_ GEAR : 0|8@1+ (1,0) [0|256] "" Vector__XXX
|
||||
SG_ GEAR_SHIFTER : 36|4@1+ (1,0) [0|15] "" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x1A4 VSA_STATUS: 8 VSA
|
||||
SG_ USER_BRAKE : 0|16@1+ (0.015625,-103) [0|1000] "" Vector__XXX
|
||||
SG_ ESP_DISABLED : 27|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x1A6 SCM_BUTTONS: 8 SCM
|
||||
SG_ CRUISE_BUTTONS : 0|3@1+ (1,0) [0|7] "" Vector__XXX
|
||||
SG_ LIGHTS_SETTING : 6|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ MAIN_ON : 40|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CRUISE_SETTING : 44|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x1AC XXX: 8 XXX
|
||||
|
||||
BO_ 0x1B0 STANDSTILL: 7 VSA
|
||||
SG_ WHEELS_MOVING : 11|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ BRAKE_ERROR_1 : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ BRAKE_ERROR_2 : 14|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ COUNTER : 50|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 52|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x1D0 WHEEL_SPEEDS: 8 VSA
|
||||
SG_ WHEEL_SPEED_FL : 0|15@1+ (0.002759506,0) [0|70] "m/s" Vector__XXX
|
||||
SG_ WHEEL_SPEED_FR : 15|15@1+ (0.002759506,0) [0|70] "m/s" Vector__XXX
|
||||
SG_ WHEEL_SPEED_RL : 30|15@1+ (0.002759506,0) [0|70] "m/s" Vector__XXX
|
||||
SG_ WHEEL_SPEED_RR : 45|15@1+ (0.002759506,0) [0|70] "m/s" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x1DC XXX: 4 XXX
|
||||
|
||||
BO_ 0x1EA VEHICLE_DYNAMICS: 8 VSA
|
||||
SG_ LONG_ACCEL : 16|16@1- (0.0015384,0) [-20|20] "m/s2" Vector__XXX
|
||||
|
||||
BO_ 0x1FA BRAKE_COMMAND: 8 ADAS
|
||||
SG_ COMPUTER_BRAKE : 0|10@1+ (0.003906248,0) [0|1] "" Vector__XXX
|
||||
SG_ ZEROS_BOH : 10|5@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ COMPUTER_BRAKE_REQUEST : 15|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CRUISE_BOH2 : 16|3@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CRUISE_OVERRIDE : 19|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CRUISE_BOH3 : 20|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CRUISE_FAULT_CMD : 21|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CRUISE_CANCEL_CMD : 22|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ COMPUTER_BRAKE_REQUEST_2 : 23|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CRUISE_BOH4 : 24|8@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ BRAKE_LIGHTS : 32|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CRUISE_BOH5 : 33|7@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CHIME : 40|3@1+ (1,0) [0|7] "" Vector__XXX
|
||||
SG_ CRUISE_BOH6 : 43|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ FCW : 44|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CRUISE_BOH7 : 46|10@1+ (1,0) [0|0] "" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x200 GAS_COMMAND: 3 ADAS
|
||||
SG_ GAS_COMMAND : 0|16@1+ (0.253984064,-328) [0|1] "" Vector__XXX
|
||||
SG_ COUNTER : 18|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 20|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x201 GAS_SENSOR: 5 ADAS
|
||||
SG_ INTERCEPTOR_GAS : 0|16@1+ (0.253984064,-328) [0|1] "" Vector__XXX
|
||||
SG_ INTERCEPTOR_GAS2 : 16|16@1+ (0.126992032,-656) [0|1] "" Vector__XXX
|
||||
SG_ COUNTER : 34|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 36|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x21E XXX: 7 XXX
|
||||
BO_ 0x221 XXX: 4 XXX
|
||||
|
||||
BO_ 0x255 ROUGH_WHEEL_SPEED: 8 VSA
|
||||
SG_ WHEEL_SPEED_FL : 0|8@1+ (1,0) [0|255] "mph" Vector__XXX
|
||||
SG_ WHEEL_SPEED_FR : 8|8@1+ (1,0) [0|255] "mph" Vector__XXX
|
||||
SG_ WHEEL_SPEED_RL : 16|8@1+ (1,0) [0|255] "mph" Vector__XXX
|
||||
SG_ WHEEL_SPEED_RR : 24|8@1+ (1,0) [0|255] "mph" Vector__XXX
|
||||
SG_ SET_TO_X55 : 32|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ SET_TO_X55 : 40|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
|
||||
BO_ 0x294 SCM_COMMANDS: 8 SCM
|
||||
SG_ RIGHT_BLINKER : 1|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LEFT_BLINKER : 2|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ WIPERS_SPEED : 3|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x305 SEATBELT_STATUS: 7 BDY
|
||||
SG_ SEATBELT_DRIVER_LAMP : 0|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ SEATBELT_DRIVER_LATCHED : 10|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ COUNTER : 50|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 52|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x309 XXX: 8 XXX
|
||||
|
||||
BO_ 0x30C ACC_HUD: 8 ADAS
|
||||
SG_ PCM_SPEED : 0|16@1+ (0.002763889,0) [0|100] "m/s" Vector__XXX
|
||||
SG_ PCM_GAS : 16|7@1+ (1,0) [0|127] "" Vector__XXX
|
||||
SG_ ZEROS_BOH : 23|1@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ CRUISE_SPEED : 24|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ DTC_MODE : 32|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ BOH : 33|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ ACC_PROBLEM : 34|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ FCM_OFF : 35|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ BOH_2 : 36|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ FCM_PROBLEM : 37|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ RADAR_OBSTRUCTED : 38|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ ENABLE_MINI_CAR : 39|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ SET_ME_X03 : 40|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ HUD_LEAD : 42|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ BOH_3 : 44|1@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ BOH_4 : 45|1@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ BOH_5 : 46|1@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CRUISE_CONTROL_LABEL : 47|1@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ HUD_DISTANCE_3 : 51|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x320 XXX: 8 XXX
|
||||
|
||||
BO_ 0x324 CRUISE: 8 PCM
|
||||
SG_ ENGINE_TEMPERATURE : 0|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ BOH : 8|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ TRIP_FUEL_CONSUMED : 16|16@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ CRUISE_SPEED_PCM : 32|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ BOH2 : 40|8@1- (1,0) [0|255] "" Vector__XXX
|
||||
SG_ BOH3 : 48|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
|
||||
BO_ 0x328 XXX: 8 XXX
|
||||
BO_ 0x333 XXX: 7 XXX
|
||||
BO_ 0x335 XXX: 5 XXX
|
||||
|
||||
BO_ 0x33D LKAS_HUD_2: 5 ADAS
|
||||
SG_ CAM_TEMP_HIGH : 0|1@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ BOH : 1|7@1+ (1,0) [0|127] "" Vector__XXX
|
||||
SG_ DASHED_LANES : 9|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ DTC : 10|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LKAS_PROBLEM : 11|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LKAS_OFF : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ SOLID_LANES : 13|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LDW_RIGHT : 14|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ STEERING_REQUIRED : 15|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ BOH : 16|2@1+ (1,0) [0|4] "" Vector__XXX
|
||||
SG_ LDW_PROBLEM : 18|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ BEEP : 22|2@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LDW_ON : 27|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LDW_OFF : 28|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CLEAN_WINDSHIELD : 29|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ SET_ME_X48 : 24|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ COUNTER : 34|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 36|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BU_: INTERCEPTOR EBCM NEO ADAS PCM EPS VSA SCM BDY XXX
|
||||
|
||||
|
||||
BO_ 0x372 XXX: 2 XXX
|
||||
BO_ 57 XXX_1: 3 XXX
|
||||
|
||||
BO_ 0x374 XXX: 7 XXX
|
||||
BO_ 0x377 XXX: 8 XXX
|
||||
BO_ 0x378 XXX: 8 XXX
|
||||
BO_ 0x37C XXX: 8 XXX
|
||||
BO_ 0x39B XXX: 2 XXX
|
||||
BO_ 0x3A1 XXX: 4 XXX
|
||||
BO_ 0x3D7 XXX: 8 XXX
|
||||
BO_ 0x3D9 XXX: 3 XXX
|
||||
BO_ 0x400 XXX: 5 XXX
|
||||
BO_ 0x403 XXX: 5 XXX
|
||||
BO_ 145 XXX_2: 8 XXX
|
||||
SG_ LAT_ACCEL : 7|10@0+ (0.02,-512) [-20|20] "m/s2" NEO
|
||||
|
||||
BO_ 0x405 DOORS_STATUS: 8 BDY
|
||||
SG_ DOOR_OPEN_FL : 34|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ DOOR_OPEN_FR : 33|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ DOOR_OPEN_RL : 32|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ DOOR_OPEN_RR : 47|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 228 STEERING_CONTROL: 5 ADAS
|
||||
SG_ STEER_TORQUE : 7|16@0- (1,0) [-3840|3840] "" EPS
|
||||
SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS
|
||||
SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS
|
||||
SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|0] "" EPS
|
||||
SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" EPS
|
||||
SG_ CHECKSUM : 35|4@0+ (1,0) [0|3] "" EPS
|
||||
|
||||
BO_ 0x406 XXX: 5 VSA
|
||||
BO_ 0x40A XXX: 5 XXX
|
||||
BO_ 0x40C XXX: 8 XXX
|
||||
BO_ 0x40F XXX: 8 XXX
|
||||
BO_ 0x421 XXX: 5 EPS
|
||||
BO_ 0x428 XXX: 7 XXX
|
||||
BO_ 0x454 XXX: 8 XXX
|
||||
BO_ 0x555 XXX: 5 XXX
|
||||
BO_ 0x640 XXX: 5 XXX
|
||||
BO_ 0x641 XXX: 8 XXX
|
||||
BO_ 304 GAS_PEDAL2: 8 PCM
|
||||
SG_ ENGINE_TORQUE_ESTIMATE : 7|16@0- (1,0) [-1000|1000] "Nm" NEO
|
||||
SG_ ENGINE_TORQUE_REQUEST : 23|16@0- (1,0) [-1000|1000] "Nm" NEO
|
||||
SG_ CAR_GAS : 39|8@0+ (1,0) [0|255] "" NEO
|
||||
|
||||
VAL_ 0x1A6 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none";
|
||||
VAL_ 0x1A6 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none";
|
||||
VAL_ 0x30C HUD_LEAD 3 "no_car" 2 "solid_car" 1 "dashed_car" 0 "no_car";
|
||||
VAL_ 0x1A6 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights";
|
||||
VAL_ 0x18F STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal";
|
||||
VAL_ 0x1A3 GEAR_SHIFTER 10 "S" 4 "D" 3 "N" 2 "R" 1 "P";
|
||||
VAL_ 0x33D BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep";
|
||||
VAL_ 0x1FA CHIME 4 "double_chime" 3 "single_chime" 2 "continuous_chime" 1 "repeating_chime" 0 "no_chime";
|
||||
VAL_ 0x1FA FCW 3 "fcw" 2 "fcw" 1 "fcw" 0 "no_fcw";
|
||||
BO_ 316 GAS_PEDAL: 8 PCM
|
||||
SG_ CAR_GAS : 39|8@0+ (1,0) [0|255] "" NEO
|
||||
|
||||
BO_ 342 STEERING_SENSORS: 6 EPS
|
||||
SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" NEO
|
||||
SG_ STEER_ANGLE_RATE : 23|16@0- (1,0) [-3000|3000] "deg/s" NEO
|
||||
SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 344 POWERTRAIN_DATA: 8 PCM
|
||||
SG_ XMISSION_SPEED : 7|16@0+ (0.002759506,0) [0|70] "m/s" NEO
|
||||
SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" NEO
|
||||
SG_ XMISSION_SPEED2 : 39|16@0+ (0.002759506,0) [0|70] "m/s" NEO
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 380 POWERTRAIN_DATA2: 8 PCM
|
||||
SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" NEO
|
||||
SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" NEO
|
||||
SG_ GAS_PRESSED : 39|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ ACC_STATUS : 38|1@0+ (1,0) [0|1] "rpm" NEO
|
||||
SG_ BOH_17C : 37|5@0+ (1,0) [0|1] "rpm" NEO
|
||||
SG_ BRAKE_LIGHTS_ON : 32|1@0+ (1,0) [0|1] "rpm" NEO
|
||||
SG_ BOH2_17C : 47|10@0+ (1,0) [0|1] "rpm" NEO
|
||||
SG_ BRAKE_PRESSED : 53|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ BOH3_17C : 52|5@0+ (1,0) [0|1] "rpm" NEO
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 398 XXX_3: 3 XXX
|
||||
|
||||
BO_ 399 STEER_STATUS: 7 EPS
|
||||
SG_ STEER_TORQUE_SENSOR : 7|16@0- (1,0) [-31000|31000] "tbd" NEO
|
||||
SG_ STEER_TORQUE_MOTOR : 23|16@0- (1,0) [-31000|31000] "tbd" NEO
|
||||
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" NEO
|
||||
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 419 GEARBOX: 8 PCM
|
||||
SG_ GEAR : 7|8@0+ (1,0) [0|256] "" NEO
|
||||
SG_ GEAR_SHIFTER : 35|4@0+ (1,0) [0|15] "" NEO
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 420 VSA_STATUS: 8 VSA
|
||||
SG_ USER_BRAKE : 7|16@0+ (0.015625,-103) [0|1000] "" NEO
|
||||
SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 422 SCM_BUTTONS: 8 SCM
|
||||
SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" NEO
|
||||
SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ MAIN_ON : 47|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ CRUISE_SETTING : 43|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 428 XXX_4: 8 XXX
|
||||
|
||||
BO_ 432 STANDSTILL: 7 VSA
|
||||
SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ BRAKE_ERROR_1 : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ BRAKE_ERROR_2 : 9|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 464 WHEEL_SPEEDS: 8 VSA
|
||||
SG_ WHEEL_SPEED_FL : 7|15@0+ (0.002759506,0) [0|70] "m/s" NEO
|
||||
SG_ WHEEL_SPEED_FR : 8|15@0+ (0.002759506,0) [0|70] "m/s" NEO
|
||||
SG_ WHEEL_SPEED_RL : 25|15@0+ (0.002759506,0) [0|70] "m/s" NEO
|
||||
SG_ WHEEL_SPEED_RR : 42|15@0+ (0.002759506,0) [0|70] "m/s" NEO
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 476 XXX_5: 4 XXX
|
||||
|
||||
BO_ 490 VEHICLE_DYNAMICS: 8 VSA
|
||||
SG_ LONG_ACCEL : 23|16@0- (0.0015384,0) [-20|20] "m/s2" NEO
|
||||
|
||||
BO_ 506 BRAKE_COMMAND: 8 ADAS
|
||||
SG_ COMPUTER_BRAKE : 7|10@0+ (0.003906248,0) [0|1] "" EBCM
|
||||
SG_ ZEROS_BOH : 13|5@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ COMPUTER_BRAKE_REQUEST : 8|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_BOH2 : 23|3@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_OVERRIDE : 20|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_BOH3 : 19|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_FAULT_CMD : 18|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_CANCEL_CMD : 17|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ COMPUTER_BRAKE_REQUEST_2 : 16|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_BOH4 : 31|8@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ BRAKE_LIGHTS : 39|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_BOH5 : 38|7@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CHIME : 47|3@0+ (1,0) [0|7] "" EBCM
|
||||
SG_ CRUISE_BOH6 : 44|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ FCW : 43|2@0+ (1,0) [0|3] "" EBCM
|
||||
SG_ CRUISE_BOH7 : 41|10@0+ (1,0) [0|0] "" EBCM
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EBCM
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EBCM
|
||||
|
||||
BO_ 512 GAS_COMMAND: 3 NEO
|
||||
SG_ GAS_COMMAND : 7|16@0+ (0.253984064,-328) [0|1] "" INTERCEPTOR
|
||||
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" INTERCEPTOR
|
||||
SG_ CHECKSUM : 19|4@0+ (1,0) [0|3] "" INTERCEPTOR
|
||||
|
||||
BO_ 513 GAS_SENSOR: 5 INTERCEPTOR
|
||||
SG_ INTERCEPTOR_GAS : 7|16@0+ (0.253984064,-328) [0|1] "" NEO
|
||||
SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.126992032,-656) [0|1] "" NEO
|
||||
SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 35|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 542 XXX_6: 7 XXX
|
||||
|
||||
BO_ 545 XXX_7: 4 XXX
|
||||
|
||||
BO_ 597 ROUGH_WHEEL_SPEED: 8 VSA
|
||||
SG_ WHEEL_SPEED_FL : 7|8@0+ (1,0) [0|255] "mph" NEO
|
||||
SG_ WHEEL_SPEED_FR : 15|8@0+ (1,0) [0|255] "mph" NEO
|
||||
SG_ WHEEL_SPEED_RL : 23|8@0+ (1,0) [0|255] "mph" NEO
|
||||
SG_ WHEEL_SPEED_RR : 31|8@0+ (1,0) [0|255] "mph" NEO
|
||||
SG_ SET_TO_X55 : 39|8@0+ (1,0) [0|255] "" NEO
|
||||
SG_ SET_TO_X55 : 47|8@0+ (1,0) [0|255] "" NEO
|
||||
|
||||
BO_ 660 SCM_COMMANDS: 8 SCM
|
||||
SG_ RIGHT_BLINKER : 6|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LEFT_BLINKER : 5|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ WIPERS_SPEED : 4|2@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 773 SEATBELT_STATUS: 7 BDY
|
||||
SG_ SEATBELT_DRIVER_LAMP : 7|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ SEATBELT_DRIVER_LATCHED : 13|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 777 XXX_8: 8 XXX
|
||||
|
||||
BO_ 780 ACC_HUD: 8 ADAS
|
||||
SG_ PCM_SPEED : 7|16@0+ (0.002763889,0) [0|100] "m/s" BDY
|
||||
SG_ PCM_GAS : 23|7@0+ (1,0) [0|127] "" BDY
|
||||
SG_ ZEROS_BOH : 16|1@0+ (1,0) [0|255] "" BDY
|
||||
SG_ CRUISE_SPEED : 31|8@0+ (1,0) [0|255] "" BDY
|
||||
SG_ DTC_MODE : 39|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ BOH : 38|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ ACC_PROBLEM : 37|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ FCM_OFF : 36|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ BOH_2 : 35|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ FCM_PROBLEM : 34|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ RADAR_OBSTRUCTED : 33|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ ENABLE_MINI_CAR : 32|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ SET_ME_X03 : 47|2@0+ (1,0) [0|3] "" BDY
|
||||
SG_ HUD_LEAD : 45|2@0+ (1,0) [0|3] "" BDY
|
||||
SG_ BOH_3 : 43|1@0+ (1,0) [0|3] "" BDY
|
||||
SG_ BOH_4 : 42|1@0+ (1,0) [0|3] "" BDY
|
||||
SG_ BOH_5 : 41|1@0+ (1,0) [0|3] "" BDY
|
||||
SG_ CRUISE_CONTROL_LABEL : 40|1@0+ (1,0) [0|3] "" BDY
|
||||
SG_ HUD_DISTANCE_3 : 52|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" BDY
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" BDY
|
||||
|
||||
BO_ 800 XXX_9: 8 XXX
|
||||
|
||||
BO_ 804 CRUISE: 8 PCM
|
||||
SG_ ENGINE_TEMPERATURE : 7|8@0+ (1,0) [0|255] "" NEO
|
||||
SG_ BOH : 15|8@0+ (1,0) [0|255] "" NEO
|
||||
SG_ TRIP_FUEL_CONSUMED : 23|16@0+ (1,0) [0|255] "" NEO
|
||||
SG_ CRUISE_SPEED_PCM : 39|8@0+ (1,0) [0|255] "" NEO
|
||||
SG_ BOH2 : 47|8@0- (1,0) [0|255] "" NEO
|
||||
SG_ BOH3 : 55|8@0+ (1,0) [0|255] "" NEO
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 808 XXX_10: 8 XXX
|
||||
|
||||
BO_ 819 XXX_11: 7 XXX
|
||||
|
||||
BO_ 821 XXX_12: 5 XXX
|
||||
|
||||
BO_ 829 LKAS_HUD_2: 5 ADAS
|
||||
SG_ CAM_TEMP_HIGH : 7|1@0+ (1,0) [0|255] "" BDY
|
||||
SG_ BOH : 6|7@0+ (1,0) [0|127] "" BDY
|
||||
SG_ DASHED_LANES : 14|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ DTC : 13|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ LKAS_PROBLEM : 12|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ LKAS_OFF : 11|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ SOLID_LANES : 10|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ LDW_RIGHT : 9|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ STEERING_REQUIRED : 8|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ BOH : 23|2@0+ (1,0) [0|4] "" BDY
|
||||
SG_ LDW_PROBLEM : 21|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ BEEP : 17|2@0+ (1,0) [0|1] "" BDY
|
||||
SG_ LDW_ON : 28|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ LDW_OFF : 27|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ CLEAN_WINDSHIELD : 26|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ SET_ME_X48 : 31|8@0+ (1,0) [0|255] "" BDY
|
||||
SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" BDY
|
||||
SG_ CHECKSUM : 35|4@0+ (1,0) [0|3] "" BDY
|
||||
|
||||
BO_ 882 XXX_13: 2 XXX
|
||||
|
||||
BO_ 884 XXX_14: 7 XXX
|
||||
|
||||
BO_ 887 XXX_15: 8 XXX
|
||||
|
||||
BO_ 888 XXX_16: 8 XXX
|
||||
|
||||
BO_ 892 XXX_17: 8 XXX
|
||||
|
||||
BO_ 923 XXX_18: 2 XXX
|
||||
|
||||
BO_ 929 XXX_19: 4 XXX
|
||||
|
||||
BO_ 983 XXX_20: 8 XXX
|
||||
|
||||
BO_ 985 XXX_21: 3 XXX
|
||||
|
||||
BO_ 1024 XXX_22: 5 XXX
|
||||
|
||||
BO_ 1027 XXX_23: 5 XXX
|
||||
|
||||
BO_ 1029 DOORS_STATUS: 8 BDY
|
||||
SG_ DOOR_OPEN_FL : 37|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ DOOR_OPEN_FR : 38|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ DOOR_OPEN_RL : 39|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ DOOR_OPEN_RR : 40|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 1030 XXX_24: 5 VSA
|
||||
|
||||
BO_ 1034 XXX_25: 5 XXX
|
||||
|
||||
BO_ 1036 XXX_26: 8 XXX
|
||||
|
||||
BO_ 1039 XXX_27: 8 XXX
|
||||
|
||||
BO_ 1057 XXX_28: 5 EPS
|
||||
|
||||
BO_ 1064 XXX_29: 7 XXX
|
||||
|
||||
BO_ 1108 XXX_30: 8 XXX
|
||||
|
||||
BO_ 1365 XXX_31: 5 XXX
|
||||
|
||||
BO_ 1600 XXX_32: 5 XXX
|
||||
|
||||
BO_ 1601 XXX_33: 8 XXX
|
||||
|
||||
BO_TX_BU_ 228 : NEO,ADAS;
|
||||
BO_TX_BU_ 506 : NEO,ADAS;
|
||||
BO_TX_BU_ 780 : NEO,ADAS;
|
||||
BO_TX_BU_ 829 : NEO,ADAS;
|
||||
|
||||
|
||||
CM_ SG_ 419 GEAR "10 = reverse, 11 = transition";
|
||||
CM_ SG_ 490 LONG_ACCEL "wheel speed derivative, noisy and zero snapping";
|
||||
CM_ SG_ 780 CRUISE_SPEED "255 = no speed";
|
||||
CM_ SG_ 804 CRUISE_SPEED_PCM "255 = no speed";
|
||||
CM_ SG_ 829 BEEP "beeps are pleasant, chimes are for warnngs etc...";
|
||||
VAL_ 399 STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ;
|
||||
VAL_ 419 GEAR_SHIFTER 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ;
|
||||
VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ;
|
||||
VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ;
|
||||
VAL_ 422 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ;
|
||||
VAL_ 506 CHIME 4 "double_chime" 3 "single_chime" 2 "continuous_chime" 1 "repeating_chime" 0 "no_chime" ;
|
||||
VAL_ 506 FCW 3 "fcw" 2 "fcw" 1 "fcw" 0 "no_fcw" ;
|
||||
VAL_ 780 HUD_LEAD 3 "no_car" 2 "solid_car" 1 "dashed_car" 0 "no_car" ;
|
||||
VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ;
|
||||
|
||||
CM_ SG_ 0x1A3 GEAR "10 = reverse, 11 = transition";
|
||||
CM_ SG_ 0x324 CRUISE_SPEED_ECHO "255 = no speed";
|
||||
CM_ SG_ 0x33D CRUISE_SPEED "255 = no speed";
|
||||
CM_ SG_ 0x1EA LONG_ACCEL "wheel speed derivative, noisy and zero snapping";
|
||||
CM_ SG_ 0x33D BEEP "beeps are pleasant, chimes are for warnngs etc...";
|
||||
|
||||
@@ -15,7 +15,7 @@ NS_ :
|
||||
ENVVAR_DATA_
|
||||
SGTYPE_
|
||||
SGTYPE_VAL_
|
||||
BA_DEF_SGTYPE_
|
||||
BA_DEF_SGTYPE_
|
||||
BA_SGTYPE_
|
||||
SIG_TYPE_REF_
|
||||
VAL_TABLE_
|
||||
@@ -33,143 +33,151 @@ NS_ :
|
||||
|
||||
BS_:
|
||||
|
||||
BU_: ADAS RADAR NEO XXX
|
||||
|
||||
BO_ 0x300 VEHICLE_STATE: 8 ADAS
|
||||
SG_ SET_ME_XF9 : 0|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ VEHICLE_SPEED : 8|8@1+ (1,0) [0|255] "kph" Vector__XXX
|
||||
|
||||
BO_ 0x301 VEHICLE_STATE2: 8 ADAS
|
||||
SG_ SET_ME_0F18510 : 0|28@1+ (1,0) [0|268435455] "" Vector__XXX
|
||||
SG_ SET_ME_25A0000 : 28|28@1+ (1,0) [0|268435455] "" Vector__XXX
|
||||
BO_ 768 VEHICLE_STATE: 8 ADAS
|
||||
SG_ SET_ME_XF9 : 7|8@0+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ VEHICLE_SPEED : 15|8@0+ (1,0) [0|255] "kph" Vector__XXX
|
||||
|
||||
BO_ 0x400 XXX: 8 RADAR
|
||||
BO_ 769 VEHICLE_STATE2: 8 ADAS
|
||||
SG_ SET_ME_0F18510 : 7|28@0+ (1,0) [0|268435455] "" Vector__XXX
|
||||
SG_ SET_ME_25A0000 : 27|28@0+ (1,0) [0|268435455] "" Vector__XXX
|
||||
|
||||
BO_ 0x410 XXX: 8 RADAR
|
||||
BO_ 1024 XXX_100: 8 RADAR
|
||||
|
||||
BO_ 0x411 XXX: 8 RADAR
|
||||
BO_ 1040 XXX_101: 8 RADAR
|
||||
|
||||
BO_ 0x412 XXX: 8 RADAR
|
||||
BO_ 1041 XXX_102: 8 RADAR
|
||||
|
||||
BO_ 0x413 XXX: 8 RADAR
|
||||
BO_ 1042 XXX_103: 8 RADAR
|
||||
|
||||
BO_ 0x414 XXX: 8 RADAR
|
||||
BO_ 1043 XXX_104: 8 RADAR
|
||||
|
||||
BO_ 0x415 XXX: 8 RADAR
|
||||
BO_ 1044 XXX_105: 8 RADAR
|
||||
|
||||
BO_ 0x416 XXX: 8 RADAR
|
||||
BO_ 1045 XXX_106: 8 RADAR
|
||||
|
||||
BO_ 0x417 XXX: 8 RADAR
|
||||
BO_ 1046 XXX_107: 8 RADAR
|
||||
|
||||
BO_ 0x420 XXX: 8 RADAR
|
||||
BO_ 1047 XXX_108: 8 RADAR
|
||||
|
||||
BO_ 0x421 XXX: 8 RADAR
|
||||
BO_ 1056 XXX_109: 8 RADAR
|
||||
|
||||
BO_ 0x422 XXX: 8 RADAR
|
||||
BO_ 1057 XXX_110: 8 RADAR
|
||||
|
||||
BO_ 0x423 XXX: 8 RADAR
|
||||
BO_ 1058 XXX_111: 8 RADAR
|
||||
|
||||
BO_ 0x424 XXX: 8 RADAR
|
||||
BO_ 1059 XXX_112: 8 RADAR
|
||||
|
||||
BO_ 0x430 TRACK_0: 8 RADAR
|
||||
SG_ LONG_DIST : 0|12@1+ (0.0625,0) [0|255.5] "m" Vector__XXX
|
||||
SG_ NEW_TRACK : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LAT_DIST : 14|10@1- (0.0625,0) [0|63.5] "m" Vector__XXX
|
||||
SG_ REL_SPEED : 24|12@1- (0.03125,0) [0|127.5] "m/s" Vector__XXX
|
||||
BO_ 1060 XXX_113: 8 RADAR
|
||||
|
||||
BO_ 0x431 TRACK_1: 8 RADAR
|
||||
SG_ LONG_DIST : 0|12@1+ (0.0625,0) [0|255.5] "m" Vector__XXX
|
||||
SG_ NEW_TRACK : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LAT_DIST : 14|10@1- (0.0625,0) [0|63.5] "m" Vector__XXX
|
||||
SG_ REL_SPEED : 24|12@1- (0.03125,0) [0|127.5] "m/s" Vector__XXX
|
||||
BO_ 1072 TRACK_0: 8 RADAR
|
||||
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
|
||||
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
|
||||
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO
|
||||
|
||||
BO_ 0x432 TRACK_2: 8 RADAR
|
||||
SG_ LONG_DIST : 0|12@1+ (0.0625,0) [0|255.5] "m" Vector__XXX
|
||||
SG_ NEW_TRACK : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LAT_DIST : 14|10@1- (0.0625,0) [0|63.5] "m" Vector__XXX
|
||||
SG_ REL_SPEED : 24|12@1- (0.03125,0) [0|127.5] "m/s" Vector__XXX
|
||||
BO_ 1073 TRACK_1: 8 RADAR
|
||||
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
|
||||
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
|
||||
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO
|
||||
|
||||
BO_ 0x433 TRACK_3: 8 RADAR
|
||||
SG_ LONG_DIST : 0|12@1+ (0.0625,0) [0|255.5] "m" Vector__XXX
|
||||
SG_ NEW_TRACK : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LAT_DIST : 14|10@1- (0.0625,0) [0|63.5] "m" Vector__XXX
|
||||
SG_ REL_SPEED : 24|12@1- (0.03125,0) [0|127.5] "m/s" Vector__XXX
|
||||
BO_ 1074 TRACK_2: 8 RADAR
|
||||
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
|
||||
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
|
||||
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO
|
||||
|
||||
BO_ 0x434 TRACK_4: 8 RADAR
|
||||
SG_ LONG_DIST : 0|12@1+ (0.0625,0) [0|255.5] "m" Vector__XXX
|
||||
SG_ NEW_TRACK : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LAT_DIST : 14|10@1- (0.0625,0) [0|63.5] "m" Vector__XXX
|
||||
SG_ REL_SPEED : 24|12@1- (0.03125,0) [0|127.5] "m/s" Vector__XXX
|
||||
BO_ 1075 TRACK_3: 8 RADAR
|
||||
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
|
||||
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
|
||||
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO
|
||||
|
||||
BO_ 0x435 TRACK_5: 8 RADAR
|
||||
SG_ LONG_DIST : 0|12@1+ (0.0625,0) [0|255.5] "m" Vector__XXX
|
||||
SG_ NEW_TRACK : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LAT_DIST : 14|10@1- (0.0625,0) [0|63.5] "m" Vector__XXX
|
||||
SG_ REL_SPEED : 24|12@1- (0.03125,0) [0|127.5] "m/s" Vector__XXX
|
||||
BO_ 1076 TRACK_4: 8 RADAR
|
||||
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
|
||||
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
|
||||
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO
|
||||
|
||||
BO_ 0x436 TRACK_6: 8 RADAR
|
||||
SG_ LONG_DIST : 0|12@1+ (0.0625,0) [0|255.5] "m" Vector__XXX
|
||||
SG_ NEW_TRACK : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LAT_DIST : 14|10@1- (0.0625,0) [0|63.5] "m" Vector__XXX
|
||||
SG_ REL_SPEED : 24|12@1- (0.03125,0) [0|127.5] "m/s" Vector__XXX
|
||||
BO_ 1077 TRACK_5: 8 RADAR
|
||||
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
|
||||
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
|
||||
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO
|
||||
|
||||
BO_ 0x437 TRACK_7: 8 RADAR
|
||||
SG_ LONG_DIST : 0|12@1+ (0.0625,0) [0|255.5] "m" Vector__XXX
|
||||
SG_ NEW_TRACK : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LAT_DIST : 14|10@1- (0.0625,0) [0|63.5] "m" Vector__XXX
|
||||
SG_ REL_SPEED : 24|12@1- (0.03125,0) [0|127.5] "m/s" Vector__XXX
|
||||
BO_ 1078 TRACK_6: 8 RADAR
|
||||
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
|
||||
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
|
||||
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO
|
||||
|
||||
BO_ 0x438 TRACK_8: 8 RADAR
|
||||
SG_ LONG_DIST : 0|12@1+ (0.0625,0) [0|255.5] "m" Vector__XXX
|
||||
SG_ NEW_TRACK : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LAT_DIST : 14|10@1- (0.0625,0) [0|63.5] "m" Vector__XXX
|
||||
SG_ REL_SPEED : 24|12@1- (0.03125,0) [0|127.5] "m/s" Vector__XXX
|
||||
BO_ 1079 TRACK_7: 8 RADAR
|
||||
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
|
||||
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
|
||||
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO
|
||||
|
||||
BO_ 0x439 TRACK_9: 8 RADAR
|
||||
SG_ LONG_DIST : 0|12@1+ (0.0625,0) [0|255.5] "m" Vector__XXX
|
||||
SG_ NEW_TRACK : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LAT_DIST : 14|10@1- (0.0625,0) [0|63.5] "m" Vector__XXX
|
||||
SG_ REL_SPEED : 24|12@1- (0.03125,0) [0|127.5] "m/s" Vector__XXX
|
||||
BO_ 1080 TRACK_8: 8 RADAR
|
||||
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
|
||||
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
|
||||
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO
|
||||
|
||||
BO_ 0x440 TRACK_10: 8 RADAR
|
||||
SG_ LONG_DIST : 0|12@1+ (0.0625,0) [0|255.5] "m" Vector__XXX
|
||||
SG_ NEW_TRACK : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LAT_DIST : 14|10@1- (0.0625,0) [0|63.5] "m" Vector__XXX
|
||||
SG_ REL_SPEED : 24|12@1- (0.03125,0) [0|127.5] "m/s" Vector__XXX
|
||||
BO_ 1081 TRACK_9: 8 RADAR
|
||||
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
|
||||
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
|
||||
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO
|
||||
|
||||
BO_ 0x441 TRACK_11: 8 RADAR
|
||||
SG_ LONG_DIST : 0|12@1+ (0.0625,0) [0|255.5] "m" Vector__XXX
|
||||
SG_ NEW_TRACK : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LAT_DIST : 14|10@1- (0.0625,0) [0|63.5] "m" Vector__XXX
|
||||
SG_ REL_SPEED : 24|12@1- (0.03125,0) [0|127.5] "m/s" Vector__XXX
|
||||
BO_ 1088 TRACK_10: 8 RADAR
|
||||
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
|
||||
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
|
||||
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO
|
||||
|
||||
BO_ 0x442 TRACK_12: 8 RADAR
|
||||
SG_ LONG_DIST : 0|12@1+ (0.0625,0) [0|255.5] "m" Vector__XXX
|
||||
SG_ NEW_TRACK : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LAT_DIST : 14|10@1- (0.0625,0) [0|63.5] "m" Vector__XXX
|
||||
SG_ REL_SPEED : 24|12@1- (0.03125,0) [0|127.5] "m/s" Vector__XXX
|
||||
BO_ 1089 TRACK_11: 8 RADAR
|
||||
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
|
||||
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
|
||||
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO
|
||||
|
||||
BO_ 0x443 TRACK_13: 8 RADAR
|
||||
SG_ LONG_DIST : 0|12@1+ (0.0625,0) [0|255.5] "m" Vector__XXX
|
||||
SG_ NEW_TRACK : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LAT_DIST : 14|10@1- (0.0625,0) [0|63.5] "m" Vector__XXX
|
||||
SG_ REL_SPEED : 24|12@1- (0.03125,0) [0|127.5] "m/s" Vector__XXX
|
||||
BO_ 1090 TRACK_12: 8 RADAR
|
||||
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
|
||||
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
|
||||
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO
|
||||
|
||||
BO_ 0x444 TRACK_14: 8 RADAR
|
||||
SG_ LONG_DIST : 0|12@1+ (0.0625,0) [0|255.5] "m" Vector__XXX
|
||||
SG_ NEW_TRACK : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LAT_DIST : 14|10@1- (0.0625,0) [0|63.5] "m" Vector__XXX
|
||||
SG_ REL_SPEED : 24|12@1- (0.03125,0) [0|127.5] "m/s" Vector__XXX
|
||||
BO_ 1091 TRACK_13: 8 RADAR
|
||||
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
|
||||
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
|
||||
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO
|
||||
|
||||
BO_ 0x445 TRACK_15: 8 RADAR
|
||||
SG_ LONG_DIST : 0|12@1+ (0.0625,0) [0|255.5] "m" Vector__XXX
|
||||
SG_ NEW_TRACK : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LAT_DIST : 14|10@1- (0.0625,0) [0|63.5] "m" Vector__XXX
|
||||
SG_ REL_SPEED : 24|12@1- (0.03125,0) [0|127.5] "m/s" Vector__XXX
|
||||
BO_ 1092 TRACK_14: 8 RADAR
|
||||
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
|
||||
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
|
||||
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO
|
||||
|
||||
BO_ 0x4FF XXX: 8 RADAR
|
||||
BO_ 1093 TRACK_15: 8 RADAR
|
||||
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
|
||||
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
|
||||
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO
|
||||
|
||||
BO_ 1279 XXX_114: 8 RADAR
|
||||
|
||||
BO_ 1280 XXX_115: 8 RADAR
|
||||
|
||||
BO_ 1296 XXX_116: 8 RADAR
|
||||
|
||||
BO_ 1297 XXX_117: 8 RADAR
|
||||
|
||||
BO_TX_BU_ 768 : NEO,ADAS;
|
||||
BO_TX_BU_ 769 : NEO,ADAS;
|
||||
|
||||
BO_ 0x500 XXX: 8 RADAR
|
||||
|
||||
BO_ 0x510 XXX: 8 RADAR
|
||||
|
||||
BO_ 0x511 XXX: 8 RADAR
|
||||
|
||||
@@ -15,7 +15,7 @@ NS_ :
|
||||
ENVVAR_DATA_
|
||||
SGTYPE_
|
||||
SGTYPE_VAL_
|
||||
BA_DEF_SGTYPE_
|
||||
BA_DEF_SGTYPE_
|
||||
BA_SGTYPE_
|
||||
SIG_TYPE_REF_
|
||||
VAL_TABLE_
|
||||
@@ -33,287 +33,311 @@ NS_ :
|
||||
|
||||
BS_:
|
||||
|
||||
BO_ 0x039 XXX: 3 XXX
|
||||
BU_: INTERCEPTOR EBCM NEO ADAS PCM EPS VSA SCM BDY XXX EPB
|
||||
|
||||
BO_ 0x94 XXX: 8 XXX
|
||||
SG_ LAT_ACCEL : 0|10@1+ (0.02,-512) [-20|20] "m/s2" Vector__XXX
|
||||
SG_ LONG_ACCEL : 31|9@1- (-0.02,0) [-20|20] "m/s2" Vector__XXX
|
||||
|
||||
BO_ 0x0E4 STEERING_CONTROL: 5 ADAS
|
||||
SG_ STEER_TORQUE : 0|16@1- (1,0) [-3840|3840] "" Vector__XXX
|
||||
SG_ STEER_TORQUE_REQUEST : 16|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ SET_ME_X00 : 17|7@1+ (1,0) [0|127] "" Vector__XXX
|
||||
SG_ SET_ME_X00_2 : 24|8@1+ (1,0) [0|0] "" Vector__XXX
|
||||
SG_ CHECKSUM : 32|4@1+ (1,0) [0|15] "" Vector__XXX
|
||||
SG_ COUNTER : 38|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 57 XXX_1: 3 XXX
|
||||
|
||||
BO_ 0x130 GAS_PEDAL2: 8 PCM
|
||||
SG_ ENGINE_TORQUE_ESTIMATE : 0|16@1- (1,0) [-1000|1000] "Nm" Vector__XXX
|
||||
SG_ ENGINE_TORQUE_REQUEST : 16|16@1- (1,0) [-1000|1000] "Nm" Vector__XXX
|
||||
SG_ CAR_GAS : 32|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
BO_ 148 XXX_2: 8 XXX
|
||||
SG_ LAT_ACCEL : 7|10@0+ (0.02,-512) [-20|20] "m/s2" NEO
|
||||
SG_ LONG_ACCEL : 24|9@0- (-0.02,0) [-20|20] "m/s2" NEO
|
||||
|
||||
BO_ 0x14A STEERING_SENSORS: 8 EPS
|
||||
SG_ STEER_ANGLE : 0|16@1- (-0.1,0) [-500|500] "deg" Vector__XXX
|
||||
SG_ STEER_ANGLE_RATE : 16|16@1- (-1,0) [-3000|3000] "deg/s" Vector__XXX
|
||||
SG_ STEER_ANGLE_OFFSET : 32|8@1- (-0.1,0) [-128|127] "deg" Vector__XXX
|
||||
SG_ STEER_WHEEL_ANGLE : 40|16@1- (-0.1,0) [-500|500] "deg" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 228 STEERING_CONTROL: 5 ADAS
|
||||
SG_ STEER_TORQUE : 7|16@0- (1,0) [-3840|3840] "" EPS
|
||||
SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS
|
||||
SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS
|
||||
SG_ SET_ME_X00_2 : 31|8@0+ (1,0) [0|0] "" EPS
|
||||
SG_ CHECKSUM : 39|4@0+ (1,0) [0|15] "" EPS
|
||||
SG_ COUNTER : 33|2@0+ (1,0) [0|3] "" EPS
|
||||
|
||||
BO_ 0x158 POWERTRAIN_DATA: 8 PCM
|
||||
SG_ XMISSION_SPEED : 0|16@1+ (0.002759506,0) [0|70] "m/s" Vector__XXX
|
||||
SG_ ENGINE_RPM : 16|16@1+ (1,0) [0|15000] "rpm" Vector__XXX
|
||||
SG_ XMISSION_SPEED2 : 32|16@1+ (0.002759506,0) [0|70] "m/s" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 304 GAS_PEDAL2: 8 PCM
|
||||
SG_ ENGINE_TORQUE_ESTIMATE : 7|16@0- (1,0) [-1000|1000] "Nm" NEO
|
||||
SG_ ENGINE_TORQUE_REQUEST : 23|16@0- (1,0) [-1000|1000] "Nm" NEO
|
||||
SG_ CAR_GAS : 39|8@0+ (1,0) [0|255] "" NEO
|
||||
|
||||
BO_ 0x17C POWERTRAIN_DATA2: 8 PCM
|
||||
SG_ PEDAL_GAS : 0|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ ENGINE_RPM : 16|16@1+ (1,0) [0|15000] "rpm" Vector__XXX
|
||||
SG_ GAS_PRESSED : 32|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ ACC_STATUS : 33|1@1+ (1,0) [0|1] "rpm" Vector__XXX
|
||||
SG_ BOH_17C : 34|5@1+ (1,0) [0|1] "rpm" Vector__XXX
|
||||
SG_ BRAKE_LIGHTS_ON : 39|1@1+ (1,0) [0|1] "rpm" Vector__XXX
|
||||
SG_ BOH2_17C : 40|10@1+ (1,0) [0|1] "rpm" Vector__XXX
|
||||
SG_ BRAKE_PRESSED : 50|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ BOH3_17C : 51|5@1+ (1,0) [0|1] "rpm" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 330 STEERING_SENSORS: 8 EPS
|
||||
SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" NEO
|
||||
SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" NEO
|
||||
SG_ STEER_ANGLE_OFFSET : 39|8@0- (-0.1,0) [-128|127] "deg" NEO
|
||||
SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" NEO
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 0x18F STEER_STATUS: 7 EPS
|
||||
SG_ STEER_TORQUE_SENSOR : 0|16@1- (1,0) [-31000|31000] "tbd" Vector__XXX
|
||||
SG_ STEER_TORQUE_MOTOR : 16|16@1- (1,0) [-31000|31000] "tbd" Vector__XXX
|
||||
SG_ STEER_STATUS : 32|4@1+ (1,0) [0|15] "" Vector__XXX
|
||||
SG_ STEER_CONTROL_ACTIVE : 36|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ COUNTER : 50|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 52|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 344 POWERTRAIN_DATA: 8 PCM
|
||||
SG_ XMISSION_SPEED : 7|16@0+ (0.002759506,0) [0|70] "m/s" NEO
|
||||
SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" NEO
|
||||
SG_ XMISSION_SPEED2 : 39|16@0+ (0.002759506,0) [0|70] "m/s" NEO
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 0x191 GEARBOX: 8 PCM
|
||||
SG_ GEAR_SHIFTER : 2|6@1+ (1,0) [0|63] "" Vector__XXX
|
||||
SG_ GEAR : 36|4@1+ (1,0) [0|15] "" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 380 POWERTRAIN_DATA2: 8 PCM
|
||||
SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" NEO
|
||||
SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" NEO
|
||||
SG_ GAS_PRESSED : 39|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ ACC_STATUS : 38|1@0+ (1,0) [0|1] "rpm" NEO
|
||||
SG_ BOH_17C : 37|5@0+ (1,0) [0|1] "rpm" NEO
|
||||
SG_ BRAKE_LIGHTS_ON : 32|1@0+ (1,0) [0|1] "rpm" NEO
|
||||
SG_ BOH2_17C : 47|10@0+ (1,0) [0|1] "rpm" NEO
|
||||
SG_ BRAKE_PRESSED : 53|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ BOH3_17C : 52|5@0+ (1,0) [0|1] "rpm" NEO
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 0x1A4 VSA_STATUS: 8 VSA
|
||||
SG_ USER_BRAKE : 0|16@1+ (0.015625,-103) [0|1000] "" Vector__XXX
|
||||
SG_ ESP_DISABLED : 27|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 399 STEER_STATUS: 7 EPS
|
||||
SG_ STEER_TORQUE_SENSOR : 7|16@0- (1,0) [-31000|31000] "tbd" NEO
|
||||
SG_ STEER_TORQUE_MOTOR : 23|16@0- (1,0) [-31000|31000] "tbd" NEO
|
||||
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" NEO
|
||||
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 0x1AB XXX: 3 VSA
|
||||
BO_ 401 GEARBOX: 8 PCM
|
||||
SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" NEO
|
||||
SG_ GEAR : 35|4@0+ (1,0) [0|15] "" NEO
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 0x1AC XXX: 8 XXX
|
||||
BO_ 420 VSA_STATUS: 8 VSA
|
||||
SG_ USER_BRAKE : 7|16@0+ (0.015625,-103) [0|1000] "" NEO
|
||||
SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 0x1B0 STANDSTILL: 7 VSA
|
||||
SG_ WHEELS_MOVING : 11|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ BRAKE_ERROR_1 : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ BRAKE_ERROR_2 : 14|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ COUNTER : 50|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 52|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 427 XXX_3: 3 VSA
|
||||
|
||||
BO_ 0x1C2 XXX: 8 EPB
|
||||
SG_ EPB_ACTIVE : 4|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ EPB_STATE : 26|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 428 XXX_4: 8 XXX
|
||||
|
||||
BO_ 0x1D0 WHEEL_SPEEDS: 8 VSA
|
||||
SG_ WHEEL_SPEED_FL : 0|15@1+ (0.002759506,0) [0|70] "m/s" Vector__XXX
|
||||
SG_ WHEEL_SPEED_FR : 15|15@1+ (0.002759506,0) [0|70] "m/s" Vector__XXX
|
||||
SG_ WHEEL_SPEED_RL : 30|15@1+ (0.002759506,0) [0|70] "m/s" Vector__XXX
|
||||
SG_ WHEEL_SPEED_RR : 45|15@1+ (0.002759506,0) [0|70] "m/s" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 432 STANDSTILL: 7 VSA
|
||||
SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ BRAKE_ERROR_1 : 11|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ BRAKE_ERROR_2 : 9|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 0x1D6 XXX: 2 VSA
|
||||
BO_ 450 XXX_5: 8 EPB
|
||||
SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 0x1DC XXX: 7 XXX
|
||||
BO_ 464 WHEEL_SPEEDS: 8 VSA
|
||||
SG_ WHEEL_SPEED_FL : 7|15@0+ (0.002759506,0) [0|70] "m/s" NEO
|
||||
SG_ WHEEL_SPEED_FR : 8|15@0+ (0.002759506,0) [0|70] "m/s" NEO
|
||||
SG_ WHEEL_SPEED_RL : 25|15@0+ (0.002759506,0) [0|70] "m/s" NEO
|
||||
SG_ WHEEL_SPEED_RR : 42|15@0+ (0.002759506,0) [0|70] "m/s" NEO
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 0x1E7 XXX: 4 VSA
|
||||
SG_ BRAKE_PRESSURE1 : 0|10@1+ (0.015625,-103) [0|1000] "" Vector__XXX
|
||||
SG_ BRAKE_PRESSURE2 : 14|10@1+ (0.015625,-103) [0|1000] "" Vector__XXX
|
||||
BO_ 470 XXX_6: 2 VSA
|
||||
|
||||
BO_ 0x1EA VEHICLE_DYNAMICS: 8 VSA
|
||||
SG_ LONG_ACCEL : 16|16@1- (0.0015384,0) [-20|20] "m/s2" Vector__XXX
|
||||
BO_ 476 XXX_7: 7 XXX
|
||||
|
||||
BO_ 0x1ED XXX: 5 VSA
|
||||
BO_ 487 XXX_8: 4 VSA
|
||||
SG_ BRAKE_PRESSURE1 : 7|10@0+ (0.015625,-103) [0|1000] "" NEO
|
||||
SG_ BRAKE_PRESSURE2 : 9|10@0+ (0.015625,-103) [0|1000] "" NEO
|
||||
|
||||
BO_ 0x1FA BRAKE_COMMAND: 8 ADAS
|
||||
SG_ COMPUTER_BRAKE : 0|10@1+ (0.003906248,0) [0|1.0] "" Vector__XXX
|
||||
SG_ ZEROS_BOH : 10|5@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ COMPUTER_BRAKE_REQUEST : 15|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CRUISE_BOH2 : 16|3@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CRUISE_OVERRIDE : 19|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CRUISE_BOH3 : 20|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CRUISE_FAULT_CMD : 21|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CRUISE_CANCEL_CMD : 22|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ COMPUTER_BRAKE_REQUEST_2 : 23|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ SET_ME_0X80 : 24|8@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ BRAKE_LIGHTS : 32|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CRUISE_STATES : 33|7@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CHIME : 40|3@1+ (1,0) [0|7] "" Vector__XXX
|
||||
SG_ ZEROS_BOH6 : 43|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ FCW : 44|1@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ ZEROS_BOH3 : 45|2@1+ (1,0) [0|0] "" Vector__XXX
|
||||
SG_ FCW2 : 47|1@1+ (1,0) [0|0] "" Vector__XXX
|
||||
SG_ ZEROS_BOH4 : 48|8@1+ (1,0) [0|0] "" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 490 VEHICLE_DYNAMICS: 8 VSA
|
||||
SG_ LONG_ACCEL : 23|16@0- (0.0015384,0) [-20|20] "m/s2" NEO
|
||||
|
||||
BO_ 0x200 GAS_COMMAND: 3 ADAS
|
||||
SG_ GAS_COMMAND : 0|16@1+ (0.253984064,-328) [0|1] "" Vector__XXX
|
||||
SG_ COUNTER : 18|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 20|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 493 XXX_9: 5 VSA
|
||||
|
||||
BO_ 0x201 GAS_SENSOR: 5 ADAS
|
||||
SG_ INTERCEPTOR_GAS : 0|16@1+ (0.253984064,-328) [0|1] "" Vector__XXX
|
||||
SG_ INTERCEPTOR_GAS2 : 16|16@1+ (0.126992032,-656) [0|1] "" Vector__XXX
|
||||
SG_ COUNTER : 34|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 36|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 506 BRAKE_COMMAND: 8 ADAS
|
||||
SG_ COMPUTER_BRAKE : 7|10@0+ (0.003906248,0) [0|1] "" EBCM
|
||||
SG_ ZEROS_BOH : 13|5@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ COMPUTER_BRAKE_REQUEST : 8|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_BOH2 : 23|3@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_OVERRIDE : 20|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_BOH3 : 19|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_FAULT_CMD : 18|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_CANCEL_CMD : 17|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ COMPUTER_BRAKE_REQUEST_2 : 16|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ SET_ME_0X80 : 31|8@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ BRAKE_LIGHTS : 39|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CRUISE_STATES : 38|7@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ CHIME : 47|3@0+ (1,0) [0|7] "" EBCM
|
||||
SG_ ZEROS_BOH6 : 44|1@0+ (1,0) [0|1] "" EBCM
|
||||
SG_ FCW : 43|1@0+ (1,0) [0|3] "" EBCM
|
||||
SG_ ZEROS_BOH3 : 42|2@0+ (1,0) [0|0] "" EBCM
|
||||
SG_ FCW2 : 40|1@0+ (1,0) [0|0] "" EBCM
|
||||
SG_ ZEROS_BOH4 : 55|8@0+ (1,0) [0|0] "" EBCM
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EBCM
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EBCM
|
||||
|
||||
BO_ 0x221 XXX: 6 XXX
|
||||
BO_ 512 GAS_COMMAND: 3 NEO
|
||||
SG_ GAS_COMMAND : 7|16@0+ (0.253984064,-328) [0|1] "" INTERCEPTOR
|
||||
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" INTERCEPTOR
|
||||
SG_ CHECKSUM : 19|4@0+ (1,0) [0|3] "" INTERCEPTOR
|
||||
|
||||
BO_ 0x255 ROUGH_WHEEL_SPEED: 8 VSA
|
||||
SG_ WHEEL_SPEED_FL : 0|8@1+ (1,0) [0|255] "mph" Vector__XXX
|
||||
SG_ WHEEL_SPEED_FR : 8|8@1+ (1,0) [0|255] "mph" Vector__XXX
|
||||
SG_ WHEEL_SPEED_RL : 16|8@1+ (1,0) [0|255] "mph" Vector__XXX
|
||||
SG_ WHEEL_SPEED_RR : 24|8@1+ (1,0) [0|255] "mph" Vector__XXX
|
||||
SG_ SET_TO_X55 : 32|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ SET_TO_X55 : 40|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
BO_ 513 GAS_SENSOR: 5 INTERCEPTOR
|
||||
SG_ INTERCEPTOR_GAS : 7|16@0+ (0.253984064,-328) [0|1] "" NEO
|
||||
SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.126992032,-656) [0|1] "" NEO
|
||||
SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 35|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 0x296 CRUISE_BUTTONS: 4 SCM
|
||||
SG_ CRUISE_BUTTONS : 0|3@1+ (1,0) [0|7] "" Vector__XXX
|
||||
SG_ CRUISE_SETTING : 4|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 545 XXX_10: 6 XXX
|
||||
|
||||
BO_ 0x305 SEATBELT_STATUS: 7 BDY
|
||||
SG_ SEATBELT_DRIVER_LAMP : 0|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ SEATBELT_DRIVER_LATCHED : 10|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ COUNTER : 50|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 52|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 597 ROUGH_WHEEL_SPEED: 8 VSA
|
||||
SG_ WHEEL_SPEED_FL : 7|8@0+ (1,0) [0|255] "mph" NEO
|
||||
SG_ WHEEL_SPEED_FR : 15|8@0+ (1,0) [0|255] "mph" NEO
|
||||
SG_ WHEEL_SPEED_RL : 23|8@0+ (1,0) [0|255] "mph" NEO
|
||||
SG_ WHEEL_SPEED_RR : 31|8@0+ (1,0) [0|255] "mph" NEO
|
||||
SG_ SET_TO_X55 : 39|8@0+ (1,0) [0|255] "" NEO
|
||||
SG_ SET_TO_X55 : 47|8@0+ (1,0) [0|255] "" NEO
|
||||
|
||||
BO_ 0x309 XXX: 8 XXX
|
||||
BO_ 662 CRUISE_BUTTONS: 4 SCM
|
||||
SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" NEO
|
||||
SG_ CRUISE_SETTING : 3|2@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 0x30C ACC_HUD: 8 ADAS
|
||||
SG_ PCM_SPEED : 0|16@1+ (0.002763889,0) [0|100] "m/s" Vector__XXX
|
||||
SG_ PCM_GAS : 16|7@1+ (1,0) [0|127] "" Vector__XXX
|
||||
SG_ ZEROS_BOH : 23|1@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ CRUISE_SPEED : 24|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ DTC_MODE : 32|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ BOH : 33|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ ACC_PROBLEM : 34|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ FCM_OFF : 35|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ BOH_2 : 36|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ FCM_PROBLEM : 37|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ RADAR_OBSTRUCTED : 38|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ ENABLE_MINI_CAR : 39|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ HUD_DISTANCE : 40|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ HUD_LEAD : 42|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ BOH_3 : 44|1@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ BOH_4 : 45|1@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ BOH_5 : 46|1@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CRUISE_CONTROL_LABEL : 47|1@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 773 SEATBELT_STATUS: 7 BDY
|
||||
SG_ SEATBELT_DRIVER_LAMP : 7|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ SEATBELT_DRIVER_LATCHED : 13|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 0x31B XXX: 8 XXX
|
||||
BO_ 777 XXX_11: 8 XXX
|
||||
|
||||
BO_ 0x320 XXX: 8 XXX
|
||||
BO_ 780 ACC_HUD: 8 ADAS
|
||||
SG_ PCM_SPEED : 7|16@0+ (0.002763889,0) [0|100] "m/s" BDY
|
||||
SG_ PCM_GAS : 23|7@0+ (1,0) [0|127] "" BDY
|
||||
SG_ ZEROS_BOH : 16|1@0+ (1,0) [0|255] "" BDY
|
||||
SG_ CRUISE_SPEED : 31|8@0+ (1,0) [0|255] "" BDY
|
||||
SG_ DTC_MODE : 39|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ BOH : 38|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ ACC_PROBLEM : 37|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ FCM_OFF : 36|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ BOH_2 : 35|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ FCM_PROBLEM : 34|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ RADAR_OBSTRUCTED : 33|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ ENABLE_MINI_CAR : 32|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ HUD_DISTANCE : 47|2@0+ (1,0) [0|3] "" BDY
|
||||
SG_ HUD_LEAD : 45|2@0+ (1,0) [0|3] "" BDY
|
||||
SG_ BOH_3 : 43|1@0+ (1,0) [0|3] "" BDY
|
||||
SG_ BOH_4 : 42|1@0+ (1,0) [0|3] "" BDY
|
||||
SG_ BOH_5 : 41|1@0+ (1,0) [0|3] "" BDY
|
||||
SG_ CRUISE_CONTROL_LABEL : 40|1@0+ (1,0) [0|3] "" BDY
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" BDY
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" BDY
|
||||
|
||||
BO_ 0x324 CRUISE: 8 PCM
|
||||
SG_ ENGINE_TEMPERATURE : 0|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ BOH : 8|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ TRIP_FUEL_CONSUMED : 16|16@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ CRUISE_SPEED_PCM : 32|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ BOH2 : 40|8@1- (1,0) [0|255] "" Vector__XXX
|
||||
SG_ BOH3 : 48|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 795 XXX_12: 8 XXX
|
||||
|
||||
BO_ 0x326 SCM_FEEDBACK: 8 SCM
|
||||
SG_ CMBS_BUTTON : 17|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ MAIN_ON : 27|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ RIGHT_BLINKER : 28|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LEFT_BLINKER : 29|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
|
||||
BO_ 800 XXX_13: 8 XXX
|
||||
|
||||
BO_ 0x328 XXX: 8 XXX
|
||||
BO_ 804 CRUISE: 8 PCM
|
||||
SG_ ENGINE_TEMPERATURE : 7|8@0+ (1,0) [0|255] "" NEO
|
||||
SG_ BOH : 15|8@0+ (1,0) [0|255] "" NEO
|
||||
SG_ TRIP_FUEL_CONSUMED : 23|16@0+ (1,0) [0|255] "" NEO
|
||||
SG_ CRUISE_SPEED_PCM : 39|8@0+ (1,0) [0|255] "" NEO
|
||||
SG_ BOH2 : 47|8@0- (1,0) [0|255] "" NEO
|
||||
SG_ BOH3 : 55|8@0+ (1,0) [0|255] "" NEO
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 0x33D LKAS_HUD_2: 5 ADAS
|
||||
SG_ CAM_TEMP_HIGH : 0|1@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ BOH : 1|7@1+ (1,0) [0|127] "" Vector__XXX
|
||||
SG_ DASHED_LANES : 9|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ DTC : 10|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LKAS_PROBLEM : 11|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LKAS_OFF : 12|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ SOLID_LANES : 13|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LDW_RIGHT : 14|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ STEERING_REQUIRED : 15|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ BOH : 16|2@1+ (1,0) [0|4] "" Vector__XXX
|
||||
SG_ LDW_PROBLEM : 18|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ BEEP : 22|2@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LDW_ON : 27|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ LDW_OFF : 28|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ CLEAN_WINDSHIELD : 29|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ SET_ME_X48 : 24|8@1+ (1,0) [0|255] "" Vector__XXX
|
||||
SG_ COUNTER : 34|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 36|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 806 SCM_FEEDBACK: 8 SCM
|
||||
SG_ CMBS_BUTTON : 22|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ MAIN_ON : 28|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ RIGHT_BLINKER : 27|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ LEFT_BLINKER : 26|1@0+ (1,0) [0|1] "" NEO
|
||||
|
||||
BO_ 0x35E XXX: 8 ADAS
|
||||
SG_ UI_ALERTS : 0|56@1+ (1,0) [0|127] "" Vector__XXX
|
||||
BO_ 808 XXX_14: 8 XXX
|
||||
|
||||
BO_ 0x374 XXX: 8 XXX
|
||||
BO_ 0x37B XXX: 8 XXX
|
||||
BO_ 0x37C XXX: 8 XXX
|
||||
BO_ 829 LKAS_HUD_2: 5 ADAS
|
||||
SG_ CAM_TEMP_HIGH : 7|1@0+ (1,0) [0|255] "" BDY
|
||||
SG_ BOH : 6|7@0+ (1,0) [0|127] "" BDY
|
||||
SG_ DASHED_LANES : 14|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ DTC : 13|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ LKAS_PROBLEM : 12|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ LKAS_OFF : 11|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ SOLID_LANES : 10|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ LDW_RIGHT : 9|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ STEERING_REQUIRED : 8|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ BOH : 23|2@0+ (1,0) [0|4] "" BDY
|
||||
SG_ LDW_PROBLEM : 21|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ BEEP : 17|2@0+ (1,0) [0|1] "" BDY
|
||||
SG_ LDW_ON : 28|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ LDW_OFF : 27|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ CLEAN_WINDSHIELD : 26|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ SET_ME_X48 : 31|8@0+ (1,0) [0|255] "" BDY
|
||||
SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" BDY
|
||||
SG_ CHECKSUM : 35|4@0+ (1,0) [0|3] "" BDY
|
||||
|
||||
BO_ 0x39F XXX: 8 ADAS
|
||||
SG_ ZEROS_BOH : 0|17@1+ (1,0) [0|127] "" Vector__XXX
|
||||
SG_ APPLY_BRAKES_FOR_CANC : 16|1@1+ (1,0) [0|15] "" Vector__XXX
|
||||
SG_ ZEROS_BOH2 : 17|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ RESUME_INSTRUCTION : 18|1@1+ (1,0) [0|15] "" Vector__XXX
|
||||
SG_ ACC_ALERTS : 19|5@1+ (1,0) [0|15] "" Vector__XXX
|
||||
SG_ ZEROS_BOH2 : 24|8@1+ (1,0) [0|127] "" Vector__XXX
|
||||
SG_ LEAD_SPEED : 32|9@1+ (1,0) [0|127] "" Vector__XXX
|
||||
SG_ LEAD_STATE : 41|3@1+ (1,0) [0|127] "" Vector__XXX
|
||||
SG_ LEAD_DISTANCE : 44|5@1+ (1,0) [0|31] "" Vector__XXX
|
||||
SG_ ZEROS_BOH3 : 49|7@1+ (1,0) [0|127] "" Vector__XXX
|
||||
BO_ 862 XXX_15: 8 ADAS
|
||||
SG_ UI_ALERTS : 7|56@0+ (1,0) [0|127] "" BDY
|
||||
|
||||
BO_ 0x3A1 XXX: 8 XXX
|
||||
BO_ 0x3D9 XXX: 3 XXX
|
||||
BO_ 0x400 XXX: 5 XXX
|
||||
BO_ 0x403 XXX: 5 XXX
|
||||
BO_ 884 XXX_16: 8 XXX
|
||||
|
||||
BO_ 0x405 DOORS_STATUS: 8 BDY
|
||||
SG_ DOOR_OPEN_FL : 34|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ DOOR_OPEN_FR : 33|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ DOOR_OPEN_RL : 32|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ DOOR_OPEN_RR : 47|1@1+ (1,0) [0|1] "" Vector__XXX
|
||||
SG_ COUNTER : 58|2@1+ (1,0) [0|3] "" Vector__XXX
|
||||
SG_ CHECKSUM : 60|4@1+ (1,0) [0|3] "" Vector__XXX
|
||||
BO_ 891 XXX_17: 8 XXX
|
||||
|
||||
BO_ 0x40C XXX: 8 XXX
|
||||
BO_ 0x40F XXX: 8 XXX
|
||||
BO_ 0x454 XXX: 8 XXX
|
||||
BO_ 0x516 XXX: 8 XXX
|
||||
BO_ 0x52A XXX: 5 XXX
|
||||
BO_ 0x551 XXX: 5 XXX
|
||||
BO_ 0x555 XXX: 5 XXX
|
||||
BO_ 0x590 XXX: 5 XXX
|
||||
BO_ 0x640 XXX: 5 XXX
|
||||
BO_ 0x641 XXX: 8 XXX
|
||||
BO_ 0x661 XXX: 8 XXX
|
||||
BO_ 892 XXX_18: 8 XXX
|
||||
|
||||
VAL_ 0x296 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none";
|
||||
VAL_ 0x296 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none";
|
||||
VAL_ 0x33D HUD_LEAD 3 "acc_off" 2 "solid_car" 1 "dashed_car" 0 "no_car";
|
||||
VAL_ 0x1A6 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights";
|
||||
VAL_ 0x18F STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal";
|
||||
VAL_ 0x191 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P";
|
||||
VAL_ 0x33D BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep";
|
||||
VAL_ 0x1FA CHIME 4 "double_chime" 3 "single_chime" 2 "continuous_chime" 1 "repeating_chime" 0 "no_chime";
|
||||
VAL_ 0x1C2 EPB_STATE 3 "engaged" 2 "disengaging" 1 "engaging" 0 "disengaged";
|
||||
VAL_ 0x326 CMBS_BUTTON 3 "pressed" 0 "released";
|
||||
VAL_ 0x39F ACC_ALERTS 29 "esp_active_acc_canceled" 10 "b_pedal_applied" 9 "speed_too_low" 8 "speed_too_high" 7 "p_brake_applied" 6 "gear_no_d" 5 "seatbelt" 4 "too_steep_downhill" 3 "too_steep_uphill" 2 "too_close" 1 "no_vehicle_ahead";
|
||||
VAL_ 0x30C CRUISE_SPEED 255 "no_speed" 252 "stopped";
|
||||
BO_ 927 XXX_19: 8 ADAS
|
||||
SG_ ZEROS_BOH : 7|17@0+ (1,0) [0|127] "" BDY
|
||||
SG_ APPLY_BRAKES_FOR_CANC : 23|1@0+ (1,0) [0|15] "" BDY
|
||||
SG_ ZEROS_BOH2 : 22|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ RESUME_INSTRUCTION : 21|1@0+ (1,0) [0|15] "" BDY
|
||||
SG_ ACC_ALERTS : 20|5@0+ (1,0) [0|15] "" BDY
|
||||
SG_ ZEROS_BOH2 : 31|8@0+ (1,0) [0|127] "" BDY
|
||||
SG_ LEAD_SPEED : 39|9@0+ (1,0) [0|127] "" BDY
|
||||
SG_ LEAD_STATE : 46|3@0+ (1,0) [0|127] "" BDY
|
||||
SG_ LEAD_DISTANCE : 43|5@0+ (1,0) [0|31] "" BDY
|
||||
SG_ ZEROS_BOH3 : 54|7@0+ (1,0) [0|127] "" BDY
|
||||
|
||||
BO_ 929 XXX_20: 8 XXX
|
||||
|
||||
BO_ 985 XXX_21: 3 XXX
|
||||
|
||||
BO_ 1024 XXX_22: 5 XXX
|
||||
|
||||
BO_ 1027 XXX_23: 5 XXX
|
||||
|
||||
BO_ 1029 DOORS_STATUS: 8 BDY
|
||||
SG_ DOOR_OPEN_FL : 37|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ DOOR_OPEN_FR : 38|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ DOOR_OPEN_RL : 39|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ DOOR_OPEN_RR : 40|1@0+ (1,0) [0|1] "" NEO
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" NEO
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
BO_ 1036 XXX_24: 8 XXX
|
||||
|
||||
BO_ 1039 XXX_25: 8 XXX
|
||||
|
||||
BO_ 1108 XXX_26: 8 XXX
|
||||
|
||||
BO_ 1302 XXX_27: 8 XXX
|
||||
|
||||
BO_ 1322 XXX_28: 5 XXX
|
||||
|
||||
BO_ 1361 XXX_29: 5 XXX
|
||||
|
||||
BO_ 1365 XXX_30: 5 XXX
|
||||
|
||||
BO_ 1424 XXX_31: 5 XXX
|
||||
|
||||
BO_ 1600 XXX_32: 5 XXX
|
||||
|
||||
BO_ 1601 XXX_33: 8 XXX
|
||||
|
||||
BO_ 1633 XXX_34: 8 XXX
|
||||
|
||||
BO_TX_BU_ 228 : NEO,ADAS;
|
||||
BO_TX_BU_ 506 : NEO,ADAS;
|
||||
BO_TX_BU_ 780 : NEO,ADAS;
|
||||
BO_TX_BU_ 829 : NEO,ADAS;
|
||||
BO_TX_BU_ 862 : NEO,ADAS;
|
||||
BO_TX_BU_ 927 : NEO,ADAS;
|
||||
|
||||
|
||||
CM_ SG_ 401 GEAR "10 = reverse, 11 = transition";
|
||||
CM_ SG_ 490 LONG_ACCEL "wheel speed derivative, noisy and zero snapping";
|
||||
CM_ SG_ 780 CRUISE_SPEED "255 = no speed";
|
||||
CM_ SG_ 804 CRUISE_SPEED_PCM "255 = no speed";
|
||||
CM_ SG_ 829 BEEP "beeps are pleasant, chimes are for warnngs etc...";
|
||||
VAL_ 399 STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ;
|
||||
VAL_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P" ;
|
||||
VAL_ 450 EPB_STATE 3 "engaged" 2 "disengaging" 1 "engaging" 0 "disengaged" ;
|
||||
VAL_ 506 CHIME 4 "double_chime" 3 "single_chime" 2 "continuous_chime" 1 "repeating_chime" 0 "no_chime" ;
|
||||
VAL_ 662 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ;
|
||||
VAL_ 662 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ;
|
||||
VAL_ 780 CRUISE_SPEED 255 "no_speed" 252 "stopped" ;
|
||||
VAL_ 780 HUD_LEAD 3 "acc_off" 2 "solid_car" 1 "dashed_car" 0 "no_car" ;
|
||||
VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ;
|
||||
VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ;
|
||||
VAL_ 927 ACC_ALERTS 29 "esp_active_acc_canceled" 10 "b_pedal_applied" 9 "speed_too_low" 8 "speed_too_high" 7 "p_brake_applied" 6 "gear_no_d" 5 "seatbelt" 4 "too_steep_downhill" 3 "too_steep_uphill" 2 "too_close" 1 "no_vehicle_ahead" ;
|
||||
|
||||
CM_ SG_ 0x1A3 GEAR "10 = reverse, 11 = transition";
|
||||
CM_ SG_ 0x324 CRUISE_SPEED_PCM "255 = no speed";
|
||||
CM_ SG_ 0x30C CRUISE_SPEED "255 = no speed";
|
||||
CM_ SG_ 0x1EA LONG_ACCEL "wheel speed derivative, noisy and zero snapping";
|
||||
CM_ SG_ 0x33D BEEP "beeps are pleasant, chimes are for warnngs etc...";
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# enable wifi access point for debugging only!
|
||||
#service call wifi 37 i32 0 i32 1 # WifiService.setWifiApEnabled(null, true)
|
||||
|
||||
# use the openpilot ro key
|
||||
export GIT_SSH_COMMAND="ssh -i /data/data/com.termux/files/id_rsa_openpilot_ro"
|
||||
|
||||
# check out the openpilot repo
|
||||
# TODO: release branch only
|
||||
if [ ! -d /data/openpilot ]; then
|
||||
cd /tmp
|
||||
git clone git@github.com:commaai/openpilot.git
|
||||
mv /tmp/openpilot /data/openpilot
|
||||
fi
|
||||
|
||||
# update the openpilot repo
|
||||
cd /data/openpilot
|
||||
git pull
|
||||
|
||||
# start manager
|
||||
cd selfdrive
|
||||
mkdir -p /sdcard/realdata
|
||||
PYTHONPATH=/data/openpilot ./manager.py
|
||||
|
||||
# if broken, keep on screen error
|
||||
while true; do sleep 1; done
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEpAIBAAKCAQEAy/ZlYE/iHHjhbSvCnBm5Zsq5GPpVugLXFHai/doqyfRxErop
|
||||
/g1TIRhzK3mkHRYRN7H0L9whogwoIVr5CldoxU49FDnNbVHNimScNrL4LprRWjq6
|
||||
dRmCVoxMpLHZTyX1jIkcHsMr7klcUnssyeQO2pWvZv0ZC67wM7G20r7+ZLdEa0Ck
|
||||
MBh8JYhDaZx2xvYtTnt6vKMmFVE5+zW/+wDVma3a4r9pG9s0+r0wCl8CUuJ+yDhR
|
||||
mzNkPJ5mJCMx99AI6k4Gq9Vsng8/35b6Azh3TucPaXOLK7yPnL3YBKUa0PpR7IRH
|
||||
+OKkVCH+LL7tcPFSqPPVy/pUTBdEUROjJdSHxwIDAQABAoIBAQCxBgUM56h3T89Q
|
||||
AoghFg6dkdu/Ox8GmAp231UuAJncuMUfHObvcj8xXVgwZp4zBIEjFte6ZlPmoqh9
|
||||
8sht2lm7zeEjWdvbQwGjWRlgPEs9n++OYaSNl/tRBOpMk3Ppxydst1/prznE0nVH
|
||||
vVKtU7w0qXAYchm30zj1lQv5s/12CTGmnpQatbo5X488RfCfv2zFX1h+lEWF8ycL
|
||||
eZRi8z6l8h2Y+JLyEwPCmR+gR6XtosZ/ECQcTknavqLqdr7NbYYfOo3JfHCUtpJa
|
||||
8s7m0VFhMuxFFCl1sV0eMzAynJYNVz45DyaKpr2b/2YAGY8fn96FxaWv1xw1xTkK
|
||||
c5+wStwJAoGBAOjQpLZ1qGa4GwXzeHoDsGFpGgY9ug6af0M23c8O42fJHAwYkk7r
|
||||
Qeo4SSBddoSfo3jdchFLo59+m3qyTKpjkph7NBBCEwaCvX3heStDIMZEWX0IOV5y
|
||||
iJD/D6EXSqFmXCUUaudX2OxlaHguA0yOEx9s/5uUJrvaIHbBAOpYyar1AoGBAOBG
|
||||
MJp+EA3e1Zx/VszD2Tdxn8V0DAwvy9WIEqZuG689S/Sk5GnA4m2L8Txv0xAHFvLv
|
||||
JpF7Zn9AoFXGpjf9P0FF53cpjEYn9f+uK84j1HOL/6R7Nj9rcS5yL2PCP1ZHymw6
|
||||
xOXl3oZa1YtYE6jfvXUaOb8Z7y8gaStP763sXmpLAoGBAM1WSBANUcvXES58gIPN
|
||||
ASHJGwTqKFF8/kV//L4EuZjuDWi1u0UTxX0Yy5ZaGI/8ZKfTWCnc9qFTfzoGTAvz
|
||||
6nXGJDM6s6EIaqy90qrPd/amje7y8/ZTOhP4ggZojpAvwZGKoocMOey1vCBTJOG+
|
||||
ZStQbVkAn/EK/5r9uxr12FiJAoGAH9UWlPcLpExamWnhkhLCRAJWoRoFk708+0Pj
|
||||
EchTGZ5jp4e3++KqwM26Ic/lb0LyWOzk1oVjWPB9UW9urEe/sK4RWnKFPHfzjKTW
|
||||
Bt5DC1t1n4z1eC7x05vVah1qC/8IljAJPnBQE1XVNX/82l1XcMWWKK+vqUq6YrFn
|
||||
3ZHNHN0CgYA3uUVWqW37vfJuk0MJBkQSqMo5Y5TPlCt4b1ebkdhlM4v/N+iuiPiC
|
||||
PBhjP1MLeudkJvzllt4YvNWLerCKpMWuw7Zvy5uzFEsqOrVlzfnyWqqqYbYjHe9f
|
||||
Ef0/yXKuGJajs54Ts6Xrm0+elVUu//pEuf6NI96Ehctqz8/BqGqAtw==
|
||||
-----END RSA PRIVATE KEY-----
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# move files into place
|
||||
adb push files/id_rsa_openpilot_ro /tmp/id_rsa_openpilot_ro
|
||||
adb shell mv /tmp/id_rsa_openpilot_ro /data/data/com.termux/files/
|
||||
|
||||
# moving continue into place runs the continue script
|
||||
adb push files/continue.sh /tmp/continue.sh
|
||||
adb shell mv /tmp/continue.sh /data/data/com.termux/files/
|
||||
|
||||
1381
phonelibs/json/src/json.c
Normal file
1381
phonelibs/json/src/json.c
Normal file
File diff suppressed because it is too large
Load Diff
117
phonelibs/json/src/json.h
Normal file
117
phonelibs/json/src/json.h
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
Copyright (C) 2011 Joseph A. Adams (joeyadams3.14159@gmail.com)
|
||||
All rights reserved.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef CCAN_JSON_H
|
||||
#define CCAN_JSON_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef enum {
|
||||
JSON_NULL,
|
||||
JSON_BOOL,
|
||||
JSON_STRING,
|
||||
JSON_NUMBER,
|
||||
JSON_ARRAY,
|
||||
JSON_OBJECT,
|
||||
} JsonTag;
|
||||
|
||||
typedef struct JsonNode JsonNode;
|
||||
|
||||
struct JsonNode
|
||||
{
|
||||
/* only if parent is an object or array (NULL otherwise) */
|
||||
JsonNode *parent;
|
||||
JsonNode *prev, *next;
|
||||
|
||||
/* only if parent is an object (NULL otherwise) */
|
||||
char *key; /* Must be valid UTF-8. */
|
||||
|
||||
JsonTag tag;
|
||||
union {
|
||||
/* JSON_BOOL */
|
||||
bool bool_;
|
||||
|
||||
/* JSON_STRING */
|
||||
char *string_; /* Must be valid UTF-8. */
|
||||
|
||||
/* JSON_NUMBER */
|
||||
double number_;
|
||||
|
||||
/* JSON_ARRAY */
|
||||
/* JSON_OBJECT */
|
||||
struct {
|
||||
JsonNode *head, *tail;
|
||||
} children;
|
||||
};
|
||||
};
|
||||
|
||||
/*** Encoding, decoding, and validation ***/
|
||||
|
||||
JsonNode *json_decode (const char *json);
|
||||
char *json_encode (const JsonNode *node);
|
||||
char *json_encode_string (const char *str);
|
||||
char *json_stringify (const JsonNode *node, const char *space);
|
||||
void json_delete (JsonNode *node);
|
||||
|
||||
bool json_validate (const char *json);
|
||||
|
||||
/*** Lookup and traversal ***/
|
||||
|
||||
JsonNode *json_find_element (JsonNode *array, int index);
|
||||
JsonNode *json_find_member (JsonNode *object, const char *key);
|
||||
|
||||
JsonNode *json_first_child (const JsonNode *node);
|
||||
|
||||
#define json_foreach(i, object_or_array) \
|
||||
for ((i) = json_first_child(object_or_array); \
|
||||
(i) != NULL; \
|
||||
(i) = (i)->next)
|
||||
|
||||
/*** Construction and manipulation ***/
|
||||
|
||||
JsonNode *json_mknull(void);
|
||||
JsonNode *json_mkbool(bool b);
|
||||
JsonNode *json_mkstring(const char *s);
|
||||
JsonNode *json_mknumber(double n);
|
||||
JsonNode *json_mkarray(void);
|
||||
JsonNode *json_mkobject(void);
|
||||
|
||||
void json_append_element(JsonNode *array, JsonNode *element);
|
||||
void json_prepend_element(JsonNode *array, JsonNode *element);
|
||||
void json_append_member(JsonNode *object, const char *key, JsonNode *value);
|
||||
void json_prepend_member(JsonNode *object, const char *key, JsonNode *value);
|
||||
|
||||
void json_remove_from_parent(JsonNode *node);
|
||||
|
||||
/*** Debugging ***/
|
||||
|
||||
/*
|
||||
* Look for structure and encoding problems in a JsonNode or its descendents.
|
||||
*
|
||||
* If a problem is detected, return false, writing a description of the problem
|
||||
* to errmsg (unless errmsg is NULL).
|
||||
*/
|
||||
bool json_check(const JsonNode *node, char errmsg[256]);
|
||||
|
||||
#endif
|
||||
11
requirements_openpilot.txt
Normal file
11
requirements_openpilot.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
Cython==0.24.1
|
||||
bitstring==3.1.5
|
||||
fastcluster==1.1.21
|
||||
libusb1==1.5.0
|
||||
pycapnp==0.5.9
|
||||
pyzmq==15.4.0
|
||||
raven==5.23.0
|
||||
requests==2.10.0
|
||||
setproctitle==1.1.10
|
||||
simplejson==3.8.2
|
||||
-e git+https://github.com/commaai/le_python.git#egg=Logentries
|
||||
7
run_docker_tests.sh
Executable file
7
run_docker_tests.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
docker build -t tmppilot -f Dockerfile.openpilot .
|
||||
docker run --rm \
|
||||
-v "$(pwd)"/selfdrive/test/plant/out:/tmp/openpilot/selfdrive/test/plant/out \
|
||||
tmppilot /bin/sh -c 'cd /tmp/openpilot/selfdrive/test/plant && ./runtest.sh'
|
||||
@@ -19,10 +19,7 @@ ZMQ_LIBS = -L$(PHONELIBS)/zmq/aarch64/lib \
|
||||
-l:libczmq.a -l:libzmq.a \
|
||||
-lgnustl_shared
|
||||
|
||||
CEREAL_FLAGS = -I$(PHONELIBS)/capnp-cpp/include
|
||||
CEREAL_LIBS = -L$(PHONELIBS)/capnp-cpp/aarch64/lib/ \
|
||||
-l:libcapnp.a -l:libkj.a
|
||||
CEREAL_OBJS = ../../cereal/gen/c/log.capnp.o
|
||||
JSON_FLAGS = -I$(PHONELIBS)/json/src
|
||||
|
||||
EXTRA_LIBS = -lusb
|
||||
|
||||
@@ -34,14 +31,18 @@ CEREAL_LIBS = -L$(HOME)/drive/external/capnp/lib/ \
|
||||
EXTRA_LIBS = -lusb-1.0 -lpthread
|
||||
endif
|
||||
|
||||
.PHONY: all
|
||||
all: boardd
|
||||
|
||||
-include ../common/cereal.mk
|
||||
|
||||
OBJS = boardd.o \
|
||||
log.capnp.o
|
||||
../common/swaglog.o \
|
||||
$(PHONELIBS)/json/src/json.o \
|
||||
$(CEREAL_OBJS)
|
||||
|
||||
DEPS := $(OBJS:.o=.d)
|
||||
|
||||
all: boardd
|
||||
|
||||
boardd: $(OBJS)
|
||||
@echo "[ LINK ] $@"
|
||||
$(CXX) -fPIC -o '$@' $^ \
|
||||
@@ -53,18 +54,20 @@ boardd.o: boardd.cc
|
||||
@echo "[ CXX ] $@"
|
||||
$(CXX) $(CXXFLAGS) \
|
||||
-I$(PHONELIBS)/android_system_core/include \
|
||||
$(CEREAL_FLAGS) \
|
||||
$(CEREAL_CFLAGS) \
|
||||
$(ZMQ_FLAGS) \
|
||||
-I../ \
|
||||
-I../../ \
|
||||
-c -o '$@' '$<'
|
||||
|
||||
|
||||
log.capnp.o: ../../cereal/gen/cpp/log.capnp.c++
|
||||
@echo "[ CXX ] $@"
|
||||
$(CXX) $(CXXFLAGS) $(CEREAL_FLAGS) \
|
||||
-c -o '$@' '$<'
|
||||
|
||||
%.o: %.c
|
||||
@echo "[ CC ] $@"
|
||||
$(CC) $(CFLAGS) -MMD \
|
||||
-Iinclude -I.. -I../.. \
|
||||
$(CEREAL_CFLAGS) \
|
||||
$(ZMQ_FLAGS) \
|
||||
$(JSON_FLAGS) \
|
||||
-c -o '$@' '$<'
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <sched.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
@@ -19,6 +20,7 @@
|
||||
#include <capnp/serialize.h>
|
||||
#include "cereal/gen/cpp/log.capnp.h"
|
||||
|
||||
#include "common/swaglog.h"
|
||||
#include "common/timing.h"
|
||||
|
||||
int do_exit = 0;
|
||||
@@ -27,17 +29,13 @@ libusb_context *ctx = NULL;
|
||||
libusb_device_handle *dev_handle;
|
||||
pthread_mutex_t usb_lock;
|
||||
|
||||
bool spoofing_started = false;
|
||||
bool fake_send = false;
|
||||
|
||||
// double the FIFO size
|
||||
#define RECV_SIZE (0x1000)
|
||||
#define TIMEOUT 0
|
||||
|
||||
#define DEBUG_BOARDD
|
||||
#ifdef DEBUG_BOARDD
|
||||
#define DPRINTF(fmt, ...) printf("boardd: " fmt, ## __VA_ARGS__)
|
||||
#else
|
||||
#define DPRINTF(fmt, ...)
|
||||
#endif
|
||||
|
||||
bool usb_connect() {
|
||||
int err;
|
||||
|
||||
@@ -53,11 +51,17 @@ bool usb_connect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void usb_retry_connect() {
|
||||
LOG("attempting to connect");
|
||||
while (!usb_connect()) { usleep(100*1000); }
|
||||
LOGW("connected to board");
|
||||
}
|
||||
|
||||
void handle_usb_issue(int err, const char func[]) {
|
||||
DPRINTF("usb error %d \"%s\" in %s\n", err, libusb_strerror((enum libusb_error)err), func);
|
||||
LOGE("usb error %d \"%s\" in %s", err, libusb_strerror((enum libusb_error)err), func);
|
||||
if (err == -4) {
|
||||
while (!usb_connect()) { DPRINTF("attempting to connect\n"); usleep(100*1000); }
|
||||
LOGE("lost connection");
|
||||
usb_retry_connect();
|
||||
}
|
||||
// TODO: check other errors, is simply retrying okay?
|
||||
}
|
||||
@@ -74,7 +78,7 @@ void can_recv(void *s) {
|
||||
do {
|
||||
err = libusb_bulk_transfer(dev_handle, 0x81, (uint8_t*)data, RECV_SIZE, &recv, TIMEOUT);
|
||||
if (err != 0) { handle_usb_issue(err, __func__); }
|
||||
if (err == -8) { DPRINTF("overflow got 0x%x\n", recv); };
|
||||
if (err == -8) { LOGE("overflow got 0x%x", recv); };
|
||||
|
||||
// timeout is okay to exit, recv still happened
|
||||
if (err == -7) { break; }
|
||||
@@ -126,6 +130,7 @@ void can_health(void *s) {
|
||||
uint8_t started;
|
||||
uint8_t controls_allowed;
|
||||
uint8_t gas_interceptor_detected;
|
||||
uint8_t started_signal_detected;
|
||||
} health;
|
||||
|
||||
// recv from board
|
||||
@@ -147,9 +152,14 @@ void can_health(void *s) {
|
||||
// set fields
|
||||
healthData.setVoltage(health.voltage);
|
||||
healthData.setCurrent(health.current);
|
||||
healthData.setStarted(health.started);
|
||||
if (spoofing_started) {
|
||||
healthData.setStarted(1);
|
||||
} else {
|
||||
healthData.setStarted(health.started);
|
||||
}
|
||||
healthData.setControlsAllowed(health.controls_allowed);
|
||||
healthData.setGasInterceptorDetected(health.gas_interceptor_detected);
|
||||
healthData.setStartedSignalDetected(health.started_signal_detected);
|
||||
|
||||
// send to health
|
||||
auto words = capnp::messageToFlatArray(msg);
|
||||
@@ -167,8 +177,10 @@ void can_send(void *s) {
|
||||
err = zmq_msg_recv(&msg, s, 0);
|
||||
assert(err >= 0);
|
||||
|
||||
// format for board
|
||||
auto amsg = kj::arrayPtr((const capnp::word*)zmq_msg_data(&msg), zmq_msg_size(&msg));
|
||||
// format for board, make copy due to alignment issues, will be freed on out of scope
|
||||
auto amsg = kj::heapArray<capnp::word>((zmq_msg_size(&msg) / sizeof(capnp::word)) + 1);
|
||||
memcpy(amsg.begin(), zmq_msg_data(&msg), zmq_msg_size(&msg));
|
||||
|
||||
capnp::FlatArrayMessageReader cmsg(amsg);
|
||||
cereal::Event::Reader event = cmsg.getRoot<cereal::Event>();
|
||||
int msg_count = event.getCan().size();
|
||||
@@ -177,7 +189,7 @@ void can_send(void *s) {
|
||||
memset(send, 0, msg_count*0x10);
|
||||
|
||||
for (int i = 0; i < msg_count; i++) {
|
||||
auto cmsg = event.getCan()[i];
|
||||
auto cmsg = event.getSendcan()[i];
|
||||
if (cmsg.getAddress() >= 0x800) {
|
||||
// extended
|
||||
send[i*4] = (cmsg.getAddress() << 3) | 5;
|
||||
@@ -190,8 +202,6 @@ void can_send(void *s) {
|
||||
memcpy(&send[i*4+2], cmsg.getDat().begin(), cmsg.getDat().size());
|
||||
}
|
||||
|
||||
//DPRINTF("got send message: %d\n", msg_count);
|
||||
|
||||
// release msg
|
||||
zmq_msg_close(&msg);
|
||||
|
||||
@@ -199,10 +209,12 @@ void can_send(void *s) {
|
||||
int sent;
|
||||
pthread_mutex_lock(&usb_lock);
|
||||
|
||||
do {
|
||||
err = libusb_bulk_transfer(dev_handle, 3, (uint8_t*)send, msg_count*0x10, &sent, TIMEOUT);
|
||||
if (err != 0 || msg_count*0x10 != sent) { handle_usb_issue(err, __func__); }
|
||||
} while(err != 0);
|
||||
if (!fake_send) {
|
||||
do {
|
||||
err = libusb_bulk_transfer(dev_handle, 3, (uint8_t*)send, msg_count*0x10, &sent, TIMEOUT);
|
||||
if (err != 0 || msg_count*0x10 != sent) { handle_usb_issue(err, __func__); }
|
||||
} while(err != 0);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&usb_lock);
|
||||
|
||||
@@ -214,7 +226,7 @@ void can_send(void *s) {
|
||||
// **** threads ****
|
||||
|
||||
void *can_send_thread(void *crap) {
|
||||
DPRINTF("start send thread\n");
|
||||
LOGD("start send thread");
|
||||
|
||||
// sendcan = 8017
|
||||
void *context = zmq_ctx_new();
|
||||
@@ -230,7 +242,7 @@ void *can_send_thread(void *crap) {
|
||||
}
|
||||
|
||||
void *can_recv_thread(void *crap) {
|
||||
DPRINTF("start recv thread\n");
|
||||
LOGD("start recv thread");
|
||||
|
||||
// can = 8006
|
||||
void *context = zmq_ctx_new();
|
||||
@@ -247,7 +259,7 @@ void *can_recv_thread(void *crap) {
|
||||
}
|
||||
|
||||
void *can_health_thread(void *crap) {
|
||||
DPRINTF("start health thread\n");
|
||||
LOGD("start health thread");
|
||||
|
||||
// health = 8011
|
||||
void *context = zmq_ctx_new();
|
||||
@@ -262,32 +274,41 @@ void *can_health_thread(void *crap) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int set_realtime_priority(int level) {
|
||||
// should match python using chrt
|
||||
struct sched_param sa;
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sched_priority = level;
|
||||
return sched_setscheduler(getpid(), SCHED_FIFO, &sa);
|
||||
}
|
||||
|
||||
int main() {
|
||||
int err;
|
||||
printf("boardd: starting boardd\n");
|
||||
LOGW("starting boardd");
|
||||
|
||||
// set process priority
|
||||
err = setpriority(PRIO_PROCESS, 0, -4);
|
||||
printf("boardd: setpriority returns %d\n", err);
|
||||
err = set_realtime_priority(4);
|
||||
LOG("setpriority returns %d", err);
|
||||
|
||||
// connect to the board
|
||||
// check the environment
|
||||
if (getenv("STARTED")) {
|
||||
spoofing_started = true;
|
||||
}
|
||||
|
||||
if (getenv("FAKESEND")) {
|
||||
fake_send = true;
|
||||
}
|
||||
|
||||
// init libusb
|
||||
err = libusb_init(&ctx);
|
||||
assert(err == 0);
|
||||
libusb_set_debug(ctx, 3);
|
||||
|
||||
// TODO: duplicate code from error handling
|
||||
while (!usb_connect()) { DPRINTF("attempting to connect\n"); usleep(100*1000); }
|
||||
// connect to the board
|
||||
usb_retry_connect();
|
||||
|
||||
/*int config;
|
||||
err = libusb_get_configuration(dev_handle, &config);
|
||||
assert(err == 0);
|
||||
DPRINTF("configuration is %d\n", config);*/
|
||||
|
||||
/*err = libusb_set_interface_alt_setting(dev_handle, 0, 0);
|
||||
assert(err == 0);*/
|
||||
|
||||
// create threads
|
||||
|
||||
pthread_t can_health_thread_handle;
|
||||
err = pthread_create(&can_health_thread_handle, NULL,
|
||||
can_health_thread, NULL);
|
||||
|
||||
@@ -18,27 +18,25 @@ except Exception:
|
||||
# TODO: rewrite in C to save CPU
|
||||
|
||||
# *** serialization functions ***
|
||||
def can_list_to_can_capnp(can_msgs):
|
||||
def can_list_to_can_capnp(can_msgs, msgtype='can'):
|
||||
dat = messaging.new_message()
|
||||
dat.init('can', len(can_msgs))
|
||||
dat.init(msgtype, len(can_msgs))
|
||||
for i, can_msg in enumerate(can_msgs):
|
||||
dat.can[i].address = can_msg[0]
|
||||
dat.can[i].busTime = can_msg[1]
|
||||
dat.can[i].dat = can_msg[2]
|
||||
dat.can[i].src = can_msg[3]
|
||||
if msgtype == 'sendcan':
|
||||
cc = dat.sendcan[i]
|
||||
else:
|
||||
cc = dat.can[i]
|
||||
cc.address = can_msg[0]
|
||||
cc.busTime = can_msg[1]
|
||||
cc.dat = can_msg[2]
|
||||
cc.src = can_msg[3]
|
||||
return dat
|
||||
|
||||
def can_capnp_to_can_list_old(dat, src_filter=[]):
|
||||
def can_capnp_to_can_list(can, src_filter=None):
|
||||
ret = []
|
||||
for msg in dat.can:
|
||||
if msg.src in src_filter:
|
||||
ret.append([msg.address, msg.busTime, msg.dat.encode("hex")])
|
||||
return ret
|
||||
|
||||
def can_capnp_to_can_list(dat):
|
||||
ret = []
|
||||
for msg in dat.can:
|
||||
ret.append([msg.address, msg.busTime, msg.dat, msg.src])
|
||||
for msg in can:
|
||||
if src_filter is None or msg.src in src_filter:
|
||||
ret.append((msg.address, msg.busTime, msg.dat, msg.src))
|
||||
return ret
|
||||
|
||||
# *** can driver ***
|
||||
@@ -111,7 +109,7 @@ def boardd_mock_loop():
|
||||
|
||||
while 1:
|
||||
tsc = messaging.drain_sock(logcan, wait_for_one=True)
|
||||
snds = map(can_capnp_to_can_list, tsc)
|
||||
snds = map(lambda x: can_capnp_to_can_list(x.can), tsc)
|
||||
snd = []
|
||||
for s in snds:
|
||||
snd += s
|
||||
@@ -164,7 +162,7 @@ def boardd_loop(rate=200):
|
||||
# send can if we have a packet
|
||||
tsc = messaging.recv_sock(sendcan)
|
||||
if tsc is not None:
|
||||
can_send_many(can_capnp_to_can_list(tsc))
|
||||
can_send_many(can_capnp_to_can_list(tsc.sendcan))
|
||||
|
||||
rk.keep_time()
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import numpy as np
|
||||
import tempfile
|
||||
import zmq
|
||||
|
||||
from common.services import service_list
|
||||
@@ -8,6 +11,7 @@ import selfdrive.messaging as messaging
|
||||
from selfdrive.config import ImageParams, VehicleParams
|
||||
from selfdrive.calibrationd.calibration import ViewCalibrator, CalibStatus
|
||||
|
||||
CALIBRATION_TMP_DIR = "/sdcard"
|
||||
CALIBRATION_FILE = "/sdcard/calibration_param"
|
||||
|
||||
def load_calibration(gctx):
|
||||
@@ -32,28 +36,33 @@ def load_calibration(gctx):
|
||||
|
||||
# load calibration data
|
||||
if os.path.isfile(CALIBRATION_FILE):
|
||||
# if the calibration file exist, start from the last cal values
|
||||
with open(CALIBRATION_FILE, "r") as cal_file:
|
||||
data = [float(l.strip()) for l in cal_file.readlines()]
|
||||
calib = ViewCalibrator((I.X, I.Y),
|
||||
big_box_size,
|
||||
vp_img,
|
||||
warp_matrix_start,
|
||||
vp_f=[data[2], data[3]],
|
||||
cal_cycle=data[0],
|
||||
cal_status=data[1])
|
||||
try:
|
||||
# If the calibration file exist, start from the last cal values
|
||||
with open(CALIBRATION_FILE, "r") as cal_file:
|
||||
data = [float(l.strip()) for l in cal_file.readlines()]
|
||||
return ViewCalibrator(
|
||||
(I.X, I.Y),
|
||||
big_box_size,
|
||||
vp_img,
|
||||
warp_matrix_start,
|
||||
vp_f=[data[2], data[3]],
|
||||
cal_cycle=data[0],
|
||||
cal_status=data[1])
|
||||
except Exception as e:
|
||||
print("Could not load calibration file: {}".format(e))
|
||||
|
||||
if calib.cal_status == CalibStatus.INCOMPLETE:
|
||||
print "CALIBRATION IN PROGRESS", calib.cal_cycle
|
||||
else:
|
||||
print "NO CALIBRATION FILE"
|
||||
calib = ViewCalibrator((I.X, I.Y),
|
||||
big_box_size,
|
||||
vp_img,
|
||||
warp_matrix_start,
|
||||
vp_f=vp_guess)
|
||||
return ViewCalibrator(
|
||||
(I.X, I.Y), big_box_size, vp_img, warp_matrix_start, vp_f=vp_guess)
|
||||
|
||||
return calib
|
||||
def store_calibration(calib):
|
||||
# Tempfile needs to be on the same device as the calbration file.
|
||||
with tempfile.NamedTemporaryFile(delete=False, dir=CALIBRATION_TMP_DIR) as cal_file:
|
||||
print(calib.cal_cycle, file=cal_file)
|
||||
print(calib.cal_status, file=cal_file)
|
||||
print(calib.vp_f[0], file=cal_file)
|
||||
print(calib.vp_f[1], file=cal_file)
|
||||
cal_file_name = cal_file.name
|
||||
os.rename(cal_file_name, CALIBRATION_FILE)
|
||||
|
||||
def calibrationd_thread(gctx):
|
||||
context = zmq.Context()
|
||||
@@ -69,7 +78,7 @@ def calibrationd_thread(gctx):
|
||||
v_ego = None
|
||||
|
||||
calib = load_calibration(gctx)
|
||||
last_cal_cycle = calib.cal_cycle
|
||||
last_write_cycle = calib.cal_cycle
|
||||
|
||||
while 1:
|
||||
# calibration at the end so it does not delay radar processing above
|
||||
@@ -91,14 +100,10 @@ def calibrationd_thread(gctx):
|
||||
calib.calibration(p0, p1, st, v_ego, steer_angle, VP)
|
||||
|
||||
# write a new calibration every 100 cal cycle
|
||||
if calib.cal_cycle - last_cal_cycle >= 100:
|
||||
print "writing cal", calib.cal_cycle
|
||||
with open(CALIBRATION_FILE, "w") as cal_file:
|
||||
cal_file.write(str(calib.cal_cycle)+'\n')
|
||||
cal_file.write(str(calib.cal_status)+'\n')
|
||||
cal_file.write(str(calib.vp_f[0])+'\n')
|
||||
cal_file.write(str(calib.vp_f[1])+'\n')
|
||||
last_cal_cycle = calib.cal_cycle
|
||||
if calib.cal_cycle - last_write_cycle >= 100:
|
||||
print("writing cal", calib.cal_cycle)
|
||||
store_calibration(calib)
|
||||
last_write_cycle = calib.cal_cycle
|
||||
|
||||
warp_matrix = map(float, calib.warp_matrix.reshape(9).tolist())
|
||||
dat = messaging.new_message()
|
||||
|
||||
0
selfdrive/car/__init__.py
Normal file
0
selfdrive/car/__init__.py
Normal file
@@ -1,8 +1,12 @@
|
||||
fingerprints = {
|
||||
"ACURA ILX 2016 ACURAWATCH PLUS": {
|
||||
1024L: 5, 513L: 5, 1027L: 5, 1029L: 8, 929L: 4, 1057L: 5, 777L: 8, 1034L: 5, 1036L: 8, 398L: 3, 399L: 7, 145L: 8, 660L: 8, 985L: 3, 923L: 2, 542L: 7, 773L: 7, 800L: 8, 432L: 7, 419L: 8, 420L: 8, 1030L: 5, 422L: 8, 808L: 8, 428L: 8, 304L: 8, 819L: 7, 821L: 5, 57L: 3, 316L: 8, 545L: 4, 464L: 8, 1108L: 8, 597L: 8, 342L: 6, 983L: 8, 344L: 8, 804L: 8, 1039L: 8, 476L: 4, 892L: 8, 490L: 8, 1064L: 7, 882L: 2, 884L: 7, 887L: 8, 888L: 8, 380L: 8, 1365L: 5
|
||||
1024L: 5, 513L: 5, 1027L: 5, 1029L: 8, 929L: 4, 1057L: 5, 777L: 8, 1034L: 5, 1036L: 8, 398L: 3, 399L: 7, 145L: 8, 660L: 8, 985L: 3, 923L: 2, 542L: 7, 773L: 7, 800L: 8, 432L: 7, 419L: 8, 420L: 8, 1030L: 5, 422L: 8, 808L: 8, 428L: 8, 304L: 8, 819L: 7, 821L: 5, 57L: 3, 316L: 8, 545L: 4, 464L: 8, 1108L: 8, 597L: 8, 342L: 6, 983L: 8, 344L: 8, 804L: 8, 1039L: 8, 476L: 4, 892L: 8, 490L: 8, 1064L: 7, 882L: 2, 884L: 7, 887L: 8, 888L: 8, 380L: 8, 1365L: 5,
|
||||
# sent messages
|
||||
0xe4: 5, 0x1fa: 8, 0x200: 3, 0x30c: 8, 0x33d: 4,
|
||||
},
|
||||
"HONDA CIVIC 2016 TOURING": {
|
||||
1024L: 5, 513L: 5, 1027L: 5, 1029L: 8, 777L: 8, 1036L: 8, 1039L: 8, 1424L: 5, 401L: 8, 148L: 8, 662L: 4, 985L: 3, 795L: 8, 773L: 7, 800L: 8, 545L: 6, 420L: 8, 806L: 8, 808L: 8, 1322L: 5, 427L: 3, 428L: 8, 304L: 8, 432L: 7, 57L: 3, 450L: 8, 929L: 8, 330L: 8, 1302L: 8, 464L: 8, 1361L: 5, 1108L: 8, 597L: 8, 470L: 2, 344L: 8, 804L: 8, 399L: 7, 476L: 7, 1633L: 8, 487L: 4, 892L: 8, 490L: 8, 493L: 5, 884L: 8, 891L: 8, 380L: 8, 1365L: 5
|
||||
1024L: 5, 513L: 5, 1027L: 5, 1029L: 8, 777L: 8, 1036L: 8, 1039L: 8, 1424L: 5, 401L: 8, 148L: 8, 662L: 4, 985L: 3, 795L: 8, 773L: 7, 800L: 8, 545L: 6, 420L: 8, 806L: 8, 808L: 8, 1322L: 5, 427L: 3, 428L: 8, 304L: 8, 432L: 7, 57L: 3, 450L: 8, 929L: 8, 330L: 8, 1302L: 8, 464L: 8, 1361L: 5, 1108L: 8, 597L: 8, 470L: 2, 344L: 8, 804L: 8, 399L: 7, 476L: 7, 1633L: 8, 487L: 4, 892L: 8, 490L: 8, 493L: 5, 884L: 8, 891L: 8, 380L: 8, 1365L: 5,
|
||||
# sent messages
|
||||
0xe4: 5, 0x1fa: 8, 0x200: 3, 0x30c: 8, 0x33d: 5, 0x35e: 8, 0x39f: 8,
|
||||
}
|
||||
}
|
||||
0
selfdrive/car/honda/__init__.py
Normal file
0
selfdrive/car/honda/__init__.py
Normal file
@@ -2,7 +2,7 @@ import os
|
||||
import dbcs
|
||||
from collections import defaultdict
|
||||
|
||||
from selfdrive.controls.lib.hondacan import fix
|
||||
from selfdrive.car.honda.hondacan import fix
|
||||
from common.realtime import sec_since_boot
|
||||
from common.dbc import dbc
|
||||
|
||||
@@ -59,22 +59,22 @@ class CANParser(object):
|
||||
cn_vl_max = 5 # no more than 5 wrong counter checks
|
||||
|
||||
# we are subscribing to PID_XXX, else data from USB
|
||||
for msg, ts, cdat in can_recv:
|
||||
for msg, ts, cdat, _ in can_recv:
|
||||
idxs = self._message_indices[msg]
|
||||
if idxs:
|
||||
self.msgs_upd += [msg]
|
||||
self.msgs_upd.append(msg)
|
||||
# read the entire message
|
||||
out = self.can_dbc.decode([msg, 0, cdat])[1]
|
||||
out = self.can_dbc.decode((msg, 0, cdat))[1]
|
||||
# checksum check
|
||||
self.ck[msg] = True
|
||||
if "CHECKSUM" in out.keys() and msg in self.msgs_ck:
|
||||
# remove checksum (half byte)
|
||||
ck_portion = (''.join((cdat[:-1], '0'))).decode('hex')
|
||||
ck_portion = cdat[:-1] + chr(ord(cdat[-1]) & 0xF0)
|
||||
# recalculate checksum
|
||||
msg_vl = fix(ck_portion, msg)
|
||||
# compare recalculated vs received checksum
|
||||
if msg_vl != cdat.decode('hex'):
|
||||
print hex(msg), "CHECKSUM FAIL"
|
||||
if msg_vl != cdat:
|
||||
print "CHECKSUM FAIL: " + hex(msg)
|
||||
self.ck[msg] = False
|
||||
self.ok[msg] = False
|
||||
# counter check
|
||||
@@ -89,6 +89,7 @@ class CANParser(object):
|
||||
self.cn_vl[msg] -= 1 # counter check passed
|
||||
# message status is invalid if we received too many wrong counter values
|
||||
if self.cn_vl[msg] >= cn_vl_max:
|
||||
print "COUNTER WRONG: " + hex(msg)
|
||||
self.ok[msg] = False
|
||||
|
||||
# update msg time stamps and counter value
|
||||
@@ -112,7 +113,7 @@ class CANParser(object):
|
||||
# assess overall can validity: if there is one relevant message invalid, then set can validity flag to False
|
||||
self.can_valid = True
|
||||
if False in self.ok.values():
|
||||
print "CAN INVALID!"
|
||||
#print "CAN INVALID!"
|
||||
self.can_valid = False
|
||||
|
||||
def _check_dead_msgs(self):
|
||||
@@ -1,25 +1,54 @@
|
||||
from collections import namedtuple
|
||||
|
||||
import common.numpy_fast as np
|
||||
import selfdrive.controls.lib.hondacan as hondacan
|
||||
from common.realtime import sec_since_boot
|
||||
from selfdrive.config import CruiseButtons
|
||||
from selfdrive.boardd.boardd import can_list_to_can_capnp
|
||||
from selfdrive.controls.lib.alert_database import process_hud_alert
|
||||
from selfdrive.controls.lib.drive_helpers import actuator_hystereses, rate_limit
|
||||
|
||||
class AH:
|
||||
#[alert_idx, value]
|
||||
# See dbc files for info on values"
|
||||
NONE = [0, 0]
|
||||
FCW = [1, 0x8]
|
||||
STEER = [2, 1]
|
||||
BRAKE_PRESSED = [3, 10]
|
||||
GEAR_NOT_D = [4, 6]
|
||||
SEATBELT = [5, 5]
|
||||
SPEED_TOO_HIGH = [6, 8]
|
||||
|
||||
|
||||
def process_hud_alert(hud_alert):
|
||||
# initialize to no alert
|
||||
fcw_display = 0
|
||||
steer_required = 0
|
||||
acc_alert = 0
|
||||
if hud_alert == AH.NONE: # no alert
|
||||
pass
|
||||
elif hud_alert == AH.FCW: # FCW
|
||||
fcw_display = hud_alert[1]
|
||||
elif hud_alert == AH.STEER: # STEER
|
||||
steer_required = hud_alert[1]
|
||||
else: # any other ACC alert
|
||||
acc_alert = hud_alert[1]
|
||||
|
||||
return fcw_display, steer_required, acc_alert
|
||||
|
||||
import selfdrive.car.honda.hondacan as hondacan
|
||||
|
||||
HUDData = namedtuple("HUDData",
|
||||
["pcm_accel", "v_cruise", "X2", "car", "X4", "X5",
|
||||
"lanes", "beep", "X8", "chime", "acc_alert"])
|
||||
|
||||
class CarController(object):
|
||||
def __init__(self):
|
||||
self.controls_allowed = False
|
||||
self.mismatch_start, self.pcm_mismatch_start = 0, 0
|
||||
self.braking = False
|
||||
self.brake_steady = 0.
|
||||
self.final_brake_last = 0.
|
||||
|
||||
# redundant safety check with the board
|
||||
self.controls_allowed = False
|
||||
|
||||
def update(self, sendcan, enabled, CS, frame, final_gas, final_brake, final_steer, \
|
||||
pcm_speed, pcm_override, pcm_cancel_cmd, pcm_accel, \
|
||||
hud_v_cruise, hud_show_lanes, hud_show_car, hud_alert, \
|
||||
@@ -61,9 +90,9 @@ class CarController(object):
|
||||
#print chime, alert_id, hud_alert
|
||||
fcw_display, steer_required, acc_alert = process_hud_alert(hud_alert)
|
||||
|
||||
hud = HUDData(pcm_accel, hud_v_cruise, 0x41, hud_car,
|
||||
hud = HUDData(int(pcm_accel), int(hud_v_cruise), 0x01, hud_car,
|
||||
0xc1, 0x41, hud_lanes + steer_required,
|
||||
snd_beep, 0x48, (snd_chime << 5) + fcw_display, acc_alert)
|
||||
int(snd_beep), 0x48, (snd_chime << 5) + fcw_display, acc_alert)
|
||||
|
||||
if not all(isinstance(x, int) and 0 <= x < 256 for x in hud):
|
||||
print "INVALID HUD", hud
|
||||
@@ -71,14 +100,11 @@ class CarController(object):
|
||||
|
||||
# **** process the car messages ****
|
||||
|
||||
user_brake_ctrl = CS.user_brake/0.015625 # FIXME: factor needed to convert to old scale
|
||||
|
||||
# *** compute control surfaces ***
|
||||
tt = sec_since_boot()
|
||||
GAS_MAX = 1004
|
||||
BRAKE_MAX = 1024/4
|
||||
#STEER_MAX = 0xF00 if not CS.torque_mod else 0xF00/4 # ilx has 8x steering torque limit, used as a 2x
|
||||
STEER_MAX = 0xF00 # ilx has 8x steering torque limit, used as a 2x
|
||||
STEER_MAX = 0xF00
|
||||
GAS_OFFSET = 328
|
||||
|
||||
# steer torque is converted back to CAN reference (positive when steering right)
|
||||
@@ -87,51 +113,37 @@ class CarController(object):
|
||||
apply_steer = int(np.clip(-final_steer*STEER_MAX, -STEER_MAX, STEER_MAX))
|
||||
|
||||
# no gas if you are hitting the brake or the user is
|
||||
if apply_gas > 0 and (apply_brake != 0 or user_brake_ctrl > 10):
|
||||
print "CANCELLING GAS", apply_brake, user_brake_ctrl
|
||||
if apply_gas > 0 and (apply_brake != 0 or CS.brake_pressed):
|
||||
print "CANCELLING GAS", apply_brake
|
||||
apply_gas = 0
|
||||
|
||||
# no computer brake if the user is hitting the gas
|
||||
# if the computer is trying to brake, it can't be hitting the gas
|
||||
# TODO: car_gas can override brakes without canceling... this is bad
|
||||
# no computer brake if the gas is being pressed
|
||||
if CS.car_gas > 0 and apply_brake != 0:
|
||||
print "CANCELLING BRAKE"
|
||||
apply_brake = 0
|
||||
|
||||
# any other cp.vl[0x18F]['STEER_STATUS'] is common and can happen during user override. sending 0 torque to avoid EPS sending error 5
|
||||
if CS.steer_not_allowed:
|
||||
print "STEER ALERT, TORQUE INHIBITED"
|
||||
apply_steer = 0
|
||||
|
||||
# *** entry into controls state ***
|
||||
if (CS.prev_cruise_buttons == CruiseButtons.DECEL_SET or CS.prev_cruise_buttons == CruiseButtons.RES_ACCEL) and \
|
||||
CS.cruise_buttons == 0 and not self.controls_allowed:
|
||||
print "CONTROLS ARE LIVE"
|
||||
self.controls_allowed = True
|
||||
|
||||
# to avoid race conditions, check if control has been disabled for at least 0.2s
|
||||
# keep resetting start timer if mismatch isn't true
|
||||
if not (self.controls_allowed and not enabled):
|
||||
self.mismatch_start = tt
|
||||
|
||||
# to avoid race conditions, check if control is disabled but pcm control is on for at least 0.2s
|
||||
if not (not self.controls_allowed and CS.pcm_acc_status):
|
||||
self.pcm_mismatch_start = tt
|
||||
|
||||
# something is very wrong, since pcm control is active but controls should not be allowed; TODO: send pcm fault cmd?
|
||||
if (tt - self.pcm_mismatch_start) > 0.2:
|
||||
pcm_cancel_cmd = True
|
||||
|
||||
# TODO: clean up gear condition, ideally only D (and P for debug) shall be valid gears
|
||||
# *** exit from controls state on cancel, gas, or brake ***
|
||||
if (CS.cruise_buttons == CruiseButtons.CANCEL or CS.brake_pressed or
|
||||
CS.user_gas_pressed or (tt - self.mismatch_start) > 0.2 or
|
||||
not CS.main_on or not CS.gear_shifter_valid or
|
||||
(CS.pedal_gas > 0 and CS.brake_only)) and self.controls_allowed:
|
||||
CS.user_gas_pressed or (CS.pedal_gas > 0 and CS.brake_only)) and self.controls_allowed:
|
||||
print "CONTROLS ARE DEAD"
|
||||
self.controls_allowed = False
|
||||
|
||||
# 5 is a permanent fault, no torque request will be fullfilled
|
||||
# *** controls fail on steer error, brake error, or invalid can ***
|
||||
if CS.steer_error:
|
||||
print "STEER ERROR"
|
||||
self.controls_allowed = False
|
||||
|
||||
# any other cp.vl[0x18F]['STEER_STATUS'] is common and can happen during user override. sending 0 torque to avoid EPS sending error 5
|
||||
elif CS.steer_not_allowed:
|
||||
print "STEER ALERT, TORQUE INHIBITED"
|
||||
apply_steer = 0
|
||||
|
||||
if CS.brake_error:
|
||||
print "BRAKE ERROR"
|
||||
self.controls_allowed = False
|
||||
@@ -140,13 +152,6 @@ class CarController(object):
|
||||
print "CAN INVALID"
|
||||
self.controls_allowed = False
|
||||
|
||||
if not self.controls_allowed:
|
||||
apply_steer = 0
|
||||
apply_gas = 0
|
||||
apply_brake = 0
|
||||
pcm_speed = 0 # make sure you send 0 target speed to pcm
|
||||
#pcm_cancel_cmd = 1 # prevent pcm control from turning on. FIXME: we can't just do this
|
||||
|
||||
# Send CAN commands.
|
||||
can_sends = []
|
||||
|
||||
@@ -160,7 +165,6 @@ class CarController(object):
|
||||
can_sends.append(
|
||||
hondacan.create_brake_command(apply_brake, pcm_override,
|
||||
pcm_cancel_cmd, hud.chime, idx))
|
||||
|
||||
if not CS.brake_only:
|
||||
# send exactly zero if apply_gas is zero. Interceptor will send the max between read value and apply_gas.
|
||||
# This prevents unexpected pedal range rescaling
|
||||
@@ -182,4 +186,5 @@ class CarController(object):
|
||||
idx = (frame/radar_send_step) % 4
|
||||
can_sends.extend(hondacan.create_radar_commands(CS.v_ego, CS.civic, idx))
|
||||
|
||||
sendcan.send(can_list_to_can_capnp(can_sends).to_bytes())
|
||||
sendcan.send(can_list_to_can_capnp(can_sends, msgtype='sendcan').to_bytes())
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import numpy as np
|
||||
|
||||
import selfdrive.messaging as messaging
|
||||
from selfdrive.boardd.boardd import can_capnp_to_can_list_old, can_capnp_to_can_list
|
||||
from selfdrive.controls.lib.can_parser import CANParser
|
||||
from selfdrive.controls.lib.fingerprints import fingerprints
|
||||
from selfdrive.boardd.boardd import can_capnp_to_can_list
|
||||
from selfdrive.config import VehicleParams
|
||||
from common.realtime import sec_since_boot
|
||||
|
||||
from selfdrive.car.fingerprints import fingerprints
|
||||
from selfdrive.car.honda.can_parser import CANParser
|
||||
|
||||
def get_can_parser(civic, brake_only):
|
||||
# this function generates lists for signal, messages and initial values
|
||||
@@ -46,6 +46,7 @@ def get_can_parser(civic, brake_only):
|
||||
("LEFT_BLINKER", 0x326, 0),
|
||||
("RIGHT_BLINKER", 0x326, 0),
|
||||
("COUNTER", 0x324, 0),
|
||||
("ENGINE_RPM", 0x17C, 0)
|
||||
]
|
||||
checks = [
|
||||
(0x14a, 100),
|
||||
@@ -97,6 +98,7 @@ def get_can_parser(civic, brake_only):
|
||||
("LEFT_BLINKER", 0x294, 0),
|
||||
("RIGHT_BLINKER", 0x294, 0),
|
||||
("COUNTER", 0x324, 0),
|
||||
("ENGINE_RPM", 0x17C, 0)
|
||||
]
|
||||
checks = [
|
||||
(0x156, 100),
|
||||
@@ -130,7 +132,7 @@ def fingerprint(logcan):
|
||||
for a in messaging.drain_sock(logcan, wait_for_one=True):
|
||||
if st is None:
|
||||
st = sec_since_boot()
|
||||
for adr, _, msg, idx in can_capnp_to_can_list(a):
|
||||
for adr, _, msg, idx in can_capnp_to_can_list(a.can):
|
||||
# pedal
|
||||
if adr == 0x201 and idx == 0:
|
||||
brake_only = False
|
||||
@@ -153,6 +155,7 @@ def fingerprint(logcan):
|
||||
if len(possible_cars) == 1 and st is not None and (sec_since_boot()-st) > 0.1:
|
||||
break
|
||||
elif len(possible_cars) == 0:
|
||||
print finger
|
||||
raise Exception("car doesn't match any fingerprints")
|
||||
|
||||
print "fingerprinted", possible_cars[0]
|
||||
@@ -183,6 +186,9 @@ class CarState(object):
|
||||
self.cruise_setting = 0
|
||||
self.blinker_on = 0
|
||||
|
||||
self.left_blinker_on = 0
|
||||
self.right_blinker_on = 0
|
||||
|
||||
# TODO: actually make this work
|
||||
self.a_ego = 0.
|
||||
|
||||
@@ -190,16 +196,9 @@ class CarState(object):
|
||||
self.ui_speed_fudge = 1.01 if self.civic else 1.025
|
||||
|
||||
# load vehicle params
|
||||
self.VP = VehicleParams(self.civic)
|
||||
|
||||
def update(self, logcan):
|
||||
# ******************* do can recv *******************
|
||||
can_pub_main = []
|
||||
canMonoTimes = []
|
||||
for a in messaging.drain_sock(logcan):
|
||||
canMonoTimes.append(a.logMonoTime)
|
||||
can_pub_main.extend(can_capnp_to_can_list_old(a, [0,2]))
|
||||
self.VP = VehicleParams(self.civic, self.brake_only, self.torque_mod)
|
||||
|
||||
def update(self, can_pub_main):
|
||||
cp = self.cp
|
||||
cp.update_can(can_pub_main)
|
||||
|
||||
@@ -215,6 +214,11 @@ class CarState(object):
|
||||
self.prev_cruise_setting = self.cruise_setting
|
||||
self.prev_blinker_on = self.blinker_on
|
||||
|
||||
self.prev_left_blinker_on = self.left_blinker_on
|
||||
self.prev_right_blinker_on = self.right_blinker_on
|
||||
|
||||
self.rpm = cp.vl[0x17C]['ENGINE_RPM']
|
||||
|
||||
# ******************* parse out can *******************
|
||||
self.door_all_closed = not any([cp.vl[0x405]['DOOR_OPEN_FL'], cp.vl[0x405]['DOOR_OPEN_FR'],
|
||||
cp.vl[0x405]['DOOR_OPEN_RL'], cp.vl[0x405]['DOOR_OPEN_RR']])
|
||||
@@ -252,6 +256,8 @@ class CarState(object):
|
||||
self.main_on = cp.vl[0x326]['MAIN_ON']
|
||||
self.gear_shifter_valid = self.gear_shifter in [1,8] # TODO: 1/P allowed for debug
|
||||
self.blinker_on = cp.vl[0x326]['LEFT_BLINKER'] or cp.vl[0x326]['RIGHT_BLINKER']
|
||||
self.left_blinker_on = cp.vl[0x326]['LEFT_BLINKER']
|
||||
self.right_blinker_on = cp.vl[0x326]['RIGHT_BLINKER']
|
||||
else:
|
||||
self.gear_shifter = cp.vl[0x1A3]['GEAR_SHIFTER']
|
||||
self.angle_steers = cp.vl[0x156]['STEER_ANGLE']
|
||||
@@ -261,6 +267,8 @@ class CarState(object):
|
||||
self.main_on = cp.vl[0x1A6]['MAIN_ON']
|
||||
self.gear_shifter_valid = self.gear_shifter in [1,4] # TODO: 1/P allowed for debug
|
||||
self.blinker_on = cp.vl[0x294]['LEFT_BLINKER'] or cp.vl[0x294]['RIGHT_BLINKER']
|
||||
self.left_blinker_on = cp.vl[0x294]['LEFT_BLINKER']
|
||||
self.right_blinker_on = cp.vl[0x294]['RIGHT_BLINKER']
|
||||
self.car_gas = cp.vl[0x130]['CAR_GAS']
|
||||
self.brake_pressed = cp.vl[0x17C]['BRAKE_PRESSED']
|
||||
self.user_brake = cp.vl[0x1A4]['USER_BRAKE']
|
||||
@@ -272,4 +280,3 @@ class CarState(object):
|
||||
self.hud_lead = cp.vl[0x30C]['HUD_LEAD']
|
||||
self.counter_pcm = cp.vl[0x324]['COUNTER']
|
||||
|
||||
return canMonoTimes
|
||||
238
selfdrive/car/honda/interface.py
Executable file
238
selfdrive/car/honda/interface.py
Executable file
@@ -0,0 +1,238 @@
|
||||
#!/usr/bin/env python
|
||||
import time
|
||||
import numpy as np
|
||||
|
||||
from selfdrive.config import Conversions as CV
|
||||
from selfdrive.car.honda.carstate import CarState
|
||||
from selfdrive.car.honda.carcontroller import CarController, AH
|
||||
from selfdrive.boardd.boardd import can_capnp_to_can_list
|
||||
|
||||
from cereal import car
|
||||
|
||||
import zmq
|
||||
from common.services import service_list
|
||||
import selfdrive.messaging as messaging
|
||||
|
||||
# Car button codes
|
||||
class CruiseButtons:
|
||||
RES_ACCEL = 4
|
||||
DECEL_SET = 3
|
||||
CANCEL = 2
|
||||
MAIN = 1
|
||||
|
||||
#car chimes: enumeration from dbc file. Chimes are for alerts and warnings
|
||||
class CM:
|
||||
MUTE = 0
|
||||
SINGLE = 3
|
||||
DOUBLE = 4
|
||||
REPEATED = 1
|
||||
CONTINUOUS = 2
|
||||
|
||||
#car beepss: enumeration from dbc file. Beeps are for activ and deactiv
|
||||
class BP:
|
||||
MUTE = 0
|
||||
SINGLE = 3
|
||||
TRIPLE = 2
|
||||
REPEATED = 1
|
||||
|
||||
|
||||
class CarInterface(object):
|
||||
def __init__(self, read_only=False):
|
||||
context = zmq.Context()
|
||||
self.logcan = messaging.sub_sock(context, service_list['can'].port)
|
||||
|
||||
self.frame = 0
|
||||
self.can_invalid_count = 0
|
||||
|
||||
# *** init the major players ***
|
||||
self.CS = CarState(self.logcan)
|
||||
|
||||
# sending if read only is False
|
||||
if not read_only:
|
||||
self.sendcan = messaging.pub_sock(context, service_list['sendcan'].port)
|
||||
self.CC = CarController()
|
||||
|
||||
def getVehicleParams(self):
|
||||
return self.CS.VP
|
||||
|
||||
# returns a car.CarState
|
||||
def update(self):
|
||||
# ******************* do can recv *******************
|
||||
can_pub_main = []
|
||||
canMonoTimes = []
|
||||
for a in messaging.drain_sock(self.logcan):
|
||||
canMonoTimes.append(a.logMonoTime)
|
||||
can_pub_main.extend(can_capnp_to_can_list(a.can, [0,2]))
|
||||
self.CS.update(can_pub_main)
|
||||
|
||||
# create message
|
||||
ret = car.CarState.new_message()
|
||||
|
||||
# speeds
|
||||
ret.vEgo = self.CS.v_ego
|
||||
ret.wheelSpeeds.fl = self.CS.cp.vl[0x1D0]['WHEEL_SPEED_FL']
|
||||
ret.wheelSpeeds.fr = self.CS.cp.vl[0x1D0]['WHEEL_SPEED_FR']
|
||||
ret.wheelSpeeds.rl = self.CS.cp.vl[0x1D0]['WHEEL_SPEED_RL']
|
||||
ret.wheelSpeeds.rr = self.CS.cp.vl[0x1D0]['WHEEL_SPEED_RR']
|
||||
|
||||
# gas pedal
|
||||
ret.gas = self.CS.car_gas / 256.0
|
||||
if self.CS.VP.brake_only:
|
||||
ret.gasPressed = self.CS.pedal_gas > 0
|
||||
else:
|
||||
ret.gasPressed = self.CS.user_gas_pressed
|
||||
|
||||
# brake pedal
|
||||
ret.brake = self.CS.user_brake
|
||||
ret.brakePressed = self.CS.brake_pressed != 0
|
||||
|
||||
# steering wheel
|
||||
# TODO: units
|
||||
ret.steeringAngle = self.CS.angle_steers
|
||||
ret.steeringTorque = self.CS.cp.vl[0x18F]['STEER_TORQUE_SENSOR']
|
||||
ret.steeringPressed = self.CS.steer_override
|
||||
|
||||
# cruise state
|
||||
ret.cruiseState.enabled = self.CS.pcm_acc_status != 0
|
||||
ret.cruiseState.speed = self.CS.v_cruise_pcm * CV.KPH_TO_MS
|
||||
|
||||
# TODO: button presses
|
||||
buttonEvents = []
|
||||
|
||||
if self.CS.left_blinker_on != self.CS.prev_left_blinker_on:
|
||||
be = car.CarState.ButtonEvent.new_message()
|
||||
be.type = 'leftBlinker'
|
||||
be.pressed = self.CS.left_blinker_on != 0
|
||||
buttonEvents.append(be)
|
||||
|
||||
if self.CS.right_blinker_on != self.CS.prev_right_blinker_on:
|
||||
be = car.CarState.ButtonEvent.new_message()
|
||||
be.type = 'rightBlinker'
|
||||
be.pressed = self.CS.right_blinker_on != 0
|
||||
buttonEvents.append(be)
|
||||
|
||||
if self.CS.cruise_buttons != self.CS.prev_cruise_buttons:
|
||||
be = car.CarState.ButtonEvent.new_message()
|
||||
be.type = 'unknown'
|
||||
if self.CS.cruise_buttons != 0:
|
||||
be.pressed = True
|
||||
but = self.CS.cruise_buttons
|
||||
else:
|
||||
be.pressed = False
|
||||
but = self.CS.prev_cruise_buttons
|
||||
if but == CruiseButtons.RES_ACCEL:
|
||||
be.type = 'accelCruise'
|
||||
elif but == CruiseButtons.DECEL_SET:
|
||||
be.type = 'decelCruise'
|
||||
elif but == CruiseButtons.CANCEL:
|
||||
be.type = 'cancel'
|
||||
elif but == CruiseButtons.MAIN:
|
||||
be.type = 'altButton3'
|
||||
buttonEvents.append(be)
|
||||
|
||||
if self.CS.cruise_setting != self.CS.prev_cruise_setting:
|
||||
be = car.CarState.ButtonEvent.new_message()
|
||||
be.type = 'unknown'
|
||||
if self.CS.cruise_setting != 0:
|
||||
be.pressed = True
|
||||
but = self.CS.cruise_setting
|
||||
else:
|
||||
be.pressed = False
|
||||
but = self.CS.prev_cruise_setting
|
||||
if but == 1:
|
||||
be.type = 'altButton1'
|
||||
# TODO: more buttons?
|
||||
buttonEvents.append(be)
|
||||
ret.buttonEvents = buttonEvents
|
||||
|
||||
# errors
|
||||
# TODO: I don't like the way capnp does enums
|
||||
# These strings aren't checked at compile time
|
||||
errors = []
|
||||
if not self.CS.can_valid:
|
||||
self.can_invalid_count += 1
|
||||
if self.can_invalid_count >= 5:
|
||||
errors.append('commIssue')
|
||||
else:
|
||||
self.can_invalid_count = 0
|
||||
if self.CS.steer_error:
|
||||
errors.append('steerUnavailable')
|
||||
elif self.CS.steer_not_allowed:
|
||||
errors.append('steerTemporarilyUnavailable')
|
||||
if self.CS.brake_error:
|
||||
errors.append('brakeUnavailable')
|
||||
if not self.CS.gear_shifter_valid:
|
||||
errors.append('wrongGear')
|
||||
if not self.CS.door_all_closed:
|
||||
errors.append('doorOpen')
|
||||
if not self.CS.seatbelt:
|
||||
errors.append('seatbeltNotLatched')
|
||||
if self.CS.esp_disabled:
|
||||
errors.append('espDisabled')
|
||||
if not self.CS.main_on:
|
||||
errors.append('wrongCarMode')
|
||||
if self.CS.gear_shifter == 2:
|
||||
errors.append('reverseGear')
|
||||
|
||||
ret.errors = errors
|
||||
ret.canMonoTimes = canMonoTimes
|
||||
|
||||
# cast to reader so it can't be modified
|
||||
#print ret
|
||||
return ret.as_reader()
|
||||
|
||||
# pass in a car.CarControl
|
||||
# to be called @ 100hz
|
||||
def apply(self, c):
|
||||
#print c
|
||||
|
||||
if c.hudControl.speedVisible:
|
||||
hud_v_cruise = c.hudControl.setSpeed * CV.MS_TO_KPH
|
||||
else:
|
||||
hud_v_cruise = 255
|
||||
|
||||
hud_alert = {
|
||||
"none": AH.NONE,
|
||||
"fcw": AH.FCW,
|
||||
"steerRequired": AH.STEER,
|
||||
"brakePressed": AH.BRAKE_PRESSED,
|
||||
"wrongGear": AH.GEAR_NOT_D,
|
||||
"seatbeltUnbuckled": AH.SEATBELT,
|
||||
"speedTooHigh": AH.SPEED_TOO_HIGH}[str(c.hudControl.visualAlert)]
|
||||
|
||||
snd_beep, snd_chime = {
|
||||
"none": (BP.MUTE, CM.MUTE),
|
||||
"beepSingle": (BP.SINGLE, CM.MUTE),
|
||||
"beepTriple": (BP.TRIPLE, CM.MUTE),
|
||||
"beepRepeated": (BP.REPEATED, CM.MUTE),
|
||||
"chimeSingle": (BP.MUTE, CM.SINGLE),
|
||||
"chimeDouble": (BP.MUTE, CM.DOUBLE),
|
||||
"chimeRepeated": (BP.MUTE, CM.REPEATED),
|
||||
"chimeContinuous": (BP.MUTE, CM.CONTINUOUS)}[str(c.hudControl.audibleAlert)]
|
||||
|
||||
pcm_accel = int(np.clip(c.cruiseControl.accelOverride/1.4,0,1)*0xc6)
|
||||
|
||||
self.CC.update(self.sendcan, c.enabled, self.CS, self.frame, \
|
||||
c.gas, c.brake, c.steeringTorque, \
|
||||
c.cruiseControl.speedOverride, \
|
||||
c.cruiseControl.override, \
|
||||
c.cruiseControl.cancel, \
|
||||
pcm_accel, \
|
||||
hud_v_cruise, c.hudControl.lanesVisible, \
|
||||
hud_show_car = c.hudControl.leadVisible, \
|
||||
hud_alert = hud_alert, \
|
||||
snd_beep = snd_beep, \
|
||||
snd_chime = snd_chime)
|
||||
|
||||
self.frame += 1
|
||||
return not (c.enabled and not self.CC.controls_allowed)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
CI = CarInterface(read_only=True)
|
||||
while 1:
|
||||
cs = CI.update()
|
||||
print(chr(27) + "[2J")
|
||||
print cs
|
||||
time.sleep(0.1)
|
||||
|
||||
17
selfdrive/common/cereal.mk
Normal file
17
selfdrive/common/cereal.mk
Normal file
@@ -0,0 +1,17 @@
|
||||
CEREAL_CFLAGS = -I$(PHONELIBS)/capnp-c/include
|
||||
CEREAL_CXXFLAGS = -I$(PHONELIBS)/capnp-cpp/include
|
||||
CEREAL_LIBS = -L$(PHONELIBS)/capnp-cpp/aarch64/lib/ \
|
||||
-L$(PHONELIBS)/capnp-c/aarch64/lib/ \
|
||||
-l:libcapn.a -l:libcapnp.a -l:libkj.a
|
||||
CEREAL_OBJS = ../../cereal/gen/c/log.capnp.o ../../cereal/gen/c/car.capnp.o
|
||||
|
||||
log.capnp.o: ../../cereal/gen/cpp/log.capnp.c++
|
||||
@echo "[ CXX ] $@"
|
||||
$(CXX) $(CXXFLAGS) $(CEREAL_CFLAGS) \
|
||||
-c -o '$@' '$<'
|
||||
|
||||
car.capnp.o: ../../cereal/gen/cpp/car.capnp.c++
|
||||
@echo "[ CXX ] $@"
|
||||
$(CXX) $(CXXFLAGS) $(CEREAL_CFLAGS) \
|
||||
-c -o '$@' '$<'
|
||||
|
||||
@@ -53,6 +53,7 @@ extern "C" FramebufferState* framebuffer_init(
|
||||
assert(status == 0);
|
||||
|
||||
int orientation = 3; // rotate framebuffer 270 degrees
|
||||
//int orientation = 1; // rotate framebuffer 90 degrees
|
||||
if(orientation == 1 || orientation == 3) {
|
||||
int temp = s->dinfo.h;
|
||||
s->dinfo.h = s->dinfo.w;
|
||||
|
||||
71
selfdrive/common/glutil.c
Normal file
71
selfdrive/common/glutil.c
Normal file
@@ -0,0 +1,71 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <GLES3/gl3.h>
|
||||
|
||||
#include "glutil.h"
|
||||
|
||||
GLuint load_shader(GLenum shaderType, const char *src) {
|
||||
GLint status = 0, len = 0;
|
||||
GLuint shader;
|
||||
|
||||
if (!(shader = glCreateShader(shaderType)))
|
||||
return 0;
|
||||
|
||||
glShaderSource(shader, 1, &src, NULL);
|
||||
glCompileShader(shader);
|
||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
|
||||
|
||||
if (status)
|
||||
return shader;
|
||||
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len);
|
||||
if (len) {
|
||||
char *msg = (char*)malloc(len);
|
||||
if (msg) {
|
||||
glGetShaderInfoLog(shader, len, NULL, msg);
|
||||
msg[len-1] = 0;
|
||||
fprintf(stderr, "error compiling shader:\n%s\n", msg);
|
||||
free(msg);
|
||||
}
|
||||
}
|
||||
glDeleteShader(shader);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GLuint load_program(const char *vert_src, const char *frag_src) {
|
||||
GLuint vert, frag, prog;
|
||||
GLint status = 0, len = 0;
|
||||
|
||||
if (!(vert = load_shader(GL_VERTEX_SHADER, vert_src)))
|
||||
return 0;
|
||||
if (!(frag = load_shader(GL_FRAGMENT_SHADER, frag_src)))
|
||||
goto fail_frag;
|
||||
if (!(prog = glCreateProgram()))
|
||||
goto fail_prog;
|
||||
|
||||
glAttachShader(prog, vert);
|
||||
glAttachShader(prog, frag);
|
||||
glLinkProgram(prog);
|
||||
|
||||
glGetProgramiv(prog, GL_LINK_STATUS, &status);
|
||||
if (status)
|
||||
return prog;
|
||||
|
||||
glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &len);
|
||||
if (len) {
|
||||
char *buf = (char*) malloc(len);
|
||||
if (buf) {
|
||||
glGetProgramInfoLog(prog, len, NULL, buf);
|
||||
buf[len-1] = 0;
|
||||
fprintf(stderr, "error linking program:\n%s\n", buf);
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
glDeleteProgram(prog);
|
||||
fail_prog:
|
||||
glDeleteShader(frag);
|
||||
fail_frag:
|
||||
glDeleteShader(vert);
|
||||
return 0;
|
||||
}
|
||||
8
selfdrive/common/glutil.h
Normal file
8
selfdrive/common/glutil.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef COMMON_GLUTIL_H
|
||||
#define COMMON_GLUTIL_H
|
||||
|
||||
#include <GLES3/gl3.h>
|
||||
GLuint load_shader(GLenum shaderType, const char *src);
|
||||
GLuint load_program(const char *vert_src, const char *frag_src);
|
||||
|
||||
#endif
|
||||
@@ -19,6 +19,7 @@ typedef struct LogState {
|
||||
JsonNode *ctx_j;
|
||||
void *zctx;
|
||||
void *sock;
|
||||
int print_level;
|
||||
} LogState;
|
||||
|
||||
static LogState s = {
|
||||
@@ -31,6 +32,19 @@ static void cloudlog_init() {
|
||||
s.zctx = zmq_ctx_new();
|
||||
s.sock = zmq_socket(s.zctx, ZMQ_PUSH);
|
||||
zmq_connect(s.sock, "ipc:///tmp/logmessage");
|
||||
|
||||
s.print_level = CLOUDLOG_WARNING;
|
||||
const char* print_level = getenv("LOGPRINT");
|
||||
if (print_level) {
|
||||
if (strcmp(print_level, "debug") == 0) {
|
||||
s.print_level = CLOUDLOG_DEBUG;
|
||||
} else if (strcmp(print_level, "info") == 0) {
|
||||
s.print_level = CLOUDLOG_INFO;
|
||||
} else if (strcmp(print_level, "warning") == 0) {
|
||||
s.print_level = CLOUDLOG_WARNING;
|
||||
}
|
||||
}
|
||||
|
||||
s.inited = true;
|
||||
}
|
||||
|
||||
@@ -50,7 +64,7 @@ void cloudlog_e(int levelnum, const char* filename, int lineno, const char* func
|
||||
return;
|
||||
}
|
||||
|
||||
if (levelnum >= CLOUDLOG_PRINT_LEVEL) {
|
||||
if (levelnum >= s.print_level) {
|
||||
printf("%s: %s\n", filename, msg_buf);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,19 @@
|
||||
#define CLOUDLOG_ERROR 40
|
||||
#define CLOUDLOG_CRITICAL 50
|
||||
|
||||
#define CLOUDLOG_PRINT_LEVEL CLOUDLOG_WARNING
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void cloudlog_e(int levelnum, const char* filename, int lineno, const char* func, const char* srctime,
|
||||
const char* fmt, ...) /*__attribute__ ((format (printf, 6, 7)))*/;
|
||||
|
||||
void cloudlog_bind(const char* k, const char* v);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define cloudlog(lvl, fmt, ...) cloudlog_e(lvl, __FILE__, __LINE__, \
|
||||
__func__, __DATE__ " " __TIME__, \
|
||||
fmt, ## __VA_ARGS__)
|
||||
|
||||
1
selfdrive/common/version.h
Normal file
1
selfdrive/common/version.h
Normal file
@@ -0,0 +1 @@
|
||||
const char *openpilot_version = "0.2.9";
|
||||
@@ -57,12 +57,18 @@ class UIParams:
|
||||
car_color = 110
|
||||
|
||||
class VehicleParams:
|
||||
def __init__(self, civic):
|
||||
def __init__(self, civic, brake_only=False, torque_mod=False):
|
||||
if civic:
|
||||
self.wheelbase = 2.67
|
||||
self.steer_ratio = 15.3
|
||||
self.slip_factor = 0.0014
|
||||
self.civic = True
|
||||
else:
|
||||
self.wheelbase = 2.67 # from http://www.edmunds.com/acura/ilx/2016/sedan/features-specs/
|
||||
self.steer_ratio = 15.3 # from http://www.edmunds.com/acura/ilx/2016/road-test-specs/
|
||||
self.slip_factor = 0.0014
|
||||
self.civic = False
|
||||
self.brake_only = brake_only
|
||||
self.torque_mod = torque_mod
|
||||
self.ui_speed_fudge = 1.01 if self.civic else 1.025
|
||||
|
||||
|
||||
@@ -1,234 +1,229 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import zmq
|
||||
import numpy as np
|
||||
|
||||
from common.services import service_list
|
||||
from common.realtime import sec_since_boot, set_realtime_priority, Ratekeeper
|
||||
|
||||
from selfdrive.config import CruiseButtons
|
||||
from selfdrive.config import Conversions as CV
|
||||
|
||||
from selfdrive.controls.lib.drive_helpers import learn_angle_offset
|
||||
from selfdrive.controls.lib.alert_database import process_alert, AI
|
||||
|
||||
import selfdrive.messaging as messaging
|
||||
|
||||
from selfdrive.controls.lib.carstate import CarState
|
||||
from selfdrive.controls.lib.carcontroller import CarController
|
||||
from cereal import car
|
||||
|
||||
from common.numpy_fast import clip
|
||||
|
||||
from selfdrive.config import Conversions as CV
|
||||
from common.services import service_list
|
||||
from common.realtime import sec_since_boot, set_realtime_priority, Ratekeeper
|
||||
from common.profiler import Profiler
|
||||
|
||||
from selfdrive.controls.lib.drive_helpers import learn_angle_offset
|
||||
|
||||
from selfdrive.controls.lib.longcontrol import LongControl
|
||||
from selfdrive.controls.lib.latcontrol import LatControl
|
||||
|
||||
from selfdrive.controls.lib.pathplanner import PathPlanner
|
||||
from selfdrive.controls.lib.adaptivecruise import AdaptiveCruise
|
||||
|
||||
from selfdrive.controls.lib.alertmanager import AlertManager
|
||||
|
||||
car_type = os.getenv("CAR")
|
||||
if car_type is not None:
|
||||
exec('from selfdrive.car.'+car_type+'.interface import CarInterface')
|
||||
else:
|
||||
from selfdrive.car.honda.interface import CarInterface
|
||||
|
||||
V_CRUISE_MAX = 144
|
||||
V_CRUISE_MIN = 8
|
||||
V_CRUISE_DELTA = 8
|
||||
V_CRUISE_ENABLE_MIN = 40
|
||||
|
||||
def controlsd_thread(gctx, rate=100): #rate in Hz
|
||||
# *** log ***
|
||||
context = zmq.Context()
|
||||
live100 = messaging.pub_sock(context, service_list['live100'].port)
|
||||
carstate = messaging.pub_sock(context, service_list['carState'].port)
|
||||
carcontrol = messaging.pub_sock(context, service_list['carControl'].port)
|
||||
|
||||
thermal = messaging.sub_sock(context, service_list['thermal'].port)
|
||||
live20 = messaging.sub_sock(context, service_list['live20'].port)
|
||||
model = messaging.sub_sock(context, service_list['model'].port)
|
||||
health = messaging.sub_sock(context, service_list['health'].port)
|
||||
|
||||
logcan = messaging.sub_sock(context, service_list['can'].port)
|
||||
sendcan = messaging.pub_sock(context, service_list['sendcan'].port)
|
||||
|
||||
# *** init the major players ***
|
||||
CS = CarState(logcan)
|
||||
CC = CarController()
|
||||
# connects to can and sendcan
|
||||
CI = CarInterface()
|
||||
VP = CI.getVehicleParams()
|
||||
|
||||
PP = PathPlanner(model)
|
||||
AC = AdaptiveCruise(live20)
|
||||
|
||||
AM = AlertManager()
|
||||
|
||||
LoC = LongControl()
|
||||
LaC = LatControl()
|
||||
|
||||
# *** control initial values ***
|
||||
apply_brake = 0
|
||||
# controls enabled state
|
||||
enabled = False
|
||||
last_enable_request = 0
|
||||
|
||||
# *** time values ***
|
||||
last_enable_pressed = 0
|
||||
|
||||
# *** controls initial values ***
|
||||
# *** display stuff
|
||||
soft_disable_start = 0
|
||||
sounding = False
|
||||
no_mismatch_pcm_last, no_mismatch_ctrl_last = 0, 0
|
||||
|
||||
# car state
|
||||
alert, sound_exp, hud_exp, text_exp, alert_p = None, 0, 0, 0, 0
|
||||
rear_view_cam, rear_view_toggle = False, False
|
||||
|
||||
v_cruise = 255 # this means no display
|
||||
v_cruise_max = 144
|
||||
v_cruise_min = 8
|
||||
v_cruise_delta = 8
|
||||
|
||||
# on activation target at least 25mph. With 5mph you need too much tapping
|
||||
v_cruise_enable_min = 40
|
||||
|
||||
hud_v_cruise = 255
|
||||
|
||||
# learned angle offset
|
||||
angle_offset = 0
|
||||
|
||||
max_enable_speed = 57. # ~91 mph
|
||||
# rear view camera state
|
||||
rear_view_toggle = False
|
||||
|
||||
pcm_threshold = 25.*CV.MPH_TO_MS # below this speed pcm cancels
|
||||
|
||||
overtemp = True
|
||||
v_cruise_kph = 255
|
||||
|
||||
# 0.0 - 1.0
|
||||
awareness_status = 0.0
|
||||
|
||||
soft_disable_timer = None
|
||||
|
||||
# Is cpu temp too high to enable?
|
||||
overtemp = False
|
||||
free_space = 1.0
|
||||
|
||||
# start the loop
|
||||
set_realtime_priority(2)
|
||||
|
||||
rk = Ratekeeper(rate)
|
||||
rk = Ratekeeper(rate, print_delay_threshold=2./1000)
|
||||
while 1:
|
||||
prof = Profiler()
|
||||
cur_time = sec_since_boot()
|
||||
|
||||
# read CAN
|
||||
canMonoTimes = CS.update(logcan)
|
||||
CS = CI.update()
|
||||
|
||||
# **** rearview mirror management ***
|
||||
if CS.cruise_setting == 1 and CS.prev_cruise_setting == 0:
|
||||
rear_view_toggle = not rear_view_toggle
|
||||
# broadcast carState
|
||||
cs_send = messaging.new_message()
|
||||
cs_send.init('carState')
|
||||
cs_send.carState = CS # copy?
|
||||
carstate.send(cs_send.to_bytes())
|
||||
|
||||
# show rear view camera on phone if in reverse gear or when lkas button is pressed
|
||||
rear_view_cam = (CS.gear_shifter == 2) or rear_view_toggle or CS.blinker_on
|
||||
prof.checkpoint("CarInterface")
|
||||
|
||||
# did it request to enable?
|
||||
enable_request, enable_condition = False, False
|
||||
|
||||
if enabled:
|
||||
# gives the user 6 minutes
|
||||
awareness_status -= 1.0/(100*60*6)
|
||||
if awareness_status <= 0.:
|
||||
AM.add("driverDistracted", enabled)
|
||||
|
||||
# reset awareness status on steering
|
||||
if CS.steeringPressed:
|
||||
awareness_status = 1.0
|
||||
|
||||
# handle button presses
|
||||
for b in CS.buttonEvents:
|
||||
print b
|
||||
|
||||
# reset awareness on any user action
|
||||
awareness_status = 1.0
|
||||
|
||||
# button presses for rear view
|
||||
if b.type == "leftBlinker" or b.type == "rightBlinker":
|
||||
if b.pressed:
|
||||
rear_view_toggle = True
|
||||
else:
|
||||
rear_view_toggle = False
|
||||
|
||||
if b.type == "altButton1" and b.pressed:
|
||||
rear_view_toggle = not rear_view_toggle
|
||||
|
||||
if not VP.brake_only and enabled and not b.pressed:
|
||||
if b.type == "accelCruise":
|
||||
v_cruise_kph = v_cruise_kph - (v_cruise_kph % V_CRUISE_DELTA) + V_CRUISE_DELTA
|
||||
elif b.type == "decelCruise":
|
||||
v_cruise_kph = v_cruise_kph - (v_cruise_kph % V_CRUISE_DELTA) - V_CRUISE_DELTA
|
||||
v_cruise_kph = clip(v_cruise_kph, V_CRUISE_MIN, V_CRUISE_MAX)
|
||||
|
||||
if not enabled and b.type in ["accelCruise", "decelCruise"] and not b.pressed:
|
||||
enable_request = True
|
||||
|
||||
# do disable on button down
|
||||
if b.type == "cancel" and b.pressed:
|
||||
AM.add("disable", enabled)
|
||||
|
||||
prof.checkpoint("Buttons")
|
||||
|
||||
# *** health checking logic ***
|
||||
hh = messaging.recv_sock(health)
|
||||
if hh is not None:
|
||||
# if the board isn't allowing controls but somehow we are enabled!
|
||||
if not hh.health.controlsAllowed and enabled:
|
||||
AM.add("controlsMismatch", enabled)
|
||||
|
||||
# *** thermal checking logic ***
|
||||
|
||||
# thermal data, checked every second
|
||||
td = messaging.recv_sock(thermal)
|
||||
if td is not None:
|
||||
cpu_temps = [td.thermal.cpu0, td.thermal.cpu1, td.thermal.cpu2,
|
||||
td.thermal.cpu3, td.thermal.mem, td.thermal.gpu]
|
||||
# check overtemp
|
||||
overtemp = any(t > 950 for t in cpu_temps)
|
||||
# Check temperature.
|
||||
overtemp = any(
|
||||
t > 950
|
||||
for t in (td.thermal.cpu0, td.thermal.cpu1, td.thermal.cpu2,
|
||||
td.thermal.cpu3, td.thermal.mem, td.thermal.gpu))
|
||||
# under 15% of space free
|
||||
free_space = td.thermal.freeSpace
|
||||
|
||||
prof.checkpoint("Health")
|
||||
|
||||
# *** getting model logic ***
|
||||
PP.update(cur_time, CS.v_ego)
|
||||
PP.update(cur_time, CS.vEgo)
|
||||
|
||||
if rk.frame % 5 == 2:
|
||||
# *** run this at 20hz again ***
|
||||
angle_offset = learn_angle_offset(enabled, CS.v_ego, angle_offset, np.asarray(PP.d_poly), LaC.y_des, CS.steer_override)
|
||||
angle_offset = learn_angle_offset(enabled, CS.vEgo, angle_offset, np.asarray(PP.d_poly), LaC.y_des, CS.steeringPressed)
|
||||
|
||||
# to avoid race conditions, check if control has been disabled for at least 0.2s
|
||||
mismatch_ctrl = not CC.controls_allowed and enabled
|
||||
mismatch_pcm = (not CS.pcm_acc_status and (not apply_brake or CS.v_ego < 0.1)) and enabled
|
||||
|
||||
# keep resetting start timer if mismatch isn't true
|
||||
if not mismatch_ctrl:
|
||||
no_mismatch_ctrl_last = cur_time
|
||||
if not mismatch_pcm or not CS.brake_only:
|
||||
no_mismatch_pcm_last = cur_time
|
||||
|
||||
#*** v_cruise logic ***
|
||||
if CS.brake_only:
|
||||
v_cruise = int(CS.v_cruise_pcm) # TODO: why sometimes v_cruise_pcm is long type?
|
||||
else:
|
||||
if CS.prev_cruise_buttons == 0 and CS.cruise_buttons == CruiseButtons.RES_ACCEL and enabled:
|
||||
v_cruise = v_cruise - (v_cruise % v_cruise_delta) + v_cruise_delta
|
||||
elif CS.prev_cruise_buttons == 0 and CS.cruise_buttons == CruiseButtons.DECEL_SET and enabled:
|
||||
v_cruise = v_cruise + (v_cruise % v_cruise_delta) - v_cruise_delta
|
||||
|
||||
# *** enabling/disabling logic ***
|
||||
enable_pressed = (CS.prev_cruise_buttons == CruiseButtons.DECEL_SET or CS.prev_cruise_buttons == CruiseButtons.RES_ACCEL) \
|
||||
and CS.cruise_buttons == 0
|
||||
|
||||
if enable_pressed:
|
||||
print "enabled pressed at", cur_time
|
||||
last_enable_pressed = cur_time
|
||||
|
||||
# if pcm does speed control than we need to wait on pcm to enable
|
||||
if CS.brake_only:
|
||||
enable_condition = (cur_time - last_enable_pressed) < 0.2 and CS.pcm_acc_status
|
||||
else:
|
||||
enable_condition = enable_pressed
|
||||
|
||||
# always clear the alert at every cycle
|
||||
alert_id = []
|
||||
|
||||
# check for PCM not enabling
|
||||
if CS.brake_only and (cur_time - last_enable_pressed) < 0.2 and not CS.pcm_acc_status:
|
||||
print "waiting for PCM to enable"
|
||||
|
||||
# check for denied enabling
|
||||
if enable_pressed and not enabled:
|
||||
deny_enable = \
|
||||
[(AI.SEATBELT, not CS.seatbelt),
|
||||
(AI.DOOR_OPEN, not CS.door_all_closed),
|
||||
(AI.ESP_OFF, CS.esp_disabled),
|
||||
(AI.STEER_ERROR, CS.steer_error),
|
||||
(AI.BRAKE_ERROR, CS.brake_error),
|
||||
(AI.GEAR_NOT_D, not CS.gear_shifter_valid),
|
||||
(AI.MAIN_OFF, not CS.main_on),
|
||||
(AI.PEDAL_PRESSED, CS.user_gas_pressed or CS.brake_pressed or (CS.pedal_gas > 0 and CS.brake_only)),
|
||||
(AI.HIGH_SPEED, CS.v_ego > max_enable_speed),
|
||||
(AI.OVERHEAT, overtemp),
|
||||
(AI.COMM_ISSUE, PP.dead or AC.dead),
|
||||
(AI.CONTROLSD_LAG, rk.remaining < -0.2)]
|
||||
for alertn, cond in deny_enable:
|
||||
if cond:
|
||||
alert_id += [alertn]
|
||||
|
||||
# check for soft disables
|
||||
# disable if the pedals are pressed while engaged, this is a user disable
|
||||
if enabled:
|
||||
soft_disable = \
|
||||
[(AI.SEATBELT_SD, not CS.seatbelt),
|
||||
(AI.DOOR_OPEN_SD, not CS.door_all_closed),
|
||||
(AI.ESP_OFF_SD, CS.esp_disabled),
|
||||
(AI.OVERHEAT_SD, overtemp),
|
||||
(AI.COMM_ISSUE_SD, PP.dead or AC.dead),
|
||||
(AI.CONTROLSD_LAG_SD, rk.remaining < -0.2)]
|
||||
sounding = False
|
||||
for alertn, cond in soft_disable:
|
||||
if cond:
|
||||
alert_id += [alertn]
|
||||
sounding = True
|
||||
# soft disengagement expired, user need to take control
|
||||
if (cur_time - soft_disable_start) > 3.:
|
||||
enabled = False
|
||||
v_cruise = 255
|
||||
if not sounding:
|
||||
soft_disable_start = cur_time
|
||||
if CS.gasPressed or CS.brakePressed:
|
||||
AM.add("disable", enabled)
|
||||
|
||||
# check for immediate disables
|
||||
if enabled:
|
||||
immediate_disable = \
|
||||
[(AI.PCM_LOW_SPEED, (cur_time > no_mismatch_pcm_last > 0.2) and CS.v_ego < pcm_threshold),
|
||||
(AI.STEER_ERROR_ID, CS.steer_error),
|
||||
(AI.BRAKE_ERROR_ID, CS.brake_error),
|
||||
(AI.CTRL_MISMATCH_ID, (cur_time - no_mismatch_ctrl_last) > 0.2),
|
||||
(AI.PCM_MISMATCH_ID, (cur_time - no_mismatch_pcm_last) > 0.2)]
|
||||
for alertn, cond in immediate_disable:
|
||||
if cond:
|
||||
alert_id += [alertn]
|
||||
# immediate turn off control
|
||||
enabled = False
|
||||
v_cruise = 255
|
||||
if enable_request:
|
||||
# check for pressed pedals
|
||||
if CS.gasPressed or CS.brakePressed:
|
||||
AM.add("pedalPressed", enabled)
|
||||
enable_request = False
|
||||
else:
|
||||
print "enabled pressed at", cur_time
|
||||
last_enable_request = cur_time
|
||||
|
||||
# user disabling
|
||||
if enabled and (CS.user_gas_pressed or CS.brake_pressed or not CS.gear_shifter_valid or \
|
||||
(CS.cruise_buttons == CruiseButtons.CANCEL and CS.prev_cruise_buttons == 0) or \
|
||||
not CS.main_on or (CS.pedal_gas > 0 and CS.brake_only)):
|
||||
enabled = False
|
||||
v_cruise = 255
|
||||
alert_id += [AI.DISABLE]
|
||||
# don't engage with less than 15% free
|
||||
if free_space < 0.15:
|
||||
AM.add("outOfSpace", enabled)
|
||||
enable_request = False
|
||||
|
||||
# enabling
|
||||
if enable_condition and not enabled and len(alert_id) == 0:
|
||||
if VP.brake_only:
|
||||
enable_condition = ((cur_time - last_enable_request) < 0.2) and CS.cruiseState.enabled
|
||||
else:
|
||||
enable_condition = enable_request
|
||||
|
||||
if enable_request or enable_condition or enabled:
|
||||
# add all alerts from car
|
||||
for alert in CS.errors:
|
||||
AM.add(alert, enabled)
|
||||
|
||||
if AC.dead:
|
||||
AM.add("radarCommIssue", enabled)
|
||||
|
||||
if PP.dead:
|
||||
AM.add("modelCommIssue", enabled)
|
||||
|
||||
if overtemp:
|
||||
AM.add("overheat", enabled)
|
||||
|
||||
prof.checkpoint("Model")
|
||||
|
||||
if enable_condition and not enabled and not AM.alertPresent():
|
||||
print "*** enabling controls"
|
||||
|
||||
#enable both lateral and longitudinal controls
|
||||
# beep for enabling
|
||||
AM.add("enable", enabled)
|
||||
|
||||
# enable both lateral and longitudinal controls
|
||||
enabled = True
|
||||
counter_pcm_enabled = CS.counter_pcm
|
||||
|
||||
# on activation, let's always set v_cruise from where we are, even if PCM ACC is active
|
||||
# what we want to be displayed in mph
|
||||
v_cruise_mph = round(CS.v_ego * CV.MS_TO_MPH * CS.ui_speed_fudge)
|
||||
# what we need to send to have that displayed
|
||||
v_cruise = int(round(np.maximum(v_cruise_mph * CV.MPH_TO_KPH, v_cruise_enable_min)))
|
||||
v_cruise_kph = int(round(max(CS.vEgo * CV.MS_TO_KPH * VP.ui_speed_fudge, V_CRUISE_ENABLE_MIN)))
|
||||
|
||||
# 6 minutes driver you're on
|
||||
awareness_status = 1.0
|
||||
@@ -236,67 +231,80 @@ def controlsd_thread(gctx, rate=100): #rate in Hz
|
||||
# reset the PID loops
|
||||
LaC.reset()
|
||||
# start long control at actual speed
|
||||
LoC.reset(v_pid = CS.v_ego)
|
||||
LoC.reset(v_pid = CS.vEgo)
|
||||
|
||||
alert_id += [AI.ENABLE]
|
||||
if VP.brake_only and CS.cruiseState.enabled:
|
||||
v_cruise_kph = CS.cruiseState.speed * CV.MS_TO_KPH
|
||||
|
||||
if v_cruise != 255 and not CS.brake_only:
|
||||
v_cruise = np.clip(v_cruise, v_cruise_min, v_cruise_max)
|
||||
# *** put the adaptive in adaptive cruise control ***
|
||||
AC.update(cur_time, CS.vEgo, CS.steeringAngle, LoC.v_pid, awareness_status, VP)
|
||||
|
||||
# **** awareness status manager ****
|
||||
if enabled:
|
||||
# gives the user 6 minutes
|
||||
awareness_status -= 1.0/(100*60*6)
|
||||
# reset on steering, blinker, or cruise buttons
|
||||
if CS.steer_override or CS.blinker_on or CS.cruise_buttons or CS.cruise_setting:
|
||||
awareness_status = 1.0
|
||||
if awareness_status <= 0.:
|
||||
alert_id += [AI.DRIVER_DISTRACTED]
|
||||
prof.checkpoint("AdaptiveCruise")
|
||||
|
||||
# ****** initial actuators commands ***
|
||||
# *** gas/brake PID loop ***
|
||||
AC.update(cur_time, CS.v_ego, CS.angle_steers, LoC.v_pid, awareness_status, CS.VP)
|
||||
final_gas, final_brake = LoC.update(enabled, CS, v_cruise, AC.v_target_lead, AC.a_target, AC.jerk_factor)
|
||||
pcm_accel = int(np.clip(AC.a_pcm/1.4,0,1)*0xc6) # TODO: perc of max accel in ACC?
|
||||
final_gas, final_brake = LoC.update(enabled, CS.vEgo, v_cruise_kph, AC.v_target_lead, AC.a_target, AC.jerk_factor, VP)
|
||||
|
||||
# *** steering PID loop ***
|
||||
final_steer, sat_flag = LaC.update(enabled, CS, PP.d_poly, angle_offset)
|
||||
final_steer, sat_flag = LaC.update(enabled, CS.vEgo, CS.steeringAngle, CS.steeringPressed, PP.d_poly, angle_offset, VP)
|
||||
|
||||
# this needs to stay before hysteresis logic to avoid pcm staying on control during brake hysteresis
|
||||
pcm_override = True # this is always True
|
||||
pcm_cancel_cmd = False
|
||||
if CS.brake_only and final_brake == 0.:
|
||||
pcm_speed = LoC.v_pid - .3 # FIXME: just for exp
|
||||
else:
|
||||
pcm_speed = 0
|
||||
prof.checkpoint("PID")
|
||||
|
||||
# ***** handle alerts ****
|
||||
# send a "steering required alert" if saturation count has reached the limit
|
||||
if sat_flag:
|
||||
alert_id += [AI.STEER_SATURATED]
|
||||
AM.add("steerSaturated", enabled)
|
||||
|
||||
# process the alert, based on id
|
||||
alert, chime, beep, hud_alert, alert_text, sound_exp, hud_exp, text_exp, alert_p = \
|
||||
process_alert(alert_id, alert, cur_time, sound_exp, hud_exp, text_exp, alert_p)
|
||||
if enabled and AM.alertShouldDisable():
|
||||
print "DISABLING IMMEDIATELY ON ALERT"
|
||||
enabled = False
|
||||
|
||||
# alerts pub
|
||||
if len(alert_id) != 0:
|
||||
print alert_id, alert_text
|
||||
|
||||
# *** process for hud display ***
|
||||
if not enabled or (hud_v_cruise == 255 and CS.counter_pcm == counter_pcm_enabled):
|
||||
hud_v_cruise = 255
|
||||
if enabled and AM.alertShouldSoftDisable():
|
||||
if soft_disable_timer is None:
|
||||
soft_disable_timer = 3 * rate
|
||||
elif soft_disable_timer == 0:
|
||||
print "SOFT DISABLING ON ALERT"
|
||||
enabled = False
|
||||
else:
|
||||
soft_disable_timer -= 1
|
||||
else:
|
||||
hud_v_cruise = v_cruise
|
||||
soft_disable_timer = None
|
||||
|
||||
# *** actually do can sends ***
|
||||
CC.update(sendcan, enabled, CS, rk.frame, \
|
||||
final_gas, final_brake, final_steer, \
|
||||
pcm_speed, pcm_override, pcm_cancel_cmd, pcm_accel, \
|
||||
hud_v_cruise, hud_show_lanes = enabled, \
|
||||
hud_show_car = AC.has_lead, \
|
||||
hud_alert = hud_alert, \
|
||||
snd_beep = beep, snd_chime = chime)
|
||||
# *** push the alerts to current ***
|
||||
alert_text_1, alert_text_2, visual_alert, audible_alert = AM.process_alerts(cur_time)
|
||||
|
||||
# ***** control the car *****
|
||||
CC = car.CarControl.new_message()
|
||||
|
||||
CC.enabled = enabled
|
||||
|
||||
CC.gas = float(final_gas)
|
||||
CC.brake = float(final_brake)
|
||||
CC.steeringTorque = float(final_steer)
|
||||
|
||||
CC.cruiseControl.override = True
|
||||
CC.cruiseControl.cancel = bool((not VP.brake_only) or (not enabled and CS.cruiseState.enabled)) # always cancel if we have an interceptor
|
||||
CC.cruiseControl.speedOverride = float((LoC.v_pid - .3) if (VP.brake_only and final_brake == 0.) else 0.0)
|
||||
CC.cruiseControl.accelOverride = float(AC.a_pcm)
|
||||
|
||||
CC.hudControl.setSpeed = float(v_cruise_kph * CV.KPH_TO_MS)
|
||||
CC.hudControl.speedVisible = enabled
|
||||
CC.hudControl.lanesVisible = enabled
|
||||
CC.hudControl.leadVisible = bool(AC.has_lead)
|
||||
|
||||
CC.hudControl.visualAlert = visual_alert
|
||||
CC.hudControl.audibleAlert = audible_alert
|
||||
|
||||
# this alert will apply next controls cycle
|
||||
if not CI.apply(CC):
|
||||
AM.add("controlsFailed", enabled)
|
||||
|
||||
# broadcast carControl
|
||||
cc_send = messaging.new_message()
|
||||
cc_send.init('carControl')
|
||||
cc_send.carControl = CC # copy?
|
||||
carcontrol.send(cc_send.to_bytes())
|
||||
|
||||
prof.checkpoint("CarControl")
|
||||
|
||||
# ***** publish state to logger *****
|
||||
|
||||
@@ -304,14 +312,14 @@ def controlsd_thread(gctx, rate=100): #rate in Hz
|
||||
dat = messaging.new_message()
|
||||
dat.init('live100')
|
||||
|
||||
# move liveUI into live100
|
||||
dat.live100.rearViewCam = bool(rear_view_cam)
|
||||
dat.live100.alertText1 = alert_text[0]
|
||||
dat.live100.alertText2 = alert_text[1]
|
||||
# show rear view camera on phone if in reverse gear or when button is pressed
|
||||
dat.live100.rearViewCam = ('reverseGear' in CS.errors) or rear_view_toggle
|
||||
dat.live100.alertText1 = alert_text_1
|
||||
dat.live100.alertText2 = alert_text_2
|
||||
dat.live100.awarenessStatus = max(awareness_status, 0.0) if enabled else 0.0
|
||||
|
||||
# what packets were used to process
|
||||
dat.live100.canMonoTimes = canMonoTimes
|
||||
dat.live100.canMonoTimes = list(CS.canMonoTimes)
|
||||
dat.live100.mdMonoTime = PP.logMonoTime
|
||||
dat.live100.l20MonoTime = AC.logMonoTime
|
||||
|
||||
@@ -319,15 +327,13 @@ def controlsd_thread(gctx, rate=100): #rate in Hz
|
||||
dat.live100.enabled = enabled
|
||||
|
||||
# car state
|
||||
dat.live100.vEgo = float(CS.v_ego)
|
||||
dat.live100.aEgo = float(CS.a_ego)
|
||||
dat.live100.angleSteers = float(CS.angle_steers)
|
||||
dat.live100.hudLead = CS.hud_lead
|
||||
dat.live100.steerOverride = CS.steer_override
|
||||
dat.live100.vEgo = CS.vEgo
|
||||
dat.live100.angleSteers = CS.steeringAngle
|
||||
dat.live100.steerOverride = CS.steeringPressed
|
||||
|
||||
# longitudinal control state
|
||||
dat.live100.vPid = float(LoC.v_pid)
|
||||
dat.live100.vCruise = float(v_cruise)
|
||||
dat.live100.vCruise = float(v_cruise_kph)
|
||||
dat.live100.upAccelCmd = float(LoC.Up_accel_cmd)
|
||||
dat.live100.uiAccelCmd = float(LoC.Ui_accel_cmd)
|
||||
|
||||
@@ -348,8 +354,11 @@ def controlsd_thread(gctx, rate=100): #rate in Hz
|
||||
|
||||
live100.send(dat.to_bytes())
|
||||
|
||||
prof.checkpoint("Live100")
|
||||
|
||||
# *** run loop at fixed rate ***
|
||||
rk.keep_time()
|
||||
if rk.keep_time():
|
||||
prof.display()
|
||||
|
||||
def main(gctx=None):
|
||||
controlsd_thread(gctx, 100)
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
import selfdrive.messaging as messaging
|
||||
import math
|
||||
import numpy as np
|
||||
from common.numpy_fast import clip, interp
|
||||
import selfdrive.messaging as messaging
|
||||
|
||||
# lookup tables VS speed to determine min and max accels in cruise
|
||||
_A_CRUISE_MIN_V = np.asarray([-1.0, -.8, -.67, -.5, -.30])
|
||||
_A_CRUISE_MIN_BP = np.asarray([ 0., 5., 10., 20., 40.])
|
||||
_A_CRUISE_MIN_V = [-1.0, -.8, -.67, -.5, -.30]
|
||||
_A_CRUISE_MIN_BP = [ 0., 5., 10., 20., 40.]
|
||||
|
||||
# need fast accel at very low speed for stop and go
|
||||
_A_CRUISE_MAX_V = np.asarray([1., 1., .8, .5, .30])
|
||||
_A_CRUISE_MAX_BP = np.asarray([0., 5., 10., 20., 40.])
|
||||
_A_CRUISE_MAX_V = [1., 1., .8, .5, .30]
|
||||
_A_CRUISE_MAX_BP = [0., 5., 10., 20., 40.]
|
||||
|
||||
def calc_cruise_accel_limits(v_ego):
|
||||
a_cruise_min = np.interp(v_ego, _A_CRUISE_MIN_BP, _A_CRUISE_MIN_V)
|
||||
a_cruise_max = np.interp(v_ego, _A_CRUISE_MAX_BP, _A_CRUISE_MAX_V)
|
||||
a_cruise_min = interp(v_ego, _A_CRUISE_MIN_BP, _A_CRUISE_MIN_V)
|
||||
a_cruise_max = interp(v_ego, _A_CRUISE_MAX_BP, _A_CRUISE_MAX_V)
|
||||
return np.vstack([a_cruise_min, a_cruise_max])
|
||||
|
||||
a_pcm = 1. # always 1 for now
|
||||
return np.vstack([a_cruise_min, a_cruise_max]), a_pcm
|
||||
|
||||
_A_TOTAL_MAX_V = np.asarray([1.5, 1.9, 3.2])
|
||||
_A_TOTAL_MAX_BP = np.asarray([0., 20., 40.])
|
||||
_A_TOTAL_MAX_V = [1.5, 1.9, 3.2]
|
||||
_A_TOTAL_MAX_BP = [0., 20., 40.]
|
||||
|
||||
def limit_accel_in_turns(v_ego, angle_steers, a_target, a_pcm, VP):
|
||||
#*** this function returns a limited long acceleration allowed, depending on the existing lateral acceleration
|
||||
# this should avoid accelerating when losing the target in turns
|
||||
deg_to_rad = np.pi / 180. # from can reading to rad
|
||||
|
||||
a_total_max = np.interp(v_ego, _A_TOTAL_MAX_BP, _A_TOTAL_MAX_V)
|
||||
a_total_max = interp(v_ego, _A_TOTAL_MAX_BP, _A_TOTAL_MAX_V)
|
||||
a_y = v_ego**2 * angle_steers * deg_to_rad / (VP.steer_ratio * VP.wheelbase)
|
||||
a_x_allowed = np.sqrt(np.maximum(a_total_max**2 - a_y**2, 0.))
|
||||
a_x_allowed = math.sqrt(max(a_total_max**2 - a_y**2, 0.))
|
||||
|
||||
a_target[1] = np.minimum(a_target[1], a_x_allowed)
|
||||
a_pcm = np.minimum(a_pcm, a_x_allowed)
|
||||
a_target[1] = min(a_target[1], a_x_allowed)
|
||||
a_pcm = min(a_pcm, a_x_allowed)
|
||||
return a_target, a_pcm
|
||||
|
||||
def process_a_lead(a_lead):
|
||||
# soft threshold of 0.5m/s^2 applied to a_lead to reject noise, also not considered positive a_lead
|
||||
a_lead_threshold = 0.5
|
||||
a_lead = np.minimum(a_lead + a_lead_threshold, 0)
|
||||
a_lead = min(a_lead + a_lead_threshold, 0)
|
||||
return a_lead
|
||||
|
||||
def calc_desired_distance(v_lead):
|
||||
@@ -46,12 +46,12 @@ def calc_desired_distance(v_lead):
|
||||
|
||||
|
||||
#linear slope
|
||||
_L_SLOPE_V = np.asarray([0.40, 0.10])
|
||||
_L_SLOPE_BP = np.asarray([0., 40])
|
||||
_L_SLOPE_V = [0.40, 0.10]
|
||||
_L_SLOPE_BP = [0., 40]
|
||||
|
||||
# parabola slope
|
||||
_P_SLOPE_V = np.asarray([1.0, 0.25])
|
||||
_P_SLOPE_BP = np.asarray([0., 40])
|
||||
_P_SLOPE_V = [1.0, 0.25]
|
||||
_P_SLOPE_BP = [0., 40]
|
||||
|
||||
def calc_desired_speed(d_lead, d_des, v_lead, a_lead):
|
||||
#*** compute desired speed ***
|
||||
@@ -64,8 +64,8 @@ def calc_desired_speed(d_lead, d_des, v_lead, a_lead):
|
||||
max_runaway_speed = -2. # no slower than 2m/s over the lead
|
||||
|
||||
# interpolate the lookups to find the slopes for a give lead speed
|
||||
l_slope = np.interp(v_lead, _L_SLOPE_BP, _L_SLOPE_V)
|
||||
p_slope = np.interp(v_lead, _P_SLOPE_BP, _P_SLOPE_V)
|
||||
l_slope = interp(v_lead, _L_SLOPE_BP, _L_SLOPE_V)
|
||||
p_slope = interp(v_lead, _P_SLOPE_BP, _P_SLOPE_V)
|
||||
|
||||
# this is where parabola and linear curves are tangents
|
||||
x_linear_to_parabola = p_slope / l_slope**2
|
||||
@@ -79,41 +79,41 @@ def calc_desired_speed(d_lead, d_des, v_lead, a_lead):
|
||||
# calculate v_rel_des on one third of the linear slope
|
||||
v_rel_des_2 = (d_lead - d_des) * l_slope / 3.
|
||||
# take the min of the 2 above
|
||||
v_rel_des = np.minimum(v_rel_des_1, v_rel_des_2)
|
||||
v_rel_des = np.maximum(v_rel_des, max_runaway_speed)
|
||||
v_rel_des = min(v_rel_des_1, v_rel_des_2)
|
||||
v_rel_des = max(v_rel_des, max_runaway_speed)
|
||||
elif d_lead < d_des + x_linear_to_parabola:
|
||||
v_rel_des = (d_lead - d_des) * l_slope
|
||||
v_rel_des = np.maximum(v_rel_des, max_runaway_speed)
|
||||
v_rel_des = max(v_rel_des, max_runaway_speed)
|
||||
else:
|
||||
v_rel_des = np.sqrt(2 * (d_lead - d_des - x_parabola_offset) * p_slope)
|
||||
v_rel_des = math.sqrt(2 * (d_lead - d_des - x_parabola_offset) * p_slope)
|
||||
|
||||
# compute desired speed
|
||||
v_target = v_rel_des + v_lead
|
||||
|
||||
# compute v_coast: above this speed we want to coast
|
||||
t_lookahead = 1. # how far in time we consider a_lead to anticipate the coast region
|
||||
v_coast_shift = np.maximum(a_lead * t_lookahead, - v_lead) # don't consider projections that would make v_lead<0
|
||||
v_coast_shift = max(a_lead * t_lookahead, - v_lead) # don't consider projections that would make v_lead<0
|
||||
v_coast = (v_lead + v_target)/2 + v_coast_shift # no accel allowed above this line
|
||||
v_coast = np.minimum(v_coast, v_target)
|
||||
v_coast = min(v_coast, v_target)
|
||||
|
||||
return v_target, v_coast
|
||||
|
||||
def calc_critical_decel(d_lead, v_rel, d_offset, v_offset):
|
||||
# this function computes the required decel to avoid crashing, given safety offsets
|
||||
a_critical = - np.maximum(0., v_rel + v_offset)**2/np.maximum(2*(d_lead - d_offset), 0.5)
|
||||
a_critical = - max(0., v_rel + v_offset)**2/max(2*(d_lead - d_offset), 0.5)
|
||||
return a_critical
|
||||
|
||||
|
||||
# maximum acceleration adjustment
|
||||
_A_CORR_BY_SPEED_V = np.asarray([0.4, 0.4, 0])
|
||||
_A_CORR_BY_SPEED_V = [0.4, 0.4, 0]
|
||||
# speeds
|
||||
_A_CORR_BY_SPEED_BP = np.asarray([0., 5., 20.])
|
||||
_A_CORR_BY_SPEED_BP = [0., 5., 20.]
|
||||
|
||||
def calc_positive_accel_limit(d_lead, d_des, v_ego, v_rel, v_ref, v_rel_ref, v_coast, v_target, a_lead_contr, a_max):
|
||||
a_coast_min = -1.0 # never coast faster then -1m/s^2
|
||||
# coasting behavior above v_coast. Forcing a_max to be negative will force the pid_speed to decrease,
|
||||
# regardless v_target
|
||||
if v_ref > np.minimum(v_coast, v_target):
|
||||
if v_ref > min(v_coast, v_target):
|
||||
# for smooth coast we can be agrressive and target a point where car would actually crash
|
||||
v_offset_coast = 0.
|
||||
d_offset_coast = d_des/2. - 4.
|
||||
@@ -123,31 +123,31 @@ def calc_positive_accel_limit(d_lead, d_des, v_ego, v_rel, v_ref, v_rel_ref, v_c
|
||||
a_coast = calc_critical_decel(d_lead, v_rel_ref, d_offset_coast, v_offset_coast)
|
||||
# if lead is decelerating, then offset the coast decel
|
||||
a_coast += a_lead_contr
|
||||
a_max = np.maximum(a_coast, a_coast_min)
|
||||
a_max = max(a_coast, a_coast_min)
|
||||
else:
|
||||
a_max = a_coast_min
|
||||
else:
|
||||
# same as cruise accel, but add a small correction based on lead acceleration at low speeds
|
||||
# when lead car accelerates faster, we can do the same, and vice versa
|
||||
|
||||
a_max = a_max + np.interp(v_ego, _A_CORR_BY_SPEED_BP, _A_CORR_BY_SPEED_V) \
|
||||
* np.clip(-v_rel / 4., -.5, 1)
|
||||
a_max = a_max + interp(v_ego, _A_CORR_BY_SPEED_BP, _A_CORR_BY_SPEED_V) \
|
||||
* clip(-v_rel / 4., -.5, 1)
|
||||
return a_max
|
||||
|
||||
# arbitrary limits to avoid too high accel being computed
|
||||
_A_SAT = np.asarray([-10., 5.])
|
||||
_A_SAT = [-10., 5.]
|
||||
|
||||
# do not consider a_lead at 0m/s, fully consider it at 10m/s
|
||||
_A_LEAD_LOW_SPEED_V = np.asarray([0., 1.])
|
||||
_A_LEAD_LOW_SPEED_V = [0., 1.]
|
||||
|
||||
# speed break points
|
||||
_A_LEAD_LOW_SPEED_BP = np.asarray([0., 10.])
|
||||
_A_LEAD_LOW_SPEED_BP = [0., 10.]
|
||||
|
||||
# add a small offset to the desired decel, just for safety margin
|
||||
_DECEL_OFFSET_V = np.asarray([-0.3, -0.5, -0.5, -0.4, -0.3])
|
||||
_DECEL_OFFSET_V = [-0.3, -0.5, -0.5, -0.4, -0.3]
|
||||
|
||||
# speed bp: different offset based on the likelyhood that lead decels abruptly
|
||||
_DECEL_OFFSET_BP = np.asarray([0., 4., 15., 30, 40.])
|
||||
_DECEL_OFFSET_BP = [0., 4., 15., 30, 40.]
|
||||
|
||||
|
||||
def calc_acc_accel_limits(d_lead, d_des, v_ego, v_pid, v_lead, v_rel, a_lead,
|
||||
@@ -159,8 +159,8 @@ def calc_acc_accel_limits(d_lead, d_des, v_ego, v_pid, v_lead, v_rel, a_lead,
|
||||
v_rel_pid = v_pid - v_lead
|
||||
|
||||
# this is how much lead accel we consider in assigning the desired decel
|
||||
a_lead_contr = a_lead * np.interp(v_lead, _A_LEAD_LOW_SPEED_BP,
|
||||
_A_LEAD_LOW_SPEED_V) * 0.8
|
||||
a_lead_contr = a_lead * interp(v_lead, _A_LEAD_LOW_SPEED_BP,
|
||||
_A_LEAD_LOW_SPEED_V) * 0.8
|
||||
|
||||
# first call of calc_positive_accel_limit is used to shape v_pid
|
||||
a_target[1] = calc_positive_accel_limit(d_lead, d_des, v_ego, v_rel, v_pid,
|
||||
@@ -178,15 +178,15 @@ def calc_acc_accel_limits(d_lead, d_des, v_ego, v_pid, v_lead, v_rel, a_lead,
|
||||
pass # acc target speed is above vehicle speed, so we can use the cruise limits
|
||||
elif d_lead > d_offset + 0.01: # add small value to avoid by zero divisions
|
||||
# compute needed accel to get to 1m distance with -1m/s rel speed
|
||||
decel_offset = np.interp(v_lead, _DECEL_OFFSET_BP, _DECEL_OFFSET_V)
|
||||
decel_offset = interp(v_lead, _DECEL_OFFSET_BP, _DECEL_OFFSET_V)
|
||||
|
||||
critical_decel = calc_critical_decel(d_lead, v_rel, d_offset, v_offset)
|
||||
a_target[0] = np.minimum(decel_offset + critical_decel + a_lead_contr,
|
||||
a_target[0])
|
||||
a_target[0] = min(decel_offset + critical_decel + a_lead_contr,
|
||||
a_target[0])
|
||||
else:
|
||||
a_target[0] = _A_SAT[0]
|
||||
# a_min can't be higher than a_max
|
||||
a_target[0] = np.minimum(a_target[0], a_target[1])
|
||||
a_target[0] = min(a_target[0], a_target[1])
|
||||
# final check on limits
|
||||
a_target = np.clip(a_target, _A_SAT[0], _A_SAT[1])
|
||||
a_target = a_target.tolist()
|
||||
@@ -208,8 +208,8 @@ def calc_jerk_factor(d_lead, v_rel):
|
||||
else:
|
||||
a_critical = - calc_critical_decel(d_lead, -v_rel, d_offset, v_offset)
|
||||
# increase Kp and Ki by 20% for every 1m/s2 of decel required above 1m/s2
|
||||
jerk_factor = np.maximum(a_critical - a_offset, 0.)/5.
|
||||
jerk_factor = np.minimum(jerk_factor, jerk_factor_max)
|
||||
jerk_factor = max(a_critical - a_offset, 0.)/5.
|
||||
jerk_factor = min(jerk_factor, jerk_factor_max)
|
||||
return jerk_factor
|
||||
|
||||
|
||||
@@ -223,27 +223,27 @@ def calc_ttc(d_rel, v_rel, a_rel, v_lead):
|
||||
# assuming that closing gap a_rel comes from lead vehicle decel, then limit a_rel so that v_lead will get to zero in no sooner than t_decel
|
||||
# this helps overweighting a_rel when v_lead is close to zero.
|
||||
t_decel = 2.
|
||||
a_rel = np.minimum(a_rel, v_lead/t_decel)
|
||||
a_rel = min(a_rel, v_lead/t_decel)
|
||||
|
||||
delta = v_rel**2 + 2 * d_rel * a_rel
|
||||
# assign an arbitrary high ttc value if there is no solution to ttc
|
||||
if delta < 0.1:
|
||||
ttc = 5.
|
||||
elif np.sqrt(delta) + v_rel < 0.1:
|
||||
elif math.sqrt(delta) + v_rel < 0.1:
|
||||
ttc = 5.
|
||||
else:
|
||||
ttc = 2 * d_rel / (np.sqrt(delta) + v_rel)
|
||||
ttc = 2 * d_rel / (math.sqrt(delta) + v_rel)
|
||||
return ttc
|
||||
|
||||
|
||||
def limit_accel_driver_awareness(v_ego, a_target, a_pcm, awareness_status):
|
||||
decel_bp = [0. , 40.]
|
||||
decel_v = [-0.3, -0.2]
|
||||
decel = np.interp(v_ego, decel_bp, decel_v)
|
||||
decel = interp(v_ego, decel_bp, decel_v)
|
||||
# gives 18 seconds before decel begins (w 6 minute timeout)
|
||||
if awareness_status < -0.05:
|
||||
a_target[1] = np.minimum(a_target[1], decel)
|
||||
a_target[0] = np.minimum(a_target[1], a_target[0])
|
||||
a_target[1] = min(a_target[1], decel)
|
||||
a_target[0] = min(a_target[1], a_target[0])
|
||||
a_pcm = 0.
|
||||
return a_target, a_pcm
|
||||
|
||||
@@ -258,7 +258,10 @@ def compute_speed_with_leads(v_ego, angle_steers, v_pid, l1, l2, awareness_statu
|
||||
v_target_lead = MAX_SPEED_POSSIBLE
|
||||
|
||||
#*** set accel limits as cruise accel/decel limits ***
|
||||
a_target, a_pcm = calc_cruise_accel_limits(v_ego)
|
||||
a_target = calc_cruise_accel_limits(v_ego)
|
||||
# Always 1 for now.
|
||||
a_pcm = 1
|
||||
|
||||
#*** limit max accel in sharp turns
|
||||
a_target, a_pcm = limit_accel_in_turns(v_ego, angle_steers, a_target, a_pcm, VP)
|
||||
jerk_factor = 0.
|
||||
|
||||
@@ -1,178 +0,0 @@
|
||||
alerts = []
|
||||
keys = ["id",
|
||||
"chime",
|
||||
"beep",
|
||||
"hud_alert",
|
||||
"screen_chime",
|
||||
"priority",
|
||||
"text_line_1",
|
||||
"text_line_2",
|
||||
"duration_sound",
|
||||
"duration_hud_alert",
|
||||
"duration_text"]
|
||||
|
||||
|
||||
#car chimes: enumeration from dbc file. Chimes are for alerts and warnings
|
||||
class CM:
|
||||
MUTE = 0
|
||||
SINGLE = 3
|
||||
DOUBLE = 4
|
||||
REPEATED = 1
|
||||
CONTINUOUS = 2
|
||||
|
||||
|
||||
#car beepss: enumeration from dbc file. Beeps are for activ and deactiv
|
||||
class BP:
|
||||
MUTE = 0
|
||||
SINGLE = 3
|
||||
TRIPLE = 2
|
||||
REPEATED = 1
|
||||
|
||||
|
||||
# lert ids
|
||||
class AI:
|
||||
ENABLE = 0
|
||||
DISABLE = 1
|
||||
SEATBELT = 2
|
||||
DOOR_OPEN = 3
|
||||
PEDAL_PRESSED = 4
|
||||
COMM_ISSUE = 5
|
||||
ESP_OFF = 6
|
||||
FCW = 7
|
||||
STEER_ERROR = 8
|
||||
BRAKE_ERROR = 9
|
||||
CALIB_INCOMPLETE = 10
|
||||
CALIB_INVALID = 11
|
||||
GEAR_NOT_D = 12
|
||||
MAIN_OFF = 13
|
||||
STEER_SATURATED = 14
|
||||
PCM_LOW_SPEED = 15
|
||||
THERMAL_DEAD = 16
|
||||
OVERHEAT = 17
|
||||
HIGH_SPEED = 18
|
||||
CONTROLSD_LAG = 19
|
||||
STEER_ERROR_ID = 100
|
||||
BRAKE_ERROR_ID = 101
|
||||
PCM_MISMATCH_ID = 102
|
||||
CTRL_MISMATCH_ID = 103
|
||||
SEATBELT_SD = 200
|
||||
DOOR_OPEN_SD = 201
|
||||
COMM_ISSUE_SD = 202
|
||||
ESP_OFF_SD = 203
|
||||
THERMAL_DEAD_SD = 204
|
||||
OVERHEAT_SD = 205
|
||||
CONTROLSD_LAG_SD = 206
|
||||
CALIB_INCOMPLETE_SD = 207
|
||||
CALIB_INVALID_SD = 208
|
||||
DRIVER_DISTRACTED = 300
|
||||
|
||||
class AH:
|
||||
#[alert_idx, value]
|
||||
# See dbc files for info on values"
|
||||
NONE = [0, 0]
|
||||
FCW = [1, 0x8]
|
||||
STEER = [2, 1]
|
||||
BRAKE_PRESSED = [3, 10]
|
||||
GEAR_NOT_D = [4, 6]
|
||||
SEATBELT = [5, 5]
|
||||
SPEED_TOO_HIGH = [6, 8]
|
||||
|
||||
class ET:
|
||||
ENABLE = 0
|
||||
NO_ENTRY = 1
|
||||
WARNING = 2
|
||||
SOFT_DISABLE = 3
|
||||
IMMEDIATE_DISABLE = 4
|
||||
USER_DISABLE = 5
|
||||
|
||||
def process_alert(alert_id, alert, cur_time, sound_exp, hud_exp, text_exp, alert_p):
|
||||
# INPUTS:
|
||||
# alert_id is mapped to the alert properties in alert_database
|
||||
# cur_time is current time
|
||||
# sound_exp is when the alert beep/chime is supposed to end
|
||||
# hud_exp is when the hud visual is supposed to end
|
||||
# text_exp is when the alert text is supposed to disappear
|
||||
# alert_p is the priority of the current alert
|
||||
# CM, BP, AH are classes defined in alert_database and they respresents chimes, beeps and hud_alerts
|
||||
if len(alert_id) > 0:
|
||||
# take the alert with higher priority
|
||||
alerts_present = filter(lambda a_id: a_id['id'] in alert_id, alerts)
|
||||
alert = sorted(alerts_present, key=lambda k: k['priority'])[-1]
|
||||
# check if we have a more important alert
|
||||
if alert['priority'] > alert_p:
|
||||
alert_p = alert['priority']
|
||||
sound_exp = cur_time + alert['duration_sound']
|
||||
hud_exp = cur_time + alert['duration_hud_alert']
|
||||
text_exp = cur_time + alert['duration_text']
|
||||
|
||||
chime = CM.MUTE
|
||||
beep = BP.MUTE
|
||||
if cur_time < sound_exp:
|
||||
chime = alert['chime']
|
||||
beep = alert['beep']
|
||||
|
||||
hud_alert = AH.NONE
|
||||
if cur_time < hud_exp:
|
||||
hud_alert = alert['hud_alert']
|
||||
|
||||
alert_text = ["", ""]
|
||||
if cur_time < text_exp:
|
||||
alert_text = [alert['text_line_1'], alert['text_line_2']]
|
||||
|
||||
if chime == CM.MUTE and beep == BP.MUTE and hud_alert == AH.NONE: #and alert_text[0] is None and alert_text[1] is None:
|
||||
alert_p = 0
|
||||
return alert, chime, beep, hud_alert, alert_text, sound_exp, hud_exp, text_exp, alert_p
|
||||
|
||||
def process_hud_alert(hud_alert):
|
||||
# initialize to no alert
|
||||
fcw_display = 0
|
||||
steer_required = 0
|
||||
acc_alert = 0
|
||||
if hud_alert == AH.NONE: # no alert
|
||||
pass
|
||||
elif hud_alert == AH.FCW: # FCW
|
||||
fcw_display = hud_alert[1]
|
||||
elif hud_alert == AH.STEER: # STEER
|
||||
steer_required = hud_alert[1]
|
||||
else: # any other ACC alert
|
||||
acc_alert = hud_alert[1]
|
||||
|
||||
return fcw_display, steer_required, acc_alert
|
||||
|
||||
def app_alert(alert_add):
|
||||
alerts.append(dict(zip(keys, alert_add)))
|
||||
|
||||
app_alert([AI.ENABLE, CM.MUTE, BP.SINGLE, AH.NONE, ET.ENABLE, 2, "", "", .2, 0., 0.])
|
||||
app_alert([AI.DISABLE, CM.MUTE, BP.SINGLE, AH.NONE, ET.USER_DISABLE, 2, "", "", .2, 0., 0.])
|
||||
app_alert([AI.SEATBELT, CM.DOUBLE, BP.MUTE, AH.SEATBELT, ET.NO_ENTRY, 1, "Comma Unavailable", "Seatbelt Unlatched", .4, 2., 3.])
|
||||
app_alert([AI.DOOR_OPEN, CM.DOUBLE, BP.MUTE, AH.NONE, ET.NO_ENTRY, 1, "Comma Unavailable", "Door Open", .4, 0., 3.])
|
||||
app_alert([AI.PEDAL_PRESSED, CM.DOUBLE, BP.MUTE, AH.BRAKE_PRESSED, ET.NO_ENTRY, 1, "Comma Unavailable", "Pedal Pressed", .4, 2., 3.])
|
||||
app_alert([AI.COMM_ISSUE, CM.DOUBLE, BP.MUTE, AH.NONE, ET.NO_ENTRY, 1, "Comma Unavailable", "Communcation Issues", .4, 0., 3.])
|
||||
app_alert([AI.ESP_OFF, CM.DOUBLE, BP.MUTE, AH.NONE, ET.NO_ENTRY, 1, "Comma Unavailable", "ESP Off", .4, 0., 3.])
|
||||
app_alert([AI.FCW, CM.REPEATED, BP.MUTE, AH.FCW, ET.WARNING, 3, "Risk of Collision", "", 1., 2., 3.])
|
||||
app_alert([AI.STEER_ERROR, CM.DOUBLE, BP.MUTE, AH.NONE, ET.NO_ENTRY, 1, "Comma Unavailable", "Steer Error", .4, 0., 3.])
|
||||
app_alert([AI.BRAKE_ERROR, CM.DOUBLE, BP.MUTE, AH.NONE, ET.NO_ENTRY, 1, "Comma Unavailable", "Brake Error", .4, 0., 3.])
|
||||
app_alert([AI.CALIB_INCOMPLETE, CM.DOUBLE, BP.MUTE, AH.NONE, ET.NO_ENTRY, 1, "Comma Unavailable", "Calibration in Progress", .4, 0., 3.])
|
||||
app_alert([AI.CALIB_INVALID, CM.DOUBLE, BP.MUTE, AH.NONE, ET.NO_ENTRY, 1, "Comma Unavailable", "Calibration Error", .4, 0., 3.])
|
||||
app_alert([AI.GEAR_NOT_D, CM.DOUBLE, BP.MUTE, AH.GEAR_NOT_D, ET.NO_ENTRY, 1, "Comma Unavailable", "Gear not in D", .4, 2., 3.])
|
||||
app_alert([AI.MAIN_OFF, CM.MUTE, BP.MUTE, AH.NONE, ET.NO_ENTRY, 1, "Comma Unavailable", "Main Switch Off", .4, 0., 3.])
|
||||
app_alert([AI.STEER_SATURATED, CM.SINGLE, BP.MUTE, AH.STEER, ET.WARNING, 2, "Take Control", "Steer Control Saturated", 1., 2., 3.])
|
||||
app_alert([AI.PCM_LOW_SPEED, CM.MUTE, BP.SINGLE, AH.STEER, ET.WARNING, 2, "Comma disengaged", "Speed too low", .2, 2., 3.])
|
||||
app_alert([AI.THERMAL_DEAD, CM.DOUBLE, BP.MUTE, AH.NONE, ET.NO_ENTRY, 1, "Comma Unavailable", "Thermal Unavailable", .4, 0., 3.])
|
||||
app_alert([AI.OVERHEAT, CM.DOUBLE, BP.MUTE, AH.NONE, ET.NO_ENTRY, 1, "Comma Unavailable", "System Overheated", .4, 0., 3.])
|
||||
app_alert([AI.HIGH_SPEED, CM.DOUBLE, BP.MUTE, AH.SPEED_TOO_HIGH, ET.NO_ENTRY, 1, "Comma Unavailable", "Speed Too High", .4, 2., 3.])
|
||||
app_alert([AI.CONTROLSD_LAG, CM.DOUBLE, BP.MUTE, AH.NONE, ET.NO_ENTRY, 1, "Comma Unavailable", "Controls Lagging", .4, 0., 3.])
|
||||
app_alert([AI.STEER_ERROR_ID, CM.REPEATED, BP.MUTE, AH.STEER, ET.IMMEDIATE_DISABLE, 3, "Take Control Immediately", "Steer Error", 1., 3., 3.])
|
||||
app_alert([AI.BRAKE_ERROR_ID, CM.REPEATED, BP.MUTE, AH.STEER, ET.IMMEDIATE_DISABLE, 3, "Take Control Immediately", "Brake Error", 1., 3., 3.])
|
||||
app_alert([AI.PCM_MISMATCH_ID, CM.REPEATED, BP.MUTE, AH.STEER, ET.IMMEDIATE_DISABLE, 3, "Take Control Immediately", "Pcm Mismatch", 1., 3., 3.])
|
||||
app_alert([AI.CTRL_MISMATCH_ID, CM.REPEATED, BP.MUTE, AH.STEER, ET.IMMEDIATE_DISABLE, 3, "Take Control Immediately", "Ctrl Mismatch", 1., 3., 3.])
|
||||
app_alert([AI.SEATBELT_SD, CM.REPEATED, BP.MUTE, AH.STEER, ET.SOFT_DISABLE, 3, "Take Control Immediately", "Seatbelt Unlatched", 1., 3., 3.])
|
||||
app_alert([AI.DOOR_OPEN_SD, CM.REPEATED, BP.MUTE, AH.STEER, ET.SOFT_DISABLE, 3, "Take Control Immediately", "Door Open", 1., 3., 3.])
|
||||
app_alert([AI.COMM_ISSUE_SD, CM.REPEATED, BP.MUTE, AH.STEER, ET.SOFT_DISABLE, 3, "Take Control Immediately", "Technical Issues", 1., 3., 3.])
|
||||
app_alert([AI.ESP_OFF_SD, CM.REPEATED, BP.MUTE, AH.STEER, ET.SOFT_DISABLE, 3, "Take Control Immediately", "ESP Off", 1., 3., 3.])
|
||||
app_alert([AI.THERMAL_DEAD_SD, CM.REPEATED, BP.MUTE, AH.STEER, ET.SOFT_DISABLE, 3, "Take Control Immediately", "Thermal Unavailable", 1., 3., 3.])
|
||||
app_alert([AI.OVERHEAT_SD, CM.REPEATED, BP.MUTE, AH.STEER, ET.SOFT_DISABLE, 3, "Take Control Immediately", "System Overheated", 1., 3., 3.])
|
||||
app_alert([AI.CONTROLSD_LAG_SD, CM.REPEATED, BP.MUTE, AH.STEER, ET.SOFT_DISABLE, 3, "Take Control Immediately", "Controls Lagging", 1., 3., 3.])
|
||||
app_alert([AI.CALIB_INCOMPLETE_SD, CM.REPEATED, BP.MUTE, AH.STEER, ET.SOFT_DISABLE, 3, "Take Control Immediately", "Calibration in Progress", 1., 3., 3.])
|
||||
app_alert([AI.CALIB_INVALID_SD, CM.REPEATED, BP.MUTE, AH.STEER, ET.SOFT_DISABLE, 3, "Take Control Immediately", "Calibration Error", 1., 3., 3.])
|
||||
app_alert([AI.DRIVER_DISTRACTED, CM.REPEATED, BP.MUTE, AH.STEER, ET.SOFT_DISABLE, 2, "Take Control to Regain Speed", "User Distracted", 1., 1., 1.])
|
||||
129
selfdrive/controls/lib/alertmanager.py
Normal file
129
selfdrive/controls/lib/alertmanager.py
Normal file
@@ -0,0 +1,129 @@
|
||||
from cereal import car
|
||||
from selfdrive.swaglog import cloudlog
|
||||
|
||||
class ET:
|
||||
ENABLE = 0
|
||||
NO_ENTRY = 1
|
||||
WARNING = 2
|
||||
SOFT_DISABLE = 3
|
||||
IMMEDIATE_DISABLE = 4
|
||||
USER_DISABLE = 5
|
||||
|
||||
class alert(object):
|
||||
def __init__(self, alert_text_1, alert_text_2, alert_type, visual_alert, audible_alert, duration_sound, duration_hud_alert, duration_text):
|
||||
self.alert_text_1 = alert_text_1
|
||||
self.alert_text_2 = alert_text_2
|
||||
self.alert_type = alert_type
|
||||
self.visual_alert = visual_alert if visual_alert is not None else "none"
|
||||
self.audible_alert = audible_alert if audible_alert is not None else "none"
|
||||
|
||||
self.duration_sound = duration_sound
|
||||
self.duration_hud_alert = duration_hud_alert
|
||||
self.duration_text = duration_text
|
||||
|
||||
# typecheck that enums are valid on startup
|
||||
tst = car.CarControl.new_message()
|
||||
tst.hudControl.visualAlert = self.visual_alert
|
||||
tst.hudControl.audibleAlert = self.audible_alert
|
||||
|
||||
def __str__(self):
|
||||
return self.alert_text_1 + "/" + self.alert_text_2 + " " + str(self.alert_type) + " " + str(self.visual_alert) + " " + str(self.audible_alert)
|
||||
|
||||
def __gt__(self, alert2):
|
||||
return self.alert_type > alert2.alert_type
|
||||
|
||||
class AlertManager(object):
|
||||
alerts = {
|
||||
"enable": alert("", "", ET.ENABLE, None, "beepSingle", .2, 0., 0.),
|
||||
"disable": alert("", "", ET.USER_DISABLE, None, "beepSingle", .2, 0., 0.),
|
||||
"pedalPressed": alert("Comma Unavailable", "Pedal Pressed", ET.NO_ENTRY, "brakePressed", "chimeDouble", .4, 2., 3.),
|
||||
"driverDistracted": alert("Take Control to Regain Speed", "User Distracted", ET.WARNING, "steerRequired", "chimeRepeated", 1., 1., 1.),
|
||||
"steerSaturated": alert("Take Control", "Steer Control Saturated", ET.WARNING, "steerRequired", "chimeSingle", 1., 2., 3.),
|
||||
"overheat": alert("Take Control Immediately", "System Overheated", ET.SOFT_DISABLE, "steerRequired", "chimeRepeated", 1., 3., 3.),
|
||||
"controlsMismatch": alert("Take Control Immediately", "Controls Mismatch", ET.IMMEDIATE_DISABLE, "steerRequired", "chimeRepeated", 1., 3., 3.),
|
||||
"radarCommIssue": alert("Take Control Immediately", "Radar Comm Issue", ET.IMMEDIATE_DISABLE, "steerRequired", "chimeRepeated", 1., 3., 3.),
|
||||
"modelCommIssue": alert("Take Control Immediately", "Model Comm Issue", ET.IMMEDIATE_DISABLE, "steerRequired", "chimeRepeated", 1., 3., 3.),
|
||||
"controlsFailed": alert("Take Control Immediately", "Controls Failed", ET.IMMEDIATE_DISABLE, "steerRequired", "chimeRepeated", 1., 3., 3.),
|
||||
# car errors
|
||||
"commIssue": alert("Take Control Immediately","Communication Issues", ET.IMMEDIATE_DISABLE, "steerRequired", "chimeRepeated", 1., 3., 3.),
|
||||
"steerUnavailable": alert("Take Control Immediately","Steer Error", ET.IMMEDIATE_DISABLE, "steerRequired", "chimeRepeated", 1., 3., 3.),
|
||||
"steerTemporarilyUnavailable": alert("Take Control", "Steer Temporarily Unavailable", ET.WARNING, "steerRequired", "chimeRepeated", 1., 2., 3.),
|
||||
"brakeUnavailable": alert("Take Control Immediately","Brake Error", ET.IMMEDIATE_DISABLE, "steerRequired", "chimeRepeated", 1., 3., 3.),
|
||||
"gasUnavailable": alert("Take Control Immediately","Gas Error", ET.IMMEDIATE_DISABLE, "steerRequired", "chimeRepeated", 1., 3., 3.),
|
||||
"wrongGear": alert("Take Control Immediately","Gear not D", ET.SOFT_DISABLE, "steerRequired", "chimeRepeated", 1., 3., 3.),
|
||||
"reverseGear": alert("Take Control Immediately","Car in Reverse", ET.IMMEDIATE_DISABLE, "steerRequired", "chimeRepeated", 1., 3., 3.),
|
||||
"doorOpen": alert("Take Control Immediately","Door Open", ET.SOFT_DISABLE, "steerRequired", "chimeRepeated", 1., 3., 3.),
|
||||
"seatbeltNotLatched": alert("Take Control Immediately","Seatbelt Unlatched", ET.SOFT_DISABLE, "steerRequired", "chimeRepeated", 1., 3., 3.),
|
||||
"espDisabled": alert("Take Control Immediately","ESP Off", ET.SOFT_DISABLE, "steerRequired", "chimeRepeated", 1., 3., 3.),
|
||||
"wrongCarMode": alert("Comma Unavailable","Main Switch Off", ET.NO_ENTRY, None, "chimeDouble", .4, 0., 3.),
|
||||
"outOfSpace": alert("Comma Unavailable","Out of Space", ET.NO_ENTRY, None, "chimeDouble", .4, 0., 3.),
|
||||
"ethicalDilemma": alert("Take Control Immediately","Ethical Dilemma Detected", ET.IMMEDIATE_DISABLE, "steerRequired", "chimeRepeated", 1., 3., 3.),
|
||||
"startup": alert("Always Keep Hands on Wheel","Be Ready to Take Over Any Time", ET.NO_ENTRY, None, None, 0., 0., 15.),
|
||||
}
|
||||
def __init__(self):
|
||||
self.activealerts = []
|
||||
self.current_alert = None
|
||||
self.add("startup", False)
|
||||
|
||||
def alertPresent(self):
|
||||
return len(self.activealerts) > 0
|
||||
|
||||
def alertShouldSoftDisable(self):
|
||||
return len(self.activealerts) > 0 and self.activealerts[0].alert_type == ET.SOFT_DISABLE
|
||||
|
||||
def alertShouldDisable(self):
|
||||
return len(self.activealerts) > 0 and self.activealerts[0].alert_type >= ET.IMMEDIATE_DISABLE
|
||||
|
||||
def add(self, alert_type, enabled = True):
|
||||
alert_type = str(alert_type)
|
||||
this_alert = self.alerts[alert_type]
|
||||
|
||||
# downgrade the alert if we aren't enabled
|
||||
if not enabled and this_alert.alert_type > ET.NO_ENTRY:
|
||||
this_alert = alert("Comma Unavailable" if this_alert.alert_text_1 != "" else "", this_alert.alert_text_2, ET.NO_ENTRY, None, "chimeDouble", .4, 0., 3.)
|
||||
|
||||
# ignore no entries if we are enabled
|
||||
if enabled and this_alert.alert_type < ET.WARNING:
|
||||
return
|
||||
|
||||
# if new alert is different, log it
|
||||
if self.current_alert is None or self.current_alert.alert_text_2 != this_alert.alert_text_2:
|
||||
cloudlog.event('alert_add',
|
||||
alert_type=alert_type,
|
||||
enabled=enabled)
|
||||
|
||||
self.activealerts.append(this_alert)
|
||||
self.activealerts.sort()
|
||||
|
||||
def process_alerts(self, cur_time):
|
||||
if self.alertPresent():
|
||||
self.alert_start_time = cur_time
|
||||
self.current_alert = self.activealerts[0]
|
||||
print self.current_alert
|
||||
|
||||
alert_text_1 = ""
|
||||
alert_text_2 = ""
|
||||
visual_alert = "none"
|
||||
audible_alert = "none"
|
||||
|
||||
if self.current_alert is not None:
|
||||
# ewwwww
|
||||
if self.alert_start_time + self.current_alert.duration_sound > cur_time:
|
||||
audible_alert = self.current_alert.audible_alert
|
||||
|
||||
if self.alert_start_time + self.current_alert.duration_hud_alert > cur_time:
|
||||
visual_alert = self.current_alert.visual_alert
|
||||
|
||||
if self.alert_start_time + self.current_alert.duration_text > cur_time:
|
||||
alert_text_1 = self.current_alert.alert_text_1
|
||||
alert_text_2 = self.current_alert.alert_text_2
|
||||
|
||||
# disable current alert
|
||||
if self.alert_start_time + max(self.current_alert.duration_sound, self.current_alert.duration_hud_alert, self.current_alert.duration_text) < cur_time:
|
||||
self.current_alert = None
|
||||
|
||||
# reset
|
||||
self.activealerts = []
|
||||
|
||||
return alert_text_1, alert_text_2, visual_alert, audible_alert
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import numpy as np
|
||||
from common.numpy_fast import clip, interp
|
||||
|
||||
def rate_limit(new_value, last_value, dw_step, up_step):
|
||||
return np.clip(new_value, last_value + dw_step, last_value + up_step)
|
||||
return clip(new_value, last_value + dw_step, last_value + up_step)
|
||||
|
||||
def learn_angle_offset(lateral_control, v_ego, angle_offset, d_poly, y_des, steer_override):
|
||||
# simple integral controller that learns how much steering offset to put to have the car going straight
|
||||
@@ -11,12 +12,12 @@ def learn_angle_offset(lateral_control, v_ego, angle_offset, d_poly, y_des, stee
|
||||
min_learn_speed = 1.
|
||||
|
||||
# learn less at low speed or when turning
|
||||
alpha_v = alpha*(np.maximum(v_ego - min_learn_speed, 0.))/(1. + 0.5*abs(y_des))
|
||||
alpha_v = alpha*(max(v_ego - min_learn_speed, 0.))/(1. + 0.5*abs(y_des))
|
||||
|
||||
# only learn if lateral control is active and if driver is not overriding:
|
||||
if lateral_control and not steer_override:
|
||||
angle_offset += d_poly[3] * alpha_v
|
||||
angle_offset = np.clip(angle_offset, min_offset, max_offset)
|
||||
angle_offset = clip(angle_offset, min_offset, max_offset)
|
||||
|
||||
return angle_offset
|
||||
|
||||
@@ -44,7 +45,7 @@ def actuator_hystereses(final_brake, braking, brake_steady, v_ego, civic):
|
||||
brake_on_offset_v = [.25, .15] # min brake command on brake activation. below this no decel is perceived
|
||||
brake_on_offset_bp = [15., 30.] # offset changes VS speed to not have too abrupt decels at high speeds
|
||||
# offset the brake command for threshold in the brake system. no brake torque perceived below it
|
||||
brake_on_offset = np.interp(v_ego, brake_on_offset_bp, brake_on_offset_v)
|
||||
brake_on_offset = interp(v_ego, brake_on_offset_bp, brake_on_offset_v)
|
||||
brake_offset = brake_on_offset - brake_hyst_on
|
||||
if final_brake > 0.0:
|
||||
final_brake += brake_offset
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import math
|
||||
import numpy as np
|
||||
from common.numpy_fast import clip
|
||||
|
||||
def calc_curvature(v_ego, angle_steers, VP, angle_offset=0):
|
||||
deg_to_rad = np.pi/180.
|
||||
@@ -14,7 +16,7 @@ def calc_d_lookahead(v_ego):
|
||||
# sqrt on speed is needed to keep, for a given curvature, the y_offset
|
||||
# proportional to speed. Indeed, y_offset is prop to d_lookahead^2
|
||||
# 26m at 25m/s
|
||||
d_lookahead = offset_lookahead + np.sqrt(np.maximum(v_ego, 0)) * coeff_lookahead
|
||||
d_lookahead = offset_lookahead + math.sqrt(max(v_ego, 0)) * coeff_lookahead
|
||||
return d_lookahead
|
||||
|
||||
def calc_lookahead_offset(v_ego, angle_steers, d_lookahead, VP, angle_offset):
|
||||
@@ -53,7 +55,7 @@ def pid_lateral_control(v_ego, y_actual, y_des, Ui_steer, steer_max,
|
||||
Ui_steer -= Ui_unwind_speed * np.sign(Ui_steer)
|
||||
|
||||
# still, intergral term should not be bigger then limits
|
||||
Ui_steer = np.clip(Ui_steer, -steer_max, steer_max)
|
||||
Ui_steer = clip(Ui_steer, -steer_max, steer_max)
|
||||
|
||||
output_steer = Up_steer + Ui_steer
|
||||
|
||||
@@ -67,7 +69,7 @@ def pid_lateral_control(v_ego, y_actual, y_des, Ui_steer, steer_max,
|
||||
if abs(output_steer) > steer_max:
|
||||
lateral_control_sat = True
|
||||
|
||||
output_steer = np.clip(output_steer, -steer_max, steer_max)
|
||||
output_steer = clip(output_steer, -steer_max, steer_max)
|
||||
|
||||
# if lateral control is saturated for a certain period of time, send an alert for taking control of the car
|
||||
# wind
|
||||
@@ -81,7 +83,7 @@ def pid_lateral_control(v_ego, y_actual, y_des, Ui_steer, steer_max,
|
||||
if sat_count >= sat_count_limit:
|
||||
sat_flag = True
|
||||
|
||||
sat_count = np.clip(sat_count, 0, 1)
|
||||
sat_count = clip(sat_count, 0, 1)
|
||||
|
||||
return output_steer, Up_steer, Ui_steer, lateral_control_sat, sat_count, sat_flag
|
||||
|
||||
@@ -97,24 +99,24 @@ class LatControl(object):
|
||||
def reset(self):
|
||||
self.Ui_steer = 0.
|
||||
|
||||
def update(self, enabled, CS, d_poly, angle_offset):
|
||||
def update(self, enabled, v_ego, angle_steers, steer_override, d_poly, angle_offset, VP):
|
||||
rate = 100
|
||||
|
||||
steer_max = 1.0
|
||||
|
||||
# how far we look ahead is function of speed
|
||||
d_lookahead = calc_d_lookahead(CS.v_ego)
|
||||
d_lookahead = calc_d_lookahead(v_ego)
|
||||
|
||||
# calculate actual offset at the lookahead point
|
||||
self.y_actual, _ = calc_lookahead_offset(CS.v_ego, CS.angle_steers,
|
||||
d_lookahead, CS.VP, angle_offset)
|
||||
self.y_actual, _ = calc_lookahead_offset(v_ego, angle_steers,
|
||||
d_lookahead, VP, angle_offset)
|
||||
|
||||
# desired lookahead offset
|
||||
self.y_des = np.polyval(d_poly, d_lookahead)
|
||||
|
||||
output_steer, self.Up_steer, self.Ui_steer, self.lateral_control_sat, self.sat_count, sat_flag = pid_lateral_control(
|
||||
CS.v_ego, self.y_actual, self.y_des, self.Ui_steer, steer_max,
|
||||
CS.steer_override, self.sat_count, enabled, CS.torque_mod, rate)
|
||||
v_ego, self.y_actual, self.y_des, self.Ui_steer, steer_max,
|
||||
steer_override, self.sat_count, enabled, VP.torque_mod, rate)
|
||||
|
||||
final_steer = np.clip(output_steer, -steer_max, steer_max)
|
||||
final_steer = clip(output_steer, -steer_max, steer_max)
|
||||
return final_steer, sat_flag
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import numpy as np
|
||||
from common.numpy_fast import clip, interp
|
||||
from selfdrive.config import Conversions as CV
|
||||
|
||||
class LongCtrlState:
|
||||
@@ -82,15 +83,18 @@ def get_compute_gb():
|
||||
# takes in [desired_accel, current_speed] -> [-1.0, 1.0] where -1.0 is max brake and 1.0 is max gas
|
||||
compute_gb = get_compute_gb()
|
||||
|
||||
|
||||
_KP_BP = [0., 5., 35.]
|
||||
_KP_V = [1.2, 0.8, 0.5]
|
||||
|
||||
_kI_BP = [0., 35.]
|
||||
_kI_V = [0.18, 0.12]
|
||||
|
||||
def pid_long_control(v_ego, v_pid, Ui_accel_cmd, gas_max, brake_max, jerk_factor, gear, rate):
|
||||
#*** This function compute the gb pedal positions in order to track the desired speed
|
||||
# proportional and integral terms. More precision at low speed
|
||||
Kp_v = [1.2, 0.8, 0.5]
|
||||
Kp_bp = [0., 5., 35.]
|
||||
Kp = np.interp(v_ego, Kp_bp, Kp_v)
|
||||
Ki_v = [0.18, 0.12]
|
||||
Ki_bp = [0., 35.]
|
||||
Ki = np.interp(v_ego, Ki_bp, Ki_v)
|
||||
Kp = interp(v_ego, _KP_BP, _KP_V)
|
||||
Ki = interp(v_ego, _kI_BP, _kI_V)
|
||||
|
||||
# scle Kp and Ki by jerk factor drom drive_thread
|
||||
Kp = (1. + jerk_factor)*Kp
|
||||
@@ -98,7 +102,7 @@ def pid_long_control(v_ego, v_pid, Ui_accel_cmd, gas_max, brake_max, jerk_factor
|
||||
|
||||
# this is ugly but can speed reports 0 when speed<0.3m/s and we can't have that jump
|
||||
v_ego_min = 0.3
|
||||
v_ego = np.maximum(v_ego, v_ego_min)
|
||||
v_ego = max(v_ego, v_ego_min)
|
||||
|
||||
v_error = v_pid - v_ego
|
||||
|
||||
@@ -107,7 +111,7 @@ def pid_long_control(v_ego, v_pid, Ui_accel_cmd, gas_max, brake_max, jerk_factor
|
||||
accel_cmd_new = Ui_accel_cmd_new + Up_accel_cmd
|
||||
output_gb_new = compute_gb([accel_cmd_new, v_ego])
|
||||
|
||||
# Anti-wind up for integrator: only update integrator if we not against the thottle and brake limits
|
||||
# Anti-wind up for integrator: only update integrator if we not against the throttle and brake limits
|
||||
# do not wind up if we are changing gear and we are on the gas pedal
|
||||
if (((v_error >= 0. and (output_gb_new < gas_max or Ui_accel_cmd < 0)) or
|
||||
(v_error <= 0. and (output_gb_new > - brake_max or Ui_accel_cmd > 0))) and
|
||||
@@ -126,7 +130,7 @@ def pid_long_control(v_ego, v_pid, Ui_accel_cmd, gas_max, brake_max, jerk_factor
|
||||
if output_gb > gas_max or output_gb < -brake_max:
|
||||
long_control_sat = True
|
||||
|
||||
output_gb = np.clip(output_gb, -brake_max, gas_max)
|
||||
output_gb = clip(output_gb, -brake_max, gas_max)
|
||||
|
||||
return output_gb, Up_accel_cmd, Ui_accel_cmd, long_control_sat
|
||||
|
||||
@@ -136,8 +140,8 @@ starting_brake_rate = 0.6 # brake_travel/s while releasing on restart
|
||||
starting_Ui = 0.5 # Since we don't have much info about acceleration at this point, be conservative
|
||||
brake_stopping_target = 0.5 # apply at least this amount of brake to maintain the vehicle stationary
|
||||
|
||||
max_speed_error_v = [1.5, .8] # max positive v_pid error VS actual speed; this avoids controls windup due to slow pedal resp
|
||||
max_speed_error_bp = [0., 30.] # speed breakpoints
|
||||
_MAX_SPEED_ERROR_BP = [0., 30.] # speed breakpoints
|
||||
_MAX_SPEED_ERROR_V = [1.5, .8] # max positive v_pid error VS actual speed; this avoids controls windup due to slow pedal resp
|
||||
|
||||
class LongControl(object):
|
||||
def __init__(self):
|
||||
@@ -151,19 +155,20 @@ class LongControl(object):
|
||||
self.Ui_accel_cmd = 0.
|
||||
self.v_pid = v_pid
|
||||
|
||||
def update(self, enabled, CS, v_cruise, v_target_lead, a_target, jerk_factor):
|
||||
# TODO: not every time
|
||||
if CS.brake_only:
|
||||
gas_max_v = [0, 0] # values
|
||||
else:
|
||||
gas_max_v = [0.6, 0.6] # values
|
||||
gas_max_bp = [0., 100.] # speeds
|
||||
brake_max_v = [1.0, 1.0, 0.8, 0.8] # values
|
||||
def update(self, enabled, v_ego, v_cruise, v_target_lead, a_target, jerk_factor, VP):
|
||||
brake_max_bp = [0., 5., 20., 100.] # speeds
|
||||
brake_max_v = [1.0, 1.0, 0.8, 0.8] # values
|
||||
|
||||
# brake and gas limits
|
||||
brake_max = np.interp(CS.v_ego, brake_max_bp, brake_max_v)
|
||||
gas_max = np.interp(CS.v_ego, gas_max_bp, gas_max_v)
|
||||
brake_max = interp(v_ego, brake_max_bp, brake_max_v)
|
||||
|
||||
# TODO: not every time
|
||||
if VP.brake_only:
|
||||
gas_max = 0
|
||||
else:
|
||||
gas_max_bp = [0., 100.] # speeds
|
||||
gas_max_v = [0.6, 0.6] # values
|
||||
gas_max = interp(v_ego, gas_max_bp, gas_max_v)
|
||||
|
||||
overshoot_allowance = 2.0 # overshoot allowed when changing accel sign
|
||||
|
||||
@@ -172,30 +177,30 @@ class LongControl(object):
|
||||
|
||||
# limit max target speed based on cruise setting:
|
||||
v_cruise_mph = round(v_cruise * CV.KPH_TO_MPH) # what's displayed in mph on the IC
|
||||
v_target = np.minimum(v_target_lead, v_cruise_mph * CV.MPH_TO_MS / CS.ui_speed_fudge)
|
||||
v_target = min(v_target_lead, v_cruise_mph * CV.MPH_TO_MS / VP.ui_speed_fudge)
|
||||
|
||||
max_speed_delta_up = a_target[1]*1.0/rate
|
||||
max_speed_delta_down = a_target[0]*1.0/rate
|
||||
|
||||
# *** long control substate transitions
|
||||
self.long_control_state = long_control_state_trans(enabled, self.long_control_state, CS.v_ego, v_target, self.v_pid, output_gb)
|
||||
self.long_control_state = long_control_state_trans(enabled, self.long_control_state, v_ego, v_target, self.v_pid, output_gb)
|
||||
|
||||
# *** long control behavior based on state
|
||||
# TODO: move this to drive_helpers
|
||||
# disabled
|
||||
if self.long_control_state == LongCtrlState.off:
|
||||
self.v_pid = CS.v_ego # do nothing
|
||||
self.v_pid = v_ego # do nothing
|
||||
output_gb = 0.
|
||||
self.Ui_accel_cmd = 0.
|
||||
# tracking objects and driving
|
||||
elif self.long_control_state == LongCtrlState.pid:
|
||||
#reset v_pid close to v_ego if it was too far and new v_target is closer to v_ego
|
||||
if ((self.v_pid > CS.v_ego + overshoot_allowance) and
|
||||
if ((self.v_pid > v_ego + overshoot_allowance) and
|
||||
(v_target < self.v_pid)):
|
||||
self.v_pid = np.maximum(v_target, CS.v_ego + overshoot_allowance)
|
||||
elif ((self.v_pid < CS.v_ego - overshoot_allowance) and
|
||||
self.v_pid = max(v_target, v_ego + overshoot_allowance)
|
||||
elif ((self.v_pid < v_ego - overshoot_allowance) and
|
||||
(v_target > self.v_pid)):
|
||||
self.v_pid = np.minimum(v_target, CS.v_ego - overshoot_allowance)
|
||||
self.v_pid = min(v_target, v_ego - overshoot_allowance)
|
||||
|
||||
# move v_pid no faster than allowed accel limits
|
||||
if (v_target > self.v_pid + max_speed_delta_up):
|
||||
@@ -206,27 +211,29 @@ class LongControl(object):
|
||||
self.v_pid = v_target
|
||||
|
||||
# to avoid too much wind up on acceleration, limit positive speed error
|
||||
if not CS.brake_only:
|
||||
max_speed_error = np.interp(CS.v_ego, max_speed_error_bp, max_speed_error_v)
|
||||
self.v_pid = np.minimum(self.v_pid, CS.v_ego + max_speed_error)
|
||||
if not VP.brake_only:
|
||||
max_speed_error = interp(v_ego, _MAX_SPEED_ERROR_BP, _MAX_SPEED_ERROR_V)
|
||||
self.v_pid = min(self.v_pid, v_ego + max_speed_error)
|
||||
|
||||
output_gb, self.Up_accel_cmd, self.Ui_accel_cmd, self.long_control_sat = pid_long_control(CS.v_ego, self.v_pid, \
|
||||
self.Ui_accel_cmd, gas_max, brake_max, jerk_factor, CS.gear, rate)
|
||||
# TODO: removed anti windup on gear change, does it matter?
|
||||
output_gb, self.Up_accel_cmd, self.Ui_accel_cmd, self.long_control_sat = pid_long_control(v_ego, self.v_pid, \
|
||||
self.Ui_accel_cmd, gas_max, brake_max, jerk_factor, 0, rate)
|
||||
# intention is to stop, switch to a different brake control until we stop
|
||||
elif self.long_control_state == LongCtrlState.stopping:
|
||||
if CS.v_ego > 0. or output_gb > -brake_stopping_target or not CS.standstill:
|
||||
if v_ego > 0. or output_gb > -brake_stopping_target:
|
||||
output_gb -= stopping_brake_rate/rate
|
||||
output_gb = np.clip(output_gb, -brake_max, gas_max)
|
||||
self.v_pid = CS.v_ego
|
||||
output_gb = clip(output_gb, -brake_max, gas_max)
|
||||
self.v_pid = v_ego
|
||||
self.Ui_accel_cmd = 0.
|
||||
# intention is to move again, release brake fast before handling control to PID
|
||||
elif self.long_control_state == LongCtrlState.starting:
|
||||
if output_gb < -0.2:
|
||||
output_gb += starting_brake_rate/rate
|
||||
self.v_pid = CS.v_ego
|
||||
self.v_pid = v_ego
|
||||
self.Ui_accel_cmd = starting_Ui
|
||||
|
||||
self.last_output_gb = output_gb
|
||||
final_gas = np.clip(output_gb, 0., gas_max)
|
||||
final_brake = -np.clip(output_gb, -brake_max, 0.)
|
||||
final_gas = clip(output_gb, 0., gas_max)
|
||||
final_brake = -clip(output_gb, -brake_max, 0.)
|
||||
return final_gas, final_brake
|
||||
|
||||
|
||||
@@ -1,26 +1,36 @@
|
||||
import selfdrive.messaging as messaging
|
||||
import math
|
||||
import numpy as np
|
||||
X_PATH = np.arange(0.0, 50.0)
|
||||
|
||||
def model_polyfit(points):
|
||||
return np.polyfit(X_PATH, map(float, points), 3)
|
||||
from common.numpy_fast import interp
|
||||
import selfdrive.messaging as messaging
|
||||
|
||||
|
||||
def compute_path_pinv():
|
||||
deg = 3
|
||||
x = np.arange(50.0)
|
||||
X = np.vstack(tuple(x**n for n in range(deg, -1, -1))).T
|
||||
pinv = np.linalg.pinv(X)
|
||||
return pinv
|
||||
|
||||
def model_polyfit(points, path_pinv):
|
||||
return np.dot(path_pinv, map(float, points))
|
||||
|
||||
# lane width http://safety.fhwa.dot.gov/geometric/pubs/mitigationstrategies/chapter3/3_lanewidth.cfm
|
||||
_LANE_WIDTH_V = np.asarray([3., 3.8])
|
||||
_LANE_WIDTH_V = [3., 3.8]
|
||||
|
||||
# break points of speed
|
||||
_LANE_WIDTH_BP = np.asarray([0., 31.])
|
||||
_LANE_WIDTH_BP = [0., 31.]
|
||||
|
||||
def calc_desired_path(l_poly, r_poly, p_poly, l_prob, r_prob, p_prob, speed):
|
||||
#*** this function computes the poly for the center of the lane, averaging left and right polys
|
||||
lane_width = np.interp(speed, _LANE_WIDTH_BP, _LANE_WIDTH_V)
|
||||
lane_width = interp(speed, _LANE_WIDTH_BP, _LANE_WIDTH_V)
|
||||
|
||||
# lanes in US are ~3.6m wide
|
||||
half_lane_poly = np.array([0., 0., 0., lane_width / 2.])
|
||||
if l_prob + r_prob > 0.01:
|
||||
c_poly = ((l_poly - half_lane_poly) * l_prob +
|
||||
(r_poly + half_lane_poly) * r_prob) / (l_prob + r_prob)
|
||||
c_prob = np.sqrt((l_prob**2 + r_prob**2) / 2.)
|
||||
c_prob = math.sqrt((l_prob**2 + r_prob**2) / 2.)
|
||||
else:
|
||||
c_poly = np.zeros(4)
|
||||
c_prob = 0.
|
||||
@@ -37,24 +47,26 @@ class PathPlanner(object):
|
||||
self.last_model = 0.
|
||||
self.logMonoTime = 0
|
||||
self.lead_dist, self.lead_prob, self.lead_var = 0, 0, 1
|
||||
self._path_pinv = compute_path_pinv()
|
||||
|
||||
def update(self, cur_time, v_ego):
|
||||
md = messaging.recv_sock(self.model)
|
||||
|
||||
if md is not None:
|
||||
self.logMonoTime = md.logMonoTime
|
||||
p_poly = model_polyfit(md.model.path.points) # predicted path
|
||||
p_prob = 1. # model does not tell this probability yet, so set to 1 for now
|
||||
l_poly = model_polyfit(md.model.leftLane.points) # left line
|
||||
l_prob = md.model.leftLane.prob # left line prob
|
||||
r_poly = model_polyfit(md.model.rightLane.points) # right line
|
||||
r_prob = md.model.rightLane.prob # right line prob
|
||||
p_poly = model_polyfit(md.model.path.points, self._path_pinv) # predicted path
|
||||
l_poly = model_polyfit(md.model.leftLane.points, self._path_pinv) # left line
|
||||
r_poly = model_polyfit(md.model.rightLane.points, self._path_pinv) # right line
|
||||
|
||||
p_prob = 1. # model does not tell this probability yet, so set to 1 for now
|
||||
l_prob = md.model.leftLane.prob # left line prob
|
||||
r_prob = md.model.rightLane.prob # right line prob
|
||||
|
||||
self.lead_dist = md.model.lead.dist
|
||||
self.lead_prob = md.model.lead.prob
|
||||
self.lead_var = md.model.lead.std**2
|
||||
|
||||
#*** compute target path ***
|
||||
# compute target path
|
||||
self.d_poly, _, _ = calc_desired_path(l_poly, r_poly, p_poly, l_prob, r_prob, p_prob, v_ego)
|
||||
|
||||
self.last_model = cur_time
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import numpy as np
|
||||
import platform
|
||||
import os
|
||||
import sys
|
||||
import math
|
||||
import platform
|
||||
import numpy as np
|
||||
|
||||
from common.numpy_fast import clip, interp
|
||||
from common.kalman.ekf import FastEKF1D, SimpleSensor
|
||||
|
||||
# radar tracks
|
||||
@@ -51,14 +53,14 @@ class Track(object):
|
||||
else:
|
||||
# estimate acceleration
|
||||
a_rel_unfilt = (self.vRel - self.vRelPrev) / ts
|
||||
a_rel_unfilt = np.clip(a_rel_unfilt, -10., 10.)
|
||||
a_rel_unfilt = clip(a_rel_unfilt, -10., 10.)
|
||||
self.aRel = k_a_lead * a_rel_unfilt + (1 - k_a_lead) * self.aRel
|
||||
|
||||
v_lat_unfilt = (self.dPath - self.dPathPrev) / ts
|
||||
self.vLat = k_v_lat * v_lat_unfilt + (1 - k_v_lat) * self.vLat
|
||||
|
||||
a_lead_unfilt = (self.vLead - self.vLeadPrev) / ts
|
||||
a_lead_unfilt = np.clip(a_lead_unfilt, -10., 10.)
|
||||
a_lead_unfilt = clip(a_lead_unfilt, -10., 10.)
|
||||
self.aLead = k_a_lead * a_lead_unfilt + (1 - k_a_lead) * self.aLead
|
||||
|
||||
if self.stationary:
|
||||
@@ -217,7 +219,7 @@ class Cluster(object):
|
||||
ret += " vision_cnt: %6.0f" % self.vision_cnt
|
||||
return ret
|
||||
|
||||
def is_potential_lead(self, v_ego, enabled):
|
||||
def is_potential_lead(self, v_ego):
|
||||
# predict cut-ins by extrapolating lateral speed by a lookahead time
|
||||
# lookahead time depends on cut-in distance. more attentive for close cut-ins
|
||||
# also, above 50 meters the predicted path isn't very reliable
|
||||
@@ -231,13 +233,12 @@ class Cluster(object):
|
||||
# average dist
|
||||
d_path = self.dPath
|
||||
|
||||
if enabled:
|
||||
t_lookahead = np.interp(self.dRel, t_lookahead_bp, t_lookahead_v)
|
||||
# correct d_path for lookahead time, considering only cut-ins and no more than 1m impact
|
||||
lat_corr = np.clip(t_lookahead * self.vLat, -1, 0)
|
||||
else:
|
||||
lat_corr = 0.
|
||||
d_path = np.maximum(d_path + lat_corr, 0)
|
||||
# lat_corr used to be gated on enabled, now always running
|
||||
t_lookahead = interp(self.dRel, t_lookahead_bp, t_lookahead_v)
|
||||
# correct d_path for lookahead time, considering only cut-ins and no more than 1m impact
|
||||
lat_corr = clip(t_lookahead * self.vLat, -1, 0)
|
||||
|
||||
d_path = max(d_path + lat_corr, 0)
|
||||
|
||||
if d_path < 1.5 and not self.stationary and not self.oncoming:
|
||||
return True
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import zmq
|
||||
import numpy as np
|
||||
import numpy.matlib
|
||||
@@ -7,9 +8,7 @@ from collections import defaultdict
|
||||
from fastcluster import linkage_vector
|
||||
|
||||
import selfdrive.messaging as messaging
|
||||
from selfdrive.boardd.boardd import can_capnp_to_can_list_old
|
||||
from selfdrive.controls.lib.latcontrol import calc_lookahead_offset
|
||||
from selfdrive.controls.lib.can_parser import CANParser
|
||||
from selfdrive.controls.lib.pathplanner import PathPlanner
|
||||
from selfdrive.config import VehicleParams
|
||||
from selfdrive.controls.lib.radar_helpers import Track, Cluster, fcluster, RDR_TO_LDR
|
||||
@@ -18,10 +17,16 @@ from common.services import service_list
|
||||
from common.realtime import sec_since_boot, set_realtime_priority, Ratekeeper
|
||||
from common.kalman.ekf import EKF, SimpleSensor
|
||||
|
||||
radar_type = os.getenv("RADAR")
|
||||
if radar_type is not None:
|
||||
exec('from selfdrive.radar.'+car_type+'.interface import RadarInterface')
|
||||
else:
|
||||
from selfdrive.radar.nidec.interface import RadarInterface
|
||||
|
||||
#vision point
|
||||
DIMSV = 2
|
||||
XV, SPEEDV = 0, 1
|
||||
VISION_POINT = 1
|
||||
VISION_POINT = -1
|
||||
|
||||
class EKFV1D(EKF):
|
||||
def __init__(self):
|
||||
@@ -31,7 +36,6 @@ class EKFV1D(EKF):
|
||||
self.var_init = 1e2 # ~ model variance when probability is 70%, so good starting point
|
||||
self.covar = self.identity * self.var_init
|
||||
|
||||
# self.process_noise = np.asmatrix(np.diag([100, 10]))
|
||||
self.process_noise = np.matlib.diag([0.5, 1])
|
||||
|
||||
def calc_transfer_fun(self, dt):
|
||||
@@ -41,30 +45,6 @@ class EKFV1D(EKF):
|
||||
return tf, tfj
|
||||
|
||||
|
||||
# nidec radar decoding
|
||||
def nidec_decode(cp, ar_pts):
|
||||
for ii in cp.msgs_upd:
|
||||
# filter points with very big distance, as fff (~255) is invalid. FIXME: use VAL tables from dbc
|
||||
if cp.vl[ii]['LONG_DIST'] < 255:
|
||||
ar_pts[ii] = [cp.vl[ii]['LONG_DIST'] + RDR_TO_LDR,
|
||||
-cp.vl[ii]['LAT_DIST'], cp.vl[ii]['REL_SPEED'], np.nan,
|
||||
cp.ts[ii], cp.vl[ii]['NEW_TRACK'], cp.ct[ii]]
|
||||
elif ii in ar_pts:
|
||||
del ar_pts[ii]
|
||||
return ar_pts
|
||||
|
||||
|
||||
def _create_radard_can_parser():
|
||||
dbc_f = 'acura_ilx_2016_nidec.dbc'
|
||||
radar_messages = range(0x430, 0x43A) + range(0x440, 0x446)
|
||||
signals = zip(['LONG_DIST'] * 16 + ['NEW_TRACK'] * 16 + ['LAT_DIST'] * 16 +
|
||||
['REL_SPEED'] * 16, radar_messages * 4,
|
||||
[255] * 16 + [1] * 16 + [0] * 16 + [0] * 16)
|
||||
checks = zip(radar_messages, [20]*16)
|
||||
|
||||
return CANParser(dbc_f, signals, checks)
|
||||
|
||||
|
||||
# fuses camera and radar data for best lead detection
|
||||
def radard_thread(gctx=None):
|
||||
set_realtime_priority(1)
|
||||
@@ -73,10 +53,10 @@ def radard_thread(gctx=None):
|
||||
|
||||
# *** subscribe to features and model from visiond
|
||||
model = messaging.sub_sock(context, service_list['model'].port)
|
||||
logcan = messaging.sub_sock(context, service_list['can'].port)
|
||||
live100 = messaging.sub_sock(context, service_list['live100'].port)
|
||||
|
||||
PP = PathPlanner(model)
|
||||
RI = RadarInterface()
|
||||
|
||||
# *** publish live20 and liveTracks
|
||||
live20 = messaging.pub_sock(context, service_list['live20'].port)
|
||||
@@ -84,9 +64,8 @@ def radard_thread(gctx=None):
|
||||
|
||||
# subscribe to stats about the car
|
||||
# TODO: move this to new style packet
|
||||
VP = VehicleParams(False) # same for ILX and civic
|
||||
VP = VehicleParams(False, False) # same for ILX and civic
|
||||
|
||||
ar_pts = {}
|
||||
path_x = np.arange(0.0, 140.0, 0.1) # 140 meters is max
|
||||
|
||||
# Time-alignment
|
||||
@@ -100,9 +79,6 @@ def radard_thread(gctx=None):
|
||||
|
||||
tracks = defaultdict(dict)
|
||||
|
||||
# Nidec
|
||||
cp = _create_radard_can_parser()
|
||||
|
||||
# Kalman filter stuff:
|
||||
ekfv = EKFV1D()
|
||||
speedSensorV = SimpleSensor(XV, 1, 2)
|
||||
@@ -114,23 +90,11 @@ def radard_thread(gctx=None):
|
||||
|
||||
rk = Ratekeeper(rate, print_delay_threshold=np.inf)
|
||||
while 1:
|
||||
canMonoTimes = []
|
||||
can_pub_radar = []
|
||||
for a in messaging.drain_sock(logcan, wait_for_one=True):
|
||||
canMonoTimes.append(a.logMonoTime)
|
||||
can_pub_radar.extend(can_capnp_to_can_list_old(a, [1, 3]))
|
||||
rr = RI.update()
|
||||
|
||||
# only run on the 0x445 packets, used for timing
|
||||
if not any(x[0] == 0x445 for x in can_pub_radar):
|
||||
continue
|
||||
|
||||
cp.update_can(can_pub_radar)
|
||||
|
||||
if not cp.can_valid:
|
||||
# TODO: handle this
|
||||
pass
|
||||
|
||||
ar_pts = nidec_decode(cp, ar_pts)
|
||||
ar_pts = {}
|
||||
for pt in rr.points:
|
||||
ar_pts[pt.trackId] = [pt.dRel + RDR_TO_LDR, pt.yRel, pt.vRel, pt.aRel, None, False, None]
|
||||
|
||||
# receive the live100s
|
||||
l100 = messaging.recv_sock(live100)
|
||||
@@ -184,7 +148,7 @@ def radard_thread(gctx=None):
|
||||
v_ego_t_aligned = np.interp(cur_time - rdr_delay, v_ego_array[1], v_ego_array[0])
|
||||
d_path = np.sqrt(np.amin((path_x - rpt[0]) ** 2 + (path_y - rpt[1]) ** 2))
|
||||
|
||||
# create the track
|
||||
# create the track if it doesn't exist or it's a new track
|
||||
if ids not in tracks or rpt[5] == 1:
|
||||
tracks[ids] = Track()
|
||||
tracks[ids].update(rpt[0], rpt[1], rpt[2], d_path, v_ego_t_aligned)
|
||||
@@ -232,7 +196,7 @@ def radard_thread(gctx=None):
|
||||
|
||||
# *** extract the lead car ***
|
||||
lead_clusters = [c for c in clusters
|
||||
if c.is_potential_lead(v_ego, enabled)]
|
||||
if c.is_potential_lead(v_ego)]
|
||||
lead_clusters.sort(key=lambda x: x.dRel)
|
||||
lead_len = len(lead_clusters)
|
||||
|
||||
@@ -246,7 +210,7 @@ def radard_thread(gctx=None):
|
||||
dat = messaging.new_message()
|
||||
dat.init('live20')
|
||||
dat.live20.mdMonoTime = PP.logMonoTime
|
||||
dat.live20.canMonoTimes = canMonoTimes
|
||||
dat.live20.canMonoTimes = list(rr.canMonoTimes)
|
||||
if lead_len > 0:
|
||||
lead_clusters[0].toLive20(dat.live20.leadOne)
|
||||
if lead2_len > 0:
|
||||
|
||||
31
selfdrive/debug/dump.py
Executable file
31
selfdrive/debug/dump.py
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
import argparse
|
||||
import zmq
|
||||
from hexdump import hexdump
|
||||
|
||||
import selfdrive.messaging as messaging
|
||||
from common.services import service_list
|
||||
|
||||
if __name__ == "__main__":
|
||||
context = zmq.Context()
|
||||
poller = zmq.Poller()
|
||||
|
||||
parser = argparse.ArgumentParser(description='Sniff a communcation socket')
|
||||
parser.add_argument('--raw', action='store_true')
|
||||
parser.add_argument("socket", type=str,
|
||||
help="socket name")
|
||||
args = parser.parse_args()
|
||||
|
||||
messaging.sub_sock(context, service_list[args.socket].port, poller)
|
||||
|
||||
while 1:
|
||||
polld = poller.poll(timeout=1000)
|
||||
for sock, mode in polld:
|
||||
if mode != zmq.POLLIN:
|
||||
continue
|
||||
if args.raw:
|
||||
hexdump(sock.recv())
|
||||
else:
|
||||
print messaging.recv_sock(sock)
|
||||
|
||||
@@ -17,18 +17,16 @@ ZMQ_LIBS = -L$(PHONELIBS)/zmq/aarch64/lib \
|
||||
-l:libczmq.a -l:libzmq.a \
|
||||
-lgnustl_shared
|
||||
|
||||
CEREAL_FLAGS = -I$(PHONELIBS)/capnp-cpp/include
|
||||
CEREAL_LIBS = -L$(PHONELIBS)/capnp-cpp/aarch64/lib/ \
|
||||
-l:libcapnp.a -l:libkj.a
|
||||
CEREAL_OBJS = ../../cereal/gen/c/log.capnp.o
|
||||
.PHONY: all
|
||||
all: logcatd
|
||||
|
||||
-include ../common/cereal.mk
|
||||
|
||||
OBJS = logcatd.o \
|
||||
log.capnp.o
|
||||
$(CEREAL_OBJS)
|
||||
|
||||
DEPS := $(OBJS:.o=.d)
|
||||
|
||||
all: logcatd
|
||||
|
||||
logcatd: $(OBJS)
|
||||
@echo "[ LINK ] $@"
|
||||
$(CXX) -fPIC -o '$@' $^ \
|
||||
@@ -40,17 +38,12 @@ logcatd: $(OBJS)
|
||||
@echo "[ CXX ] $@"
|
||||
$(CXX) $(CXXFLAGS) \
|
||||
-I$(PHONELIBS)/android_system_core/include \
|
||||
$(CEREAL_FLAGS) \
|
||||
$(CEREAL_CFLAGS) \
|
||||
$(ZMQ_FLAGS) \
|
||||
-I../ \
|
||||
-I../../ \
|
||||
-c -o '$@' '$<'
|
||||
|
||||
log.capnp.o: ../../cereal/gen/cpp/log.capnp.c++
|
||||
@echo "[ CXX ] $@"
|
||||
$(CXX) $(CXXFLAGS) $(CEREAL_FLAGS) \
|
||||
-c -o '$@' '$<'
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f logcatd $(OBJS) $(DEPS)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import os
|
||||
|
||||
# fetch from environment
|
||||
DONGLE_ID = os.getenv("DONGLE_ID")
|
||||
DONGLE_SECRET = os.getenv("DONGLE_SECRET")
|
||||
def get_dongle_id_and_secret():
|
||||
return os.getenv("DONGLE_ID"), os.getenv("DONGLE_SECRET")
|
||||
|
||||
ROOT = '/sdcard/realdata/'
|
||||
|
||||
|
||||
@@ -75,10 +75,17 @@ def main(gctx=None):
|
||||
rotate_msg = messaging.log.LogRotate.new_message()
|
||||
rotate_msg.segmentNum = cur_part
|
||||
rotate_msg.path = cur_dir
|
||||
|
||||
vision_control_sock.send(rotate_msg.to_bytes())
|
||||
|
||||
finally:
|
||||
cloudlog.info("loggerd exiting...")
|
||||
|
||||
# tell visiond to stop logging
|
||||
rotate_msg = messaging.log.LogRotate.new_message()
|
||||
rotate_msg.segmentNum = -1
|
||||
rotate_msg.path = "/dev/null"
|
||||
vision_control_sock.send(rotate_msg.to_bytes())
|
||||
|
||||
# stop logging
|
||||
logger.stop()
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -9,11 +9,14 @@ import requests
|
||||
import traceback
|
||||
import threading
|
||||
|
||||
from collections import Counter
|
||||
from selfdrive.swaglog import cloudlog
|
||||
from selfdrive.loggerd.config import DONGLE_ID, DONGLE_SECRET, ROOT
|
||||
from selfdrive.loggerd.config import get_dongle_id_and_secret, ROOT
|
||||
|
||||
from common.api import api_get
|
||||
|
||||
fake_upload = os.getenv("FAKEUPLOAD") is not None
|
||||
|
||||
def raise_on_thread(t, exctype):
|
||||
for ctid, tobj in threading._active.items():
|
||||
if tobj is t:
|
||||
@@ -84,6 +87,8 @@ class Uploader(object):
|
||||
cloudlog.exception("clean_dirs failed")
|
||||
|
||||
def gen_upload_files(self):
|
||||
if not os.path.isdir(self.root):
|
||||
return
|
||||
for logname in listdir_by_creation_date(self.root):
|
||||
path = os.path.join(self.root, logname)
|
||||
names = os.listdir(path)
|
||||
@@ -96,6 +101,14 @@ class Uploader(object):
|
||||
|
||||
yield (name, key, fn)
|
||||
|
||||
def get_data_stats(self):
|
||||
name_counts = Counter()
|
||||
total_size = 0
|
||||
for name, key, fn in self.gen_upload_files():
|
||||
name_counts[name] += 1
|
||||
total_size += os.stat(fn).st_size
|
||||
return dict(name_counts), total_size
|
||||
|
||||
def next_file_to_upload(self):
|
||||
# try to upload log files first
|
||||
for name, key, fn in self.gen_upload_files():
|
||||
@@ -118,8 +131,15 @@ class Uploader(object):
|
||||
url = url_resp.text
|
||||
cloudlog.info({"upload_url", url})
|
||||
|
||||
with open(fn, "rb") as f:
|
||||
self.last_resp = requests.put(url, data=f)
|
||||
if fake_upload:
|
||||
print "*** WARNING, THIS IS A FAKE UPLOAD TO %s ***" % url
|
||||
class FakeResponse(object):
|
||||
def __init__(self):
|
||||
self.status_code = 200
|
||||
self.last_resp = FakeResponse()
|
||||
else:
|
||||
with open(fn, "rb") as f:
|
||||
self.last_resp = requests.put(url, data=f)
|
||||
except Exception as e:
|
||||
self.last_exc = (e, traceback.format_exc())
|
||||
raise
|
||||
@@ -203,7 +223,13 @@ class Uploader(object):
|
||||
def uploader_fn(exit_event):
|
||||
cloudlog.info("uploader_fn")
|
||||
|
||||
uploader = Uploader(DONGLE_ID, DONGLE_SECRET, ROOT)
|
||||
dongle_id, dongle_secret = get_dongle_id_and_secret()
|
||||
|
||||
if dongle_id is None or dongle_secret is None:
|
||||
cloudlog.info("uploader MISSING DONGLE_ID or DONGLE_SECRET")
|
||||
raise Exception("uploader can't start without dongle id and secret")
|
||||
|
||||
uploader = Uploader(dongle_id, dongle_secret, ROOT)
|
||||
|
||||
while True:
|
||||
backoff = 0.1
|
||||
|
||||
@@ -6,7 +6,7 @@ import selfdrive.messaging as messaging
|
||||
|
||||
def main(gctx):
|
||||
# setup logentries. we forward log messages to it
|
||||
le_token = "bc65354a-b887-4ef4-8525-15dd51230e8c"
|
||||
le_token = "e8549616-0798-4d7e-a2ca-2513ae81fa17"
|
||||
le_handler = LogentriesHandler(le_token, use_tls=False)
|
||||
|
||||
le_level = 20 #logging.INFO
|
||||
|
||||
@@ -21,6 +21,8 @@ from selfdrive.registration import register
|
||||
|
||||
import common.crash
|
||||
|
||||
from selfdrive.loggerd.config import ROOT
|
||||
|
||||
# comment out anything you don't want to run
|
||||
managed_processes = {
|
||||
"uploader": "selfdrive.loggerd.uploader",
|
||||
@@ -29,7 +31,6 @@ managed_processes = {
|
||||
"calibrationd": "selfdrive.calibrationd.calibrationd",
|
||||
"loggerd": "selfdrive.loggerd.loggerd",
|
||||
"logmessaged": "selfdrive.logmessaged",
|
||||
#"boardd": "selfdrive.boardd.boardd",
|
||||
"logcatd": ("logcatd", ["./logcatd"]),
|
||||
"boardd": ("boardd", ["./boardd"]), # switch to c++ boardd
|
||||
"ui": ("ui", ["./ui"]),
|
||||
@@ -38,16 +39,18 @@ managed_processes = {
|
||||
|
||||
running = {}
|
||||
|
||||
car_started_processes = ['controlsd', 'loggerd', 'visiond', 'sensord', 'radard', 'calibrationd']
|
||||
# due to qualcomm kernel bugs SIGKILLing visiond sometimes causes page table corruption
|
||||
unkillable_processes = ['visiond']
|
||||
|
||||
# processes to end with SIGINT instead of SIGTERM
|
||||
interrupt_processes = ['loggerd']
|
||||
|
||||
car_started_processes = ['controlsd', 'loggerd', 'sensord', 'radard', 'calibrationd', 'visiond']
|
||||
|
||||
|
||||
# ****************** process management functions ******************
|
||||
def launcher(proc, gctx):
|
||||
try:
|
||||
# unset the signals
|
||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||
signal.signal(signal.SIGTERM, signal.SIG_DFL)
|
||||
|
||||
# import the process
|
||||
mod = importlib.import_module(proc)
|
||||
|
||||
@@ -56,6 +59,8 @@ def launcher(proc, gctx):
|
||||
|
||||
# exec the process
|
||||
mod.main(gctx)
|
||||
except KeyboardInterrupt:
|
||||
cloudlog.info("child %s got ctrl-c" % proc)
|
||||
except Exception:
|
||||
# can't install the crash handler becuase sys.excepthook doesn't play nice
|
||||
# with threads, so catch it here.
|
||||
@@ -91,15 +96,30 @@ def kill_managed_process(name):
|
||||
if name not in running or name not in managed_processes:
|
||||
return
|
||||
cloudlog.info("killing %s" % name)
|
||||
running[name].terminate()
|
||||
|
||||
if name in interrupt_processes:
|
||||
os.kill(running[name].pid, signal.SIGINT)
|
||||
else:
|
||||
running[name].terminate()
|
||||
|
||||
|
||||
# give it 5 seconds to die
|
||||
running[name].join(5.0)
|
||||
if running[name].exitcode is None:
|
||||
cloudlog.info("killing %s with SIGKILL" % name)
|
||||
os.kill(running[name].pid, signal.SIGKILL)
|
||||
running[name].join()
|
||||
cloudlog.info("%s is finally dead" % name)
|
||||
else:
|
||||
cloudlog.info("%s is dead with %d" % (name, running[name].exitcode))
|
||||
if name in unkillable_processes:
|
||||
cloudlog.critical("unkillable process %s failed to exit! rebooting in 15 if it doesn't die" % name)
|
||||
running[name].join(15.0)
|
||||
if running[name].exitcode is None:
|
||||
cloudlog.critical("FORCE REBOOTING PHONE!")
|
||||
os.system("date > /sdcard/unkillable_reboot")
|
||||
os.system("reboot")
|
||||
raise RuntimeError
|
||||
else:
|
||||
cloudlog.info("killing %s with SIGKILL" % name)
|
||||
os.kill(running[name].pid, signal.SIGKILL)
|
||||
running[name].join()
|
||||
|
||||
cloudlog.info("%s is dead with %d" % (name, running[name].exitcode))
|
||||
del running[name]
|
||||
|
||||
def cleanup_all_processes(signal, frame):
|
||||
@@ -125,6 +145,7 @@ def manager_init():
|
||||
os.environ['DONGLE_SECRET'] = dongle_secret
|
||||
|
||||
cloudlog.bind_global(dongle_id=dongle_id)
|
||||
common.crash.bind_user(dongle_id=dongle_id)
|
||||
|
||||
# set gctx
|
||||
gctx = {
|
||||
@@ -135,25 +156,25 @@ def manager_init():
|
||||
}
|
||||
}
|
||||
|
||||
# hook to kill all processes
|
||||
signal.signal(signal.SIGINT, cleanup_all_processes)
|
||||
signal.signal(signal.SIGTERM, cleanup_all_processes)
|
||||
|
||||
def manager_thread():
|
||||
# now loop
|
||||
context = zmq.Context()
|
||||
thermal_sock = messaging.pub_sock(context, service_list['thermal'].port)
|
||||
health_sock = messaging.sub_sock(context, service_list['health'].port)
|
||||
|
||||
cloudlog.info("manager start")
|
||||
version = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "common", "version.h")).read().split('"')[1]
|
||||
|
||||
cloudlog.info("manager start %s" % version)
|
||||
cloudlog.info(dict(os.environ))
|
||||
|
||||
start_managed_process("logmessaged")
|
||||
start_managed_process("logcatd")
|
||||
start_managed_process("uploader")
|
||||
start_managed_process("ui")
|
||||
|
||||
# *** wait for the board ***
|
||||
wait_for_device()
|
||||
if os.getenv("NOBOARD") is None:
|
||||
# *** wait for the board ***
|
||||
wait_for_device()
|
||||
|
||||
# flash the device
|
||||
if os.getenv("NOPROG") is None:
|
||||
@@ -166,6 +187,14 @@ def manager_thread():
|
||||
for p in car_started_processes:
|
||||
start_managed_process(p)
|
||||
|
||||
logger_dead = False
|
||||
|
||||
count = 0
|
||||
|
||||
# set 5 second timeout on health socket
|
||||
# 5x slower than expected
|
||||
health_sock.RCVTIMEO = 5000
|
||||
|
||||
while 1:
|
||||
# get health of board, log this in "thermal"
|
||||
td = messaging.recv_sock(health_sock, wait=True)
|
||||
@@ -173,6 +202,17 @@ def manager_thread():
|
||||
|
||||
# replace thermald
|
||||
msg = read_thermal()
|
||||
|
||||
# loggerd is gated based on free space
|
||||
statvfs = os.statvfs(ROOT)
|
||||
avail = (statvfs.f_bavail * 1.0)/statvfs.f_blocks
|
||||
|
||||
# thermal message now also includes free space
|
||||
msg.thermal.freeSpace = avail
|
||||
with open("/sys/class/power_supply/battery/capacity") as f:
|
||||
msg.thermal.batteryPercent = int(f.read())
|
||||
with open("/sys/class/power_supply/battery/status") as f:
|
||||
msg.thermal.batteryStatus = f.read().strip()
|
||||
thermal_sock.send(msg.to_bytes())
|
||||
print msg
|
||||
|
||||
@@ -187,17 +227,41 @@ def manager_thread():
|
||||
elif max_temp < 70.0:
|
||||
start_managed_process("uploader")
|
||||
|
||||
if avail < 0.05:
|
||||
logger_dead = True
|
||||
|
||||
# start constellation of processes when the car starts
|
||||
if td.health.started:
|
||||
for p in car_started_processes:
|
||||
start_managed_process(p)
|
||||
else:
|
||||
for p in car_started_processes:
|
||||
kill_managed_process(p)
|
||||
if not os.getenv("STARTALL"):
|
||||
# with 2% left, we killall, otherwise the phone is bricked
|
||||
if td is not None and td.health.started and avail > 0.02:
|
||||
for p in car_started_processes:
|
||||
if p == "loggerd" and logger_dead:
|
||||
kill_managed_process(p)
|
||||
else:
|
||||
start_managed_process(p)
|
||||
else:
|
||||
logger_dead = False
|
||||
for p in car_started_processes:
|
||||
kill_managed_process(p)
|
||||
|
||||
# shutdown if the battery gets lower than 10%, we aren't running, and we are discharging
|
||||
if msg.thermal.batteryPercent < 5 and msg.thermal.batteryStatus == "Discharging":
|
||||
os.system('LD_LIBRARY_PATH="" svc power shutdown')
|
||||
|
||||
# check the status of all processes, did any of them die?
|
||||
for p in running:
|
||||
cloudlog.info(" running %s %s" % (p, running[p]))
|
||||
cloudlog.debug(" running %s %s" % (p, running[p]))
|
||||
|
||||
# report to server once per minute
|
||||
if (count%60) == 0:
|
||||
cloudlog.event("STATUS_PACKET",
|
||||
running=running.keys(),
|
||||
count=count,
|
||||
health=(td.to_dict() if td else None),
|
||||
thermal=msg.to_dict(),
|
||||
version=version)
|
||||
|
||||
count += 1
|
||||
|
||||
|
||||
# optional, build the c++ binaries and preimport the python for speed
|
||||
@@ -219,24 +283,6 @@ def manager_prepare():
|
||||
subprocess.check_call(["make", "clean"], cwd=proc[0])
|
||||
subprocess.check_call(["make", "-j4"], cwd=proc[0])
|
||||
|
||||
def manager_test():
|
||||
global managed_processes
|
||||
managed_processes = {}
|
||||
managed_processes["test1"] = ("test", ["./test.py"])
|
||||
managed_processes["test2"] = ("test", ["./test.py"])
|
||||
managed_processes["test3"] = "selfdrive.test.test"
|
||||
manager_prepare()
|
||||
start_managed_process("test1")
|
||||
start_managed_process("test2")
|
||||
start_managed_process("test3")
|
||||
print running
|
||||
time.sleep(3)
|
||||
kill_managed_process("test1")
|
||||
kill_managed_process("test2")
|
||||
kill_managed_process("test3")
|
||||
print running
|
||||
time.sleep(10)
|
||||
|
||||
def wait_for_device():
|
||||
while 1:
|
||||
try:
|
||||
@@ -257,22 +303,34 @@ def wait_for_device():
|
||||
def main():
|
||||
if os.getenv("NOLOG") is not None:
|
||||
del managed_processes['loggerd']
|
||||
if os.getenv("NOUPLOAD") is not None:
|
||||
del managed_processes['uploader']
|
||||
if os.getenv("NOVISION") is not None:
|
||||
del managed_processes['visiond']
|
||||
if os.getenv("NOBOARD") is not None:
|
||||
del managed_processes['boardd']
|
||||
if os.getenv("LEAN") is not None:
|
||||
del managed_processes['uploader']
|
||||
del managed_processes['loggerd']
|
||||
del managed_processes['logmessaged']
|
||||
del managed_processes['logcatd']
|
||||
if os.getenv("NOCONTROL") is not None:
|
||||
del managed_processes['controlsd']
|
||||
del managed_processes['radard']
|
||||
|
||||
manager_init()
|
||||
manager_prepare()
|
||||
|
||||
if os.getenv("PREPAREONLY") is not None:
|
||||
sys.exit(0)
|
||||
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "test":
|
||||
manager_test()
|
||||
else:
|
||||
manager_prepare()
|
||||
try:
|
||||
manager_thread()
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
common.crash.capture_exception()
|
||||
finally:
|
||||
cleanup_all_processes(None, None)
|
||||
try:
|
||||
manager_thread()
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
common.crash.capture_exception()
|
||||
finally:
|
||||
cleanup_all_processes(None, None)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
0
selfdrive/radar/__init__.py
Normal file
0
selfdrive/radar/__init__.py
Normal file
0
selfdrive/radar/nidec/__init__.py
Normal file
0
selfdrive/radar/nidec/__init__.py
Normal file
83
selfdrive/radar/nidec/interface.py
Executable file
83
selfdrive/radar/nidec/interface.py
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env python
|
||||
import numpy as np
|
||||
from selfdrive.car.honda.can_parser import CANParser
|
||||
from selfdrive.boardd.boardd import can_capnp_to_can_list
|
||||
|
||||
from cereal import car
|
||||
|
||||
import zmq
|
||||
from common.services import service_list
|
||||
import selfdrive.messaging as messaging
|
||||
|
||||
def _create_radard_can_parser():
|
||||
dbc_f = 'acura_ilx_2016_nidec.dbc'
|
||||
radar_messages = range(0x430, 0x43A) + range(0x440, 0x446)
|
||||
signals = zip(['LONG_DIST'] * 16 + ['NEW_TRACK'] * 16 + ['LAT_DIST'] * 16 +
|
||||
['REL_SPEED'] * 16, radar_messages * 4,
|
||||
[255] * 16 + [1] * 16 + [0] * 16 + [0] * 16)
|
||||
checks = zip(radar_messages, [20]*16)
|
||||
|
||||
return CANParser(dbc_f, signals, checks)
|
||||
|
||||
class RadarInterface(object):
|
||||
def __init__(self):
|
||||
# radar
|
||||
self.pts = {}
|
||||
self.track_id = 0
|
||||
|
||||
# Nidec
|
||||
self.rcp = _create_radard_can_parser()
|
||||
|
||||
context = zmq.Context()
|
||||
self.logcan = messaging.sub_sock(context, service_list['can'].port)
|
||||
|
||||
def update(self):
|
||||
canMonoTimes = []
|
||||
can_pub_radar = []
|
||||
|
||||
# TODO: can hang if no packets show up
|
||||
while 1:
|
||||
for a in messaging.drain_sock(self.logcan, wait_for_one=True):
|
||||
canMonoTimes.append(a.logMonoTime)
|
||||
can_pub_radar.extend(can_capnp_to_can_list(a.can, [1, 3]))
|
||||
|
||||
# only run on the 0x445 packets, used for timing
|
||||
if any(x[0] == 0x445 for x in can_pub_radar):
|
||||
break
|
||||
|
||||
self.rcp.update_can(can_pub_radar)
|
||||
|
||||
ret = car.RadarState.new_message()
|
||||
errors = []
|
||||
if not self.rcp.can_valid:
|
||||
errors.append("notValid")
|
||||
ret.errors = errors
|
||||
ret.canMonoTimes = canMonoTimes
|
||||
|
||||
for ii in self.rcp.msgs_upd:
|
||||
cpt = self.rcp.vl[ii]
|
||||
if cpt['LONG_DIST'] < 255:
|
||||
if ii not in self.pts or cpt['NEW_TRACK']:
|
||||
self.pts[ii] = car.RadarState.RadarPoint.new_message()
|
||||
self.pts[ii].trackId = self.track_id
|
||||
self.track_id += 1
|
||||
self.pts[ii].dRel = cpt['LONG_DIST'] # from front of car
|
||||
self.pts[ii].yRel = -cpt['LAT_DIST'] # in car frame's y axis, left is positive
|
||||
self.pts[ii].vRel = cpt['REL_SPEED']
|
||||
self.pts[ii].aRel = float('nan')
|
||||
self.pts[ii].yvRel = float('nan')
|
||||
else:
|
||||
if ii in self.pts:
|
||||
del self.pts[ii]
|
||||
|
||||
ret.points = self.pts.values()
|
||||
return ret
|
||||
|
||||
if __name__ == "__main__":
|
||||
RI = RadarInterface()
|
||||
while 1:
|
||||
ret = RI.update()
|
||||
print(chr(27) + "[2J")
|
||||
print ret
|
||||
|
||||
|
||||
@@ -17,18 +17,16 @@ ZMQ_LIBS = -L$(PHONELIBS)/zmq/aarch64/lib \
|
||||
-l:libczmq.a -l:libzmq.a \
|
||||
-lgnustl_shared
|
||||
|
||||
CEREAL_FLAGS = -I$(PHONELIBS)/capnp-cpp/include
|
||||
CEREAL_LIBS = -L$(PHONELIBS)/capnp-cpp/aarch64/lib/ \
|
||||
-l:libcapnp.a -l:libkj.a
|
||||
CEREAL_OBJS = ../../cereal/gen/c/log.capnp.o
|
||||
.PHONY: all
|
||||
all: sensord
|
||||
|
||||
-include ../common/cereal.mk
|
||||
|
||||
OBJS = sensors.o \
|
||||
log.capnp.o
|
||||
$(CEREAL_OBJS)
|
||||
|
||||
DEPS := $(OBJS:.o=.d)
|
||||
|
||||
all: sensord
|
||||
|
||||
sensord: $(OBJS)
|
||||
@echo "[ LINK ] $@"
|
||||
$(CXX) -fPIC -o '$@' $^ \
|
||||
@@ -40,19 +38,12 @@ sensors.o: sensors.cc
|
||||
@echo "[ CXX ] $@"
|
||||
$(CXX) $(CXXFLAGS) \
|
||||
-I$(PHONELIBS)/android_system_core/include \
|
||||
$(CEREAL_FLAGS) \
|
||||
$(CEREAL_CFLAGS) \
|
||||
$(ZMQ_FLAGS) \
|
||||
-I../ \
|
||||
-I../../ \
|
||||
-c -o '$@' '$<'
|
||||
|
||||
|
||||
log.capnp.o: ../../cereal/gen/cpp/log.capnp.c++
|
||||
@echo "[ CXX ] $@"
|
||||
$(CXX) $(CXXFLAGS) $(CEREAL_FLAGS) \
|
||||
-c -o '$@' '$<'
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f sensord $(OBJS) $(DEPS)
|
||||
|
||||
@@ -83,6 +83,7 @@ void sensor_loop() {
|
||||
|
||||
const sensors_event_t& data = buffer[i];
|
||||
|
||||
sensorEvents[i].setSource(cereal::SensorEventData::SensorSource::ANDROID);
|
||||
sensorEvents[i].setVersion(data.version);
|
||||
sensorEvents[i].setSensor(data.sensor);
|
||||
sensorEvents[i].setType(data.type);
|
||||
|
||||
0
selfdrive/test/__init__.py
Normal file
0
selfdrive/test/__init__.py
Normal file
0
selfdrive/test/plant/__init__.py
Normal file
0
selfdrive/test/plant/__init__.py
Normal file
71
selfdrive/test/plant/maneuver.py
Normal file
71
selfdrive/test/plant/maneuver.py
Normal file
@@ -0,0 +1,71 @@
|
||||
import os
|
||||
from enum import Enum
|
||||
from maneuverplots import ManeuverPlot
|
||||
from plant import Plant
|
||||
import numpy as np
|
||||
|
||||
|
||||
class Maneuver(object):
|
||||
def __init__(self, title, duration, **kwargs):
|
||||
# Was tempted to make a builder class
|
||||
self.distance_lead = kwargs.get("initial_distance_lead", 200.0)
|
||||
self.speed = kwargs.get("initial_speed", 0.0)
|
||||
self.lead_relevancy = kwargs.get("lead_relevancy", 0)
|
||||
|
||||
self.grade_values = kwargs.get("grade_values", [0.0, 0.0])
|
||||
self.grade_breakpoints = kwargs.get("grade_breakpoints", [0.0, duration])
|
||||
self.speed_lead_values = kwargs.get("speed_lead_values", [0.0, 0.0])
|
||||
self.speed_lead_breakpoints = kwargs.get("speed_lead_values", [0.0, duration])
|
||||
|
||||
self.cruise_button_presses = kwargs.get("cruise_button_presses", [])
|
||||
|
||||
self.duration = duration
|
||||
self.title = title
|
||||
|
||||
def evaluate(self):
|
||||
"""runs the plant sim and returns (score, run_data)"""
|
||||
plant = Plant(
|
||||
lead_relevancy = self.lead_relevancy,
|
||||
speed = self.speed,
|
||||
distance_lead = self.distance_lead
|
||||
)
|
||||
|
||||
last_live100 = None
|
||||
event_queue = sorted(self.cruise_button_presses, key=lambda a: a[1])[::-1]
|
||||
plot = ManeuverPlot(self.title)
|
||||
|
||||
buttons_sorted = sorted(self.cruise_button_presses, key=lambda a: a[1])
|
||||
current_button = 0
|
||||
while plant.current_time() < self.duration:
|
||||
while buttons_sorted and plant.current_time() >= buttons_sorted[0][1]:
|
||||
current_button = buttons_sorted[0][0]
|
||||
buttons_sorted = buttons_sorted[1:]
|
||||
print "current button changed to", current_button
|
||||
|
||||
grade = np.interp(plant.current_time(), self.grade_breakpoints, self.grade_values)
|
||||
speed_lead = np.interp(plant.current_time(), self.speed_lead_breakpoints, self.speed_lead_values)
|
||||
|
||||
distance, speed, acceleration, distance_lead, brake, gas, steer_torque, live100 = plant.step(speed_lead, current_button, grade)
|
||||
if live100:
|
||||
last_live100 = live100[-1]
|
||||
|
||||
d_rel = distance_lead - distance if self.lead_relevancy else 200.
|
||||
v_rel = speed_lead - speed if self.lead_relevancy else 0.
|
||||
|
||||
if last_live100:
|
||||
# print last_live100
|
||||
#develop plots
|
||||
plot.add_data(
|
||||
time=plant.current_time(),
|
||||
gas=gas, brake=brake, steer_torque=steer_torque,
|
||||
distance=distance, speed=speed, acceleration=acceleration,
|
||||
up_accel_cmd=last_live100.upAccelCmd, ui_accel_cmd=last_live100.uiAccelCmd,
|
||||
d_rel=d_rel, v_rel=v_rel, v_lead=speed_lead,
|
||||
v_target_lead=last_live100.vTargetLead, pid_speed=last_live100.vPid,
|
||||
cruise_speed=last_live100.vCruise,
|
||||
jerk_factor=last_live100.jerkFactor,
|
||||
a_target_min=last_live100.aTargetMin, a_target_max=last_live100.aTargetMax)
|
||||
|
||||
return (None, plot)
|
||||
|
||||
|
||||
140
selfdrive/test/plant/maneuverplots.py
Normal file
140
selfdrive/test/plant/maneuverplots.py
Normal file
@@ -0,0 +1,140 @@
|
||||
import os
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import pylab
|
||||
|
||||
from selfdrive.config import Conversions as CV
|
||||
|
||||
class ManeuverPlot(object):
|
||||
def __init__(self, title = None):
|
||||
self.time_array = []
|
||||
|
||||
self.gas_array = []
|
||||
self.brake_array = []
|
||||
self.steer_torque_array = []
|
||||
|
||||
self.distance_array = []
|
||||
self.speed_array = []
|
||||
self.acceleration_array = []
|
||||
|
||||
self.up_accel_cmd_array = []
|
||||
self.ui_accel_cmd_array = []
|
||||
|
||||
self.d_rel_array = []
|
||||
self.v_rel_array = []
|
||||
self.v_lead_array = []
|
||||
self.v_target_lead_array = []
|
||||
self.pid_speed_array = []
|
||||
self.cruise_speed_array = []
|
||||
self.jerk_factor_array = []
|
||||
|
||||
self.a_target_min_array = []
|
||||
self.a_target_max_array = []
|
||||
|
||||
self.v_target_array = []
|
||||
|
||||
self.title = title
|
||||
|
||||
def add_data(self, time, gas, brake, steer_torque, distance, speed,
|
||||
acceleration, up_accel_cmd, ui_accel_cmd, d_rel, v_rel, v_lead,
|
||||
v_target_lead, pid_speed, cruise_speed, jerk_factor, a_target_min,
|
||||
a_target_max):
|
||||
self.time_array.append(time)
|
||||
self.gas_array.append(gas)
|
||||
self.brake_array.append(brake)
|
||||
self.steer_torque_array.append(steer_torque)
|
||||
self.distance_array.append(distance)
|
||||
self.speed_array.append(speed)
|
||||
self.acceleration_array.append(acceleration)
|
||||
self.up_accel_cmd_array.append(up_accel_cmd)
|
||||
self.ui_accel_cmd_array.append(ui_accel_cmd)
|
||||
self.d_rel_array.append(d_rel)
|
||||
self.v_rel_array.append(v_rel)
|
||||
self.v_lead_array.append(v_lead)
|
||||
self.v_target_lead_array.append(v_target_lead)
|
||||
self.pid_speed_array.append(pid_speed)
|
||||
self.cruise_speed_array.append(cruise_speed)
|
||||
self.jerk_factor_array.append(jerk_factor)
|
||||
self.a_target_min_array.append(a_target_min)
|
||||
self.a_target_max_array.append(a_target_max)
|
||||
|
||||
|
||||
def write_plot(self, path, maneuver_name):
|
||||
title = self.title or maneuver_name
|
||||
# TODO: Missing plots from the old one:
|
||||
# long_control_state
|
||||
# proportional_gb, intergral_gb
|
||||
if not os.path.exists(path + "/" + maneuver_name):
|
||||
os.makedirs(path + "/" + maneuver_name)
|
||||
plt_num = 0
|
||||
|
||||
# speed chart ===================
|
||||
plt_num += 1
|
||||
plt.figure(plt_num)
|
||||
plt.plot(
|
||||
np.array(self.time_array), np.array(self.speed_array) * CV.MS_TO_MPH, 'r',
|
||||
np.array(self.time_array), np.array(self.pid_speed_array) * CV.MS_TO_MPH, 'y--',
|
||||
np.array(self.time_array), np.array(self.v_target_lead_array) * CV.MS_TO_MPH, 'b',
|
||||
np.array(self.time_array), np.array(self.cruise_speed_array) * CV.KPH_TO_MPH, 'k',
|
||||
np.array(self.time_array), np.array(self.v_lead_array) * CV.MS_TO_MPH, 'm'
|
||||
)
|
||||
plt.xlabel('Time [s]')
|
||||
plt.ylabel('Speed [mph]')
|
||||
plt.legend(['speed', 'pid speed', 'Target (lead) speed', 'Cruise speed', 'Lead speed'], loc=0)
|
||||
plt.grid()
|
||||
pylab.savefig("/".join([path, maneuver_name, 'speeds.svg']), dpi=1000)
|
||||
|
||||
# acceleration chart ============
|
||||
plt_num += 1
|
||||
plt.figure(plt_num)
|
||||
plt.plot(
|
||||
np.array(self.time_array), np.array(self.acceleration_array), 'g',
|
||||
np.array(self.time_array), np.array(self.a_target_min_array), 'k--',
|
||||
np.array(self.time_array), np.array(self.a_target_max_array), 'k--',
|
||||
)
|
||||
plt.xlabel('Time [s]')
|
||||
plt.ylabel('Acceleration [m/s^2]')
|
||||
plt.legend(['accel', 'max', 'min'], loc=0)
|
||||
plt.grid()
|
||||
pylab.savefig("/".join([path, maneuver_name, 'acceleration.svg']), dpi=1000)
|
||||
|
||||
# pedal chart ===================
|
||||
plt_num += 1
|
||||
plt.figure(plt_num)
|
||||
plt.plot(
|
||||
np.array(self.time_array), np.array(self.gas_array), 'g',
|
||||
np.array(self.time_array), np.array(self.brake_array), 'r',
|
||||
)
|
||||
plt.xlabel('Time [s]')
|
||||
plt.ylabel('Pedal []')
|
||||
plt.legend(['Gas pedal', 'Brake pedal'], loc=0)
|
||||
plt.grid()
|
||||
pylab.savefig("/".join([path, maneuver_name, 'pedals.svg']), dpi=1000)
|
||||
|
||||
# pid chart ======================
|
||||
plt_num += 1
|
||||
plt.figure(plt_num)
|
||||
plt.plot(
|
||||
np.array(self.time_array), np.array(self.up_accel_cmd_array), 'g',
|
||||
np.array(self.time_array), np.array(self.ui_accel_cmd_array), 'b'
|
||||
)
|
||||
plt.xlabel("Time, [s]")
|
||||
plt.ylabel("Accel Cmd [m/s^2]")
|
||||
plt.grid()
|
||||
plt.legend(["Proportional", "Integral"], loc=0)
|
||||
pylab.savefig("/".join([path, maneuver_name, "pid.svg"]), dpi=1000)
|
||||
|
||||
# relative distances chart =======
|
||||
plt_num += 1
|
||||
plt.figure(plt_num)
|
||||
plt.plot(
|
||||
np.array(self.time_array), np.array(self.d_rel_array), 'g',
|
||||
)
|
||||
plt.xlabel('Time [s]')
|
||||
plt.ylabel('Relative Distance [m]')
|
||||
plt.grid()
|
||||
pylab.savefig("/".join([path, maneuver_name, 'distance.svg']), dpi=1000)
|
||||
|
||||
plt.close("all")
|
||||
|
||||
274
selfdrive/test/plant/plant.py
Executable file
274
selfdrive/test/plant/plant.py
Executable file
@@ -0,0 +1,274 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import struct
|
||||
|
||||
import zmq
|
||||
import numpy as np
|
||||
|
||||
from dbcs import DBC_PATH
|
||||
|
||||
from common.realtime import Ratekeeper
|
||||
from common.services import service_list
|
||||
|
||||
import selfdrive.messaging as messaging
|
||||
from selfdrive.config import CruiseButtons
|
||||
from selfdrive.car.honda.hondacan import fix
|
||||
from selfdrive.car.honda.carstate import get_can_parser
|
||||
from selfdrive.boardd.boardd import can_capnp_to_can_list, can_list_to_can_capnp
|
||||
|
||||
from selfdrive.car.honda.can_parser import CANParser
|
||||
|
||||
|
||||
from common.dbc import dbc
|
||||
acura = dbc(os.path.join(DBC_PATH, "acura_ilx_2016_can.dbc"))
|
||||
|
||||
def car_plant(pos, speed, grade, gas, brake):
|
||||
# vehicle parameters
|
||||
mass = 1700
|
||||
aero_cd = 0.3
|
||||
force_peak = mass*3.
|
||||
force_brake_peak = -mass*10. #1g
|
||||
power_peak = 100000 # 100kW
|
||||
speed_base = power_peak/force_peak
|
||||
rolling_res = 0.01
|
||||
g = 9.81
|
||||
wheel_r = 0.31
|
||||
frontal_area = 2.2
|
||||
air_density = 1.225
|
||||
gas_to_peak_linear_slope = 3.33
|
||||
brake_to_peak_linear_slope = 0.2
|
||||
creep_accel_v = [1., 0.]
|
||||
creep_accel_bp = [0., 1.5]
|
||||
|
||||
#*** longitudinal model ***
|
||||
# find speed where peak torque meets peak power
|
||||
force_brake = brake * force_brake_peak * brake_to_peak_linear_slope
|
||||
if speed < speed_base: # torque control
|
||||
force_gas = gas * force_peak * gas_to_peak_linear_slope
|
||||
else: # power control
|
||||
force_gas = gas * power_peak / speed * gas_to_peak_linear_slope
|
||||
|
||||
force_grade = - grade * mass # positive grade means uphill
|
||||
|
||||
creep_accel = np.interp(speed, creep_accel_bp, creep_accel_v)
|
||||
force_creep = creep_accel * mass
|
||||
|
||||
force_resistance = -(rolling_res * mass * g + 0.5 * speed**2 * aero_cd * air_density)
|
||||
force = force_gas + force_brake + force_resistance + force_grade + force_creep
|
||||
acceleration = force / mass
|
||||
|
||||
# TODO: lateral model
|
||||
return speed, acceleration
|
||||
|
||||
def get_car_can_parser():
|
||||
dbc_f = 'acura_ilx_2016_can.dbc'
|
||||
signals = [
|
||||
("STEER_TORQUE", 0xe4, 0),
|
||||
("STEER_TORQUE_REQUEST", 0xe4, 0),
|
||||
("COMPUTER_BRAKE", 0x1fa, 0),
|
||||
("COMPUTER_BRAKE_REQUEST", 0x1fa, 0),
|
||||
("GAS_COMMAND", 0x200, 0),
|
||||
]
|
||||
checks = [
|
||||
(0xe4, 100),
|
||||
(0x1fa, 50),
|
||||
(0x200, 50),
|
||||
]
|
||||
return CANParser(dbc_f, signals, checks)
|
||||
|
||||
|
||||
class Plant(object):
|
||||
messaging_initialized = False
|
||||
|
||||
def __init__(self, lead_relevancy=False, rate=100, speed=0.0, distance_lead=2.0):
|
||||
self.rate = rate
|
||||
self.civic = False
|
||||
self.brake_only = False
|
||||
|
||||
if not Plant.messaging_initialized:
|
||||
context = zmq.Context()
|
||||
Plant.logcan = messaging.pub_sock(context, service_list['can'].port)
|
||||
Plant.sendcan = messaging.sub_sock(context, service_list['sendcan'].port)
|
||||
Plant.model = messaging.pub_sock(context, service_list['model'].port)
|
||||
Plant.live100 = messaging.sub_sock(context, service_list['live100'].port)
|
||||
Plant.messaging_initialized = True
|
||||
|
||||
self.angle_steer = 0.
|
||||
self.gear_choice = 0
|
||||
self.speed, self.speed_prev = 0., 0.
|
||||
|
||||
self.esp_disabled = 0
|
||||
self.main_on = 1
|
||||
self.user_gas = 0
|
||||
self.computer_brake,self.user_brake = 0,0
|
||||
self.brake_pressed = 0
|
||||
self.distance, self.distance_prev = 0., 0.
|
||||
self.speed, self.speed_prev = speed, speed
|
||||
self.steer_error, self.brake_error, self.steer_not_allowed = 0, 0, 0
|
||||
self.gear_shifter = 4 # D gear
|
||||
self.pedal_gas = 0
|
||||
self.cruise_setting = 0
|
||||
|
||||
self.seatbelt, self.door_all_closed = True, True
|
||||
self.steer_torque, self.v_cruise, self.acc_status = 0, 0, 0 # v_cruise is reported from can, not the one used for controls
|
||||
|
||||
self.lead_relevancy = lead_relevancy
|
||||
|
||||
# lead car
|
||||
self.distance_lead, self.distance_lead_prev = distance_lead , distance_lead
|
||||
|
||||
self.rk = Ratekeeper(rate, print_delay_threshold=100)
|
||||
self.ts = 1./rate
|
||||
|
||||
self.cp = get_car_can_parser()
|
||||
|
||||
def speed_sensor(self, speed):
|
||||
if speed<0.3:
|
||||
return 0
|
||||
else:
|
||||
return speed
|
||||
|
||||
def current_time(self):
|
||||
return float(self.rk.frame) / self.rate
|
||||
|
||||
def step(self, v_lead=0.0, cruise_buttons=None, grade=0.0):
|
||||
# dbc_f, sgs, ivs, msgs, cks_msgs, frqs = initialize_can_struct(self.civic, self.brake_only)
|
||||
cp2 = get_can_parser(self.civic, self.brake_only)
|
||||
sgs = cp2._sgs
|
||||
msgs = cp2._msgs
|
||||
cks_msgs = cp2.msgs_ck
|
||||
|
||||
# ******** get messages sent to the car ********
|
||||
can_msgs = []
|
||||
for a in messaging.drain_sock(Plant.sendcan):
|
||||
can_msgs.extend(can_capnp_to_can_list(a.sendcan, [0,2]))
|
||||
self.cp.update_can(can_msgs)
|
||||
|
||||
# ******** get live100 messages for plotting ***
|
||||
live_msgs = []
|
||||
for a in messaging.drain_sock(Plant.live100):
|
||||
live_msgs.append(a.live100)
|
||||
|
||||
|
||||
if self.cp.vl[0x1fa]['COMPUTER_BRAKE_REQUEST']:
|
||||
brake = self.cp.vl[0x1fa]['COMPUTER_BRAKE']
|
||||
else:
|
||||
brake = 0.0
|
||||
|
||||
if self.cp.vl[0x200]['GAS_COMMAND'] > 0:
|
||||
gas = self.cp.vl[0x200]['GAS_COMMAND'] / 256.0
|
||||
else:
|
||||
gas = 0.0
|
||||
|
||||
if self.cp.vl[0xe4]['STEER_TORQUE_REQUEST']:
|
||||
steer_torque = self.cp.vl[0xe4]['STEER_TORQUE']*1.0/0xf00
|
||||
else:
|
||||
steer_torque = 0.0
|
||||
|
||||
distance_lead = self.distance_lead_prev + v_lead * self.ts
|
||||
|
||||
# ******** run the car ********
|
||||
speed, acceleration = car_plant(self.distance_prev, self.speed_prev, grade, gas, brake)
|
||||
standstill = (speed == 0)
|
||||
distance = self.distance_prev + speed * self.ts
|
||||
speed = self.speed_prev + self.ts * acceleration
|
||||
if speed <= 0:
|
||||
speed = 0
|
||||
acceleration = 0
|
||||
|
||||
# ******** lateral ********
|
||||
self.angle_steer -= steer_torque
|
||||
|
||||
# *** radar model ***
|
||||
if self.lead_relevancy:
|
||||
d_rel = np.maximum(0., self.distance_lead - distance)
|
||||
v_rel = v_lead - speed
|
||||
else:
|
||||
d_rel = 200.
|
||||
v_rel = 0.
|
||||
a_rel = 0
|
||||
lateral_pos_rel = 0.
|
||||
|
||||
# print at 5hz
|
||||
if (self.rk.frame%(self.rate/5)) == 0:
|
||||
print "%6.2f m %6.2f m/s %6.2f m/s2 %.2f ang gas: %.2f brake: %.2f steer: %5.2f lead_rel: %6.2f m %6.2f m/s" % (distance, speed, acceleration, self.angle_steer, gas, brake, steer_torque, d_rel, v_rel)
|
||||
|
||||
# ******** publish the car ********
|
||||
vls = [self.speed_sensor(speed), self.speed_sensor(speed), self.speed_sensor(speed), self.speed_sensor(speed),
|
||||
self.angle_steer, 0, self.gear_choice, speed!=0,
|
||||
0, 0, 0, 0,
|
||||
self.v_cruise, not self.seatbelt, self.seatbelt, self.brake_pressed,
|
||||
self.user_gas, cruise_buttons, self.esp_disabled, 0,
|
||||
self.user_brake, self.steer_error, self.speed_sensor(speed), self.brake_error,
|
||||
self.brake_error, self.gear_shifter, self.main_on, self.acc_status,
|
||||
self.pedal_gas, self.cruise_setting,
|
||||
# left_blinker, right_blinker, counter
|
||||
0,0,0,
|
||||
# interceptor_gas
|
||||
0,0]
|
||||
|
||||
|
||||
# TODO: publish each message at proper frequency
|
||||
can_msgs = []
|
||||
for msg in set(msgs):
|
||||
msg_struct = {}
|
||||
indxs = [i for i, x in enumerate(msgs) if msg == msgs[i]]
|
||||
for i in indxs:
|
||||
msg_struct[sgs[i]] = vls[i]
|
||||
if msg in cks_msgs:
|
||||
msg_struct["COUNTER"] = self.rk.frame % 4
|
||||
|
||||
msg_data = acura.encode(msg, msg_struct)
|
||||
|
||||
if msg in cks_msgs:
|
||||
msg_data = fix(msg_data, msg)
|
||||
|
||||
can_msgs.append([msg, 0, msg_data, 0])
|
||||
|
||||
# add the radar message
|
||||
# TODO: use the DBC
|
||||
def to_3_byte(x):
|
||||
return struct.pack("!H", int(x)).encode("hex")[1:]
|
||||
|
||||
def to_3s_byte(x):
|
||||
return struct.pack("!h", int(x)).encode("hex")[1:]
|
||||
radar_msg = to_3_byte(d_rel*16.0) + \
|
||||
to_3_byte(int(lateral_pos_rel*16.0)&0x3ff) + \
|
||||
to_3s_byte(int(v_rel*32.0)) + \
|
||||
"0f00000"
|
||||
can_msgs.append([0x445, 0, radar_msg.decode("hex"), 1])
|
||||
Plant.logcan.send(can_list_to_can_capnp(can_msgs).to_bytes())
|
||||
|
||||
# ******** publish a fake model going straight ********
|
||||
md = messaging.new_message()
|
||||
md.init('model')
|
||||
md.model.frameId = 0
|
||||
for x in [md.model.path, md.model.leftLane, md.model.rightLane]:
|
||||
x.points = [0.0]*50
|
||||
x.prob = 1.0
|
||||
x.std = 1.0
|
||||
# fake values?
|
||||
Plant.model.send(md.to_bytes())
|
||||
|
||||
|
||||
# ******** update prevs ********
|
||||
self.speed_prev = speed
|
||||
self.distance_prev = distance
|
||||
self.distance_lead_prev = distance_lead
|
||||
|
||||
self.rk.keep_time()
|
||||
return (distance, speed, acceleration, distance_lead, brake, gas, steer_torque, live_msgs)
|
||||
|
||||
# simple engage in standalone mode
|
||||
def plant_thread(rate=100):
|
||||
plant = Plant(rate)
|
||||
while 1:
|
||||
if plant.rk.frame%100 >= 20 and plant.rk.frame%100 <= 25:
|
||||
cruise_buttons = CruiseButtons.RES_ACCEL
|
||||
else:
|
||||
cruise_buttons = 0
|
||||
plant.step()
|
||||
|
||||
if __name__ == "__main__":
|
||||
plant_thread()
|
||||
|
||||
10
selfdrive/test/plant/runtest.sh
Executable file
10
selfdrive/test/plant/runtest.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
pushd ../../controls
|
||||
./controlsd.py &
|
||||
pid1=$!
|
||||
./radard.py &
|
||||
pid2=$!
|
||||
trap "trap - SIGTERM && kill $pid1 && kill $pid2" SIGINT SIGTERM EXIT
|
||||
popd
|
||||
mkdir -p out
|
||||
MPLBACKEND=svg ./runtracks.py out
|
||||
207
selfdrive/test/plant/runtracks.py
Executable file
207
selfdrive/test/plant/runtracks.py
Executable file
@@ -0,0 +1,207 @@
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
import time, json
|
||||
|
||||
from selfdrive.test.plant import plant
|
||||
from selfdrive.config import Conversions as CV, CruiseButtons as CB
|
||||
from maneuver import *
|
||||
|
||||
maneuvers = [
|
||||
Maneuver(
|
||||
'while cruising at 40 mph, change cruise speed to 50mph',
|
||||
duration=30.,
|
||||
initial_speed = 40. * CV.MPH_TO_MS,
|
||||
cruise_button_presses = [(CB.DECEL_SET, 2.), (0, 2.3),
|
||||
(CB.RES_ACCEL, 10.), (0, 10.1),
|
||||
(CB.RES_ACCEL, 10.2), (0, 10.3)]
|
||||
),
|
||||
Maneuver(
|
||||
'while cruising at 60 mph, change cruise speed to 50mph',
|
||||
duration=30.,
|
||||
initial_speed=60. * CV.MPH_TO_MS,
|
||||
cruise_button_presses = [(CB.DECEL_SET, 2.), (0, 2.3),
|
||||
(CB.DECEL_SET, 10.), (0, 10.1),
|
||||
(CB.DECEL_SET, 10.2), (0, 10.3)]
|
||||
),
|
||||
Maneuver(
|
||||
'while cruising at 20mph, grade change +10%',
|
||||
duration=25.,
|
||||
initial_speed=20. * CV.MPH_TO_MS,
|
||||
cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3)],
|
||||
grade_values = [0., 0., 1.0],
|
||||
grade_breakpoints = [0., 10., 11.]
|
||||
),
|
||||
Maneuver(
|
||||
'while cruising at 20mph, grade change -10%',
|
||||
duration=25.,
|
||||
initial_speed=20. * CV.MPH_TO_MS,
|
||||
cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3)],
|
||||
grade_values = [0., 0., -1.0],
|
||||
grade_breakpoints = [0., 10., 11.]
|
||||
),
|
||||
Maneuver(
|
||||
'approaching a 40mph car while cruising at 60mph from 100m away',
|
||||
duration=30.,
|
||||
initial_speed = 60. * CV.MPH_TO_MS,
|
||||
lead_relevancy=True,
|
||||
initial_distance_lead=100.,
|
||||
speed_lead_values = [40.*CV.MPH_TO_MS, 40.*CV.MPH_TO_MS],
|
||||
speed_lead_breakpoints = [0., 100.],
|
||||
cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3)]
|
||||
),
|
||||
Maneuver(
|
||||
'approaching a 0mph car while cruising at 40mph from 150m away',
|
||||
duration=30.,
|
||||
initial_speed = 40. * CV.MPH_TO_MS,
|
||||
lead_relevancy=True,
|
||||
initial_distance_lead=150.,
|
||||
speed_lead_values = [0.*CV.MPH_TO_MS, 0.*CV.MPH_TO_MS],
|
||||
speed_lead_breakpoints = [0., 100.],
|
||||
cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3)]
|
||||
),
|
||||
Maneuver(
|
||||
'steady state following a car at 20m/s, then lead decel to 0mph at 1m/s^2',
|
||||
duration=50.,
|
||||
initial_speed = 20.,
|
||||
lead_relevancy=True,
|
||||
initial_distance_lead=35.,
|
||||
speed_lead_values = [20.*CV.MPH_TO_MS, 20.*CV.MPH_TO_MS, 0.*CV.MPH_TO_MS],
|
||||
speed_lead_breakpoints = [0., 15., 35.0],
|
||||
cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3)]
|
||||
),
|
||||
Maneuver(
|
||||
'steady state following a car at 20m/s, then lead decel to 0mph at 2m/s^2',
|
||||
duration=50.,
|
||||
initial_speed = 20.,
|
||||
lead_relevancy=True,
|
||||
initial_distance_lead=35.,
|
||||
speed_lead_values = [20.*CV.MPH_TO_MS, 20.*CV.MPH_TO_MS, 0.*CV.MPH_TO_MS],
|
||||
speed_lead_breakpoints = [0., 15., 25.0],
|
||||
cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3)]
|
||||
),
|
||||
Maneuver(
|
||||
'starting at 0mph, approaching a stopped car 100m away',
|
||||
duration=30.,
|
||||
initial_speed = 0.,
|
||||
lead_relevancy=True,
|
||||
initial_distance_lead=100.,
|
||||
cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3),
|
||||
(CB.RES_ACCEL, 1.4), (0.0, 1.5),
|
||||
(CB.RES_ACCEL, 1.6), (0.0, 1.7),
|
||||
(CB.RES_ACCEL, 1.8), (0.0, 1.9)]
|
||||
),
|
||||
Maneuver(
|
||||
"following a car at 60mph, lead accel and decel at 0.5m/s^2 every 2s",
|
||||
duration=25.,
|
||||
initial_speed=30.,
|
||||
lead_relevancy=True,
|
||||
initial_distance_lead=49.,
|
||||
speed_lead_values=[30.,30.,29.,31.,29.,31.,29.],
|
||||
speed_lead_breakpoints=[0., 6., 8., 12.,16.,20.,24.],
|
||||
cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3),
|
||||
(CB.RES_ACCEL, 1.4), (0.0, 1.5),
|
||||
(CB.RES_ACCEL, 1.6), (0.0, 1.7)]
|
||||
),
|
||||
Maneuver(
|
||||
"following a car at 10mph, stop and go at 1m/s2 lead dece1 and accel",
|
||||
duration=70.,
|
||||
initial_speed=10.,
|
||||
lead_relevancy=True,
|
||||
initial_distance_lead=20.,
|
||||
speed_lead_values=[10., 0., 0., 10., 0.,10.],
|
||||
speed_lead_breakpoints=[10., 20., 30., 40., 50., 60.],
|
||||
cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3),
|
||||
(CB.RES_ACCEL, 1.4), (0.0, 1.5),
|
||||
(CB.RES_ACCEL, 1.6), (0.0, 1.7)]
|
||||
),
|
||||
Maneuver(
|
||||
"green light: stopped behind lead car, lead car accelerates at 1.5 m/s",
|
||||
duration=30.,
|
||||
initial_speed=0.,
|
||||
lead_relevancy=True,
|
||||
initial_distance_lead=4.,
|
||||
speed_lead_values=[0, 0 , 45],
|
||||
speed_lead_breakpoints=[0, 10., 40.],
|
||||
cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3),
|
||||
(CB.RES_ACCEL, 1.4), (0.0, 1.5),
|
||||
(CB.RES_ACCEL, 1.6), (0.0, 1.7),
|
||||
(CB.RES_ACCEL, 1.8), (0.0, 1.9),
|
||||
(CB.RES_ACCEL, 2.0), (0.0, 2.1),
|
||||
(CB.RES_ACCEL, 2.2), (0.0, 2.3)]
|
||||
),
|
||||
Maneuver(
|
||||
"stop and go with 1m/s2 lead decel and accel, with full stops",
|
||||
duration=70.,
|
||||
initial_speed=0.,
|
||||
lead_relevancy=True,
|
||||
initial_distance_lead=20.,
|
||||
speed_lead_values=[10., 0., 0., 10., 0., 0.] ,
|
||||
speed_lead_breakpoints=[10., 20., 30., 40., 50., 60.],
|
||||
cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3),
|
||||
(CB.RES_ACCEL, 1.4), (0.0, 1.5),
|
||||
(CB.RES_ACCEL, 1.6), (0.0, 1.7)]
|
||||
),
|
||||
Maneuver(
|
||||
"accelerate from 20 while lead vehicle decelerates from 40 to 20 at 1m/s2",
|
||||
duration=30.,
|
||||
initial_speed=10.,
|
||||
lead_relevancy=True,
|
||||
initial_distance_lead=10.,
|
||||
speed_lead_values=[20., 10.],
|
||||
speed_lead_breakpoints=[1., 11.],
|
||||
cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3),
|
||||
(CB.RES_ACCEL, 1.4), (0.0, 1.5),
|
||||
(CB.RES_ACCEL, 1.6), (0.0, 1.7),
|
||||
(CB.RES_ACCEL, 1.8), (0.0, 1.9),
|
||||
(CB.RES_ACCEL, 2.0), (0.0, 2.1),
|
||||
(CB.RES_ACCEL, 2.2), (0.0, 2.3)]
|
||||
),
|
||||
Maneuver(
|
||||
"accelerate from 20 while lead vehicle decelerates from 40 to 0 at 2m/s2",
|
||||
duration=30.,
|
||||
initial_speed=10.,
|
||||
lead_relevancy=True,
|
||||
initial_distance_lead=10.,
|
||||
speed_lead_values=[20., 0.],
|
||||
speed_lead_breakpoints=[1., 11.],
|
||||
cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3),
|
||||
(CB.RES_ACCEL, 1.4), (0.0, 1.5),
|
||||
(CB.RES_ACCEL, 1.6), (0.0, 1.7),
|
||||
(CB.RES_ACCEL, 1.8), (0.0, 1.9),
|
||||
(CB.RES_ACCEL, 2.0), (0.0, 2.1),
|
||||
(CB.RES_ACCEL, 2.2), (0.0, 2.3)]
|
||||
)
|
||||
]
|
||||
|
||||
css_style = """
|
||||
.maneuver_title {
|
||||
font-size: 24px;
|
||||
text-align: center;
|
||||
}
|
||||
.maneuver_graph {
|
||||
width: 100%;
|
||||
}
|
||||
"""
|
||||
|
||||
def main(output_dir):
|
||||
view_html = "<html><head><style>%s</style></head><body><table>" % (css_style,)
|
||||
for i, man in enumerate(maneuvers):
|
||||
view_html += "<tr><td class='maneuver_title' colspan=5><div>%s</div></td></tr><tr>" % (man.title,)
|
||||
for c in ['distance.svg', 'speeds.svg', 'acceleration.svg', 'pedals.svg', 'pid.svg']:
|
||||
view_html += "<td><img class='maneuver_graph' src='%s'/></td>" % (os.path.join("maneuver" + str(i+1).zfill(2), c), )
|
||||
view_html += "</tr>"
|
||||
|
||||
with open(os.path.join(output_dir, "index.html"), "w") as f:
|
||||
f.write(view_html)
|
||||
|
||||
for i, man in enumerate(maneuvers):
|
||||
score, plot = man.evaluate()
|
||||
plot.write_plot(output_dir, "maneuver" + str(i+1).zfill(2))
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) <= 1:
|
||||
print "Usage:", sys.argv[0], "<output_dir>"
|
||||
exit(1)
|
||||
|
||||
main(sys.argv[1])
|
||||
|
||||
@@ -3,7 +3,7 @@ import selfdrive.messaging as messaging
|
||||
|
||||
def read_tz(x):
|
||||
with open("/sys/devices/virtual/thermal/thermal_zone%d/temp" % x) as f:
|
||||
ret = int(f.read())
|
||||
ret = max(0, int(f.read()))
|
||||
return ret
|
||||
|
||||
def read_thermal():
|
||||
|
||||
@@ -30,6 +30,7 @@ FRAMEBUFFER_LIBS = -lutils -lgui -lEGL
|
||||
|
||||
OBJS = ui.o \
|
||||
touch.o \
|
||||
../common/glutil.o \
|
||||
../common/visionipc.o \
|
||||
../common/framebuffer.o \
|
||||
$(PHONELIBS)/nanovg/nanovg.o \
|
||||
|
||||
@@ -1,15 +1,50 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <assert.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/poll.h>
|
||||
#include <linux/input.h>
|
||||
|
||||
#include "touch.h"
|
||||
|
||||
static int find_dev() {
|
||||
int err;
|
||||
|
||||
int ret = -1;
|
||||
|
||||
DIR *dir = opendir("/dev/input");
|
||||
assert(dir);
|
||||
struct dirent* de = NULL;
|
||||
while ((de = readdir(dir))) {
|
||||
if (strncmp(de->d_name, "event", 5)) continue;
|
||||
|
||||
int fd = openat(dirfd(dir), de->d_name, O_RDONLY);
|
||||
assert(fd >= 0);
|
||||
|
||||
char name[128] = {0};
|
||||
err = ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name);
|
||||
assert(err >= 0);
|
||||
|
||||
unsigned long ev_bits[8] = {0};
|
||||
err = ioctl(fd, EVIOCGBIT(0, sizeof(ev_bits)), ev_bits);
|
||||
assert(err >= 0);
|
||||
|
||||
if (strncmp(name, "synaptics", 9) == 0 && ev_bits[0] == 0xb) {
|
||||
ret = fd;
|
||||
break;
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
closedir(dir);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void touch_init(TouchState *s) {
|
||||
// synaptics touch screen on oneplus 3
|
||||
s->fd = open("/dev/input/event4", O_RDONLY);
|
||||
s->fd = find_dev();
|
||||
assert(s->fd >= 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,11 +20,14 @@
|
||||
#include "common/timing.h"
|
||||
#include "common/util.h"
|
||||
#include "common/mat.h"
|
||||
#include "common/glutil.h"
|
||||
|
||||
#include "common/framebuffer.h"
|
||||
#include "common/visionipc.h"
|
||||
#include "common/modeldata.h"
|
||||
|
||||
#include "common/version.h"
|
||||
|
||||
#include "cereal/gen/c/log.capnp.h"
|
||||
|
||||
#include "touch.h"
|
||||
@@ -95,7 +98,6 @@ typedef struct UIState {
|
||||
|
||||
// base ui
|
||||
uint64_t last_base_update;
|
||||
uint64_t last_rx_bytes;
|
||||
uint64_t last_tx_bytes;
|
||||
char serial[4096];
|
||||
const char* dongle_id;
|
||||
@@ -133,10 +135,31 @@ typedef struct UIState {
|
||||
GLuint frame_front_tex;
|
||||
|
||||
UIScene scene;
|
||||
|
||||
|
||||
|
||||
bool awake;
|
||||
int awake_timeout;
|
||||
} UIState;
|
||||
|
||||
static void set_awake(UIState *s, bool awake) {
|
||||
if (awake) {
|
||||
// 30 second timeout
|
||||
s->awake_timeout = 30;
|
||||
}
|
||||
if (s->awake != awake) {
|
||||
s->awake = awake;
|
||||
|
||||
// TODO: actually turn off the screen and not just the backlight
|
||||
FILE *f = fopen("/sys/class/leds/lcd-backlight/brightness", "wb");
|
||||
if (f != NULL) {
|
||||
if (awake) {
|
||||
fprintf(f, "205");
|
||||
} else {
|
||||
fprintf(f, "0");
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool activity_running() {
|
||||
return system("dumpsys activity activities | grep mFocusedActivity > /dev/null") == 0;
|
||||
@@ -173,13 +196,13 @@ typedef struct Button {
|
||||
static const Button buttons[] = {
|
||||
{
|
||||
.label = "wifi",
|
||||
.x = 400, .y = 700, .w = 250, .h = 250,
|
||||
.x = 400, .y = 730, .w = 250, .h = 250,
|
||||
.pressed = wifi_pressed,
|
||||
.enabled = wifi_enabled,
|
||||
},
|
||||
{
|
||||
.label = "ap",
|
||||
.x = 1300, .y = 700, .w = 250, .h = 250,
|
||||
.x = 1300, .y = 730, .w = 250, .h = 250,
|
||||
.pressed = ap_pressed,
|
||||
.enabled = ap_enabled,
|
||||
}
|
||||
@@ -228,70 +251,6 @@ static const char line_fragment_shader[] =
|
||||
" gl_FragColor = vColor;\n"
|
||||
"}\n";
|
||||
|
||||
static GLuint load_shader(GLenum shaderType, const char *src) {
|
||||
GLint status = 0, len = 0;
|
||||
GLuint shader;
|
||||
|
||||
if (!(shader = glCreateShader(shaderType)))
|
||||
return 0;
|
||||
|
||||
glShaderSource(shader, 1, &src, NULL);
|
||||
glCompileShader(shader);
|
||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
|
||||
|
||||
if (status)
|
||||
return shader;
|
||||
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len);
|
||||
if (len) {
|
||||
char *msg = malloc(len);
|
||||
if (msg) {
|
||||
glGetShaderInfoLog(shader, len, NULL, msg);
|
||||
msg[len-1] = 0;
|
||||
fprintf(stderr, "error compiling shader:\n%s\n", msg);
|
||||
free(msg);
|
||||
}
|
||||
}
|
||||
glDeleteShader(shader);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static GLuint load_program(const char *vert_src, const char *frag_src) {
|
||||
GLuint vert, frag, prog;
|
||||
GLint status = 0, len = 0;
|
||||
|
||||
if (!(vert = load_shader(GL_VERTEX_SHADER, vert_src)))
|
||||
return 0;
|
||||
if (!(frag = load_shader(GL_FRAGMENT_SHADER, frag_src)))
|
||||
goto fail_frag;
|
||||
if (!(prog = glCreateProgram()))
|
||||
goto fail_prog;
|
||||
|
||||
glAttachShader(prog, vert);
|
||||
glAttachShader(prog, frag);
|
||||
glLinkProgram(prog);
|
||||
|
||||
glGetProgramiv(prog, GL_LINK_STATUS, &status);
|
||||
if (status)
|
||||
return prog;
|
||||
|
||||
glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &len);
|
||||
if (len) {
|
||||
char *buf = (char*) malloc(len);
|
||||
if (buf) {
|
||||
glGetProgramInfoLog(prog, len, NULL, buf);
|
||||
buf[len-1] = 0;
|
||||
fprintf(stderr, "error linking program:\n%s\n", buf);
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
glDeleteProgram(prog);
|
||||
fail_prog:
|
||||
glDeleteShader(frag);
|
||||
fail_frag:
|
||||
glDeleteShader(vert);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const mat4 device_transform = {{
|
||||
1.0, 0.0, 0.0, 0.0,
|
||||
@@ -380,6 +339,9 @@ static void ui_init(UIState *s) {
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
|
||||
// set awake
|
||||
set_awake(s, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -735,9 +697,9 @@ static void ui_draw_vision(UIState *s) {
|
||||
draw_frame(s);
|
||||
|
||||
if (!scene->frontview) {
|
||||
draw_rgb_box(s, scene->big_box_x, s->rgb_height-scene->big_box_height-scene->big_box_y,
|
||||
/*draw_rgb_box(s, scene->big_box_x, s->rgb_height-scene->big_box_height-scene->big_box_y,
|
||||
scene->big_box_width, scene->big_box_height,
|
||||
0xFF0000FF);
|
||||
0xFF0000FF);*/
|
||||
|
||||
ui_draw_transformed_box(s, 0xFF00FF00);
|
||||
|
||||
@@ -818,7 +780,7 @@ static void ui_draw_vision(UIState *s) {
|
||||
if (strlen(scene->alert_text2) > 0) {
|
||||
nvgFillColor(s->vg, nvgRGBA(255,255,255,255));
|
||||
nvgFontSize(s->vg, 100.0f);
|
||||
nvgText(s->vg, 100+1700/2, 200+500, scene->alert_text2, NULL);
|
||||
nvgText(s->vg, 100+1700/2, 200+550, scene->alert_text2, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -837,6 +799,11 @@ static void ui_draw_vision(UIState *s) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ui_draw_blank(UIState *s) {
|
||||
glClearColor(0.1, 0.1, 0.1, 1.0);
|
||||
glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
static void ui_draw_base(UIState *s) {
|
||||
glClearColor(0.1, 0.1, 0.1, 1.0);
|
||||
glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
@@ -886,8 +853,10 @@ static void ui_draw(UIState *s) {
|
||||
|
||||
if (s->vision_connected) {
|
||||
ui_draw_vision(s);
|
||||
} else {
|
||||
} else if (s->awake) {
|
||||
ui_draw_base(s);
|
||||
} else {
|
||||
ui_draw_blank(s);
|
||||
}
|
||||
|
||||
eglSwapBuffers(s->display, s->surface);
|
||||
@@ -963,9 +932,20 @@ static int pending_uploads() {
|
||||
int cnt = 0;
|
||||
struct dirent *entry = NULL;
|
||||
while ((entry = readdir(dirp))) {
|
||||
if (entry->d_name[0] != '.') {
|
||||
if (entry->d_name[0] == '.') continue;
|
||||
|
||||
char subdirn[255];
|
||||
snprintf(subdirn, 255, "/sdcard/realdata/%s", entry->d_name);
|
||||
DIR *subdirp = opendir(subdirn);
|
||||
if (!subdirp) continue;
|
||||
|
||||
struct dirent *subentry = NULL;
|
||||
while ((subentry = readdir(subdirp))) {
|
||||
if (subentry->d_name[0] == '.') continue;
|
||||
//snprintf(subdirn, 255, "/sdcard/realdata/%s/%s", entry->d_name, subentry->d_name);
|
||||
cnt++;
|
||||
}
|
||||
closedir(subdirp);
|
||||
}
|
||||
closedir(dirp);
|
||||
return cnt;
|
||||
@@ -1123,7 +1103,7 @@ static void ui_update(UIState *s) {
|
||||
s->scene.v_cruise = datad.vCruise;
|
||||
s->scene.v_ego = datad.vEgo;
|
||||
s->scene.angle_steers = datad.angleSteers;
|
||||
s->scene.engaged = (datad.hudLead == 1) || (datad.hudLead == 2);
|
||||
s->scene.engaged = datad.enabled;
|
||||
// printf("recv %f\n", datad.vEgo);
|
||||
|
||||
s->scene.frontview = datad.rearViewCam;
|
||||
@@ -1182,20 +1162,25 @@ static void ui_update(UIState *s) {
|
||||
char* bat_stat = read_file("/sys/class/power_supply/battery/status");
|
||||
|
||||
int tx_rate = 0;
|
||||
int rx_rate = 0;
|
||||
char* rx_bytes = read_file("/sys/class/net/rmnet_data0/statistics/rx_bytes");
|
||||
char* tx_bytes = read_file("/sys/class/net/rmnet_data0/statistics/tx_bytes");
|
||||
if (rx_bytes && tx_bytes) {
|
||||
uint64_t rx_bytes_n = atoll(rx_bytes);
|
||||
rx_rate = rx_bytes_n - s->last_rx_bytes;
|
||||
s->last_rx_bytes = rx_bytes_n;
|
||||
uint64_t tx_bytes_n = 0;
|
||||
char *tx_bytes;
|
||||
|
||||
uint64_t tx_bytes_n = atoll(tx_bytes);
|
||||
tx_rate = tx_bytes_n - s->last_tx_bytes;
|
||||
s->last_tx_bytes = tx_bytes_n;
|
||||
}
|
||||
if (rx_bytes) free(rx_bytes);
|
||||
if (tx_bytes) free(tx_bytes);
|
||||
// cellular bytes
|
||||
tx_bytes = read_file("/sys/class/net/rmnet_data0/statistics/tx_bytes");
|
||||
if (tx_bytes) { tx_bytes_n += atoll(tx_bytes); free(tx_bytes); }
|
||||
|
||||
// wifi bytes
|
||||
tx_bytes = read_file("/sys/class/net/wlan0/statistics/tx_bytes");
|
||||
if (tx_bytes) { tx_bytes_n += atoll(tx_bytes); free(tx_bytes); }
|
||||
|
||||
tx_rate = tx_bytes_n - s->last_tx_bytes;
|
||||
s->last_tx_bytes = tx_bytes_n;
|
||||
|
||||
// TODO: do this properly
|
||||
system("git rev-parse --abbrev-ref HEAD > /tmp/git_branch");
|
||||
char *git_branch = read_file("/tmp/git_branch");
|
||||
system("git rev-parse --short HEAD > /tmp/git_commit");
|
||||
char *git_commit = read_file("/tmp/git_commit");
|
||||
|
||||
int pending = pending_uploads();
|
||||
|
||||
@@ -1210,14 +1195,31 @@ static void ui_update(UIState *s) {
|
||||
s->board_connected = !system("lsusb | grep bbaa > /dev/null");
|
||||
|
||||
snprintf(s->base_text, sizeof(s->base_text),
|
||||
"serial: %s\n dongle id: %s\n battery: %s %s\npending: %d\nrx %.1fkiB/s tx %.1fkiB/s\nboard: %s",
|
||||
"version: v%s %s (%s)\nserial: %s\n dongle id: %s\n battery: %s %s\npending: %d -> %.1f kb/s\nboard: %s",
|
||||
openpilot_version, git_commit, git_branch,
|
||||
s->serial, s->dongle_id, bat_cap ? bat_cap : "(null)", bat_stat ? bat_stat : "(null)",
|
||||
pending, rx_rate / 1024.0, tx_rate / 1024.0, s->board_connected ? "found" : "NOT FOUND");
|
||||
pending, tx_rate / 1024.0, s->board_connected ? "found" : "NOT FOUND");
|
||||
|
||||
if (bat_cap) free(bat_cap);
|
||||
if (bat_stat) free(bat_stat);
|
||||
|
||||
if (git_branch) free(git_branch);
|
||||
if (git_commit) free(git_commit);
|
||||
|
||||
s->last_base_update = ts;
|
||||
|
||||
if (!activity_running()) {
|
||||
if (s->awake_timeout > 0) {
|
||||
s->awake_timeout--;
|
||||
} else {
|
||||
set_awake(s, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (s->vision_connected) {
|
||||
// always awake if vision is connected
|
||||
set_awake(s, true);
|
||||
}
|
||||
|
||||
if (!s->vision_connected) {
|
||||
@@ -1226,16 +1228,20 @@ static void ui_update(UIState *s) {
|
||||
int touch_x = -1, touch_y = -1;
|
||||
err = touch_poll(&s->touch, &touch_x, &touch_y);
|
||||
if (err == 1) {
|
||||
// press buttons
|
||||
for (int i=0; i<ARRAYSIZE(buttons); i++) {
|
||||
const Button *b = &buttons[i];
|
||||
if (touch_x >= b->x && touch_x < b->x+b->w
|
||||
&& touch_y >= b->y && touch_y < b->y+b->h) {
|
||||
if (b->pressed && !activity_running()) {
|
||||
b->pressed();
|
||||
break;
|
||||
if (s->awake) {
|
||||
// press buttons
|
||||
for (int i=0; i<ARRAYSIZE(buttons); i++) {
|
||||
const Button *b = &buttons[i];
|
||||
if (touch_x >= b->x && touch_x < b->x+b->w
|
||||
&& touch_y >= b->y && touch_y < b->y+b->h) {
|
||||
if (b->pressed && !activity_running()) {
|
||||
b->pressed();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
set_awake(s, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user