I am looking into hosting an external computer/microcontroller on board a copter with an APM. The goal is to provide vision assistance for the sparkfun AVC competition. I have looked into the commands and some arduino Mavlink examples, but I am still struggling with the implementation.
The idea is to have the APM run an autonomous mission but if a waypoint is specified(by the user) as a vision assisted waypoint it will look for an object while flying towards it. If an object is detected then the external computer will request to control the APM. If given control it will enter altitude hold mode, emulate RC controls, and fly the copter until the object is lost. Once the object is lost(hopefully popped in this case), the computer will start the mission where it left off (increment a waypoint), and give control back to the APM.
The external computer needs to handle the following Mavlink commands:
Send a heart beat
Request pitch of craft
Request altitude of craft
Request Current mission status(the current action the APM is autonomously executing)
Change flight mode
Send RC Commands
Start mission at specified point
If I read the documentation properly all these commands are supported. I am just not sure how to implement them in arduino. I only understand the heartbeat.
Does anyone have any advice or some example code involving using an external computer to control the APM/Pixhawk over Mavlink? Or is there a way to see Mavlink packets that are being sent between the ground station and APM?
The computer can currently track objects and has the logic to emulate RC control if you're wondering.