-
Notifications
You must be signed in to change notification settings - Fork 0
Data pipeline #17
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
Open
guytonde
wants to merge
11
commits into
main
Choose a base branch
from
dataPipeline
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Data pipeline #17
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2ee54d6
new branch
ali8hsn 6840c0f
this is my like final for network
ali8hsn 4cfd3a2
connector+network patch
ali8hsn 32b54fe
seeing whats wrong
ali8hsn 1f9ddff
fixedpush
ali8hsn 1c41a4d
Merge branch 'main' into dataPipeline
guytonde dd6e9ec
WORKING NETWORK QUEUE LFGG
ali8hsn db93ec3
seperate DBC parser and fixed server issue
ali8hsn 38e9961
Merge branch 'dataPipeline' of https://github.com/lhr-solar/Photon in…
ali8hsn 8e4b10a
all DBC files in a cpp and header, made window for SLCAN Tracker.🫡💩
ali8hsn b34956d
made it so you could see hexa and decimal inside of the monitor.
ali8hsn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| /* [ξ] DBC Connector Interface | ||
| Connects parsed DBC definitions to their respective CAN IDs. | ||
| Acts like a runtime dictionary for DBC → CAN lookup. | ||
| */ | ||
|
|
||
| #include <iostream> | ||
| #include <unordered_map> | ||
| #include <vector> | ||
| #include <string> | ||
| #include <memory> | ||
|
|
||
| struct DbcSignalInfo { | ||
| int startBit; | ||
| int length; | ||
| int endianness; // 1 = little, 0 = big | ||
| bool isSigned; | ||
| double factor; | ||
| double offset; | ||
| double minVal; | ||
| double maxVal; | ||
| }; | ||
|
|
||
| struct DbcMessageInfo { | ||
| int canId; | ||
| std::string name; | ||
| int dlc; | ||
| std::string transmitter; | ||
|
|
||
| // Each message holds multiple signal definitions | ||
| std::unordered_map<std::string, DbcSignalInfo> signals; | ||
| }; | ||
|
|
||
| class DbcConnector { | ||
| public: | ||
| // Top-level: map CAN IDs → DBC message info | ||
| std::unordered_map<int, std::shared_ptr<DbcMessageInfo>> dbcMap; | ||
|
|
||
| // Register a new CAN message (BO_ line) | ||
| void registerMessage(int canId, const std::string& name, int dlc, const std::string& transmitter) { | ||
| auto msg = std::make_shared<DbcMessageInfo>(); | ||
| msg->canId = canId; | ||
| msg->name = name; | ||
| msg->dlc = dlc; | ||
| msg->transmitter = transmitter; | ||
| dbcMap[canId] = msg; | ||
| } | ||
|
|
||
| // Register a new signal for a given CAN ID (SG_ line) | ||
| void registerSignal(int canId, | ||
| const std::string& signalName, | ||
| int startBit, | ||
| int length, | ||
| int endianness, | ||
| bool isSigned, | ||
| double factor, | ||
| double offset, | ||
| double minVal, | ||
| double maxVal) { | ||
| if (dbcMap.find(canId) == dbcMap.end()) { | ||
| std::cerr << "[Connector] Error: CAN ID " << canId << " not registered before SG_ line\n"; | ||
| return; | ||
| } | ||
|
|
||
| DbcSignalInfo sig{ startBit, length, endianness, isSigned, factor, offset, minVal, maxVal }; | ||
| dbcMap[canId]->signals[signalName] = sig; | ||
| } | ||
|
|
||
| // Print all stored mappings for debugging | ||
| void dump() const { | ||
| for (const auto& [id, msg] : dbcMap) { | ||
| std::cout << "CAN ID: " << id << " | Name: " << msg->name | ||
| << " | DLC: " << msg->dlc | ||
| << " | Transmitter: " << msg->transmitter << "\n"; | ||
|
|
||
| for (const auto& [sigName, sig] : msg->signals) { | ||
| std::cout << " └─ Signal: " << sigName | ||
| << " (StartBit: " << sig.startBit | ||
| << ", Len: " << sig.length | ||
| << ", Endian: " << sig.endianness | ||
| << ", Signed: " << sig.isSigned | ||
| << ", Factor: " << sig.factor | ||
| << ", Offset: " << sig.offset | ||
| << ", Min: " << sig.minVal | ||
| << ", Max: " << sig.maxVal | ||
| << ")\n"; | ||
| } | ||
| } | ||
| } | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no associated hpp (e.g. connector.hpp) for this file. There also appears to be duplicated code in this file and network.cpp/hpp. Either consolidate all code into connector.cpp (and a new connector.hpp), or remove the file.