Servers by jDrones

MAVLink and Arduino: step by step


(Tim D) #61

Why does the mavlink library not include the 3dr radio packet?

(Juan Pedro) #62

Hi, Tim. Sorry, but I do not understand your remark. MAVLink is the protocol, 3dr is the physical radio link. They are at a different OSI level.

(Tim D) #63

The library is missing this file.

Where did you get the library from?

(Juan Pedro) #64

Ah! Now I get the point to your question. As you indicate, the zip file is not the complete library, it was the version of the library that worked for me at the very begining and it is enough for basic tasks and to gain selfconfidence.

I am planning to rewrite the full article to correct some errors, include some other topics and include the full v1 library. I expect I will have some time for this around August (this year)…

(repaer_dewov) #65

So in my project i want to send information from 2 sonar sensors (one in front and another at the back of UAV) to the autopilot. the schematic shows how i have connected my setup. im having the sonar sensors give its values into the arduino(A2 for front A3 for back) after which i want to use MAVLink commands (sent from the arduino Tx to the pixhawk Rx in telemetry 2 port) to either move the drone or stop it from moving. even just displaying the values at this stage would be enough. I wanted to know how to proceed. I seem to have issues trying to get anything to work together. the mavlink libraries cant be included since it doesnt exist even though i have it in the main arduino folder (C:\Program Files (x86)\Arduino\libraries) as well as the project directory (C:\Users\Dewov\Desktop\ArduMavlink\libraries). the arduino keeps showing that there is no file or directory with that name. i have tried using #include <mavlink.h> as well as #include <C:\Users\Dewov\Desktop\ArduMavlink\libraries/mavlink.h>.
I need to know how else do you get Mavlink Libraries into the arduino IDE. (importing ZIP and manually dint seem to work)
Also how do i send a MAVLink Message to the Pixhawk to make it stop? hold position or height hold.
Any help would be greatly appreciated. even if its just pointing me to other sources to read up on. (most of what ive been looking for seem to be old and outdated giving me the 404 page.)

(Xenopoulos) #66

Dear LeiroJuan,
thank you for PM to me your code! It was really useful for me.

(Juan Pedro) #67

Hi, @trovesmurf:

It looks that your main problem is installing the library in the IDE. Check this link, the third section and revert in case you continue having problems.

(repaer_dewov) #68

Hi @jplopezll,
Thanks for the suggestion! that was the issue and after a bit of trial and error. i got the libraries installed. i would like to follow up however with regards to what messages you can send through MAVLink in order to get the sensor inputs displayed on the screen constantly. at the moment i use Proximity from the Ctrl+F menu on mission planner to view the sensor inputs. example is shown below. i would like to know if there was a way of making it appear automatically or through as message i can send as a MAVLink message from the Arduino to refresh it every time it takes a sensor reading. Thank you once again.

(Mike S) #69

Hi @jplopezll
I want to say thank you for this. Its the best I have seen. I have been struggling with reading mavlink messages on the Arduino. Was basically making it more complicated.

I am actually going in the opposite direction. Basically going from the Teensy 3.5 as a controller with mavlink going to a GCS (APM Planner in my guess) over 3dr clones. Sending messages from the Arduino to the GCS is working like a charm but having some challenges going from the GCS to the controller is giving me headaches.

Just by way of letting you know where I am. I updated my code to your comm receive method and that helped. Thank you for that. I am able to send waypoints from the GCS to the controller but having a two problems that maybe you can help me with:

  1. I am using a joystick as a controller as opposed to RC. I was able to disable all RC inputs and the GCS is saying its transmitting a manual control message. But I am not seeing it on the controller side. Is there some other trick to get this to work?
  2. I can’t seem to set param values from the GCS to controller? How would you do that?

Any help would be appreciated it.


(Mike S) #70

Just by way of an update got manual_control messages to work by updating the mavlink library to the latest v1. Still can not figure out how to set_param from the ground planner to the teensy.