I have a questions relating to servo setup and activating a servo (a camera trigger) when loitering at a point:

I’m practicing the following mission: I like to get to a WP, loiter 2 times. During this loitering I like to activate a servo (from low to high). After the 2 turns to switch off the servo (1000) and go to the next WP.

In the mission planner I’ve set it like this, but the servo was not activated at the WP:

Can you please correct me, what I’ve missed?

Thank for helping,


Views: 807

Reply to This

Replies to This Discussion

Lots of questions!

OK, let's solve one problem at a time. 

Do you have HiL? X-Plane? Flight Gear?

Load the attached missions script.

Your airport is TX35. 

If you have trouble launching with your model, lift off manually, then switch to auto.

Here is me running the circuit:

The servo gets set immediately after the plane enters WP#3's circle. The servo gets turned off as it exits the loiter and hits WP#6. This is just one example of how this can be done.


Sorry, I normally have much prettier circles.... I am messing with my HiL code, and messing with a new plane I made in X-Plane, and I stopped doing that so I could answer your question, so I have an ugly flight path. I hope you'll understand.... since otherwise I could have spent a few hours finishing my plane to give you pretty lines.... 

Hi Mike,

Thanks for the effort, you are great.

Your lines are really OK, better than my lines (-:

I don’t see the difference between our programs.

I execute my flight mission and the servo didn’t got “on”

Any ideas?




Add a couple of (at least one) waypoints before the DO_SET_SERVOS and drop the CONDTION_DELAY. It isn't needed, and it adds complexity. Make sure you do not "begin" inside of the WP that happens just before your DO_SET_SERVOS. You should fly into the perimeter of the WP that triggers your DO_ ... commands. 

Try my mission in HiL, or copy the basic pattern I did, and your servo will work.

Can you test your servo separately, make sure it accepts PWM of 2000? I used 1600 and 800 for testing. Works like a charm. 

Let me know how your testing goes. If you are not already using HiL, I highly encourage you to set it up. FlightGear is free. X-Plane is nice. It is a good way to test your missions without risking your plane, or taking a long time to fly. 

Hi Mike,

I believe I did already what you recommend.

Actually, the servo was set only at the 3rd WP…

I’ll change the PWM to see if there is any effect.

I’m not working with HiL. I’ll buy the X-plane, I hope it will not be too complicated to set it up.

Please give me some time, I’ll check and let you know….

Thanks for helping,


Hi Itzik Somehow ended up with a freind request from you.  I noticed your intent to acquire X-Plane.  Be advised from my own experience that this Ver 10 requires great processing power - at least - a 2-core 3 gigaherz computer, gobs of RAM, a game level video card with at least 4 Mb of memory, and the expertise to allocate the reasources of the card and hard drive to meet the needs.  You will also need joystick with multiple switches and rudder pedals. (or a 3-axis joystick) until you get the loop closed through your A/P and can use your Tx controls.   It is on 10 CDs which (9 not necessary) takes about 5 and 1/2 hours to load.  Load only CD number 1 (about 25 minutes).  Learning is a challenge.

Strongly recommend before buying that you download the free, 185 page X-Plane manual http://www.x-plane.com/files/manuals/X-Plane_10_Desktop_manual.pdf) (and see what is involved - then make an informed decision  on buying the program.. Also-it used to be possible to get a free copy of Disk number 1 which is all you need. the other 9 are for scenery around the world.

My gut feel is that you can figure out a solution to your problem many days earlier than you can get the loop closed around X-Plane - depends of course on power of your computer, your budget,  and your CS background.


Mike Cowan

I do agree, X-Plane is a lengthly process to setup, and X-Plane 10 (I have both, but use X-Plane 9) has a lot of data. And FlightGear is free and has some advantages over X-Plane 9 for most APM users (unless you are designing/testing your virtual airplane) 

The main reason I recommend setting up some form of HiL is that:

1) it is a great way to test your mission logic

2) while SitL is superior for PID and flight performance prediction, it does not allow hardware testing (i.e. developing and testing additional hardware sensors, fine tuning servo, relay, camera gimbal, and antenna tracker actions. HiL is also easier for most users to setup than SitL, at the moment.

3) once you have set up HiL, you can save your plane from costly mistakes by always running new missions in simulation. It is faster, cheaper, and it makes nice movies, too.

I do believe that Itzik can figure out the issue without simulation. The provided mission example works just fine for me, and he can adopt adapt it. But if he sends me his mission script, I can run it in HiL, without even changing the lat/long, and I can test his script and send him a working copy. ;) Which brings me to #4:

[there is a bad WP placement in the original script which makes the auto-takeoff not work so well. I was working on some other HiL stuff for another member, and messed it up. Just hand launch, or ask me and I'll give you a better auto-lanch. If you want to know what I was working on, see http://diydrones.com/forum/topics/change-loiter-radius-from-waypoin... ]

4) Users flying in different parts of the world can exchange missions scripts and fly them in simulation, using different plane models and test for logic, general parameters like distance between WPs, angles of incidence, turn radius, different flight speeds (for timing external equipment) and many more things.



While I agree that a joystick is helpful if you want to fly in X-Plane as a video game, if you have an APM and a TX, you don't need it. I've been using X-Plane for a long time, and I haven't owned a joystick for .... 20 years? Maybe more. 

Right - HIL can't be beat for versatility.  I am not familiar with HiL. Is this the National Systems product or do you have a link to HiL handy?  Thanks


Mike Cowan

HIL = Hardware In the Loop.  Mission Planner supports this with Flight Gear and X-Plane.  I'm pretty happy with Flight Gear by the way.  A little less polished, but has better flight model options.

Thanks Mike, I was suspecting that this is what is going to happen, glad you’ve saved my…. Trying to install the X-plane.

Do you guys know how do I active output ch’ from the planner (without using CLI) for bench testing
Jace, Flight Gear is easy to install?

Thanks for helping,


Reply to Discussion


© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service