- Home
- Skills
- Agents & Orchestration
- Hardware-in-the-Loop Testing for Robots & Drones
Hardware-in-the-Loop Testing for Robots & Drones
Build HIL and SIL benches for embedded controllers: plant simulation, I/O emulation, fault injection and CI integration.
$39
Works with the AI Agents you already use
Hardware-in-the-Loop Testing for Robots & Drones
Example session with this skill installed
Setup an HIL test bench for an STM32-based motor controller. I need to test over-current protection and log the PWM response during a simulated rotor stall.
- Read your context and instructions
- Compiled the hardware-in-the-loop testing
I have outlined the HIL test bench architecture and the automated test script for your STM32 motor controller. This setup focuses on protecting your hardware while injecting the rotor stall fault.
HIL Bench Architecture & Test Script
| Component | Specification | Purpose |
|---|---|---|
| Controller | STM32F4 series | Target under test |
| Interface | NI-6008 or similar DAQ | PWM capture and Analog Current injection |
| Protection | Optoisolators + 10k resistors | Prevent high voltage feedback to STM32 |
| Plant Model | First-order DC motor model | Simulates RPM and Back-EMF based on PWM |
# test_motor_faults.py
import pytest
from hardware_drivers import PowerSupply, DAQ, Programmer
@pytest.fixture
def bench():
psu = PowerSupply(port='/dev/ttyUSB0')
daq = DAQ(device_id='Dev1')
prog = Programmer(target='stm32f4x')
psu.set_voltage(12.0)
psu.set_current_limit(2.0)
yield psu, daq, prog
psu.output_off()
def test_rotor_stall_protection(bench):
psu, daq, prog = bench
# 1. Flash latest firmware
prog.flash('build/motor_controller.bin')
psu.output_on()
# 2. Simulate nominal operation
daq.set_analog_output('current_sense_pin', 0.5) # 0.5A nominal
# 3. Inject Fault: Rotor Stall (Current Spike)
daq.set_analog_output('current_sense_pin', 5.0) # 5A stall simulation
# 4. Verify Response
pwm_duty = daq.read_pwm_duty('motor_pwm_pin')
assert pwm_duty == 0, "Firmware failed to cut PWM during over-current"
# 5. Log Telemetry
print(f"Shutdown latency: {daq.get_last_event_timing()} ms")
Next steps
- Review the electrical isolation requirements between the DAQ analog output and the STM32 ADC pins.
- Calibrate the plant model constants (resistance, inductance) to match your physical motor.
- Add a test case for brown-out recovery by cycling the PSU voltage to 3.3V during operation.
Connects securely to your tools. The creator never sees your data.
About this skill
Test the real flight controller and firmware before the real flight.
Build hardware-in-the-loop (HIL) and software-in-the-loop (SIL) test benches for embedded controllers (STM32, ESP32, Arduino, Raspberry Pi, Jetson, PX4/ArduPilot flight controllers) - plant simulation, I/O emulation, automated test scripts, fault injection and CI integration. Use when the user wants to test firmware against a simulated robot/drone/machine, automate bench tests, or catch timing and I/O bugs before field tests.
Includes an EXPERT.md reference (exact parameters, thresholds, failure diagnosis).
Acceptable use: civil and commercial applications only. Any military, paramilitary or weapon-related use is prohibited, as stated in the skill itself.
How to use
Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scanned
Verified clean today
- Passed all security checks, Safe to install