Add pre-commit hooks (#1629)

old-commit-hash: ab83e48ec4f7c7ddaa742d9797b0d38646fdb268
This commit is contained in:
Adeeb
2020-06-03 12:54:49 -07:00
committed by GitHub
parent e6cf5883b1
commit d035394ce7
26 changed files with 98 additions and 95 deletions
+3 -3
View File
@@ -18,7 +18,7 @@ static uint32_t read24be(const uint8_t* ptr) {
}
static void write32le(FILE *of, uint32_t v) {
uint8_t va[4] = {
v & 0xff, (v >> 8) & 0xff, (v >> 16) & 0xff, (v >> 24) & 0xff
v & 0xff, (v >> 8) & 0xff, (v >> 16) & 0xff, (v >> 24) & 0xff
};
fwrite(va, 1, sizeof(va), of);
}
@@ -135,7 +135,7 @@ static void hevc_index(const uint8_t *data, size_t file_size, FILE *of_prefix, F
bs_get(&bs, 1);
}
uint32_t slice_type = bs_ue(&bs);
// write the index
write32le(of_index, slice_type);
write32le(of_index, ptr - data);
@@ -244,7 +244,7 @@ static void h264_index(const uint8_t *data, size_t file_size, FILE *of_prefix, F
uint32_t pic_parameter_set_id = bs_ue(&bs);
uint32_t frame_num = bs_get(&bs, sps_log2_max_frame_num_minus4+4);
if (first_mb_in_slice == 0) {
write32le(of_index, slice_type);
write32le(of_index, ptr - data);
+1 -1
View File
@@ -71,7 +71,7 @@ LogReader::LogReader(const QString& file, Events *events_, QReadWriteLock* event
while (1) {
mergeEvents(cdled.get());
}
});
});
}
void LogReader::mergeEvents(int dled) {
+2 -2
View File
@@ -4,7 +4,7 @@
#include <capnp/dynamic.h>
#include <capnp/schema.h>
// include the dynamic struct
// include the dynamic struct
#include "cereal/gen/cpp/car.capnp.c++"
#include "cereal/gen/cpp/log.capnp.c++"
@@ -24,7 +24,7 @@ static inline uint64_t nanos_since_boot() {
}
Unlogger::Unlogger(Events *events_, QReadWriteLock* events_lock_, QMap<int, FrameReader*> *frs_, int seek)
Unlogger::Unlogger(Events *events_, QReadWriteLock* events_lock_, QMap<int, FrameReader*> *frs_, int seek)
: events(events_), events_lock(events_lock_), frs(frs_) {
ctx = Context::create();
YAML::Node service_list = YAML::LoadFile("../../cereal/service_list.yaml");
+9 -9
View File
@@ -44,7 +44,7 @@ class Window : public QWidget {
QMap<int, LogReader*> lrs;
QMap<int, FrameReader*> frs;
// cache the bar
QPixmap *px = NULL;
@@ -72,7 +72,7 @@ Window::Window(QString route_, int seek, int use_api_) : route(route_), use_api(
file.open(QIODevice::ReadOnly | QIODevice::Text);
settings = file.readAll();
file.close();
QJsonDocument sd = QJsonDocument::fromJson(settings.toUtf8());
qWarning() << sd.isNull(); // <- print false :)
QJsonObject sett2 = sd.object();
@@ -97,7 +97,7 @@ bool Window::addSegment(int i) {
lrs.insert(i, new LogReader(fn, &events, &events_lock, &unlogger->eidx));
} else {
QString log_fn = this->log_paths.at(i).toString();
lrs.insert(i, new LogReader(log_fn, &events, &events_lock, &unlogger->eidx));
lrs.insert(i, new LogReader(log_fn, &events, &events_lock, &unlogger->eidx));
}
@@ -114,8 +114,8 @@ bool Window::addSegment(int i) {
QString camera_fn = this->camera_paths.at(i).toString();
frs.insert(i, new FrameReader(qPrintable(camera_fn)));
}
return true;
}
return false;
@@ -193,9 +193,9 @@ void Window::paintEvent(QPaintEvent *event) {
tt.drawLine(lt, 300-lvv, rt, 300-vv);
if (enabled) {
tt.setPen(Qt::green);
tt.setPen(Qt::green);
} else {
tt.setPen(Qt::blue);
tt.setPen(Qt::blue);
}
tt.drawLine(rt, 300, rt, 600);
@@ -237,7 +237,7 @@ int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QString route(argv[1]);
int use_api = QString::compare(QString("use_api"), route, Qt::CaseInsensitive) == 0;
int seek = QString(argv[2]).toInt();
printf("seek: %d\n", seek);
@@ -251,7 +251,7 @@ int main(int argc, char *argv[]) {
}
Window window(route, seek, use_api);
window.resize(1920, 800);
window.setWindowTitle("nui unlogger");
window.show();
-1
View File
@@ -9,4 +9,3 @@ if [ $# -gt 0 ]; then
else
echo "Please Enter a Route"
fi
+5 -5
View File
@@ -10,24 +10,24 @@ git clone https://github.com/commaai/openpilot.git
# Add export PYTHONPATH=$HOME/openpilot to your bashrc
# Have a working tensorflow+keras in python3.7.3 (with [packages] in openpilot/Pipfile)
```
## Install (in tab 1)
## Install (in tab 1)
```
cd ~/openpilot/tools/sim
./start_carla.sh # install CARLA 0.9.7 and start the server
```
## openpilot (in tab 2)
## openpilot (in tab 2)
```
cd ~/openpilot/selfdrive/
PASSIVE=0 NOBOARD=1 ./manager.py
```
## bridge (in tab 3)
## bridge (in tab 3)
```
# links carla to openpilot, will "start the car" according to manager
cd ~/openpilot/tools/sim
./bridge.py
```
## Controls
Now you can control the simulator with the keys:
## Controls
Now you can control the simulator with the keys:
1: Cruise up 5 mph
+1 -1
View File
@@ -15,4 +15,4 @@ if [ ! -d carla ]; then
fi
cd carla
./CarlaUE4.sh
./CarlaUE4.sh
+35 -35
View File
@@ -1,49 +1,49 @@
Run openpilot with webcam on PC/laptop
=====================
What's needed:
- Ubuntu 16.04
- Python 3.7.3
- GPU (recommended)
- Two USB webcams, at least 720p and 78 degrees FOV (e.g. Logitech C920/C615)
- [Car harness](https://comma.ai/shop/products/comma-car-harness) w/ black panda (or the outdated grey panda/giraffe combo) to connect to your car
- [Panda paw](https://comma.ai/shop/products/panda-paw) (or USB-A to USB-A cable) to connect panda to your computer
- Tape, Charger, ...
That's it!
What's needed:
- Ubuntu 16.04
- Python 3.7.3
- GPU (recommended)
- Two USB webcams, at least 720p and 78 degrees FOV (e.g. Logitech C920/C615)
- [Car harness](https://comma.ai/shop/products/comma-car-harness) w/ black panda (or the outdated grey panda/giraffe combo) to connect to your car
- [Panda paw](https://comma.ai/shop/products/panda-paw) (or USB-A to USB-A cable) to connect panda to your computer
- Tape, Charger, ...
That's it!
## Clone openpilot and install the requirements
## Clone openpilot and install the requirements
```
cd ~
git clone https://github.com/commaai/openpilot.git
cd ~
git clone https://github.com/commaai/openpilot.git
```
- Follow [this readme](https://github.com/commaai/openpilot/tree/master/tools) to install the requirements
- Add line "export PYTHONPATH=$HOME/openpilot" to your ~/.bashrc
- You also need to install tensorflow 2.2 and nvidia drivers: nvidia-xxx/cuda10.0/cudnn7.6.5
- Install [OpenCL Driver](http://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/15532/l_opencl_p_18.1.0.015.tgz)
- (Note: the code assumes cl platforms order to be 0.GPU/1.CPU when running clinfo; if reverse, change the -1 to -2 in selfdrive/modeld/modeld.cc#L130; helping us refactor this mess is encouraged)
- Install [OpenCV4](https://www.pyimagesearch.com/2018/08/15/how-to-install-opencv-4-on-ubuntu/) (ignore the Python part)
- Follow [this readme](https://github.com/commaai/openpilot/tree/master/tools) to install the requirements
- Add line "export PYTHONPATH=$HOME/openpilot" to your ~/.bashrc
- You also need to install tensorflow 2.2 and nvidia drivers: nvidia-xxx/cuda10.0/cudnn7.6.5
- Install [OpenCL Driver](http://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/15532/l_opencl_p_18.1.0.015.tgz)
- (Note: the code assumes cl platforms order to be 0.GPU/1.CPU when running clinfo; if reverse, change the -1 to -2 in selfdrive/modeld/modeld.cc#L130; helping us refactor this mess is encouraged)
- Install [OpenCV4](https://www.pyimagesearch.com/2018/08/15/how-to-install-opencv-4-on-ubuntu/) (ignore the Python part)
## Build openpilot for webcam
## Build openpilot for webcam
```
cd ~/openpilot
cd ~/openpilot
```
- check out selfdrive/camerad/cameras/camera_webcam.cc line72&146 before building if any camera is upside down
- check out selfdrive/camerad/cameras/camera_webcam.cc line72&146 before building if any camera is upside down
```
scons use_webcam=1
touch prebuilt
scons use_webcam=1
touch prebuilt
```
## Connect the hardwares
- Connect the road facing camera first, then the driver facing camera
- (default indexes are 1 and 2; can be modified in selfdrive/camerad/cameras/camera_webcam.cc)
- Connect your computer to panda
## Connect the hardwares
- Connect the road facing camera first, then the driver facing camera
- (default indexes are 1 and 2; can be modified in selfdrive/camerad/cameras/camera_webcam.cc)
- Connect your computer to panda
## GO
## GO
```
cd ~/openpilot/tools/webcam
./accept_terms.py # accept the user terms so that thermald can detect the car started
cd ~/openpilot/selfdrive
PASSIVE=0 NOSENSOR=1 WEBCAM=1 ./manager.py
cd ~/openpilot/tools/webcam
./accept_terms.py # accept the user terms so that thermald can detect the car started
cd ~/openpilot/selfdrive
PASSIVE=0 NOSENSOR=1 WEBCAM=1 ./manager.py
```
- Start the car, then the UI should show the road webcam's view
- Adjust and secure the webcams (you can run tools/webcam/front_mount_helper.py to help mount the driver camera)
- Finish calibration and engage!
- Start the car, then the UI should show the road webcam's view
- Adjust and secure the webcams (you can run tools/webcam/front_mount_helper.py to help mount the driver camera)
- Finish calibration and engage!