NAV

Copy Files Between Payloads Tutorial

Complexity: Easiest
Payloads: SABERTOOTH & SDR
Windows: PAYLOAD_SABERTOOTH

This tutorial demonstrates how to schedule the transfer a file from one payload to another on a satellite. It makes use of the copy_from parameter on the window object for the file copy remote source and local destination. This tutorial has no accompanying code - all commands are provided in the windows definition below.

Prerequisites

All tutorials require the steps outlined in the Getting Started Guide.

Steps

The scheduled window will:

  1. Before window start:
    1. Power up the SDR payload
    2. Power up the SABERTOOTH payload
    3. Copy SDR:/persist/bin/entry.sh to SABERTOOTH:/sdr_file
    4. Power down the SDR payload
  2. At window start:
    1. Run /persist/bin/entry.sh
    2. /persist/bin/entry.sh runs:
      1. mv /syslog /outbox/sdr_syslog for download to AWS S3
  3. At window end 60 seconds later:
    1. Power down the SABERTOOTH payload

Schedule Payload Window

HOST="https://api.orb.spire.com"
AUTH_HEADER="Authorization: Bearer YOUR_AUTH_TOKEN"
SAT_ID="YOUR_SAT_ID"
START=$(( `date -u +'%s'` + 86400 ))

curl -X POST ${HOST}/tasking/window \
-H "${AUTH_HEADER}" \
-H "Content-Type: application/json" \
-d @- << EOF
{
    "type": "PAYLOAD_SABERTOOTH",
    "satellite_id": "${SAT_ID}",
    "start": ${START},
    "duration": 60,
    "parameters": {
        "copy_from": [
            {
                "src_payload": "SDR",
                "src_path": "/persist/bin/entry.sh",
                "dst_path": "/sdr_file"
            }
        ],
        "user_command": {
            "executable": "/persist/bin/entry.sh",
            "executable_arguments": [
                "mv", "/sdr_file", "/outbox/sdr_file"
                ]
        },
        "downlink_budget": 1
    }
}
EOF

Response:

{"data": {"id": "d25c7a43-b70d-4f57-81d5-ff5177b26158"}}

At this point the file has been queued for upload at the next possible contact.

Review

Once the windows have completed and enough time has passed for the file to download, we can review it in AWS S3:

$ aws s3 ls --recursive s3://user-s3-bucket/a/directory/${SAT_ID}/downlink/

2021-09-06 04:32:29          0 2021/
2021-09-06 04:32:29          0 2021/09/
2021-09-06 04:32:29          0 2021/09/06/
2021-09-06 04:32:29       2568 2021/09/06/20210906T043229Z_sdr_syslog