Mode client
To work with modes from the client side, request the IModeClient
microservice from a device instance.
var modeClient = device.GetMicroservice<IModeClient>()
?? throw new Exception("No mode client found");
You can enumerate available modes:
foreach (var mode in modeClient.AvailableModes)
{
Console.WriteLine($"Available mode: {mode.Name}");
}
Or request a mode change (the client populates MAV_CMD_DO_SET_MODE
and sends it via the Command Protocol):
await modeClient.SetMode(ArduCopterMode.Guided);
Subscribe to current mode updates (values are driven from HEARTBEAT):
var subscription = modeClient.CurrentMode.Subscribe(mode =>
{
Console.WriteLine($"Current mode: {mode?.Name}");
});
IModeClient (source)
Property | Type | Description |
---|---|---|
|
| List of all supported modes for the target system. |
|
| Current mode. |
Method | Return Type | Description |
---|---|---|
|
| Sends a mode change request to the target system. |
IModeClient.SetMode
Parameter | Type | Description |
---|---|---|
|
| Mode to set. |
|
| Optional cancellation token. |
Last modified: 09 October 2025