You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/services/ftp.md
+36-6Lines changed: 36 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -508,6 +508,26 @@ The sequence of operations is:
508
508
509
509
The GSC should create a timeout after the `RemoveDirectory` command is sent and resend the message as needed (and [described above](#timeouts)).
510
510
511
+
## Virtual Directory Entries (Directory Alias)
512
+
513
+
MAVFTP supports the concept of "standard" virtual directories for storing particular types of data in a flight-stack-independent and file-system-independent location.
514
+
This allows a GCS to provision or fetch data without having to know how or where it is stored in the target component.
515
+
516
+
::: info
517
+
MAVFTP represents storage on a remote component as a single entity accessible via a directory structure that the protocol exposes.
518
+
In order to represent multiple physical drives supported by the component, such as "c" or "d" drives, these can be abstracted to this structure.
519
+
Similarly, in order to support virtual directories, components must abstract the syntax that indicates their location, and map it to their physical file system(s).
520
+
:::
521
+
522
+
In the [MAVLink FTP URL Scheme](#mavlink-ftp-url-scheme) a virtual directory is specified using the `@<directory>` prefix, such as `@MAV_LOG` for log files.
523
+
When encoded in the [FILE_TRANSFER_PROTOCOL](#FILE_TRANSFER_PROTOCOL) this prefix should be prepended when a path is being specified.
524
+
For example, when [Listing a directory](#list_directory) the request might encode `data[0]` as `@MAV_LOG/path_in_log/`, and the recipient would be expected to map this to the underlying file system.
525
+
If the full path including virtual directory is not known, the recipient would NAK with [FileNotFound](#error_codes) (this is just another "not found" error case).
526
+
527
+
The following standard directory locations are defined:
528
+
529
+
- `@MAV_LOG`- Log files
530
+
511
531
## Implementations
512
532
513
533
The FTP v1 Protocol has been implemented (at least) in PX4, ArduPilot, QGroundControl and MAVSDK.
Everything is run by the master (QGC in this case); the slave simply responds to packets in order as they arrive. There’s buffering in the server for a little overlap (two packets in the queue at a time). This is a tradeoff between memory and link latency which may need to be reconsidered at some point.
546
+
Everything is run by the client (QGC in this case); the server simply responds to packets in order as they arrive.
547
+
There's buffering in the server for a little overlap (two packets in the queue at a time). This is a tradeoff between memory and link latency which may need to be reconsidered at some point.
527
548
528
549
The MAVLink receiver thread copies an incoming request verbatim from the MAVLink buffer into a request queue, and queues a low-priority work item to handle the packet. This avoids trying to do file I/O on the MAVLink receiver thread, as well as avoiding yet another worker thread. The worker is responsible for directly queuing replies, which are sent with the same sequence number as the request.
529
550
@@ -538,28 +559,37 @@ The CRC32 algorithm used by MAVLink FTP is described in [MAVLink CRCs](../guide/
538
559
Resources to be downloaded using MAVLink FTP can be referenced using the following URL-like format:
539
560
540
561
```txt
541
-
mftp://[;comp=<id>]<path>
562
+
mftp://[;comp=<id>][/@<directory>]/<path>
542
563
```
543
564
544
565
Where:
545
566
546
-
-`path`: the location of the resource on the target component.
567
+
-`path`: the location of the resource on the target component and/or in the virtual directory.
547
568
-`id`: target _component ID_ of the component hosting the resource.
548
-
The `[;comp=<id>]` part is optional (if omitted, the resource is downloaded from the current component).
569
+
The `;comp=<id>` part is optional (if omitted, the resource is downloaded from the current component).
549
570
It should be specified if the request must be redirected
571
+
-`directory`: A [virtual directory](#virtual-directory-entries-directory-alias) on the target source.
572
+
The `@<directory>` part is optional (if omitted, the resource is downloaded from the "normal" directory path).
550
573
551
574
For example:
552
575
553
576
- A GCS connected to an autopilot might download a file using the following URL:
554
577
555
578
```txt
556
579
## FTP resource 'camera.xml' from current component
557
-
mftp://camera.xml
580
+
mftp:///camera.xml
558
581
```
559
582
560
583
- A GCS connected to an autopilot through a companion computer might host the metadata on the companion (e.g. due to lack of flash space, faster download or if there's a central MAVFTP server on the vehicle), so it would need to specify the component ID of the component running on the companion (e.g. 100 for the camera), so that the request is redirected:
561
584
562
585
```txt
563
586
## FTP resource '/info/version.json' from component with id 100
564
-
mftp://[;comp=100]/info/version.json
587
+
mftp://;comp=100/info/version.json
588
+
```
589
+
590
+
- A GCS wanting to download a log might use
591
+
592
+
```txt
593
+
## FTP resource '2024.log' from @MAV_LOG virtual directory
0 commit comments