So, here’s what I would do.
- Inspect the IRLock interface in AP_IRLock library. As you can see in AP_IRLock.h it’s a PX4-middleware dependant feature.
- Look into the implementation of AP_IRLock_PX4. It’s pretty obvious what’s going on there, namely the driver reads a
struct irlock_s
from file descriptor obtained from PX4 Middleware stack. This struct is the only thing that really matters. We need to populate it somehow. - How it’s populated? That’s a good question! The answer lies in an another repository. Apart from boilerplate code the driver is extremely small (less than 100 LOC).
- Take a look at
read_device
method. This is where all the meaty stuff at.
These links should help too: official IRLock docs and ArduPilot docs on that matter.
If you’re feeling adventurous, you can also come up with a isolated IRLock example like this one. This would be great for the community and also would make it easier to debug the driver.
This is a rough step-by-step tutorial what and how can it be implemented.