How to set up a custom Mavlink message?

So, I have read the tutorial here: http://dev.ardupilot.com/wiki/code-overview-adding-a-new-mavlink-message/

I have successfully set up the .xml file and generated the .h file, but I am confused about what exactly I should do in the main vehicle code to send it. Since it is just a custom message, any sketchy but working solution is fine.

Also, since I am trying to send the data from a custom made lidar back to an onboard raspberry pi, how to make sure that I send the message at at least 20hz or something? Looking at the output of the raw Mavlink messages already existed (via Dronekit), they seem to be sent at a much lower rate than 20hz.

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

Join diydrones

Email me when people reply –

Replies

  • Is there a reason you need to use a custom message? there's already a mavlink message for lidar sensors - DISTANCE_SENSOR.

    Take a look at the .\libraries\AP_RangeFinder folder of the APM source code. There's plenty of examples of lidar systems in there.

    • I am going to use lidar to do 3D scanning, so in addition I will need the information from two servos that control the mirror that spins the laser. Therefore I want to create a new custom message to group these info (along with another ultrasonic sensor reading and an index) together so I can access it via Dronekit more easily. However, it seems that I will still have to make a parser to read the raw mavlink messages, not sure if there is an easier way to do that. Also importantly, I want it to be sent at 20hz or above for obvious reasons. Thank you.

      • Sending of mavlink messages is limited to a maximum of 10Hz in APM.

        Since you've got an on-board Rasberry Pi, it should be easier to just connect the lidar directly to it and let Dronekit read the data from there.

        • Developer

          you can send mavlink at up to 50Hz in ArduPilot now

          • I have written my own library to make things more flexible, so I thought it might be worth it to create my own custom message.

            Also, 50hz would be great if that is possible.

            But, back to my original question, what should I do in the main vehicle code (like Arducopter.cpp or GCS_MAVLINK.cpp) to send the message? Thanks!

This reply was deleted.

Activity

DIY Drones via Twitter
Review of the new Nivida Jetson NX for robocars https://t.co/bWjd3sH2o4
yesterday
DIY Robocars via Twitter
RT @chr1sa: My review of the new @NVIDIAEmbedded Jetson Xavier NX in robotics and @DIYRobocars applications https://t.co/O7TfJZhiF9 https:/…
yesterday
DIY Drones via Twitter
RT @chr1sa: Somehow I missed this, but last week @Nvidia released a new version of its Isaac robot development framework. Lots of new Lidar…
Monday
DIY Robocars via Twitter
RT @Smartphone89: DonkeyCar Racing League Korea #donkeycar @diyrobocars https://t.co/mDlHDR1d98
Friday
Jørn Ramnæs liked VIDEO LINK's profile
Friday
Mark Harrison left a comment on Moderators
"Wow, Ning2 looks really great on mobile. I had sort of drifted away as my browse-time went more on my phone, so this is great."
Friday
Hank Deucker left a comment on PIXHAWK
"I am sure most will say not again, Pixhawk telemetry. I do need help and all can be reassured that I have spent many hours scouring the net for useful information. I am not new at quadcopter flying, I started in 2012 and have progressed through many…"
Thursday
DIY Robocars via Twitter
https://t.co/rLmFr8M2UK
Thursday
Hank Deucker left a comment on PIXHAWK
"Tomorrow, I am thinking about the wording at the moment."
May 28
DIY Drones via Twitter
Welcome to the new DIY Drones design!. You may have noticed that DIY Drones looks a little different today. That's… https://t.co/cg2EmeDGMQ
May 27
DIY Drones via Twitter
New! Online Training on Drones for Disaster Response https://t.co/brqRuujjY2
May 26
DIY Robocars via Twitter
https://t.co/8EMCvYW6oz
May 25
DIY Robocars via Twitter
RT @OttawaAVGroup: We are going to try something new this week. We will be having a drop-in style meeting Wednesday @ 7-9pm EST. Pop in and…
May 25
DIY Robocars via Twitter
RT @tawnkramer: Thanks Everyone for another fun virtual race! Amazing Ai racers competing head-to-head, Virtual Makers Fair event. Catch us…
May 23
DIY Robocars via Twitter
RT @make: Find out the latest from @diyrobocars at 10am PT from @chr1sa of @3DRobotics on Virtually Make Faire! #makerfaire #maketogether #…
May 23
DIY Robocars via Twitter
RT @Heavy02011: Join us Saturday online: Virtual Race League: @DIYRobocars Race #2 - Parking Lot Nerds https://t.co/aJUu4sdutx #Meetup via…
May 22
More…