Setting up crop sprayer

Hello, I wanted to add a crop sprayer to my drone. Right now, I am controlling them using python scripts. To set everything up, do I just work as if its just a servo, or is there already a bult-in method?

There is sprayer support. did you read the wiki?

I read the wiki, but my doubt is if I am able to manipulate those parameters while using python scripts

The flight controller supports lua scripts (Ardupilot 4.0.6 required)
Or you can use python scripts on the GCS (i.e. pymavlink, dronekit or mavproxy)

@amilcarlucas Hello, so I have this doubt, I saw that I need to enable this parameter SPRAY_ENABLE, but I planning to only use dronekit script to control the drone, using mission planner just for monitoring purposes. My doubt is how can I set this parameter from scripts?because in the https://ardupilot.org/dev/docs/copter-commands-in-guided-mode.html, that list the mavlinks the copter accepts, I couldn’t find something for spray_enable, unless I just manipulate as a servo?

Yes, probably you need to manipulate is as a servo, yes.

So if I wanted to add this functionality,I would need to create it. After researching I thought of these steps,

  1. Make a MAV_CMD_DO_SPRAYER and SPRAYER_DO_SPRAYER and add them to this code https://github.com/mavlink/mavlink/blob/master/message_definitions/v1.0/common.xml

2.Add those to the code in https://github.com/ArduPilot/ardupilot/blob/master/ArduCopter/GCS_Mavlink.cpp#L676

Is that right @amilcarlucas ?

1 Like

Yes that is correct. You need to do a Mavlink upstream pull request, and a followup ardupilot pull request.

It is now in master, both auto missions and mavlink DO commands:

but be careful, ArduPilot/mavlink#195 is still missing

3 Likes

Hello, sorry, I didn’t understand

The stuff you wanted is done now, I edited the post above to clarify.

Okay, so should I wait for a while until Ardupilot/mavlink#195 is not missing?

Yes, I hope that one will go in in the next few days.

thank you, I will wait

Hello,
Is there a updated list of the mavlink commands copter accepts? the one from wiki still lacks the spray command

1 Like

No, the source code is the most up-to-date documentation.

ok,if I may ask, what is the link of github that shows the most up-to-date list of mavlink commands copter accepts?

The spray command is supported in Arducopter 4.1.0 beta 5

I got that, I wanted the up to date list of all the mavlink commands that are currently supported in copter

Then why post in the Copter 3.6 thread?