Logging Arbitrary Data Persistently
{% hint style="info" %}
In most cases using ROS topics and printfs
should fulfill your logging needs. This serves as a reference for rarer and specific logging needs.
{% endhint %}
You can also store application information on the Skynode's SD card. This is useful to save any arbitrary data and have it persist beyond the lifecycle of the app. By default, the app container's /data
directory serves as a mount point for that app's data directory on Skynode, which is located in Skynode's /data/app/<app-name>/data
directory.
For instance you can create a text file to retrieve later on Skynode by implementing the following in your application:
```cpp
include
include
int main() { std::ofstream outputFile("/data/my_file.txt"); if (outputFile.is_open()) { outputFile << "Hello, File!\n"; outputFile.close(); } return 0; } ```
With the app installed and running, you can SSH into Skynode and retrieve this file at any time:
bash
root@skynode$ cat /data/app/com.auterion.example-app/data/my_file.txt
Hello, File!
Mounting Other Volumes
The default volume mount for applications is /data/app/<app-name>/data:/data
, but you may configure your own volumes in the auterion-app.yaml
configuration file of your app.
{% hint style="info" %}
Adding any mounted volumes override will also delete the default/data/app/<app-name>/data:/data
mount. If you wish to preserve this volume, you must then specify it again manually.
{% endhint %}
```yaml auterion-api-version: 3 auterion-app-base: v2
app-name: example-app app-author: com.auterion app-version: 0.0.1 target-platform: [skynode, skynode-s]
services: example-app: build: .
Add the override below to specify the volumes to mount
compose-override: services: example-app: volumes: - /data/app/com.auterion.example-app/data:/data # Preserve default volume mount - /skynode/path:/app/path # Add another volume mount ```
In this configuration, you can store data within your app in either /data
or /app/path
, and those files will be remain accessible on Skynode at the corresponding mount points.
Comments
0 comments
Please sign in to leave a comment.