-
Notifications
You must be signed in to change notification settings - Fork 0
Writing Drone Telemetry to an In Memory Database
The SQL capture implementation makes use of Entity Framework Core.
The TelloCommander.Data namespace includes a collector that hooks into the DroneStatusUpdated event provided by the status monitor and writes status information to a SQL database.
The TelloCommander.Data.InMemory namespace includes a database context and associated factory for writing telemetry to an in-memory database. It's envisioned primarily for use in unit testing but could be used for capture to a transient in-memory database, if required.
Table | Description |
---|---|
Drones | Contains a text description of each drone for which a session has been recorded. Each drone may have multiple sessions |
Sessions | Each session record acts as a named "container" for the data points it contains |
Properties | Named properties captured from the drone e.g. "h" for height |
DataPoints | The values for data points captured in the associated session |
Errors | If any exceptions are thrown during telemetry capture, they are logged to this table |
The "Start" column on the session record is of type Date(Time) and gives the starting date and time for the session. The "Time" column on the data point record gives the time after the start date, in milliseconds, when the data point was recorded.
To implement in-memory capture, reference the TelloCommander.Data and TelloCommander.Data.InMemory assemblies and include the following using statements:
using TelloCommander.Data.Collector;
using TelloCommander.Data.Entities;
using TelloCommander.Data.InMemory;
using TelloCommander.Interfaces;
using TelloCommander.Status;
The following code segment will capture the height of the drone at 1 second intervals over a 1 minute period:
TelloCommanderDbContext context = new TelloCommanderDbContextFactory().CreateDbContext(null);
IDroneStatusMonitor monitor = new DroneStatusMonitor();
TelemetryCollector collector = new TelemetryCollector(context, monitor);
monitor.Listen(0);
collector.Start("TELLO-1234", "My-Session", 1000, new string[] { "h" });
Thread.Sleep(60000);
The fourth argument to the collector.Start() method is an enumerable collection of property names for the properties to collect. null may be passed in its place to collect all drone telemetry properties.
The data can be queried using the public properties of the TelloCommanderDbContext instance.