move replay from selfdrive/ui/replay to tools/replay (#24971)

* mv to tools/replay

* change folder

* add .gitignore

* fix build doc

* disable warning

* enable warning after build

* build qt/util.cc qt/api.cc to library

* cleanup
old-commit-hash: fd5b3d76036b78864111790931a3abcb1d11ee0f
This commit is contained in:
Dean Lee
2022-06-28 22:12:42 +08:00
committed by GitHub
parent 403266fdb1
commit 2156e71e7a
29 changed files with 73 additions and 57 deletions
+1 -1
View File
@@ -310,7 +310,7 @@ jobs:
./selfdrive/boardd/tests/test_boardd_usbprotocol && \
./selfdrive/loggerd/tests/test_logger &&\
./system/proclogd/tests/test_proclog && \
./selfdrive/ui/replay/tests/test_replay && \
./tools/replay/tests/test_replay && \
./system/camerad/test/ae_gray_test && \
coverage xml"
- name: "Upload coverage to Codecov"
+2
View File
@@ -411,6 +411,8 @@ SConscript(['selfdrive/locationd/SConscript'])
SConscript(['selfdrive/sensord/SConscript'])
SConscript(['selfdrive/ui/SConscript'])
SConscript(['tools/replay/SConscript'])
if GetOption('test'):
SConscript('panda/tests/safety/SConscript')
+1 -1
View File
@@ -54,7 +54,7 @@ soundd
replay
""""""
.. autodoxygenindex::
:project: selfdrive_ui_replay
:project: tools_replay
qt
""
+2 -2
View File
@@ -296,8 +296,8 @@ selfdrive/ui/qt/offroad/*.qml
selfdrive/ui/qt/widgets/*.cc
selfdrive/ui/qt/widgets/*.h
selfdrive/ui/replay/*.cc
selfdrive/ui/replay/*.h
tools/replay/*.cc
tools/replay/*.h
selfdrive/ui/qt/maps/*.cc
selfdrive/ui/qt/maps/*.h
+1 -1
View File
@@ -9,7 +9,7 @@
#include "cereal/messaging/messaging.h"
#include "common/util.h"
#include "selfdrive/loggerd/logger.h"
#include "selfdrive/ui/replay/util.h"
#include "tools/replay/util.h"
typedef cereal::Sentinel::SentinelType SentinelType;
+5 -15
View File
@@ -18,10 +18,11 @@ if arch == "Darwin":
del base_libs[base_libs.index('OpenCL')]
qt_env['FRAMEWORKS'] += ['OpenCL']
widgets_src = ["ui.cc", "qt/util.cc", "qt/widgets/input.cc", "qt/widgets/drive_stats.cc",
qt_util = qt_env.Library("qt_util", ["#selfdrive/ui/qt/api.cc", "#selfdrive/ui/qt/util.cc"], LIBS=base_libs)
widgets_src = ["ui.cc", "qt/widgets/input.cc", "qt/widgets/drive_stats.cc",
"qt/widgets/ssh_keys.cc", "qt/widgets/toggle.cc", "qt/widgets/controls.cc",
"qt/widgets/offroad_alerts.cc", "qt/widgets/prime.cc", "qt/widgets/keyboard.cc",
"qt/widgets/scrollview.cc", "qt/widgets/cameraview.cc", "#third_party/qrcode/QrCode.cc", "qt/api.cc",
"qt/widgets/scrollview.cc", "qt/widgets/cameraview.cc", "#third_party/qrcode/QrCode.cc",
"qt/request_repeater.cc", "qt/qt_window.cc", "qt/offroad/networking.cc", "qt/offroad/wifiManager.cc"]
qt_env['CPPDEFINES'] = []
@@ -31,7 +32,7 @@ if maps:
qt_env['CPPDEFINES'] += ["ENABLE_MAPS"]
widgets = qt_env.Library("qt_widgets", widgets_src, LIBS=base_libs)
qt_libs = [widgets] + base_libs
qt_libs = [widgets, qt_util] + base_libs
# build assets
assets = "#selfdrive/assets/assets.cc"
@@ -107,17 +108,6 @@ if GetOption('extras'):
# keep installers small
assert f[0].get_size() < 300*1e3
# build headless replay
# build watch3
if arch in ['x86_64', 'Darwin'] or GetOption('extras'):
qt_env['CXXFLAGS'] += ["-Wno-deprecated-declarations"]
replay_lib_src = ["replay/replay.cc", "replay/consoleui.cc", "replay/camera.cc", "replay/filereader.cc", "replay/logreader.cc", "replay/framereader.cc", "replay/route.cc", "replay/util.cc"]
replay_lib = qt_env.Library("qt_replay", replay_lib_src, LIBS=base_libs)
replay_libs = [replay_lib, 'avutil', 'avcodec', 'avformat', 'bz2', 'curl', 'yuv', 'ncurses'] + qt_libs
qt_env.Program("replay/replay", ["replay/main.cc"], LIBS=replay_libs)
qt_env.Program("watch3", ["watch3.cc"], LIBS=qt_libs + ['common', 'json11', 'zmq', 'visionipc', 'messaging'])
if GetOption('test'):
qt_env.Program('replay/tests/test_replay', ['replay/tests/test_runner.cc', 'replay/tests/test_replay.cc'], LIBS=[replay_libs])
+1 -1
View File
@@ -12,7 +12,7 @@ Welcome to the first part of the comma CTF!
getting started
```bash
# start the route reply
cd selfdrive/ui/replay
cd tools/replay
./replay '0c7f0c7f0c7f0c7f|2021-10-13--13-00-00' --dcam --ecam
# start the UI in another terminal
+5
View File
@@ -0,0 +1,5 @@
moc_*
*.moc
replay
tests/test_replay
+7 -7
View File
@@ -9,12 +9,12 @@
python lib/auth.py
# Start a replay
selfdrive/ui/replay/replay <route-name>
tools/replay/replay <route-name>
# Example:
# selfdrive/ui/replay/replay '4cf7a6ad03080c90|2021-09-29--13-46-36'
# tools/replay/replay '4cf7a6ad03080c90|2021-09-29--13-46-36'
# or use --demo to replay the default demo route:
# selfdrive/ui/replay/replay --demo
# tools/replay/replay --demo
# watch the replay with the normal openpilot UI
cd selfdrive/ui && ./ui
@@ -25,8 +25,8 @@ python replay/ui.py
## usage
``` bash
$ selfdrive/ui/replay/replay -h
Usage: selfdrive/ui/replay/replay [options] route
$ tools/replay/replay -h
Usage: tools/replay/replay [options] route
Mock openpilot components by publishing logged messages.
Options:
@@ -51,7 +51,7 @@ simply replay a route using the `--dcam` and `--ecam` flags:
```bash
# start a replay
cd selfdrive/ui/replay && ./replay --demo --dcam --ecam
cd tools/replay && ./replay --demo --dcam --ecam
# then start watch3
cd selfdrive/ui && ./watch3
@@ -70,5 +70,5 @@ In order to replay specific route:
MOCK=1 selfdrive/boardd/tests/boardd_old.py
# In another terminal:
selfdrive/ui/replay/replay <route-name>
tools/replay/replay <route-name>
```
+19
View File
@@ -0,0 +1,19 @@
import os
Import('env', 'qt_env', 'arch', 'common', 'messaging', 'visionipc',
'cereal', 'transformations')
base_libs = [common, messaging, cereal, visionipc, transformations, 'zmq',
'capnp', 'kj', 'm', 'OpenCL', 'ssl', 'crypto', 'pthread'] + qt_env["LIBS"]
qt_libs = ['qt_util'] + base_libs
if arch in ['x86_64', 'Darwin'] or GetOption('extras'):
qt_env['CXXFLAGS'] += ["-Wno-deprecated-declarations"]
replay_lib_src = ["replay.cc", "consoleui.cc", "camera.cc", "filereader.cc", "logreader.cc", "framereader.cc", "route.cc", "util.cc"]
replay_lib = qt_env.Library("qt_replay", replay_lib_src, LIBS=qt_libs)
replay_libs = [replay_lib, 'avutil', 'avcodec', 'avformat', 'bz2', 'curl', 'yuv', 'ncurses'] + qt_libs
qt_env.Program("replay", ["main.cc"], LIBS=replay_libs)
if GetOption('test'):
qt_env.Program('tests/test_replay', ['tests/test_runner.cc', 'tests/test_replay.cc'], LIBS=[replay_libs])
@@ -1,5 +1,5 @@
#include "selfdrive/ui/replay/camera.h"
#include "selfdrive/ui/replay/util.h"
#include "tools/replay/camera.h"
#include "tools/replay/util.h"
#include <cassert>
@@ -3,8 +3,8 @@
#include <unistd.h>
#include "cereal/visionipc/visionipc_server.h"
#include "common/queue.h"
#include "selfdrive/ui/replay/framereader.h"
#include "selfdrive/ui/replay/logreader.h"
#include "tools/replay/framereader.h"
#include "tools/replay/logreader.h"
class CameraServer {
public:
@@ -1,4 +1,4 @@
#include "selfdrive/ui/replay/consoleui.h"
#include "tools/replay/consoleui.h"
#include <QApplication>
#include <initializer_list>
@@ -7,7 +7,7 @@
#include <QTimer>
#include <QTimerEvent>
#include "selfdrive/ui/replay/replay.h"
#include "tools/replay/replay.h"
#include <ncurses.h>
class ConsoleUI : public QObject {
@@ -1,9 +1,9 @@
#include "selfdrive/ui/replay/filereader.h"
#include "tools/replay/filereader.h"
#include <fstream>
#include "common/util.h"
#include "selfdrive/ui/replay/util.h"
#include "tools/replay/util.h"
std::string cacheFilePath(const std::string &url) {
static std::string cache_path = [] {
@@ -1,5 +1,5 @@
#include "selfdrive/ui/replay/framereader.h"
#include "selfdrive/ui/replay/util.h"
#include "tools/replay/framereader.h"
#include "tools/replay/util.h"
#include <cassert>
#include "libyuv.h"
@@ -4,7 +4,7 @@
#include <string>
#include <vector>
#include "selfdrive/ui/replay/filereader.h"
#include "tools/replay/filereader.h"
extern "C" {
#include <libavcodec/avcodec.h>
@@ -1,7 +1,7 @@
#include "selfdrive/ui/replay/logreader.h"
#include "tools/replay/logreader.h"
#include <algorithm>
#include "selfdrive/ui/replay/util.h"
#include "tools/replay/util.h"
Event::Event(const kj::ArrayPtr<const capnp::word> &amsg, bool frame) : reader(amsg), frame(frame) {
words = kj::ArrayPtr<const capnp::word>(amsg.begin(), reader.getEnd());
@@ -7,7 +7,7 @@
#include "cereal/gen/cpp/log.capnp.h"
#include "system/camerad/cameras/camera_common.h"
#include "selfdrive/ui/replay/filereader.h"
#include "tools/replay/filereader.h"
const CameraType ALL_CAMERAS[] = {RoadCam, DriverCam, WideRoadCam};
const int MAX_CAMERAS = std::size(ALL_CAMERAS);
@@ -1,8 +1,8 @@
#include <QApplication>
#include <QCommandLineParser>
#include "selfdrive/ui/replay/consoleui.h"
#include "selfdrive/ui/replay/replay.h"
#include "tools/replay/consoleui.h"
#include "tools/replay/replay.h"
const QString DEMO_ROUTE = "4cf7a6ad03080c90|2021-09-29--13-46-36";
@@ -1,4 +1,4 @@
#include "selfdrive/ui/replay/replay.h"
#include "tools/replay/replay.h"
#include <QDebug>
#include <QtConcurrent>
@@ -8,7 +8,7 @@
#include "common/params.h"
#include "common/timing.h"
#include "system/hardware/hw.h"
#include "selfdrive/ui/replay/util.h"
#include "tools/replay/util.h"
Replay::Replay(QString route, QStringList allow, QStringList block, SubMaster *sm_, uint32_t flags, QString data_dir, QObject *parent)
: sm(sm_), flags_(flags), QObject(parent) {
@@ -4,8 +4,8 @@
#include <QThread>
#include "selfdrive/ui/replay/camera.h"
#include "selfdrive/ui/replay/route.h"
#include "tools/replay/camera.h"
#include "tools/replay/route.h"
// one segment uses about 100M of memory
constexpr int FORWARD_SEGS = 5;
@@ -1,4 +1,4 @@
#include "selfdrive/ui/replay/route.h"
#include "tools/replay/route.h"
#include <QDir>
#include <QEventLoop>
@@ -11,8 +11,8 @@
#include "system/hardware/hw.h"
#include "selfdrive/ui/qt/api.h"
#include "selfdrive/ui/replay/replay.h"
#include "selfdrive/ui/replay/util.h"
#include "tools/replay/replay.h"
#include "tools/replay/util.h"
Route::Route(const QString &route, const QString &data_dir) : data_dir_(data_dir) {
route_ = parseRoute(route);
@@ -2,9 +2,9 @@
#include <QFutureSynchronizer>
#include "selfdrive/ui/replay/framereader.h"
#include "selfdrive/ui/replay/logreader.h"
#include "selfdrive/ui/replay/util.h"
#include "tools/replay/framereader.h"
#include "tools/replay/logreader.h"
#include "tools/replay/util.h"
struct RouteIdentifier {
QString dongle_id;
@@ -6,8 +6,8 @@
#include "catch2/catch.hpp"
#include "common/util.h"
#include "selfdrive/ui/replay/replay.h"
#include "selfdrive/ui/replay/util.h"
#include "tools/replay/replay.h"
#include "tools/replay/util.h"
const QString DEMO_ROUTE = "4cf7a6ad03080c90|2021-09-29--13-46-36";
const std::string TEST_RLOG_URL = "https://commadataci.blob.core.windows.net/openpilotci/0c94aa1e1296d7c6/2021-05-05--19-48-37/0/rlog.bz2";
@@ -1,4 +1,4 @@
#include "selfdrive/ui/replay/util.h"
#include "tools/replay/util.h"
#include <bzlib.h>
#include <curl/curl.h>