Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to new opendbc api #63

Merged
merged 5 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/openpilot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: setup dependencies
run: |
brew install cmake bzip2 capnp qt@5 zeromq protobuf@3 gnu-tar
sudo pip3 install --no-cache-dir -r 3rdparty/opendbc/requirements.txt
sudo pip3 install --no-cache-dir -r 3rdparty/opendbc_repo/requirements.txt
- name: build
run: |
export PYTHONPATH=$PWD/3rdparty
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
path = 3rdparty/cereal
url = ../../commaai/cereal.git
[submodule "3rdparty/opendbc"]
path = 3rdparty/opendbc
path = 3rdparty/opendbc_repo
url = ../../commaai/opendbc.git
1 change: 0 additions & 1 deletion 3rdparty/opendbc
Submodule opendbc deleted from 93b983
1 change: 1 addition & 0 deletions 3rdparty/opendbc
1 change: 1 addition & 0 deletions 3rdparty/opendbc_repo
Submodule opendbc_repo added at a40652
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ RUN pip3 install pkgconfig jinja2

# installs scons, pycapnp, cython, etc.
ENV PYTHONPATH /tmp/plotjuggler/3rdparty
COPY 3rdparty/opendbc/requirements.txt /tmp/
COPY 3rdparty/opendbc_repo/requirements.txt /tmp/
RUN pip3 install Cython && pip3 install --no-cache-dir -r /tmp/requirements.txt
2 changes: 1 addition & 1 deletion plotjuggler_plugins/DataLoadRlog/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if(Rlog_FOUND)
add_definitions(${QT_DEFINITIONS})
add_definitions(-DQT_PLUGIN)
add_definitions(-DDYNAMIC_CAPNP)
add_definitions(-DDBC_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/opendbc")
add_definitions(-DDBC_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/opendbc/dbc")

SET(SRC
rlog_parser.cpp
Expand Down
16 changes: 13 additions & 3 deletions plotjuggler_plugins/DataLoadRlog/rlog_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ bool RlogMessageParser::parseCanMessage(
}

std::set<uint8_t> updated_busses;
std::vector<CanData> can_data_list;
CanData &can_data = can_data_list.emplace_back();
can_data.nanos = last_nanos;
for(auto elem : listValue) {
auto value = elem.as<capnp::DynamicStruct>();
uint8_t bus = value.get("src").as<uint8_t>();
Expand All @@ -185,12 +188,19 @@ bool RlogMessageParser::parseCanMessage(

updated_busses.insert(bus);
parsers[bus]->last_nanos = last_nanos;
parsers[bus]->UpdateCans(last_nanos, value);
parsers[bus]->UpdateValid(last_nanos);

auto dat = value.get("dat").as<capnp::Data>();
if (dat.size() > 64) continue; // shouldn't ever happen

auto &frame = can_data.frames.emplace_back();
frame.src = bus;
frame.address = value.get("address").as<uint32_t>();
frame.dat.assign(dat.begin(), dat.end());
}

for (uint8_t bus : updated_busses) {
std::vector<SignalValue> signal_values;
parsers[bus]->query_latest(signal_values);
parsers[bus]->update(can_data_list, signal_values);
for (auto& sg : signal_values) {
// TODO: plot all updated values
PJ::PlotData& _data_series = getSeries(topic_name + '/' + std::to_string(bus) + '/' +
Expand Down
2 changes: 2 additions & 0 deletions plotjuggler_plugins/DataLoadRlog/rlog_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#endif

#include <capnp/schema-parser.h>
#include <capnp/dynamic.h>
#include <capnp/serialize.h>

#include "common.h"
#include "common_dbc.h"
Expand Down
2 changes: 1 addition & 1 deletion plotjuggler_plugins/DataStreamCereal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if(Cereal_FOUND AND Rlog_FOUND)
add_definitions(${QT_DEFINITIONS})
add_definitions(-DQT_PLUGIN)
add_definitions(-DDYNAMIC_CAPNP)
add_definitions(-DDBC_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/opendbc")
add_definitions(-DDBC_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/opendbc/dbc")

QT5_WRAP_UI ( UI_SRC datastream_cereal.ui )

Expand Down
Loading