microsoft / AirSim

Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
https://microsoft.github.io/AirSim/
Other
16.39k stars 4.57k forks source link

MavLink (PX4 sitl) triggering camera #734

Open kjetilkjeka opened 6 years ago

kjetilkjeka commented 6 years ago

We're doing an application that requires the possibility of planning a mission from QGC with camera caputre. It seems like AirSim currently doesn't do anything with the corresponding MavLink message, would it be of interest to have such features up-streamed?

If my limited understanding of the codebase is correct it should be implemented in the handleMessage method of a subclass of MavLinkNodeImpl. Would MavLinkVehicle or a new class similar to MavLinkVideoServerImpl make the most sense?

sytelus commented 6 years ago

Which messages you are interested in handling? Currently we only handle actuator messages, i.e., how vehicle moves around.

kjetilkjeka commented 6 years ago

Since the HITL messages is implemented, and it's reasonable to use AUX channels for the gimbal the only new message i would like to implement is the CAMERA_TRIGGER message.

The PX4 tutorial for camera trigger states that if TRIG_INTERFACE = 3 the autopilot will send a CAMERA_TRIGGER over MavLink. This is the message i wish to react to. The desired behavior would be similar to starting and stoping a recording except exactly one frame would be stored per CAMERA_TRIGGER message.

kjetilkjeka commented 6 years ago

I've made this work but I'm no longer sure that using the CAMERA_TRIGGER message is the correct one. I've created an issue on the MavLink repo to hopefully get the correct message to use.

After i get a response from the MavLink guys, support in PX4 is the next step.

sytelus commented 6 years ago

Let us know how this goes. We haven't used these features yet... It would be great if you can submit a PR with your change!

sytelus commented 6 years ago

On related note, I just added Gimbal APIs in AirSim: https://github.com/Microsoft/AirSim/blob/master/docs/image_apis.md#camera-orientation-gimble