boardd is pandad (#32628)

* boardd is pandad

* rename tests
pull/32629/head
Adeeb Shihadeh 11 months ago committed by GitHub
parent a3d2d7892f
commit 34e329649d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      .gitignore
  2. 10
      Jenkinsfile
  3. 6
      RELEASES.md
  4. 2
      SConstruct
  5. 2
      common/realtime.py
  6. 4
      docs/c_docs.rst
  7. 2
      pyproject.toml
  8. 2
      selfdrive/SConscript
  9. 3
      selfdrive/boardd/.gitignore
  10. 0
      selfdrive/boardd/tests/__init__.py
  11. 4
      selfdrive/car/card.py
  12. 2
      selfdrive/car/ecu_addrs.py
  13. 2
      selfdrive/car/fw_query_definitions.py
  14. 2
      selfdrive/car/fw_versions.py
  15. 2
      selfdrive/car/isotp_parallel_query.py
  16. 2
      selfdrive/controls/controlsd.py
  17. 4
      selfdrive/controls/tests/test_startup.py
  18. 6
      selfdrive/debug/clear_dtc.py
  19. 6
      selfdrive/debug/cpu_usage_stat.py
  20. 2
      selfdrive/debug/get_fingerprint.py
  21. 6
      selfdrive/debug/hyundai_enable_radar_points.py
  22. 6
      selfdrive/debug/read_dtc_status.py
  23. 3
      selfdrive/pandad/.gitignore
  24. 6
      selfdrive/pandad/SConscript
  25. 2
      selfdrive/pandad/__init__.py
  26. 2
      selfdrive/pandad/can_list_to_can_capnp.cc
  27. 6
      selfdrive/pandad/main.cc
  28. 2
      selfdrive/pandad/panda.cc
  29. 2
      selfdrive/pandad/panda.h
  30. 2
      selfdrive/pandad/panda_comms.cc
  31. 0
      selfdrive/pandad/panda_comms.h
  32. 18
      selfdrive/pandad/pandad.cc
  33. 4
      selfdrive/pandad/pandad.h
  34. 10
      selfdrive/pandad/pandad.py
  35. 0
      selfdrive/pandad/pandad_api_impl.pyx
  36. 2
      selfdrive/pandad/spi.cc
  37. 0
      selfdrive/pandad/tests/__init__.py
  38. 0
      selfdrive/pandad/tests/bootstub.panda.bin
  39. 0
      selfdrive/pandad/tests/bootstub.panda_h7.bin
  40. 0
      selfdrive/pandad/tests/bootstub.panda_h7_spiv0.bin
  41. 4
      selfdrive/pandad/tests/test_pandad.py
  42. 12
      selfdrive/pandad/tests/test_pandad_loopback.py
  43. 4
      selfdrive/pandad/tests/test_pandad_spi.py
  44. 2
      selfdrive/pandad/tests/test_pandad_usbprotocol.cc
  45. 6
      selfdrive/test/test_onroad.py
  46. 4
      system/hardware/tici/hardware.py
  47. 2
      system/manager/manager.py
  48. 4
      system/manager/process_config.py
  49. 2
      system/qcomgpsd/nmeaport.py
  50. 2
      tools/cabana/SConscript
  51. 2
      tools/cabana/streams/pandastream.h
  52. 2
      tools/latencylogger/README.md
  53. 6
      tools/latencylogger/latency_logger.py
  54. 2
      tools/replay/can_replay.py
  55. 2
      tools/sim/lib/simulated_car.py

3
.gitignore vendored

@ -40,8 +40,7 @@ compile_commands.json
compare_runtime*.html compare_runtime*.html
persist persist
board/obj/ selfdrive/pandad/pandad
selfdrive/boardd/boardd
selfdrive/logcatd/logcatd selfdrive/logcatd/logcatd
selfdrive/mapd/default_speeds_by_region.json selfdrive/mapd/default_speeds_by_region.json
system/proclogd/proclogd system/proclogd/proclogd

10
Jenkinsfile vendored

@ -192,7 +192,7 @@ node {
'HW + Unit Tests': { 'HW + Unit Tests': {
deviceStage("tici-hardware", "tici-common", ["UNSAFE=1"], [ deviceStage("tici-hardware", "tici-common", ["UNSAFE=1"], [
["build", "cd system/manager && ./build.py"], ["build", "cd system/manager && ./build.py"],
["test pandad", "pytest selfdrive/boardd/tests/test_pandad.py"], ["test pandad", "pytest selfdrive/pandad/tests/test_pandad.py"],
["test power draw", "pytest -s system/hardware/tici/tests/test_power_draw.py"], ["test power draw", "pytest -s system/hardware/tici/tests/test_power_draw.py"],
["test encoder", "LD_LIBRARY_PATH=/usr/local/lib pytest system/loggerd/tests/test_encoder.py"], ["test encoder", "LD_LIBRARY_PATH=/usr/local/lib pytest system/loggerd/tests/test_encoder.py"],
["test pigeond", "pytest system/ubloxd/tests/test_pigeond.py"], ["test pigeond", "pytest system/ubloxd/tests/test_pigeond.py"],
@ -202,7 +202,7 @@ node {
'loopback': { 'loopback': {
deviceStage("loopback", "tici-loopback", ["UNSAFE=1"], [ deviceStage("loopback", "tici-loopback", ["UNSAFE=1"], [
["build openpilot", "cd system/manager && ./build.py"], ["build openpilot", "cd system/manager && ./build.py"],
["test boardd loopback", "pytest selfdrive/boardd/tests/test_boardd_loopback.py"], ["test pandad loopback", "pytest selfdrive/pandad/tests/test_pandad_loopback.py"],
]) ])
}, },
'camerad': { 'camerad': {
@ -236,9 +236,9 @@ node {
'tizi': { 'tizi': {
deviceStage("tizi", "tizi", ["UNSAFE=1"], [ deviceStage("tizi", "tizi", ["UNSAFE=1"], [
["build openpilot", "cd system/manager && ./build.py"], ["build openpilot", "cd system/manager && ./build.py"],
["test boardd loopback", "SINGLE_PANDA=1 pytest selfdrive/boardd/tests/test_boardd_loopback.py"], ["test pandad loopback", "SINGLE_PANDA=1 pytest selfdrive/pandad/tests/test_pandad_loopback.py"],
["test boardd spi", "pytest selfdrive/boardd/tests/test_boardd_spi.py"], ["test pandad spi", "pytest selfdrive/pandad/tests/test_pandad_spi.py"],
["test pandad", "pytest selfdrive/boardd/tests/test_pandad.py"], ["test pandad", "pytest selfdrive/pandad/tests/test_pandad.py"],
["test amp", "pytest system/hardware/tici/tests/test_amplifier.py"], ["test amp", "pytest system/hardware/tici/tests/test_amplifier.py"],
["test hw", "pytest system/hardware/tici/tests/test_hardware.py"], ["test hw", "pytest system/hardware/tici/tests/test_hardware.py"],
["test qcomgpsd", "pytest system/qcomgpsd/tests/test_qcomgpsd.py"], ["test qcomgpsd", "pytest system/qcomgpsd/tests/test_qcomgpsd.py"],

@ -634,7 +634,7 @@ Version 0.5.13 (2019-05-31)
* Reduce CPU utilization by 20% and improve stability * Reduce CPU utilization by 20% and improve stability
* Temporarily remove mapd functionalities to improve stability * Temporarily remove mapd functionalities to improve stability
* Add openpilot record-only mode for unsupported cars * Add openpilot record-only mode for unsupported cars
* Synchronize controlsd to boardd to reduce latency * Synchronize controlsd to pandad to reduce latency
* Remove panda support for Subaru giraffe * Remove panda support for Subaru giraffe
Version 0.5.12 (2019-05-16) Version 0.5.12 (2019-05-16)
@ -970,7 +970,7 @@ Version 0.2.8 (2017-02-27)
Version 0.2.7 (2017-02-08) Version 0.2.7 (2017-02-08)
=========================== ===========================
* Better performance and pictures at night * Better performance and pictures at night
* Fix ptr alignment issue in boardd * Fix ptr alignment issue in pandad
* Fix brake error light, fix crash if too cold * Fix brake error light, fix crash if too cold
Version 0.2.6 (2017-01-31) Version 0.2.6 (2017-01-31)
@ -1002,7 +1002,7 @@ Version 0.2.2 (2017-01-10)
Version 0.2.1 (2016-12-14) Version 0.2.1 (2016-12-14)
=========================== ===========================
* Performance improvements, removal of more numpy * Performance improvements, removal of more numpy
* Fix boardd process priority * Fix pandad process priority
* Make counter timer reset on use of steering wheel * Make counter timer reset on use of steering wheel
Version 0.2 (2016-12-12) Version 0.2 (2016-12-12)

@ -226,7 +226,7 @@ env = Environment(
"#cereal", "#cereal",
"#third_party", "#third_party",
"#opendbc/can", "#opendbc/can",
"#selfdrive/boardd", "#selfdrive/pandad",
"#common", "#common",
"#rednose/helpers", "#rednose/helpers",
], ],

@ -23,7 +23,7 @@ class Priority:
CTRL_LOW = 51 # plannerd & radard CTRL_LOW = 51 # plannerd & radard
# CORE 3 # CORE 3
# - boardd = 55 # - pandad = 55
CTRL_HIGH = 53 CTRL_HIGH = 53

@ -77,10 +77,10 @@ sensorsd
.. autodoxygenindex:: .. autodoxygenindex::
:project: system_sensord_sensors :project: system_sensord_sensors
boardd pandad
^^^^^^ ^^^^^^
.. autodoxygenindex:: .. autodoxygenindex::
:project: selfdrive_boardd :project: selfdrive_pandad
rednose rednose

@ -20,7 +20,7 @@ markers = [
] ]
testpaths = [ testpaths = [
"common", "common",
"selfdrive/boardd", "selfdrive/pandad",
"selfdrive/car", "selfdrive/car",
"selfdrive/controls", "selfdrive/controls",
"selfdrive/locationd", "selfdrive/locationd",

@ -1,4 +1,4 @@
SConscript(['boardd/SConscript']) SConscript(['pandad/SConscript'])
SConscript(['controls/lib/lateral_mpc_lib/SConscript']) SConscript(['controls/lib/lateral_mpc_lib/SConscript'])
SConscript(['controls/lib/longitudinal_mpc_lib/SConscript']) SConscript(['controls/lib/longitudinal_mpc_lib/SConscript'])
SConscript(['locationd/SConscript']) SConscript(['locationd/SConscript'])

@ -1,3 +0,0 @@
boardd
boardd_api_impl.cpp
tests/test_boardd_usbprotocol

@ -11,7 +11,7 @@ from panda import ALTERNATIVE_EXPERIENCE
from openpilot.common.params import Params from openpilot.common.params import Params
from openpilot.common.realtime import config_realtime_process, Priority, Ratekeeper, DT_CTRL from openpilot.common.realtime import config_realtime_process, Priority, Ratekeeper, DT_CTRL
from openpilot.selfdrive.boardd.boardd import can_list_to_can_capnp from openpilot.selfdrive.pandad import can_list_to_can_capnp
from openpilot.selfdrive.car.car_helpers import get_car, get_one_can from openpilot.selfdrive.car.car_helpers import get_car, get_one_can
from openpilot.selfdrive.car.interfaces import CarInterfaceBase from openpilot.selfdrive.car.interfaces import CarInterfaceBase
from openpilot.selfdrive.controls.lib.events import Events from openpilot.selfdrive.controls.lib.events import Events
@ -153,7 +153,7 @@ class Car:
# Initialize CarInterface, once controls are ready # Initialize CarInterface, once controls are ready
# TODO: this can make us miss at least a few cycles when doing an ECU knockout # TODO: this can make us miss at least a few cycles when doing an ECU knockout
self.CI.init(self.CP, self.can_sock, self.pm.sock['sendcan']) self.CI.init(self.CP, self.can_sock, self.pm.sock['sendcan'])
# signal boardd to switch to car safety mode # signal pandad to switch to car safety mode
self.params.put_bool_nonblocking("ControlsReady", True) self.params.put_bool_nonblocking("ControlsReady", True)
if self.sm.all_alive(['carControl']): if self.sm.all_alive(['carControl']):

@ -6,7 +6,7 @@ import cereal.messaging as messaging
from panda.python.uds import SERVICE_TYPE from panda.python.uds import SERVICE_TYPE
from openpilot.selfdrive.car import make_can_msg from openpilot.selfdrive.car import make_can_msg
from openpilot.selfdrive.car.fw_query_definitions import EcuAddrBusType from openpilot.selfdrive.car.fw_query_definitions import EcuAddrBusType
from openpilot.selfdrive.boardd.boardd import can_list_to_can_capnp from openpilot.selfdrive.pandad import can_list_to_can_capnp
from openpilot.common.swaglog import cloudlog from openpilot.common.swaglog import cloudlog

@ -85,7 +85,7 @@ class Request:
auxiliary: bool = False auxiliary: bool = False
# FW responses from these queries will not be used for fingerprinting # FW responses from these queries will not be used for fingerprinting
logging: bool = False logging: bool = False
# boardd toggles OBD multiplexing on/off as needed # pandad toggles OBD multiplexing on/off as needed
obd_multiplexing: bool = True obd_multiplexing: bool = True

@ -352,7 +352,7 @@ if __name__ == "__main__":
pandaStates_sock = messaging.sub_sock('pandaStates') pandaStates_sock = messaging.sub_sock('pandaStates')
sendcan = messaging.pub_sock('sendcan') sendcan = messaging.pub_sock('sendcan')
# Set up params for boardd # Set up params for pandad
params = Params() params = Params()
params.remove("FirmwareQueryDone") params.remove("FirmwareQueryDone")
params.put_bool("IsOnroad", False) params.put_bool("IsOnroad", False)

@ -4,7 +4,7 @@ from functools import partial
import cereal.messaging as messaging import cereal.messaging as messaging
from openpilot.common.swaglog import cloudlog from openpilot.common.swaglog import cloudlog
from openpilot.selfdrive.boardd.boardd import can_list_to_can_capnp from openpilot.selfdrive.pandad import can_list_to_can_capnp
from openpilot.selfdrive.car.fw_query_definitions import AddrType from openpilot.selfdrive.car.fw_query_definitions import AddrType
from panda.python.uds import CanClient, IsoTpMessage, FUNCTIONAL_ADDRS, get_rx_addr_for_tx_addr from panda.python.uds import CanClient, IsoTpMessage, FUNCTIONAL_ADDRS, get_rx_addr_for_tx_addr

@ -279,7 +279,7 @@ class Controls:
else: else:
safety_mismatch = pandaState.safetyModel not in IGNORED_SAFETY_MODES safety_mismatch = pandaState.safetyModel not in IGNORED_SAFETY_MODES
# safety mismatch allows some time for boardd to set the safety mode and publish it back from panda # safety mismatch allows some time for pandad to set the safety mode and publish it back from panda
if (safety_mismatch and self.sm.frame*DT_CTRL > 10.) or pandaState.safetyRxChecksInvalid or self.mismatch_counter >= 200: if (safety_mismatch and self.sm.frame*DT_CTRL > 10.) or pandaState.safetyRxChecksInvalid or self.mismatch_counter >= 200:
self.events.add(EventName.controlsMismatch) self.events.add(EventName.controlsMismatch)

@ -4,7 +4,7 @@ from parameterized import parameterized
from cereal import log, car from cereal import log, car
import cereal.messaging as messaging import cereal.messaging as messaging
from openpilot.common.params import Params from openpilot.common.params import Params
from openpilot.selfdrive.boardd.boardd_api_impl import can_list_to_can_capnp from openpilot.selfdrive.pandad.pandad_api_impl import can_list_to_can_capnp
from openpilot.selfdrive.car.fingerprints import _FINGERPRINTS from openpilot.selfdrive.car.fingerprints import _FINGERPRINTS
from openpilot.selfdrive.car.toyota.values import CAR as TOYOTA from openpilot.selfdrive.car.toyota.values import CAR as TOYOTA
from openpilot.selfdrive.car.mazda.values import CAR as MAZDA from openpilot.selfdrive.car.mazda.values import CAR as MAZDA
@ -105,7 +105,7 @@ def test_startup_alert(expected_event, car_model, fw_versions, brand):
msgs = [[addr, 0, b'\x00'*length, 0] for addr, length in finger.items()] msgs = [[addr, 0, b'\x00'*length, 0] for addr, length in finger.items()]
for _ in range(1000): for _ in range(1000):
# card waits for boardd to echo back that it has changed the multiplexing mode # card waits for pandad to echo back that it has changed the multiplexing mode
if not params.get_bool("ObdMultiplexingChanged"): if not params.get_bool("ObdMultiplexingChanged"):
params.put_bool("ObdMultiplexingChanged", True) params.put_bool("ObdMultiplexingChanged", True)

@ -12,11 +12,11 @@ parser.add_argument('--debug', action='store_true')
args = parser.parse_args() args = parser.parse_args()
try: try:
check_output(["pidof", "boardd"]) check_output(["pidof", "pandad"])
print("boardd is running, please kill openpilot before running this script! (aborted)") print("pandad is running, please kill openpilot before running this script! (aborted)")
sys.exit(1) sys.exit(1)
except CalledProcessError as e: except CalledProcessError as e:
if e.returncode != 1: # 1 == no process found (boardd not running) if e.returncode != 1: # 1 == no process found (pandad not running)
raise e raise e
panda = Panda() panda = Panda()

@ -9,10 +9,10 @@ System tools like top/htop can only show current cpu usage values, so I write th
Calculate minumium/maximum/accumulated_average cpu usage as long term inspections. Calculate minumium/maximum/accumulated_average cpu usage as long term inspections.
Monitor multiple processes simuteneously. Monitor multiple processes simuteneously.
Sample usage: Sample usage:
root@localhost:/data/openpilot$ python selfdrive/debug/cpu_usage_stat.py boardd,ubloxd root@localhost:/data/openpilot$ python selfdrive/debug/cpu_usage_stat.py pandad,ubloxd
('Add monitored proc:', './boardd') ('Add monitored proc:', './pandad')
('Add monitored proc:', 'python locationd/ubloxd.py') ('Add monitored proc:', 'python locationd/ubloxd.py')
boardd: 1.96%, min: 1.96%, max: 1.96%, acc: 1.96% pandad: 1.96%, min: 1.96%, max: 1.96%, acc: 1.96%
ubloxd.py: 0.39%, min: 0.39%, max: 0.39%, acc: 0.39% ubloxd.py: 0.39%, min: 0.39%, max: 0.39%, acc: 0.39%
''' '''
import psutil import psutil

@ -4,7 +4,7 @@
# Instructions: # Instructions:
# - connect to a Panda # - connect to a Panda
# - run selfdrive/boardd/boardd # - run selfdrive/pandad/pandad
# - launching this script # - launching this script
# Note: it's very important that the car is in stock mode, in order to collect a complete fingerprint # Note: it's very important that the car is in stock mode, in order to collect a complete fingerprint
# - since some messages are published at low frequency, keep this script running for at least 30s, # - since some messages are published at low frequency, keep this script running for at least 30s,

@ -79,11 +79,11 @@ if __name__ == "__main__":
args = parser.parse_args() args = parser.parse_args()
try: try:
check_output(["pidof", "boardd"]) check_output(["pidof", "pandad"])
print("boardd is running, please kill openpilot before running this script! (aborted)") print("pandad is running, please kill openpilot before running this script! (aborted)")
sys.exit(1) sys.exit(1)
except CalledProcessError as e: except CalledProcessError as e:
if e.returncode != 1: # 1 == no process found (boardd not running) if e.returncode != 1: # 1 == no process found (pandad not running)
raise e raise e
confirm = input("power on the vehicle keeping the engine off (press start button twice) then type OK to continue: ").upper().strip() confirm = input("power on the vehicle keeping the engine off (press start button twice) then type OK to continue: ").upper().strip()

@ -13,11 +13,11 @@ parser.add_argument('--debug', action='store_true')
args = parser.parse_args() args = parser.parse_args()
try: try:
check_output(["pidof", "boardd"]) check_output(["pidof", "pandad"])
print("boardd is running, please kill openpilot before running this script! (aborted)") print("pandad is running, please kill openpilot before running this script! (aborted)")
sys.exit(1) sys.exit(1)
except CalledProcessError as e: except CalledProcessError as e:
if e.returncode != 1: # 1 == no process found (boardd not running) if e.returncode != 1: # 1 == no process found (pandad not running)
raise e raise e
panda = Panda() panda = Panda()

@ -0,0 +1,3 @@
pandad
pandad_api_impl.cpp
tests/test_pandad_usbprotocol

@ -3,9 +3,9 @@ Import('env', 'envCython', 'common', 'cereal', 'messaging')
libs = ['usb-1.0', common, cereal, messaging, 'pthread', 'zmq', 'capnp', 'kj'] libs = ['usb-1.0', common, cereal, messaging, 'pthread', 'zmq', 'capnp', 'kj']
panda = env.Library('panda', ['panda.cc', 'panda_comms.cc', 'spi.cc']) panda = env.Library('panda', ['panda.cc', 'panda_comms.cc', 'spi.cc'])
env.Program('boardd', ['main.cc', 'boardd.cc'], LIBS=[panda] + libs) env.Program('pandad', ['main.cc', 'pandad.cc'], LIBS=[panda] + libs)
env.Library('libcan_list_to_can_capnp', ['can_list_to_can_capnp.cc']) env.Library('libcan_list_to_can_capnp', ['can_list_to_can_capnp.cc'])
envCython.Program('boardd_api_impl.so', 'boardd_api_impl.pyx', LIBS=["can_list_to_can_capnp", 'capnp', 'kj'] + envCython["LIBS"]) envCython.Program('pandad_api_impl.so', 'pandad_api_impl.pyx', LIBS=["can_list_to_can_capnp", 'capnp', 'kj'] + envCython["LIBS"])
if GetOption('extras'): if GetOption('extras'):
env.Program('tests/test_boardd_usbprotocol', ['tests/test_boardd_usbprotocol.cc'], LIBS=[panda] + libs) env.Program('tests/test_pandad_usbprotocol', ['tests/test_pandad_usbprotocol.cc'], LIBS=[panda] + libs)

@ -1,5 +1,5 @@
# Cython, now uses scons to build # Cython, now uses scons to build
from openpilot.selfdrive.boardd.boardd_api_impl import can_list_to_can_capnp from openpilot.selfdrive.pandad.pandad_api_impl import can_list_to_can_capnp
assert can_list_to_can_capnp assert can_list_to_can_capnp
def can_capnp_to_can_list(can, src_filter=None): def can_capnp_to_can_list(can, src_filter=None):

@ -1,5 +1,5 @@
#include "cereal/messaging/messaging.h" #include "cereal/messaging/messaging.h"
#include "selfdrive/boardd/panda.h" #include "selfdrive/pandad/panda.h"
void can_list_to_can_capnp_cpp(const std::vector<can_frame> &can_list, std::string &out, bool sendCan, bool valid) { void can_list_to_can_capnp_cpp(const std::vector<can_frame> &can_list, std::string &out, bool sendCan, bool valid) {
MessageBuilder msg; MessageBuilder msg;

@ -1,12 +1,12 @@
#include <cassert> #include <cassert>
#include "selfdrive/boardd/boardd.h" #include "selfdrive/pandad/pandad.h"
#include "common/swaglog.h" #include "common/swaglog.h"
#include "common/util.h" #include "common/util.h"
#include "system/hardware/hw.h" #include "system/hardware/hw.h"
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
LOGW("starting boardd"); LOGW("starting pandad");
if (!Hardware::PC()) { if (!Hardware::PC()) {
int err; int err;
@ -17,6 +17,6 @@ int main(int argc, char *argv[]) {
} }
std::vector<std::string> serials(argv + 1, argv + argc); std::vector<std::string> serials(argv + 1, argv + argc);
boardd_main_thread(serials); pandad_main_thread(serials);
return 0; return 0;
} }

@ -1,4 +1,4 @@
#include "selfdrive/boardd/panda.h" #include "selfdrive/pandad/panda.h"
#include <unistd.h> #include <unistd.h>

@ -13,7 +13,7 @@
#include "cereal/gen/cpp/log.capnp.h" #include "cereal/gen/cpp/log.capnp.h"
#include "panda/board/health.h" #include "panda/board/health.h"
#include "panda/board/can_definitions.h" #include "panda/board/can_definitions.h"
#include "selfdrive/boardd/panda_comms.h" #include "selfdrive/pandad/panda_comms.h"
#define USB_TX_SOFT_LIMIT (0x100U) #define USB_TX_SOFT_LIMIT (0x100U)
#define USBPACKET_MAX_SIZE (0x40) #define USBPACKET_MAX_SIZE (0x40)

@ -1,4 +1,4 @@
#include "selfdrive/boardd/panda.h" #include "selfdrive/pandad/panda.h"
#include <cassert> #include <cassert>
#include <stdexcept> #include <stdexcept>

@ -1,4 +1,4 @@
#include "selfdrive/boardd/boardd.h" #include "selfdrive/pandad/pandad.h"
#include <algorithm> #include <algorithm>
#include <array> #include <array>
@ -25,7 +25,7 @@
// - The internal panda will always be the first panda // - The internal panda will always be the first panda
// - Consecutive pandas will be sorted based on panda type, and then serial number // - Consecutive pandas will be sorted based on panda type, and then serial number
// Connecting: // Connecting:
// - If a panda connection is dropped, boardd will reconnect to all pandas // - If a panda connection is dropped, pandad will reconnect to all pandas
// - If a panda is added, we will only reconnect when we are offroad // - If a panda is added, we will only reconnect when we are offroad
// CAN buses: // CAN buses:
// - Each panda will have it's block of 4 buses. E.g.: the second panda will use // - Each panda will have it's block of 4 buses. E.g.: the second panda will use
@ -163,7 +163,7 @@ Panda *connect(std::string serial="", uint32_t index=0) {
} }
void can_send_thread(std::vector<Panda *> pandas, bool fake_send) { void can_send_thread(std::vector<Panda *> pandas, bool fake_send) {
util::set_thread_name("boardd_can_send"); util::set_thread_name("pandad_can_send");
AlignedBuffer aligned_buf; AlignedBuffer aligned_buf;
std::unique_ptr<Context> context(Context::create()); std::unique_ptr<Context> context(Context::create());
@ -198,12 +198,12 @@ void can_send_thread(std::vector<Panda *> pandas, bool fake_send) {
} }
void can_recv_thread(std::vector<Panda *> pandas) { void can_recv_thread(std::vector<Panda *> pandas) {
util::set_thread_name("boardd_can_recv"); util::set_thread_name("pandad_can_recv");
PubMaster pm({"can"}); PubMaster pm({"can"});
// run at 100Hz // run at 100Hz
RateKeeper rk("boardd_can_recv", 100); RateKeeper rk("pandad_can_recv", 100);
std::vector<can_frame> raw_can_data; std::vector<can_frame> raw_can_data;
while (!do_exit && check_all_connected(pandas)) { while (!do_exit && check_all_connected(pandas)) {
@ -405,7 +405,7 @@ void send_peripheral_state(PubMaster *pm, Panda *panda) {
} }
void panda_state_thread(std::vector<Panda *> pandas, bool spoofing_started) { void panda_state_thread(std::vector<Panda *> pandas, bool spoofing_started) {
util::set_thread_name("boardd_panda_state"); util::set_thread_name("pandad_panda_state");
Params params; Params params;
SubMaster sm({"controlsState"}); SubMaster sm({"controlsState"});
@ -495,7 +495,7 @@ void panda_state_thread(std::vector<Panda *> pandas, bool spoofing_started) {
void peripheral_control_thread(Panda *panda, bool no_fan_control) { void peripheral_control_thread(Panda *panda, bool no_fan_control) {
util::set_thread_name("boardd_peripheral_control"); util::set_thread_name("pandad_peripheral_control");
SubMaster sm({"deviceState", "driverCameraState"}); SubMaster sm({"deviceState", "driverCameraState"});
@ -546,8 +546,8 @@ void peripheral_control_thread(Panda *panda, bool no_fan_control) {
} }
} }
void boardd_main_thread(std::vector<std::string> serials) { void pandad_main_thread(std::vector<std::string> serials) {
LOGW("launching boardd"); LOGW("launching pandad");
if (serials.size() == 0) { if (serials.size() == 0) {
serials = Panda::list(); serials = Panda::list();

@ -3,7 +3,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "selfdrive/boardd/panda.h" #include "selfdrive/pandad/panda.h"
bool safety_setter_thread(std::vector<Panda *> pandas); bool safety_setter_thread(std::vector<Panda *> pandas);
void boardd_main_thread(std::vector<std::string> serials); void pandad_main_thread(std::vector<std::string> serials);

@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# simple boardd wrapper that updates the panda first # simple pandad wrapper that updates the panda first
import os import os
import usb1 import usb1
import time import time
@ -157,10 +157,10 @@ def main() -> NoReturn:
first_run = False first_run = False
# run boardd with all connected serials as arguments # run pandad with all connected serials as arguments
os.environ['MANAGER_DAEMON'] = 'boardd' os.environ['MANAGER_DAEMON'] = 'pandad'
os.chdir(os.path.join(BASEDIR, "selfdrive/boardd")) os.chdir(os.path.join(BASEDIR, "selfdrive/pandad"))
subprocess.run(["./boardd", *panda_serials], check=True) subprocess.run(["./pandad", *panda_serials], check=True)
if __name__ == "__main__": if __name__ == "__main__":
main() main()

@ -13,7 +13,7 @@
#include "common/timing.h" #include "common/timing.h"
#include "common/swaglog.h" #include "common/swaglog.h"
#include "panda/board/comms_definitions.h" #include "panda/board/comms_definitions.h"
#include "selfdrive/boardd/panda_comms.h" #include "selfdrive/pandad/panda_comms.h"
#define SPI_SYNC 0x5AU #define SPI_SYNC 0x5AU

@ -39,7 +39,7 @@ class TestPandad:
managed_processes['pandad'].stop() managed_processes['pandad'].stop()
if len(sm['pandaStates']) == 0 or sm['pandaStates'][0].pandaType == log.PandaState.PandaType.unknown: if len(sm['pandaStates']) == 0 or sm['pandaStates'][0].pandaType == log.PandaState.PandaType.unknown:
raise Exception("boardd failed to start") raise Exception("pandad failed to start")
return dt return dt
@ -101,7 +101,7 @@ class TestPandad:
ts.append(dt) ts.append(dt)
# 5s for USB (due to enumeration) # 5s for USB (due to enumeration)
# - 0.2s pandad -> boardd # - 0.2s pandad -> pandad
# - plus some buffer # - plus some buffer
assert 0.1 < (sum(ts)/len(ts)) < (0.5 if self.spi else 5.0) assert 0.1 < (sum(ts)/len(ts)) < (0.5 if self.spi else 5.0)
print("startup times", ts, sum(ts) / len(ts)) print("startup times", ts, sum(ts) / len(ts))

@ -11,18 +11,18 @@ from cereal import car, log
from openpilot.common.retry import retry from openpilot.common.retry import retry
from openpilot.common.params import Params from openpilot.common.params import Params
from openpilot.common.timeout import Timeout from openpilot.common.timeout import Timeout
from openpilot.selfdrive.boardd.boardd import can_list_to_can_capnp from openpilot.selfdrive.pandad import can_list_to_can_capnp
from openpilot.selfdrive.car import make_can_msg from openpilot.selfdrive.car import make_can_msg
from openpilot.system.hardware import TICI from openpilot.system.hardware import TICI
from openpilot.selfdrive.test.helpers import phone_only, with_processes from openpilot.selfdrive.test.helpers import phone_only, with_processes
@retry(attempts=3) @retry(attempts=3)
def setup_boardd(num_pandas): def setup_pandad(num_pandas):
params = Params() params = Params()
params.put_bool("IsOnroad", False) params.put_bool("IsOnroad", False)
with Timeout(90, "boardd didn't start"): with Timeout(90, "pandad didn't start"):
sm = messaging.SubMaster(['pandaStates']) sm = messaging.SubMaster(['pandaStates'])
while sm.recv_frame['pandaStates'] < 1 or len(sm['pandaStates']) == 0 or \ while sm.recv_frame['pandaStates'] < 1 or len(sm['pandaStates']) == 0 or \
any(ps.pandaType == log.PandaState.PandaType.unknown for ps in sm['pandaStates']): any(ps.pandaType == log.PandaState.PandaType.unknown for ps in sm['pandaStates']):
@ -32,7 +32,7 @@ def setup_boardd(num_pandas):
assert num_pandas == found_pandas, "connected pandas ({found_pandas}) doesn't match expected panda count ({num_pandas}). \ assert num_pandas == found_pandas, "connected pandas ({found_pandas}) doesn't match expected panda count ({num_pandas}). \
connect another panda for multipanda tests." connect another panda for multipanda tests."
# boardd safety setting relies on these params # pandad safety setting relies on these params
cp = car.CarParams.new_message() cp = car.CarParams.new_message()
safety_config = car.CarParams.SafetyConfig.new_message() safety_config = car.CarParams.SafetyConfig.new_message()
@ -72,7 +72,7 @@ class TestBoarddLoopback:
@with_processes(['pandad']) @with_processes(['pandad'])
def test_loopback(self): def test_loopback(self):
num_pandas = 2 if TICI and "SINGLE_PANDA" not in os.environ else 1 num_pandas = 2 if TICI and "SINGLE_PANDA" not in os.environ else 1
setup_boardd(num_pandas) setup_pandad(num_pandas)
sendcan = messaging.pub_sock('sendcan') sendcan = messaging.pub_sock('sendcan')
can = messaging.sub_sock('can', conflate=False, timeout=100) can = messaging.sub_sock('can', conflate=False, timeout=100)
sm = messaging.SubMaster(['pandaStates']) sm = messaging.SubMaster(['pandaStates'])
@ -80,7 +80,7 @@ class TestBoarddLoopback:
n = 200 n = 200
for i in range(n): for i in range(n):
print(f"boardd loopback {i}/{n}") print(f"pandad loopback {i}/{n}")
sent_msgs = send_random_can_messages(sendcan, random.randrange(20, 100), num_pandas) sent_msgs = send_random_can_messages(sendcan, random.randrange(20, 100), num_pandas)

@ -8,7 +8,7 @@ import cereal.messaging as messaging
from cereal.services import SERVICE_LIST from cereal.services import SERVICE_LIST
from openpilot.system.hardware import HARDWARE from openpilot.system.hardware import HARDWARE
from openpilot.selfdrive.test.helpers import phone_only, with_processes from openpilot.selfdrive.test.helpers import phone_only, with_processes
from openpilot.selfdrive.boardd.tests.test_boardd_loopback import setup_boardd, send_random_can_messages from openpilot.selfdrive.pandad.tests.test_pandad_loopback import setup_pandad, send_random_can_messages
@pytest.mark.tici @pytest.mark.tici
@ -25,7 +25,7 @@ class TestBoarddSpi:
@phone_only @phone_only
@with_processes(['pandad']) @with_processes(['pandad'])
def test_spi_corruption(self, subtests): def test_spi_corruption(self, subtests):
setup_boardd(1) setup_pandad(1)
sendcan = messaging.pub_sock('sendcan') sendcan = messaging.pub_sock('sendcan')
socks = {s: messaging.sub_sock(s, conflate=False, timeout=100) for s in ('can', 'pandaStates', 'peripheralState')} socks = {s: messaging.sub_sock(s, conflate=False, timeout=100) for s in ('can', 'pandaStates', 'peripheralState')}

@ -4,7 +4,7 @@
#include "catch2/catch.hpp" #include "catch2/catch.hpp"
#include "cereal/messaging/messaging.h" #include "cereal/messaging/messaging.h"
#include "common/util.h" #include "common/util.h"
#include "selfdrive/boardd/panda.h" #include "selfdrive/pandad/panda.h"
struct PandaTest : public Panda { struct PandaTest : public Panda {
PandaTest(uint32_t bus_offset, int can_list_size, cereal::PandaState::PandaType hw_type); PandaTest(uint32_t bus_offset, int can_list_size, cereal::PandaState::PandaType hw_type);

@ -58,7 +58,7 @@ PROCS = {
"./logcatd": 0, "./logcatd": 0,
"system.micd": 6.0, "system.micd": 6.0,
"system.timed": 0, "system.timed": 0,
"selfdrive.boardd.pandad": 0, "selfdrive.pandad.pandad": 0,
"system.statsd": 0.4, "system.statsd": 0.4,
"selfdrive.navd.navd": 0.4, "selfdrive.navd.navd": 0.4,
"system.loggerd.uploader": (0.5, 15.0), "system.loggerd.uploader": (0.5, 15.0),
@ -67,12 +67,12 @@ PROCS = {
PROCS.update({ PROCS.update({
"tici": { "tici": {
"./boardd": 4.0, "./pandad": 4.0,
"./ubloxd": 0.02, "./ubloxd": 0.02,
"system.ubloxd.pigeond": 6.0, "system.ubloxd.pigeond": 6.0,
}, },
"tizi": { "tizi": {
"./boardd": 19.0, "./pandad": 19.0,
"system.qcomgpsd.qcomgpsd": 1.0, "system.qcomgpsd.qcomgpsd": 1.0,
} }
}.get(HARDWARE.get_device_type(), {})) }.get(HARDWARE.get_device_type(), {}))

@ -379,7 +379,7 @@ class Tici(HardwareBase):
# *** CPU config *** # *** CPU config ***
# offline big cluster, leave core 4 online for boardd # offline big cluster, leave core 4 online for pandad
for i in range(5, 8): for i in range(5, 8):
val = '0' if powersave_enabled else '1' val = '0' if powersave_enabled else '1'
sudo_write(val, f'/sys/devices/system/cpu/cpu{i}/online') sudo_write(val, f'/sys/devices/system/cpu/cpu{i}/online')
@ -390,7 +390,7 @@ class Tici(HardwareBase):
# *** IRQ config *** # *** IRQ config ***
# boardd core # pandad core
affine_irq(4, "spi_geni") # SPI affine_irq(4, "spi_geni") # SPI
affine_irq(4, "xhci-hcd:usb3") # aux panda USB (or potentially anything else on USB) affine_irq(4, "xhci-hcd:usb3") # aux panda USB (or potentially anything else on USB)
if "tici" in self.get_device_type(): if "tici" in self.get_device_type():

@ -145,7 +145,7 @@ def manager_thread() -> None:
elif not started and started_prev: elif not started and started_prev:
params.clear_all(ParamKeyType.CLEAR_ON_OFFROAD_TRANSITION) params.clear_all(ParamKeyType.CLEAR_ON_OFFROAD_TRANSITION)
# update onroad params, which drives boardd's safety setter thread # update onroad params, which drives pandad's safety setter thread
if started != started_prev: if started != started_prev:
write_onroad_params(started, params) write_onroad_params(started, params)

@ -60,7 +60,7 @@ procs = [
NativeProcess("ui", "selfdrive/ui", ["./ui"], always_run, watchdog_max_dt=(5 if not PC else None)), NativeProcess("ui", "selfdrive/ui", ["./ui"], always_run, watchdog_max_dt=(5 if not PC else None)),
PythonProcess("soundd", "selfdrive.ui.soundd", only_onroad), PythonProcess("soundd", "selfdrive.ui.soundd", only_onroad),
NativeProcess("locationd", "selfdrive/locationd", ["./locationd"], only_onroad), NativeProcess("locationd", "selfdrive/locationd", ["./locationd"], only_onroad),
NativeProcess("boardd", "selfdrive/boardd", ["./boardd"], always_run, enabled=False), NativeProcess("pandad", "selfdrive/pandad", ["./pandad"], always_run, enabled=False),
PythonProcess("calibrationd", "selfdrive.locationd.calibrationd", only_onroad), PythonProcess("calibrationd", "selfdrive.locationd.calibrationd", only_onroad),
PythonProcess("torqued", "selfdrive.locationd.torqued", only_onroad), PythonProcess("torqued", "selfdrive.locationd.torqued", only_onroad),
PythonProcess("controlsd", "selfdrive.controls.controlsd", only_onroad), PythonProcess("controlsd", "selfdrive.controls.controlsd", only_onroad),
@ -70,7 +70,7 @@ procs = [
PythonProcess("qcomgpsd", "system.qcomgpsd.qcomgpsd", qcomgps, enabled=TICI), PythonProcess("qcomgpsd", "system.qcomgpsd.qcomgpsd", qcomgps, enabled=TICI),
#PythonProcess("ugpsd", "system.ugpsd", only_onroad, enabled=TICI), #PythonProcess("ugpsd", "system.ugpsd", only_onroad, enabled=TICI),
PythonProcess("navd", "selfdrive.navd.navd", only_onroad), PythonProcess("navd", "selfdrive.navd.navd", only_onroad),
PythonProcess("pandad", "selfdrive.boardd.pandad", always_run), PythonProcess("pandad", "selfdrive.pandad.pandad", always_run),
PythonProcess("paramsd", "selfdrive.locationd.paramsd", only_onroad), PythonProcess("paramsd", "selfdrive.locationd.paramsd", only_onroad),
NativeProcess("ubloxd", "system/ubloxd", ["./ubloxd"], ublox, enabled=TICI), NativeProcess("ubloxd", "system/ubloxd", ["./ubloxd"], ublox, enabled=TICI),
PythonProcess("pigeond", "system.ubloxd.pigeond", ublox, enabled=TICI), PythonProcess("pigeond", "system.ubloxd.pigeond", ublox, enabled=TICI),

@ -127,7 +127,7 @@ def main() -> NoReturn:
print("qcomgpsd is running, please kill openpilot before running this script! (aborted)") print("qcomgpsd is running, please kill openpilot before running this script! (aborted)")
sys.exit(1) sys.exit(1)
except CalledProcessError as e: except CalledProcessError as e:
if e.returncode != 1: # 1 == no process found (boardd not running) if e.returncode != 1: # 1 == no process found (pandad not running)
raise e raise e
print("power up antenna ...") print("power up antenna ...")

@ -39,4 +39,4 @@ output_json_file = 'tools/cabana/dbc/car_fingerprint_to_dbc.json'
generate_dbc = cabana_env.Command('#' + output_json_file, generate_dbc = cabana_env.Command('#' + output_json_file,
['dbc/generate_dbc_json.py'], ['dbc/generate_dbc_json.py'],
"python3 tools/cabana/dbc/generate_dbc_json.py --out " + output_json_file) "python3 tools/cabana/dbc/generate_dbc_json.py --out " + output_json_file)
cabana_env.Depends(generate_dbc, ["#common", "#selfdrive/boardd", '#opendbc', "#cereal", Glob("#opendbc/*.dbc")]) cabana_env.Depends(generate_dbc, ["#common", "#selfdrive/pandad", '#opendbc', "#cereal", Glob("#opendbc/*.dbc")])

@ -7,7 +7,7 @@
#include <QFormLayout> #include <QFormLayout>
#include "tools/cabana/streams/livestream.h" #include "tools/cabana/streams/livestream.h"
#include "selfdrive/boardd/panda.h" #include "selfdrive/pandad/panda.h"
const uint32_t speeds[] = {10U, 20U, 50U, 100U, 125U, 250U, 500U, 1000U}; const uint32_t speeds[] = {10U, 20U, 50U, 100U, 125U, 250U, 500U, 1000U};
const uint32_t data_speeds[] = {10U, 20U, 50U, 100U, 125U, 250U, 500U, 1000U, 2000U, 5000U}; const uint32_t data_speeds[] = {10U, 20U, 50U, 100U, 125U, 250U, 500U, 1000U, 2000U, 5000U};

@ -76,7 +76,7 @@ Frame ID: 1202
Events updated 111.183541 Events updated 111.183541
sendcan published 112.981692 sendcan published 112.981692
controlsState published 113.731994 controlsState published 113.731994
boardd pandad
sending sendcan to panda: 250027001751393037323631 81.928119 sending sendcan to panda: 250027001751393037323631 81.928119
sendcan sent to panda: 250027001751393037323631 82.164834 sendcan sent to panda: 250027001751393037323631 82.164834
sending sendcan to panda: 250027001751393037323631 93.569986 sending sendcan to panda: 250027001751393037323631 93.569986

@ -12,7 +12,7 @@ from openpilot.tools.lib.logreader import LogReader
DEMO_ROUTE = "9f583b1d93915c31|2022-05-18--10-49-51--0" DEMO_ROUTE = "9f583b1d93915c31|2022-05-18--10-49-51--0"
SERVICES = ['camerad', 'modeld', 'plannerd', 'controlsd', 'boardd'] SERVICES = ['camerad', 'modeld', 'plannerd', 'controlsd', 'pandad']
MONOTIME_KEYS = ['modelMonoTime', 'lateralPlanMonoTime'] MONOTIME_KEYS = ['modelMonoTime', 'lateralPlanMonoTime']
MSGQ_TO_SERVICE = { MSGQ_TO_SERVICE = {
'roadCameraState': 'camerad', 'roadCameraState': 'camerad',
@ -137,7 +137,7 @@ def insert_cloudlogs(lr, timestamps, start_times, end_times):
timestamps[int(jmsg['msg']['timestamp']['frame_id'])][service].append((event, time)) timestamps[int(jmsg['msg']['timestamp']['frame_id'])][service].append((event, time))
continue continue
if service == "boardd": if service == "pandad":
timestamps[latest_controls_frameid][service].append((event, time)) timestamps[latest_controls_frameid][service].append((event, time))
end_times[latest_controls_frameid][service] = time end_times[latest_controls_frameid][service] = time
else: else:
@ -153,7 +153,7 @@ def insert_cloudlogs(lr, timestamps, start_times, end_times):
failed_inserts += 1 failed_inserts += 1
if latest_controls_frameid == 0: if latest_controls_frameid == 0:
print("Warning: failed to bind boardd logs to a frame ID. Add a timestamp cloudlog in controlsd.") print("Warning: failed to bind pandad logs to a frame ID. Add a timestamp cloudlog in controlsd.")
elif failed_inserts > len(timestamps): elif failed_inserts > len(timestamps):
print(f"Warning: failed to bind {failed_inserts} cloudlog timestamps to a frame ID") print(f"Warning: failed to bind {failed_inserts} cloudlog timestamps to a frame ID")

@ -8,7 +8,7 @@ import threading
os.environ['FILEREADER_CACHE'] = '1' os.environ['FILEREADER_CACHE'] = '1'
from openpilot.common.realtime import config_realtime_process, Ratekeeper, DT_CTRL from openpilot.common.realtime import config_realtime_process, Ratekeeper, DT_CTRL
from openpilot.selfdrive.boardd.boardd import can_capnp_to_can_list from openpilot.selfdrive.pandad import can_capnp_to_can_list
from openpilot.tools.lib.logreader import LogReader from openpilot.tools.lib.logreader import LogReader
from panda import PandaJungle from panda import PandaJungle

@ -3,7 +3,7 @@ import cereal.messaging as messaging
from opendbc.can.packer import CANPacker from opendbc.can.packer import CANPacker
from opendbc.can.parser import CANParser from opendbc.can.parser import CANParser
from openpilot.common.params import Params from openpilot.common.params import Params
from openpilot.selfdrive.boardd.boardd_api_impl import can_list_to_can_capnp from openpilot.selfdrive.pandad.pandad_api_impl import can_list_to_can_capnp
from openpilot.tools.sim.lib.common import SimulatorState from openpilot.tools.sim.lib.common import SimulatorState
from panda.python import Panda from panda.python import Panda

Loading…
Cancel
Save