MavLink Protocol for on board Computer

Hi,

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)

Request control

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.

Thanks,

Daniel

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Hey Daniel.
    I recognized, meanwhile you realized the precision landing on another type of companion computer.

    I am working on a precision landing procedure as well (unfortunately I just noticed your project this week). I am currently working on some issues you might fixed before.

    The Arduino sends the RC commands to the Pixhawk using the MAVLink message rc_channels_override. I read that the override is only possible in Guided mode, but my tests with ArduCopter V.3.2.1 show, that Pixhawk also gets controlled by these commands in Stabilize or Alt_Hold mode. I want to switch between a "controlled-by-arduino"- and "controlled-by-remote-control"-mode. I don´t wan´t change the Pixhawk flight control stack. Is is possible to simply parametrize Pixhawk / the flight modes for this task?

    Thanks,
    Stephan

  • Is there a way for me to get sample code from you?

  • Yeah I went with a higher level software called droneAPI and used it with mavproxy and python scripting. Hope that helps.
    • Raspberry pi. I would recommend something more powerful if you plan to do vision tracking. I maxed out my raspberry pi while it was over clocked to 1gHz. It was only able to achieve a speed of 2hz image processing rate. This also caused drone api to malfunction. Didnt have time to find out why it malfunctioned. I only know it happened at heavy processor and memory usage.

      Note: My code wasn't optimized but it was definitely pushing its limits.

      For something more powerful look at the odroid u3, banana pi, or hummingbird.
    • What kind of onboard computer do you use?

  • We work on that topic, any advance?

This reply was deleted.

Activity

DIY Robocars via Twitter
RT @SmallpixelCar: My car was able to go all the way autonomously until the crosswalk. It was only 100 yards from the target. What should b…
11 hours ago
Liam left a comment on Agricultural UAVs
"Hi
I'm Liam from T-MOTOR. I would like to reach out to see if there is any possibility for us to work together.
We are a propulsion system manufacturer who offers motors, propellers and ESCs for all kinds of drone applications which vary from secur…"
Wednesday
DIY Robocars via Twitter
RT @SmallpixelCar: Smart move. The car used the shadow to guide it through the bridge. This was never in the training samples. But it learn…
Wednesday
DIY Robocars via Twitter
RT @SmallpixelCar: Getting closer to the target. Single camera. Untrained road. https://t.co/Wsr7RwDamj
Tuesday
Richard Cox left a comment on Australia
"Anyone in the DIYDRONES Australian subgroup based in Alice Springs, NT?
I am experimenting with Ardupilot (standard Arduplane), Pixhawk 4 FC in a 4-ch
RC "AXN Floater Jet" foamy plane..."
Tuesday
Omar Sykes left a comment on Australia
"Hi everyone, I am looking for someone who is good at drone building, repair and software in Adelaide. Please give me a call on 0477 319 219."
Tuesday
DIY Robocars via Twitter
RT @RoboticMasters: #donkeycar https://t.co/czuLoVRcA4
Monday
DIY Robocars via Twitter
https://t.co/DKQbNTbz0g
Monday
DIY Robocars via Twitter
RT @RoboticMasters: Donkey car, car car car car car car; Donkey car, car car car car car car; Donkey Car. Anyone like our tiny tiny donkey…
Monday
DIY Robocars via Twitter
RT @SmallpixelCar: After improving DBSCAN speed, I can get 11 frame per second on @NVIDIAEmbedded Jerson Xavier MAXN mode and the autonomou…
Jun 26
DIY Robocars via Twitter
RT @Heavy02011: Join us at next Virtual Race League: ⁦@diyrobocars⁩ Race #4 - Parking Lot Nerds, August 1st https://t.co/5KUpu7VGaH
Jun 25
DIY Robocars via Twitter
RT @SmallpixelCar: #CUDA implementation should be easy, because most of the time is on distance calculations berween two points and if the…
Jun 25
DIY Robocars via Twitter
RT @SmallpixelCar: This is the view from the car. Even my lanenet inference is fast on @NVIDIAEmbedded Jerson Xavier, DBSCAN clustering tak…
Jun 25
DIY Robocars via Twitter
RT @SmallpixelCar: Ran my car in the park, with single camera and @sparkfun IMU. #TensorRT on @NVIDIAEmbedded Jetson Xavier. Lanenet one fr…
Jun 24
DIY Robocars via Twitter
RT @SmallpixelCar: Making progress on drive the car autonomously in my neighborhood. This run used single camera only. No other sensors. ht…
Jun 24
DIY Robocars via Twitter
RT @chr1sa: The @DIYRobocars/@donkey_car AI racers are getting *fast* in the simulator, in part because it's so well optimized for reinforc…
Jun 21
More…