Skip to content

Data pipeline#17

Open
guytonde wants to merge 11 commits into
mainfrom
dataPipeline
Open

Data pipeline#17
guytonde wants to merge 11 commits into
mainfrom
dataPipeline

Conversation

@guytonde
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a data pipeline for CAN bus data, including support for parsing DBC frames. While the new functionality is significant, I've identified several critical issues related to thread safety, including race conditions that could lead to memory corruption or crashes. There are also performance concerns with busy-waiting loops that will consume unnecessary CPU cycles. Furthermore, the code has some design issues like code duplication and redundant data structures that will make it harder to maintain. I've provided specific comments and suggestions to address these critical and high-severity issues. Please address the thread-safety problems with high priority.

@lhr-solar lhr-solar deleted a comment from gemini-code-assist Bot Oct 28, 2025
Copy link
Copy Markdown
Contributor

@RomeroPablo RomeroPablo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the proposed changes are used in the actual project, nor are there any demonstrations or tests for the changes/additions. Please add appropriate UI logging that demonstrates that your proposal works for the intended work load. Additionally, there are a lot of instances of poor code smell, so please manually review and reason about code that is added to the project, especially if it is generated by any LLM. Please provide an end to end architecture and plan demonstrating your intentions with your proposed changes/additions. Make sure you mention how you plan to address threading, concurrency, synchronization, and interfaces for individuals wanting to interface with data provided over the network (slcan packets, h264, glb/gltf files, dbc files, etc.)

Comment thread photon/network/network.hpp Outdated

SPSCQueue<uint8_t> spscQueue;
std::string IP ="3.141.38.115";
std::string IP = "172.0.0.1"; //"3.141.38.115";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave the IP as 3.141.38.115. With the proposed change, if someone builds and tries to run the program they fail to make a valid connection, and are unable to observe any proposed changes to the networking stack.
Screenshot 2025-10-28 233004
Screenshot 2025-10-28 233025

@@ -1,4 +1,3 @@
/*[ξ] the photon network interface*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No Reason to Remove

Comment thread photon/network/connecter.cpp Outdated
Copy link
Copy Markdown
Contributor

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.

Comment thread photon/network/network.cpp Outdated

class DbcConnector {
public:
std::unordered_map<int, std::shared_ptr<DbcMessageInfo>> dbcMap;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not use 'smart' pointers in this code base.

Comment thread photon/network/network.hpp Outdated

/* end of network class */
std::mutex dbcMapMutex;
std::unordered_map<uint32_t, std::unique_ptr<DbcMessage>> dbcMap;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not use 'smart' pointers in this code base.

Comment thread photon/network/network.hpp Outdated
unsigned PORT = 8187;


private:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consolidate all private functions and variables under the "private" declared earlier in the class

Comment thread photon/network/network.cpp Outdated
}
};

static DbcConnector dbcConnector;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not have a single static declaration of the class in the source file. This is really bad.

}

void Network::parser(){
void Network::parser() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having our slcan parsing and DBC file parsing intermixed in a single functions is really bad, in terms of code smell and perf, wasting cycles on every attempted parse checking for a dbc file that may never be received by an instance does not make sense. An instance will very rarely every query for a DBC file, so there should be some short lived interface that independently queries and receives any desired DBC files. It also makes our parsing harder to reason about and debug.

Comment thread photon/network/network.cpp Outdated
writeDBC(canID, name, dlc, sender);
currentCanId = canID;
logs("[parser] Registered BO_ " + name + " (CAN ID: " + std::to_string(canID) + ")");
printDBCMap(); // ✅ print here after adding new BO_
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? Remove Emoji

Comment thread photon/network/network.cpp Outdated

writeSignal(currentCanId, sig);
logs("[parser] Registered SG_ " + sig.name + " for CAN ID " + std::to_string(currentCanId));
printDBCMap(); // ✅ print here after adding new SG_
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? Remove Emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants