MotorTest client
To test motors, request the IMotorTestClient microservice from a device instance.
var motorTestClient = device.GetMicroservice<IMotorTestClient>()
?? throw new Exception("No motor test client found");
Usage
Retrieve the list of testable motors from the connected device and read their telemetry:
// Access telemetry for each test motor
foreach (var motor in motorTestClient.MotorFrames)
{
Console.WriteLine($"ID: {motor.Id}, Servo channel: {motor.ServoChannel}, PWM: {motor.Pwm}, Test running: {motor.IsTestRun}");
}
To run a test, first select a motor:
var testMotor = motorTestClient.MotorFrames.First();
// Start a 10-second test of the selected motor at 50% power
var ack = await testMotor.StartTest(50, 10);
if (ack.Result != MavResult.MavResultAccepted)
{
Console.WriteLine($"Test for motor #{testMotor.Id} has started");
};
// Stop a test
await testMotor.StopTest();
Refresh the available motors if the vehicle configuration changes:
// Refresh
await motorTestClient.Refresh();
IMotorTestClient (source)
Property | Type | Description |
|---|
TestMotors
| ReadOnlyObservableList<ITestMotor>
| Testable motors with telemetry support. |
Method | Return Type | Description |
|---|
Refresh(CancellationToken cancellationToken = default)
| Task
| Updates TestMotors collection when the vehicle type changes. |
IMotorTestClient.Refresh
Parameter | Type | Description |
|---|
cancellationToken
| CancellationToken
| An optional token to cancel the operation. |
Implementations
Vehicles controlled by different autopilots (e.g., ArduPilot, PX4) provide their own implementations of IMotorTestClient and ITestMotor:
Last modified: 17 November 2025