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

Type hints + simple Pytest + higher precision serial #11

Merged
merged 182 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
182 commits
Select commit Hold shift + click to select a range
aeef5fd
Fixing things being double tabbed
LelsersLasers Sep 21, 2024
c17d123
Fixing string formatting to avoid invalid escape characters
LelsersLasers Sep 21, 2024
3725109
Fixing import error
LelsersLasers Sep 21, 2024
ae8ac96
unix file slash directions
LelsersLasers Sep 23, 2024
c29603e
Creating a super simple pytest example
LelsersLasers Sep 23, 2024
f7f6f3e
Trying to convert to pytest
LelsersLasers Sep 23, 2024
db43eab
Testing check.almost_equal()
LelsersLasers Sep 23, 2024
8944f40
Bugfix: setting up all of hil in the pytest fixture
LelsersLasers Sep 23, 2024
6dc84e3
Section dividers
LelsersLasers Sep 23, 2024
8e47132
Trying abox pytest
LelsersLasers Sep 23, 2024
a129354
Don't need to call the functions when using pytest
LelsersLasers Sep 23, 2024
89cf479
Can pass no arguments to run on all files
LelsersLasers Sep 25, 2024
a85b82f
Readability/format changes
LelsersLasers Oct 4, 2024
92840d1
Python decorator for logging HIL status
LelsersLasers Oct 11, 2024
109132b
Typo in abox text config load
LelsersLasers Oct 11, 2024
4724f5d
Trying Pytest collector
LelsersLasers Oct 11, 2024
8471391
Folder rename
LelsersLasers Oct 11, 2024
15ffd0c
< now correctly <= for the left bound
LelsersLasers Oct 11, 2024
35f2c4f
Trying Pytest main base
LelsersLasers Oct 11, 2024
b7351e2
Confirming that non "hil" params are not effected
LelsersLasers Oct 12, 2024
e52a166
Trying Pyest for main sdc
LelsersLasers Oct 12, 2024
e91075b
Typo: these tests don't read power
LelsersLasers Oct 12, 2024
6eb1c25
Trying Pytest system
LelsersLasers Oct 12, 2024
8fcff42
Trying Pytest test
LelsersLasers Oct 12, 2024
2899d4d
Separating new Pytest scripts and old ones
LelsersLasers Oct 12, 2024
09e43fb
Commenting out old code for in hil.py testing
LelsersLasers Oct 15, 2024
26a6884
Type hinting return types and instance variables
LelsersLasers Oct 15, 2024
81347b0
Type hinting hil.py
LelsersLasers Oct 15, 2024
f060d16
Type hinting pin_mapper.py
LelsersLasers Oct 15, 2024
e66dbbb
Type hinting utils
LelsersLasers Oct 16, 2024
ddc141e
Trying to improve imports?
LelsersLasers Oct 16, 2024
32a2355
Type hinting component.py
LelsersLasers Oct 16, 2024
c462c52
Type hinting hil_device.py
LelsersLasers Oct 16, 2024
526fca1
Type hinting serial_manager.py
LelsersLasers Oct 17, 2024
446a48a
Adding list of file which need to be type hinted
LelsersLasers Oct 17, 2024
265f568
Commenting out unused imports
LelsersLasers Oct 17, 2024
17d9d50
Almost done type hinting client.py
LelsersLasers Oct 19, 2024
6b5d37b
Finishing type hints for client.py
LelsersLasers Oct 19, 2024
d5a93b6
Update README.md
LelsersLasers Oct 19, 2024
ddc7f7e
Almost done type hinting can_bus.py
LelsersLasers Oct 19, 2024
2eb6c0c
Finishing type hinting can_bus.py (I think)
LelsersLasers Oct 22, 2024
f86be0a
Updating list of completed files
LelsersLasers Oct 22, 2024
658c0a7
Type hinting daq_protocal.py -> DAQPin()
LelsersLasers Oct 22, 2024
5af3836
(Mostly) type hinting daq_protocol.py -> DaqProtocol
LelsersLasers Oct 22, 2024
b855af7
(Mostly) type hinting daq_protocol.py -> DAQVariable
LelsersLasers Oct 23, 2024
4695144
Finishing type hinting daq_protocol.py
LelsersLasers Oct 23, 2024
2d03591
Done with all files
LelsersLasers Oct 23, 2024
46eaac4
No longer need the TODO
LelsersLasers Oct 23, 2024
e1e3908
Trying to understand the structure of utils.signals
LelsersLasers Oct 26, 2024
f587275
Fixing utils.signals outline/structure
LelsersLasers Oct 26, 2024
77c37b9
Type hinting/commenting out globals
LelsersLasers Oct 26, 2024
e3753df
Fixing type hint (BusSignal from util.signals not str)
LelsersLasers Oct 26, 2024
3a0e1b1
Fixing typo
LelsersLasers Oct 29, 2024
2a1c3ba
Removing duplicate line
LelsersLasers Oct 30, 2024
1c2e967
Folder name must match ino name (case sensitive)
LelsersLasers Nov 6, 2024
f383c6f
Trying to add DFRobot_MCP4725 driver
LelsersLasers Nov 6, 2024
fd31bf0
DFRobot_MCP4725: local #include instead of library global #include
LelsersLasers Nov 6, 2024
feae448
Indentation: 2 spaces -> tabs
LelsersLasers Nov 6, 2024
187548b
Adding README to the repo for how I think it could be run
LelsersLasers Nov 6, 2024
c28cbff
typo fix (missing end quote)
LelsersLasers Nov 6, 2024
ffc8eca
Fixing misnamed test script
LelsersLasers Nov 6, 2024
40780dc
type hints fix: global + type hint = bad
LelsersLasers Nov 6, 2024
c131338
Fixing imports. Everything relative to ./ instead of ./hil now
LelsersLasers Nov 6, 2024
2c568c9
Fixing path for all pytest scripts
LelsersLasers Nov 6, 2024
083f4d6
using typing.TYPE_CHECKING to avoid circular dependencies
LelsersLasers Nov 6, 2024
26fcd2f
Removing unneeded logging
LelsersLasers Nov 6, 2024
561adb7
Firmware path for Millan Kumar
LelsersLasers Nov 6, 2024
cfc04a5
Correctly initializing can for test_test.py
LelsersLasers Nov 6, 2024
b986258
Debug print for while CanBus init fails
LelsersLasers Nov 6, 2024
4f635fc
Pytest for config_dash.py
LelsersLasers Nov 6, 2024
66c90a8
"config_dash" -> "test_dash" for naming consistency
LelsersLasers Nov 6, 2024
5b692b9
Correctly lower casing scripts folder
LelsersLasers Nov 6, 2024
fd77a01
Adding note about firmware path
LelsersLasers Nov 6, 2024
0c783f0
Format fix
LelsersLasers Nov 8, 2024
2e8c222
A note about inputs vs output naming
LelsersLasers Nov 9, 2024
9478ffe
Slightly cleaning code and adding prints
LelsersLasers Nov 9, 2024
c8c1563
Adding a comment explaining the bit and-ing
LelsersLasers Nov 9, 2024
857ea0e
Only one arduino so id = 1??
LelsersLasers Nov 9, 2024
b15a9c3
Deleting old script code
LelsersLasers Nov 9, 2024
b3ed7ce
Cleaning prints
LelsersLasers Nov 9, 2024
e7652f6
Can't use "input" with Pytest
LelsersLasers Nov 9, 2024
939b60a
Improving teardown print statements
LelsersLasers Nov 9, 2024
6c011e2
Improving prints
LelsersLasers Nov 9, 2024
eac1671
test_collector but no pytest so can wait using input()
LelsersLasers Nov 9, 2024
fb93634
Type hinting new test
LelsersLasers Nov 9, 2024
3a782ac
Improving test output + tabs
LelsersLasers Nov 9, 2024
7eb2cd8
Test to toggle a DO to make sure things work
LelsersLasers Nov 9, 2024
03ddb3f
idk why the id is 2 now
LelsersLasers Nov 9, 2024
c4efb4d
Simple Arduino program that toggles DO for pin 4
LelsersLasers Nov 9, 2024
71ae4a0
Debug print
LelsersLasers Nov 9, 2024
1fbeb49
Making the arduino LED reflect the pin high/low
LelsersLasers Nov 9, 2024
4125a78
Python HIL can set Arduino pins high/low
LelsersLasers Nov 9, 2024
62aed18
HIL Micro led matches last GPIO write
LelsersLasers Nov 9, 2024
04b3492
Currently using an Arduino micro
LelsersLasers Nov 9, 2024
5f4038f
We don't need DAC features rn (I think)
LelsersLasers Nov 10, 2024
1715723
renaming to millan.py
LelsersLasers Nov 10, 2024
03d5c98
Working!: Fully custom DO and DI HIL test (without the board)
LelsersLasers Nov 10, 2024
6c8d069
Pytest version of custom test
LelsersLasers Nov 10, 2024
1aad878
Trying to test "AI" mode (unsuccessful?)
LelsersLasers Nov 10, 2024
78768e2
Testing DI and AI at the same time
LelsersLasers Nov 10, 2024
39a0238
Better comment for Arduino discovery
LelsersLasers Nov 10, 2024
e0fc9f1
Tester id = 1 (from 2)
LelsersLasers Nov 10, 2024
de39b88
Creating files to setup a breadboard Collector test
LelsersLasers Nov 11, 2024
163f897
Trying to setup a breadboard test for Collector Plate
LelsersLasers Nov 11, 2024
8783a56
Indentation changes
LelsersLasers Nov 11, 2024
c2fcccb
Commenting out unneeded variable declaration
LelsersLasers Nov 12, 2024
df4ee5a
Fixing board name for simple collector test
LelsersLasers Nov 12, 2024
e6329b1
Changing print statements slightly
LelsersLasers Nov 12, 2024
57b9174
New config for breadboard + 12 bit dac
LelsersLasers Nov 13, 2024
d16cff8
Renaming folder
LelsersLasers Nov 13, 2024
5690b02
Deleting old test I made while learning
LelsersLasers Nov 13, 2024
98fef5d
Writing the python test (and it should dictate how the net map is made)
LelsersLasers Nov 13, 2024
804f7cb
mil_dac: maybe net map and config (untested)
LelsersLasers Nov 13, 2024
3212cff
Slightly improving breadboard 12-bit DAC test
LelsersLasers Nov 13, 2024
e818d23
I think I figured out how to use the DAC and maybe a valid pin mappin…
LelsersLasers Nov 15, 2024
0113f8a
Renaming for Arduino IDE
LelsersLasers Nov 15, 2024
164e611
Fixing file name
LelsersLasers Nov 15, 2024
cf2399e
DX pins don't work, AX pins work fine for DI/DO at least
LelsersLasers Nov 15, 2024
86bc590
Successfully running DI/DO on AI pins
LelsersLasers Nov 15, 2024
6e6d8a6
Fixing typo
LelsersLasers Nov 15, 2024
51b17ee
Can write 0 voltage :shrug:
LelsersLasers Nov 15, 2024
6a22fb4
DAC works! The math for voltage to DAC is wrong
LelsersLasers Nov 15, 2024
f117d2b
DAC is effectively 8-bit when sent over serial
LelsersLasers Nov 15, 2024
cb0a6b4
Flipping addresses for DACs
LelsersLasers Nov 15, 2024
888a566
Writing a test for the RLY
LelsersLasers Nov 15, 2024
7cf4ba3
Adding last year's "pcb" device config for DI pins for comparison
LelsersLasers Nov 16, 2024
c3d5983
Improving RLY test to take DO input
LelsersLasers Nov 16, 2024
6fca615
Renaming test
LelsersLasers Nov 16, 2024
ad2aa9c
WRITE_PWM command/device type
LelsersLasers Nov 16, 2024
2146ddd
Adding PWM pins to the device config
LelsersLasers Nov 17, 2024
78931f0
Reorganizing files
LelsersLasers Nov 17, 2024
46fb830
net_map and config for all the possible pins; need to update test
LelsersLasers Nov 17, 2024
53604cd
Updating test to match net_map and config changes
LelsersLasers Nov 17, 2024
3381d99
Test for pwm. Runs all 4 PWMs
LelsersLasers Nov 17, 2024
d84c983
Testing both DACs
LelsersLasers Nov 17, 2024
34bd87c
Improving print formating
LelsersLasers Nov 17, 2024
95c4044
Formatting changes
LelsersLasers Nov 17, 2024
07d5e76
Untested: HIL python can now send data of arbitrary data sizes
LelsersLasers Nov 17, 2024
a0bd0fe
Theoretically: DACS can now function as 12-bit
LelsersLasers Nov 17, 2024
25da538
Fixing typo (code compiles)
LelsersLasers Nov 17, 2024
71f03d9
Built in LED switches state whenever a command finishes
LelsersLasers Nov 17, 2024
6265b17
Merge pull request #9 from PurdueElectricRacing/feature/millan/arbitr…
LelsersLasers Nov 17, 2024
a6a463e
There are only 2 DACS to test (typo from 4)
LelsersLasers Nov 17, 2024
105bd69
Rewriting collector plate to use RLY1 as a DO
LelsersLasers Nov 20, 2024
7b9aa2d
Finally testing DX pins (3-7 work, 8 not usable, 1 & 2 don't work)
LelsersLasers Dec 13, 2024
1d7134a
Can't use LED_BUILTIN because it is tied to 13
LelsersLasers Dec 13, 2024
16dc679
RLY3 and RLY4 are flipped
LelsersLasers Dec 13, 2024
5765844
AX pins shouldn't be used for DO because they are not pulled down
LelsersLasers Dec 13, 2024
044f7f5
The relays now work
LelsersLasers Dec 13, 2024
9477024
Reorganzing
LelsersLasers Jan 15, 2025
c644a6b
Removing old test files
LelsersLasers Jan 15, 2025
136affe
Delete config_millan.json
LelsersLasers Jan 15, 2025
a12a2f5
Delete millan_net_map.csv
LelsersLasers Jan 15, 2025
b359811
Deleting old files
LelsersLasers Jan 15, 2025
9bf79e8
Adjusting the simple col test for the inverted relay
LelsersLasers Jan 15, 2025
15d1e53
Deleting old test files
LelsersLasers Jan 22, 2025
a85395b
Removing old hil checks/testing suite + copying old file
LelsersLasers Jan 22, 2025
e8844be
Type hinting signal_int_handler
LelsersLasers Jan 22, 2025
e93e80b
Undoing CollTester
LelsersLasers Jan 22, 2025
4d96e5f
Removing TODO: type hint comments
LelsersLasers Jan 22, 2025
cb42b47
Cleaning comment
LelsersLasers Jan 22, 2025
00cab7a
Apparently can delete
LelsersLasers Jan 22, 2025
91142b8
Removing debug prints
LelsersLasers Jan 22, 2025
6b952a8
Undoing windows -> linux file conversions
LelsersLasers Jan 22, 2025
56fad8d
Delete debug print
LelsersLasers Jan 22, 2025
7430b61
Removing unused imports
LelsersLasers Jan 22, 2025
d5c47e0
Removing debug print
LelsersLasers Jan 22, 2025
0777fed
Delete debug print
LelsersLasers Jan 22, 2025
b0f0a9f
Renaming and making better use of MASK constants
LelsersLasers Jan 22, 2025
efa8388
Remove debug print
LelsersLasers Jan 22, 2025
92084cb
Delete test.sh
LelsersLasers Jan 22, 2025
f034f0d
Remove unused import
LelsersLasers Jan 22, 2025
df71ef5
Revert
LelsersLasers Jan 22, 2025
d93ba29
Delete unused
LelsersLasers Jan 22, 2025
23af70a
Removing PWM code
LelsersLasers Jan 22, 2025
84596b0
Deleting my personal test files from the PR
LelsersLasers Jan 23, 2025
12617d3
Removing collector plate tests from the PR
LelsersLasers Jan 23, 2025
f546efe
char != uint8_t
LelsersLasers Jan 24, 2025
9282379
Deleting todo
LelsersLasers Jan 25, 2025
34e3f99
Removing unused variable
LelsersLasers Jan 25, 2025
6634992
Adding comment
LelsersLasers Jan 25, 2025
d361046
Removing if (1)
LelsersLasers Jan 25, 2025
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
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# HIL Tester for PER

## Running

- Code in `./TestBench` runs on the Arduino
- Basically it just reads commands over the serial port and either executs them or writes messages back over the serial port
- To flash it, use the Arduino IDE
- Code in `./scripts` runs on your laptop
- It uses all the Python files
- Each file in `./scripts` can run a Pytest script to test some board on the car
- Do `./test.sh [filename]` to run the script, or no filename to run all of them
- (Note: have to run from the `./scripts` directory)
- Make sure you correctly set `firmware_path` in `./hil_params.json` to the path of the primary PER firmware repo!

## Notes

### Input vs Output

- `AI`/`DI` = inputs to hil (reads from the car/other board -> Arduino -> laptop/Python)
- `AO`/`DO` = outputs from hil (writes from laptop/Python -> Arduino -> car/other board)
Loading