Re: YAW control to facing next waypoint not POI
« Reply #15 on: August 05, 2021, 09:59:36 am »
I must admit that the VelocityRoam looks like it is working fairly well.
I just banked left-righ and forward-backward.  During flight quad seems stable, I didn't noticed any problems but VR for me flying in this mode is a bit slow and "swings" (braking?)  when I put sticks to neutral positions.
Remember that in VelocityRoam you are commanding velocity in a particular direction.  The banking forward to speed up and banking backward to slow down is what it must do to do the speed changes that you are asking for.

I noticed that  but I think speed is reduced, too... How get rid of these "swings" in VelocityRoam when the sticks go to neutral position?
The swings are required.  It is braking to slow down.

How did you limit the roll/pitch response?  Using the Stabilization page response sliders?  That is the correct way, but again, I think at least part of the problem is slow response in Attitude mode.  I shudder to recall that some folks have detuned the PIDs in an effort to reduce the response.

Yes, using the stabilization page response sliders but IMHO respond in Attitude mode is quite fast. I can record a video to show how it fly in Attitude, what should I do during flight? Banking and move sticks to neutral? Leveling speed after flip in Rattitude? 
I can see that VelocityRoam mode is commanding the underlying Attitude mode to bank quickly and it is banking quickly and well.

AFAIK  VtolPathFollowerSettings->HorizontalVelMax is for speed only in pathplanner mode. RTB speed is in FlyModeSettings->ReturnToBaseVelocity. I changed this one but above 20 m/s I don't see any significant change in speed in RTB mode.
These VtolPathFollowerSettings speed settings are used by all GPS modes AFAIK.  I know that they are used in VelocityRoam.  They define what speed you get at full stick.

Wow 20m/s is pretty fast!  There are *MaxRollPitch bank angles in VtolPathFollowerSettings.  You may need to allow more bank angle to get more speed.

For me Attitude mode has annoying trend to drift away after leveling (when the sticks go to neutral) and quad wont's "stops"  as I expect - just slow drift away, how get rid of this? In GPS mode like GPSAssist or VelocityRoam when the sticks go to neutral quad "swings" (breaking?) , of course after it it perfectly stays in the position but those "swings" are  annoying, too...
Two things:  You must use reverse banking to get it to slow down to a stop.  Like you see VelocityRoam mode doing for you.  Attitude mode does not use the GPS, so the very best you could hope for once you get it stopped is for it to drift with the wind.  Most of the time, there is a fraction of a degree away from being perfectly level and it very slowly accelerates in that direction.

In Attitude mode it is just a thing sitting on top of a column of air.  If you walk up and push it, it will drift a long way.  There is nothing to stop it but drag with the air.  More likely, even a fraction of a degree away from level will cause a slow drift.

A general rule to follow is that you don't want to change the transmitter trims.  Not ever after you run the setup wizard.  For instance if you change the transmitter trims to keep it from drifting in Attitude mode, it will think it is being commanded to move slowly in that direction when it is in VelocityRoam mode (and other issues with other modes).  There is some deadband built in, so you may not see the drift if it is inside the deadband.

Basically, all flight modes except the self-leveling, non-GPS ones (Attitude, Rattitude, WeakLeveling) do not ever need trim.  If they do, then something is bad wrong.

For the self-leveling non-GPS modes (Attitude, Rattitude, WeakLeveling) there is a thing called RotateVirtual... in Config->Attitude.  You adjust that, exacly like transmitter trims till your Attitude mode drift is minimized in a zero wind hover.  I can tell that it needs adjusting down to just 2 or 3  1/10th's of a degree.   For outdoors, when flying a drift test, rotate 180 degrees with yaw to make sure that there really is zero wind affecting it.

GpsAssist:  Once you get your Attitude mode drift trimmed out you can enable the GpsAssist function for that flight mode number in the FMS setup.  It will go into PositionHold when you center the sticks.

In the video, I don't see a problem with Attitude mode response.  It looks fast enough.

I confess that I fly 16.09 and not next because I have a lot of models all on 16.09 and I would have to convert them, including reconfiguring them, or have more field equipment like ground station OpLinks with the next firmware.

I have made 5 or 6 waypoint flights in the last few weeks, and I did notice that it didn't seem to get up to the configured waypoint speed for quite a few seconds.  I wonder if that is related to your issue.  It did look quite slow after it did the 180 in your waypoint video.  I remember some discussion of this as long as a few years ago.

Make sure that you have the mag source (I forget what it is called) set to "aux mag only", not "both" or "main board only".  This is more of a direction issue.  If you tell it to go straight forward in VelocityRoam and it goes a bit left or right of straight ahead, this is one fix.  The other is adjusting your mag (GPS) to point a little left or right, or doing the same thing with settings (aux mag board rotation - I forget what it called in the GCS GUI).

If you are interested, here are my raw notes (with some code change tracking links and forum posting links) about that RTB speed issue, which could affect all GPS flight modes, not just RTB.  And if waypoint flight does not achieve the configured airspeed, it will do the "error destination" thing (unless you have the error destinations set to -1, really -anything).
Code: [Select]
apparent high speed RTB if triggered from VelocityRoam
  https://forum.librepilot.org/index.php?topic=4466.msg30547#msg30547
  vgwit
    have flashed LP16.09_LP504_LP462 to have velocity correct. Now it's (velocity's?) fine.
    But ReturnToBase behaviour has changed. Now quad does not go straight up to AltitudeOffset
    but simultaneously does a considerable pitch toward base with acceleration.
    Then passes base point and still goes further several meters.
    Do I need to recalibrate sensors after firmware change?
  Quote from: TheOtherCliff on 2018-10-30, 21:36:19
    Did you find out the cause of this?  I am going to guess that you have
    VtolPathFollowerSettings Max Horizontal Velocity (or similar name) set
    very high.  Maybe VtolPFS max bank angle set very high.  Etc.  ?
  vgwit
    I haven't found out the cause but determined that this "strange" RTB is seen
    in case it is activated from Velocity Roam (probably from any GPS mode).
    And RTB works correct in case it is activated from Altitude Vario or
    Rate modes. Here is my today's footage. It contains 4 RTB passes.
  https://drive.google.com/open?id=1jiAI4SBINMby_NdnYtsZvq9oqfEcfWan
    (cliff saved 4RTB.avi as "Desktop/rc videos/4RTB failure of RTB only when it comes from failsafe.avi")
  (much later, a year?)
  I remember the video you made of the RTB speed issue.  I don't know if it has been fixed in next.
    https://forum.librepilot.org/index.php?topic=4619.0
  related
    LP-367 - Set Return to home velocity (looks merged into 16.09)
      https://bitbucket.org/librepilot/librepilot/pull-requests/293/lp-367-set-return-to-home-velocity/diff
    LP-203 - Fix velocities and 3D in pathplanner pathfollower (not fixed)
      https://librepilot.atlassian.net/browse/LP-203
  vgwit: The problem with RTH velocity looks the same on 16.09 and Next.
    [color=red]https://forum.librepilot.org/index.php?topic=4619.msg31292#msg31292[/color]
« Last Edit: August 05, 2021, 10:06:38 am by TheOtherCliff »

Marico

  • *
  • 37
Re: YAW control to facing next waypoint not POI
« Reply #16 on: August 05, 2021, 01:34:10 pm »
AFAIK  VtolPathFollowerSettings->HorizontalVelMax is for speed only in pathplanner mode. RTB speed is in FlyModeSettings->ReturnToBaseVelocity. I changed this one but above 20 m/s I don't see any significant change in speed in RTB mode.
These VtolPathFollowerSettings speed settings are used by all GPS modes AFAIK.  I know that they are used in VelocityRoam.  They define what speed you get at full stick.

So what for is FlyModeSettings->ReturnToBaseVelocity? Which one (VtolPathFollowerSettings->HorizontalVelMax or FlyModeSettings->ReturnToBaseVelocity) has real impact on RTB?

Wow 20m/s is pretty fast!  There are *MaxRollPitch bank angles in VtolPathFollowerSettings.  You may need to allow more bank angle to get more speed.

It explains why my ridiculous value set to 20 m/s has no real effect, I didn't changed MaxRollPitch bank... I thought bank angles are maintained automatically to meet desired speed...

A general rule to follow is that you don't want to change the transmitter trims.  Not ever after you run the setup wizard.  For instance if you change the transmitter trims to keep it from drifting in Attitude mode, it will think it is being commanded to move slowly in that direction when it is in VelocityRoam mode (and other issues with other modes).  There is some deadband built in, so you may not see the drift if it is inside the deadband.

I never do any regulations with trims, I keep them always set to 0. Some day I got confused when GPSAssist just refused to activate during flight. I spent 15 mins to figure out what's going on until realized that I accidentally touched roll trims and neutral values goes outside deadband range so GPSAssist was unable to detect neutral position and "lock in".


For the self-leveling non-GPS modes (Attitude, Rattitude, WeakLeveling) there is a thing called RotateVirtual... in Config->Attitude.  You adjust that, exacly like transmitter trims till your Attitude mode drift is minimized in a zero wind hover.  I can tell that it needs adjusting down to just 2 or 3  1/10th's of a degree.   For outdoors, when flying a drift test, rotate 180 degrees with yaw to make sure that there really is zero wind affecting it.

I tried all above and never get rid of little drifts in Attitude mode :( I have to fly with GpsAssist to get perfect posiotion hold.

Make sure that you have the mag source (I forget what it is called) set to "aux mag only", not "both" or "main board only".  This is more of a direction issue.  If you tell it to go straight forward in VelocityRoam and it goes a bit left or right of straight ahead, this is one fix.  The other is adjusting your mag (GPS) to point a little left or right, or doing the same thing with settings (aux mag board rotation - I forget what it called in the GCS GUI).

It's set to "aux mag only", and I have to set proper virtual mag board rotation, too. Without this quad just flips over on take off.

Re: YAW control to facing next waypoint not POI
« Reply #17 on: August 06, 2021, 01:02:00 am »
These VtolPathFollowerSettings speed settings are used by all GPS modes AFAIK.  I know that they are used in VelocityRoam.  They define what speed you get at full stick.

So what for is FlyModeSettings->ReturnToBaseVelocity? Which one (VtolPathFollowerSettings->HorizontalVelMax or FlyModeSettings->ReturnToBaseVelocity) has real impact on RTB?
I misspoke.  RTB does have it's own setting.  For VTOL, the GPS flight modes that don't have their own setting should use the VtolPathFollowerSettings->HorizontalVelMax

I recall that I have changed the max speed of VelocityRoam by changing HorizontalVelMax.  The whole stick range is affected, so if you make it too big, the sticks become very sensitive and a small amount of stick makes it go fairly fast.

Without looking at the code or just test flying, for RTB I don't know whether VtolPathFollowerSettings->HorizontalVelMax can limit FlightModeSettings->ReturnToBaseVelocity or not.  I know there are / have been some issues with GPS flight mode speed so the code might say to use it, but it still doesn't get used.   I don't know if FlightModeSettings->ReturnToBaseVelocity is used at all because I don't remember testing it or reading it's code.  I suspect it is not used at all in fixed wing since 2 m/s is too slow for many FW aircraft and I have played with RTB in FW.

For the self-leveling non-GPS modes (Attitude, Rattitude, WeakLeveling) there is a thing called RotateVirtual... in Config->Attitude.  You adjust that, exacly like transmitter trims till your Attitude mode drift is minimized in a zero wind hover.  I can tell that it needs adjusting down to just 2 or 3  1/10th's of a degree.   For outdoors, when flying a drift test, rotate 180 degrees with yaw to make sure that there really is zero wind affecting it.

I tried all above and never get rid of little drifts in Attitude mode :( I have to fly with GpsAssist to get perfect posiotion hold.

Even if the car is perfect and the road is straight, the car will not stay on the road without some correction from the driver (or the autonomous driving which is like our GPS flight modes).  Attitude mode is the same.

The best you can do is to remove any consistent drift.  If it usually drifts in one particular direction, the solution (with many assumptions like no loose motor, no cracked arm, well balanced props, ...) is to adjust RotateVirtual... as good as you can.  I can tell you that you should get down to 1 degree so that changing anything a degree in any direction makes it worse.  As I recall, I get down to about 0.2 degree before I am done.  If you have not got down to 1 whole degree or less, then I would guess that RotateVirtual... could be adjusted better.

A final note about balancing a multicopter:  If one side of the multicopter is heavier (camera, off center battery, etc.) and it doesn't balance in the center or if one motor is stronger/weaker or if one prop is different or if the ESCs are not calibrated the same, anything that has to do with thrust or weight not being symmetric, the PID will adjust for that and it will hover perfectly.  The farther away from hover you are, the more aggressive your flight, the more crazy it will be.  One way to see this is to hover and use just yaw.  A lot.  Full yaw stick one way, let it spin up to full speed.  Does it spin nicely like a top or does it wobble?  Full yaw stick one way, let it spin up to full speed and then full the other way.  Does it wobble badly?

As you build up the complexity pyramid with hardware on the bottom, simple flight modes in the middle and autonomous flight modes at the top, it works best to get all the low level stuff working well before moving on to the next higher level because that next higher level working well depends on the lower levels working well.

Some things can be adjusted for.  For example, if you have one motor that is stronger than the rest, you can adjust for it on the Output page by setting that motor's max to a smaller value and somehow measuring RPM or thrust to know how much smaller the max should be.  Some things can't be adjusted for.  They are things that suddenly cause a change.  A loose motor or cracked arm will go out of alignment more as the power is increased.  A bent arm that is otherwise strong or misaligned motor is not an issue.

Bad prop balance must be fixed.  There will be a certain RPM where the vibration is worst and it really starts to shake.  Somewhere in there the vibration starts to affect the sensors (accels and gyros) and it looks like you are giving it a lot of roll or pitch stick.  If you are seeing 5 G's of accel noise on the scope while hovering, you are on the line.  If it gets worse, there will be a problem even if there is not one right now.

I have found that for me (say 8000 RPM at full power) rubber anti-vibration mounts for the FC actually make this worse because there is a place where the rubber anti-vibration mount rings like a plucked guitar string and when your motors hit that speed, it gets bad.  You are running higher RPM motors, so it may be OK if you use these.