jdl

  • ***
  • 246
CourseLock - how it's expected to work?
« on: April 13, 2017, 04:29:34 pm »
Sorry if the question is dull, but I cannot make CourseLock mode to work for me, neither for the quad, nor for the fixed wing.

I recently built a Wing Z-84 with Revo, uBlox7 GPS & Auxmag module. Radio Control & Telemetry via Oplink. The wing is flying very satisfactory in Manual (when not too windy), Attitude, Rate, AxisLock, PositionHold, ReturnToBase. Autonomous flight is working reliably.

Still, when I try CourseLock, I get behaviour similar to PositionHold...

What I expect from CourseLock is something like flying levelled, maintaining the altitude and the heading that the wing was at when CourseLock mode was engaged.

Is that correct?

And what I'm missing?


Re: CourseLock - how it's expected to work?
« Reply #1 on: April 14, 2017, 07:59:15 am »
First of all, for a GPS quad, I recommend VelocityRoam (GPS) as the analog of Attitude mode (non GPS).  VelocityRoam with sticks centered is exactly PositionHold.  Move any stick and it does what you expect.  Holding left roll makes it travel straight left for as long as you hold the stick.  Holding left yaw makes it spin in place.  Holding forward pitch makes it fly forward.  A little above half throttle and it climbs slowly (rate limited).  Almost zero throttle and it descends in a rate controlled fashion.  Zero throttle stops the motors.
https://forum.librepilot.org/index.php?topic=1805.0

I fly GPS quads all the time, but I have never actually flown CourseLock, and I only flew some GPS fixed wing stuff a really long time ago.  I took a quick look at the code and I think it does this for quads:  You must hold the stick (e.g. forward) for it to make progress (e.g. forward).  It is like VelocityRoam, but with CL if you start out pointed west then forward stick is always west (even if you yaw to face south), where with VR, forward stick is always forward.

I am going to make a guess that you want to use CourseLock for fixed wing if you want something like VelocityRoam for quads, and also that VelocityRoam is not designed for fixed wing because during PH the heading is all over the place.

So for FixedWing with CourseLock with stick in the middle, you get a random wander PositionHold.  If your course direction is west, then forward stick will move that PH position westward.  With a "proper" configuration (horizontal velocities set high enough) then (if course is westward) holding full forward pitch will not be a wander westward, but a straight flight westward and full left stick will fly southward.  At this point it pays to get your min speed / max speed configured correctly so that at medium stick it can fly straight but slowly instead of doing a faster wander.

Educated guesses, but try it out.  :)  If I am wrong let me know or someone else that has used it will post.

Re: CourseLock - how it's expected to work?
« Reply #2 on: April 14, 2017, 09:45:35 pm »
I got interested again and dug some more and I <think> this is the way it works, especially for quads.

AbsolutePosition says that forward pitch always moves north, and left roll always moves west.  With fixed wing and low speed you are just driving the PH point slowly and the aircraft will still do it's wander, but the center point of the wander will move.

CourseLock gets it's "course" when you switch into CL but otherwise acts like AP.  If you are pointed north when you switch into CL, it is exactly like AP.  If you are pointed west when you enter CL, then forward pitch is always west and left roll is always south.

With AB AP or CL, to make a circle left requires a very slow left circular motion on the roll/pitch stick (mode 2 transmitter sticks assumed).

For VelocityRoam, forward pitch is always ... forward; and to make a left circle, you hold constant forward stick and (small) left yaw.
« Last Edit: July 01, 2018, 12:07:42 am by TheOtherCliff »

jdl

  • ***
  • 246
Re: CourseLock - how it's expected to work?
« Reply #3 on: April 20, 2017, 02:13:00 pm »
TheOtherCliff, thank you very much for the time you spent to answer. Sorry for late reply, I was away for a week.

If you are right (and I'm sure you are), then this implementation of CL is useless for a fixed wing. It is almost useless (especially for me) for quad too, as I prefer to fly small (220) fast frame in rate mode primarily. My current 220 size long-range quad (with HD cam) has perfectly working autonomous modes but I use only RTB as failsafe option if the control link fails, and PH/VR before landing LOS in Attitude when the landing site is more challenging/risky to land FPV. Then the PH gives me time to safely took off goggles and spot the quad in the air.

What I hoped CL to be is an autonomous mode that drives the vehicle into the direction locked upon mode engagement, maintaining the altitude, WITHOUT any further pilot's interaction (no sticks input). Just like RTB does, except the locked-on-engagement direction and not waiting to reach any predefined point.

Re: CourseLock - how it's expected to work?
« Reply #4 on: April 20, 2017, 02:45:10 pm »
Again, I haven't used it, and I didn't spend enough time to trace through all the code.  I mainly focused on the quad code and not fixed wing.

As I suggested in another recent post, if it does work that way, then one solution would be to mix a knob into the pitch (elevator) on the transmitter, and once you engage CL, twist the knob to get the desired forward speed.  At that point it would be flying in the desired direction at constant altitude, at constant speed.  With a quad, you could rotate yaw to make a flyby video.  You could make minor adjustments with roll/pitch.

jdl

  • ***
  • 246
Re: CourseLock - how it's expected to work?
« Reply #5 on: April 20, 2017, 03:13:13 pm »
Thanks again :)

The workaround with the mix makes sense, I'll definitely try it. In fact, I already have similar mix in the transmter for the fixed wing - little up elevator on a knob - it helps me to hand launch the wing easier with no throttle (in attitide mode) and when already in the air, I simply apply enought throttle. Just have to reverse the direction of the elevator stick input for that mix and test CL with knob engaged.