-
Notifications
You must be signed in to change notification settings - Fork 4
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
VCU Simulation Framework #60
Conversation
…e and update vcu event documentation
…for debugging/saving simulations
…cess will be distributed privately to avoid uploading to our public Team Phantom repo
…t gmail editor access using google drive API v3
…ntrols/2023/Test Logs-Simulation/VCU
…te to drive using this open source script
…to google drive to show simulation
… onto a single simulation
…tom/vcu-fw into VCUSimulationIntegration
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.
Comments for the functions and classes are very helpful while following along with the code. Just make a note for each of the comments in the files and resolve any merge conflicts but looks really good!
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.
Consider that with regard to readability and maintainability, the intention of your code should be front and center, and be as obvious as possible. In some places, the use of type annotations dominates the code more than they would in a strongly typed language like C++.
Long type annotations:
These types with nested dicts and lists should either be declared as its own class or type aliased. The information is still relevant, but we should only have to read the super-long definition when we need to.
# you have to get past the type annotation to see the actual intention of the code
write_res : dict[Union[VCU_Pedal, str], Union[list[int], list[EventData], list[StateData]]] = self._write_data()
-------------------
# at top of file
VCUResult = dict[Union[VCU_Pedal, str], Union[list[int], list[EventData], list[StateData]]]
write_res : VCUResult = self._write_data()
Redundant annotations:
Adding type annotations for every single line of code can add unnecessary noise to the codebase; not all situations need strict typing. This is a little more subjective about where you choose to forego type annotation.
A good rule to follow is to type annotate function arguments and return values. Types can then be deduced from these return values. If it's not obvious, then add a type annotation.
json_config: dict = self._parse_json()
def _parse_json(self) -> Union[dict, None]:
-------
# the IDE and the programmer can deduce the type easily from this simple assignment.
json_config = self._parse_json()
Incorrect, misleading, and/or non-obvious:
interface: VCUSimInterface = VCUSimInterface().begin() # the begin method does not actually return a VCUSimInterface
Also found a stack overflow post that I 100% agree with giving more advice on type hints
…thout a physical VCU connected
…tance. This improves thread safe environments
…ather than from the Simulation interface
…t correctly added to each row
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.
This should be a good baseline for the project. Now we can move this over to its own repo and continue development there
Overview
Develop a comprehensive VCU Simulation Framework that empowers users to conduct detailed testing of the vehicle's firmware under race-like scenarios. This framework will facilitate thorough verification of the VCU's behavior in response to various critical inputs and stimuli, including
Development discussion
A detailed discussion about the features and scope of the framework can be found via this github issue #61
User Manual
Refer to the following document for environment set up and framework usage
https://docs.google.com/document/d/1h_xk5TsREIRYUv_hB6RO2n2hTzEec8QP7Y_7VT4gCtU/edit
Design Document
The following document outlines the framework design decisions for the VCU testing robustness. Developers who wish to modify the current usage should refer to
https://docs.google.com/document/d/10IChPywZE57cQT93kg4YBlf_Gsr4lBgPxA6Phs91sME/edit
High level architecture
Framework implementation: