Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 27 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions .github/workflows/DailyBuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,67 @@ 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
```

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
Expand Down
30 changes: 25 additions & 5 deletions simulators/ADCS/packages/state_machine/StateMachine.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion simulators/ADCS/packages/tcp/TcpServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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')
Expand Down