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
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,35 @@ Generate random data for development of the frontend. Without the simulator, we
- Real-time data synchronization with React components
- Error handling and retry logic

## 🛠️ Prerequisites

- **Node.js** 22+
- **pnpm** 10.26.1+
- **Maven** 3.9+
- **Docker** & **Docker Compose**
- **Tilt** (for development orchestration)

## 📋 Installation

Install the required tools:
- [Node.js](https://nodejs.org/en/download)
- [pnpm](https://pnpm.io/installation)
- [Java (JDK)](https://www.oracle.com/ca-en/java/technologies/downloads/)
- [Maven](https://maven.apache.org/)
- [Tilt](https://docs.tilt.dev/install.html)
- [Docker Desktop](https://www.docker.com/products/docker-desktop/)

or if you're on MacOS, install with Homebrew
```bash
brew install node pnpm java maven tilt
brew install --cask docker-desktop
```
Then clone the repository and install the dependencies locally.
```bash
# Clone the repository
git clone https://github.com/McGillRocketTeam/ground-station
cd ground-station
# Install dependencies for all packages
pnpm install
# Build initial packages
pnpm build
```

## 🏃‍♂️ Running Everything with Tilt

**Tilt** orchestrates the entire development environment, including all Docker services and applications.
**Tilt** orchestrates the entire development environment, including all Docker services and applications. **Ensure that Docker Desktop is running before you start Tilt.**

```bash
# Start all services and applications
Expand Down Expand Up @@ -94,12 +102,6 @@ pnpm --filter @mrt/frontend dev
YAMCS_INSTANCE=ground_station pnpm --filter @mrt/simulator dev
```

### Build All Packages

```bash
pnpm turbo run build
```

### Type Checking

```bash
Expand Down
8 changes: 3 additions & 5 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ local_resource(
resource_deps=['backend', 'yamcs-effect', 'yamcs-atom']
)


local_resource(
'backend',
serve_cmd="cd apps/backend && mvn yamcs:run",
Expand Down Expand Up @@ -49,7 +48,7 @@ local_resource(
}

.\\venv\\Scripts\\pip install -r requirements.txt
.\\venv\\Scripts\\python converter.py --output "../backend/src/main/yamcs/mdb/rocket.xml"
.\\venv\\Scripts\\python ./src/xtce_generator.py --output-telemetry-xml "../../backend/src/main/yamcs/mdb/rocket.xml" --output-commanding-xml "../../backend/src/main/yamcs/mdb/commands.xml"
''' or '''
set -e

Expand All @@ -60,15 +59,14 @@ local_resource(
fi

./venv/bin/pip install -r requirements.txt
./venv/bin/python converter.py --output "../backend/src/main/yamcs/mdb/rocket.xml"
./venv/bin/python ./src/xtce_generator.py --output-telemetry-xml "../backend/src/main/yamcs/mdb/rocket.xml" --output-commanding-xml "../backend/src/main/yamcs/mdb/commands.xml"
''',
deps=[
"requirements.txt",
"converter.py",
"xtce_generator.py",
]
)


local_resource(
'yamcs-effect',
serve_cmd="pnpm turbo dev --filter @mrt/yamcs-effect",
Expand Down
38 changes: 29 additions & 9 deletions apps/backend/src/main/java/org/yamcs/mrt/AstraCommandLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.yamcs.YConfiguration;
import org.yamcs.YamcsServer;
import org.yamcs.CommandOption.CommandOptionType;
import org.yamcs.cmdhistory.CommandHistoryPublisher;
import org.yamcs.cmdhistory.CommandHistoryPublisher.AckStatus;
import org.yamcs.commanding.Acknowledgment;
import org.yamcs.commanding.ActiveCommand;
Expand Down Expand Up @@ -61,7 +62,7 @@ public class AstraCommandLink extends AbstractTcDataLink {
// time. We store each command and the devices it was sent to.
private final AtomicInteger currentCommandId = new AtomicInteger(1);

private Map<Integer, ArrayList<String>> commandToDeviceMap = new HashMap<>();
private Map<Integer, Collection<String>> commandToDeviceMap = new HashMap<>();
private Map<Integer, PreparedCommand> commandToPreparedMap = new HashMap<>();

@Override
Expand Down Expand Up @@ -201,6 +202,8 @@ public boolean sendCommand(PreparedCommand preparedCommand) {

this.commandHistoryPublisher.publish(preparedCommand.getCommandId(),
"TX_Devices", String.join(",", devices));
this.commandToDeviceMap.put(seqNum, devices);

for (var device : devices) {
try {
client.publish(device + "/commands", msg, null, new IMqttActionListener() {
Expand Down Expand Up @@ -257,16 +260,33 @@ private void handleMetadata(String deviceName, MqttMessage message) {

}

// FIX: Its possible that if there are two radios on the same
// frequency (i.e. pad & cs) then the ack will be sent twice.
public void handleFCAck(int cmd_id, String frequency) {
// FIX: Currently the only way we reigster the FC ack is if the same
// radio that sent it recieved it. Reciving FC acks should be
// radio agnostic, but we don't do that right now
public void handleFCAck(int cmd_id, String frequency, String deviceName) {
PreparedCommand command = commandToPreparedMap.get(cmd_id);
Collection<String> devices = commandToDeviceMap.get(cmd_id);

if (devices.contains(deviceName)) {
commandHistoryPublisher.publishAck(
command.getCommandId(),
"fc_" + frequency,
timeService.getMissionTime(),
AckStatus.OK);

devices.remove(deviceName);
}

// If both FCs have ack'd then the command
// is complete
if (devices.size() == 0) {
commandHistoryPublisher.publishAck(
command.getCommandId(),
CommandHistoryPublisher.CommandComplete_KEY,
timeService.getMissionTime(),
AckStatus.OK);
}

commandHistoryPublisher.publishAck(
command.getCommandId(),
"fc_" + frequency,
timeService.getMissionTime(),
AckStatus.OK);
}

private void handleAck(String deviceName, MqttMessage message) {
Expand Down
Loading