Skip to content

Commit

Permalink
update to new opendbc api
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee authored and sshane committed Aug 1, 2024
1 parent 5b131a4 commit 5739e15
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/opendbc
Submodule opendbc updated 179 files
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ include_directories(
./3rdparty/lua-5.4.3/src
./3rdparty/QCodeEditor/include
./3rdparty/lz4
./3rdparty/opendbc/can
./3rdparty/opendbc/opendbc/can
./3rdparty/cereal/messaging
./3rdparty/cereal
)
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

0 comments on commit 5739e15

Please sign in to comment.