diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..da4967e --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,27 @@ +## CHESS 05_FS Pull Request +|**Field**|**Value**| +|:---|:---| +|**_Base Branch_**| | +|**_Short Description_**| | +|**_Affected Component_**| | +|**_Affected Architectures(s)_**| | +|**_Related Issue(s)_**| | +|**_Has Unit Tests (y/n)_**| | +|**_Build Checked (y/n)_**| | +|**_Unit Tests Run (y/n)_**| | +|**_Documentation Included (y/n)_**| | + +--- +## Change Description +Example: This adds nothing to the FileDown component, which fixes some fake issues. These additions change no files. + +## Rationale +Example: This change was needed to fix non-existent issues in the FileDown. When testing, FileDown was conclusively proven to not be broken and therefore required these (null) fixes. + +## Testing Recommendations + +Example: Open up the file down component and check XYZ runs. + +## Future Work + +Example: No future work expected based on this request. diff --git a/.github/workflows/DailyBuild.yaml b/.github/workflows/DailyBuild.yaml index 4691c54..eec09f9 100644 --- a/.github/workflows/DailyBuild.yaml +++ b/.github/workflows/DailyBuild.yaml @@ -16,6 +16,8 @@ jobs: steps: # checkout the repository - uses: actions/checkout@v2 + with: + ref: dev - name: prepare python pre-built environnement uses: actions/setup-python@v2 diff --git a/README.md b/README.md index bda10a6..b733e73 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,13 @@ python3 -m pip install ./Fw/Python ./Gds F' compilation +Before compiling, you need to know if the flight sofrware will be used with the FPrime GDS or PUS demonstrator + +In ./App/CMakeLists.txt comment and uncomment your choice + +```cmake= +add_definitions(-D_PUS) # to use PUS with GS +#add_definitions(-D_GDS) # to use F' GDS (without PUS) ``` fprime-util generate fprime-util build @@ -39,10 +46,53 @@ fprime-util build Launch F' and GDS (Ground Software simulator) +Prerequisites +1. Run ADCS simulator +2. Run EPS simulator + ``` fprime-gds ``` +## simulators +### ADCS +#### Installing +```bash +pip install python-statemachine +``` +#### Running ADCS simulator +```bash +python3 ./simulators/ADCS/TcpMain.py +``` + +### EPS +#### Installing +```bash +pip install python-statemachine +sudo apt install libsocketcan-dev pkg-config libzmq3-dev +``` +#### Running EPS simulator +```bash +sudo chmod +x ./simulators/EPS/zmqproxy +sudo ./simulators/EPS/zmqproxy & +export LD_LIBRARY_PATH=./simulators/EPS/packages/csp/lib && python3 ./simulators/EPS/CspMain.py +``` + +## Demonstrator +### Prerequisites +1. Run ADCS simulator +2. Run EPS simulator + +## Running Demonstrator +```bash +./gs/gs +``` +The demonstrator is a TCP server. It will wait for a connection from Flight software and then, start sending and receiving packets +### Running Flight solftware with demonstrator +```bash +./App/build-artifacts/Linux/bin/App -a 127.0.0.1 -p 27015 +``` + ## Running the tests In `05_FS/App` run diff --git a/simulators/ADCS/packages/state_machine/StateMachine.py b/simulators/ADCS/packages/state_machine/StateMachine.py index 59bbc8d..0103a60 100644 --- a/simulators/ADCS/packages/state_machine/StateMachine.py +++ b/simulators/ADCS/packages/state_machine/StateMachine.py @@ -1,6 +1,25 @@ from statemachine import StateMachine, State from packages.package.UART import Uart +listTC = { + 1:"reset", + 4:"reset log pointer", + 5:"advance log pointer", + 6:"reset boot registers", + 108:"erase file", + 112:"load file donwload block", + 113:"advance file list read pointer", + 114:"initiate file upload", + 115:"file upload packet", + 116:"finalize upload block", + 117:"reset upload block", + 118:"reset file list read pointer", + 119:"initate donwload burst" +} + +listTM = { + +} class ADCSStateMachine(StateMachine): low_orbit = State('Low orbit', initial=True) @@ -47,6 +66,7 @@ def on_enter_high_orbit(self): def exec_command(self, id): try: + print(listTC[id]) data = self.switcher(id) except Exception as e: print(e) @@ -58,14 +78,14 @@ def request_telemetry_data(self, id): return self.param def request(self,packet:bytearray) -> bytearray: - code = Uart.check_packet(packet) - id = Uart.get_id(packet) + code = Uart.check_packet(packet) #error code (?) + id = Uart.get_id(packet) #third byte on the received data uart_packet = Uart(id) - if code == 0: - if id < 128: + if code == 0: #if no errors in received data + if id < 128: #telecomand code = self.exec_command(id) return uart_packet.end_packet(code) - else: + else: #telemetry tm = self.request_telemetry_data(id) return uart_packet.end_packet(tm) else: diff --git a/simulators/ADCS/packages/tcp/TcpServer.py b/simulators/ADCS/packages/tcp/TcpServer.py index b400fba..697a846 100644 --- a/simulators/ADCS/packages/tcp/TcpServer.py +++ b/simulators/ADCS/packages/tcp/TcpServer.py @@ -12,6 +12,7 @@ def runTCP(adcs): BUFFER_SIZE = 2046 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) print(f"starting up on {TCP_IP} port {TCP_PORT}") s.bind((TCP_IP, TCP_PORT)) s.listen(1) @@ -24,7 +25,6 @@ def runTCP(adcs): while 1: data = conn.recv(BUFFER_SIZE) if data: - print(f"Data Received : {data}") back_data = adcs.request(data) print(f'sending data back to client : data {back_data}\n')