I would like to map a button on my joystick to take single pictures and store them locally on the companion in full resolution (the video streamed to surface will be lower resolution than camera is capable of).
I do not believe this is really doable through joystick.cpp in ardusub, so instead I planned on making a python script that ran on the companion that would intercept the ‘MANUAL_CONTROL’ messages that include the joystick inputs from QGC.
so essentially this would mean both things (my script and joystick.cpp) would be handling the joystick inputs in parallel. While that’s obviously not ideal, it would be good enough for now if I set the buttons I want to use to disabled or an unused custom in QGC.
I was able to get this to work just fine in SITL; however I’ve not been able to get it to work with the actual ROV. I believe this is due to me making the mavlink connection incorrectly, so now I will post some details of it:
snippets of my python script :
master = mavutil.mavlink_connection('udp:0.0.0.0:14550') master.wait_heartbeat() . . . while True : msg = master.recv_match() if not msg: continue if msg.get_type() == 'MANUAL_CONTROL' : js_buttons = msg.buttons
and then my mavproxy options have :
--out udpin:localhost:9000 --out udpbcast:192.168.2.255:14550 --out udpbcast:192.168.2.255:14551
I found that I could not a heartbeat when connecting to either of those (presumably bc they were already in use) so I tried adding a
--out udpbcast:192.168.2.255:14552, and then connecting to that instead. At which point I was getting a heartbeat, but it was not getting the input messages.
I’ve also considered making this in a mavproxy module, but it seemed like it was not updating often enough when I put the contents of the
while true into the
idle task function, and I believe it might just be better practice to keep it separate.
Hopefully this will be as simple as adding an endpoint somewhere and pointing my script to it!