LibrePilot Forum

Users => Vehicles - MultiRotors => Topic started by: Donny on August 17, 2018, 10:43:34 am

Title: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: Donny on August 17, 2018, 10:43:34 am
hello all developers and experts:

     I meet some about kalman(ekf) algorithm problem on revolution board and hope you can provide suggest and some way, thank you very much in advance. :)

    First, i introduce my hardware configure to you: revolution + on board only  mag sensor + GPS of NMEA data protocol + sbus remote control input, you can detail look from attachment [revolution_hardware_config.png]. And the software release version is 16.09.

    I had completed all sensor calibration and all sensor state or alarm is green or good.

    When i set algorithm to basic(complementary), the autopilot is horizontal and aircraft is still. it looks very good.

    When i set algorithm to complementary + mag, the autopilot also is horizontal and aircraft is still. it looks also very good.

    When i set algorithm to complementary + mag + GPSOutdoor, the autopilot also is horizontal and aircraft is still. it looks also very good.

   But when i set algorithm to INS13Indoor or GPS Navigation (INS13), the autopilot goes all over the place, it is not horizontal, but aircraft is still. I check all setting and redo configure,but this problem keep exist. :'( :'( :'(

   The algorithm INS13Indoor and INS13 is base of EKF, i doubt the default  P Q R variance martrix is incorrect, but i don't know how to set these parameters. so i hope you can introduce any way about them.

   I hope you can help find some problem about setting error lead this problem, thank you... :) :)

   About autopilot go all over the place, you can look picture from attachments.

   And i have uploaded my configure file to attachments.
 
thanks,
Donny.
 
   
 
   
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: TheOtherCliff on August 17, 2018, 11:19:15 am
Don't mess with the EKF P Q R.

A certain amount of level change in INS13 is normal.  INS13 uses the full 3D mag and so it gets some leveling information from both the accels and the 3D mag.  If it is sloped less than 10 degrees and has slight jitter, say less than 3 degrees, that is fairly normal.  If it is moving around more than that in a regular oscillation, that is usually caused by a bad mag calibration.

Beware that once mag calibration is started, it is always sampling.  Because of that beware that you should not set the aircraft down at any time during mag cal.  Beware that you really need to use RF telemetry (not USB) for mag cal.  Don't do mag cal close to your car or other large metal things.  It really takes two people to do mag cal.  One to run computer and other to do aircraft rotations.
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: Donny on August 17, 2018, 11:41:33 am
First thanks Cliff. :)

I understand your reply about mag calibration. i don't have opLink module to further calibrate mag sensor. but when i calibrate mag sensor, i move the aircraft one meter away from the ground and  i have complete mag calibration and mag error level is below 5%, it looks good.

I have buy oplink module from Amazon, i receive your advice. Please asks: Do you have other problem about this view?

thanks. :)
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: TheOtherCliff on August 17, 2018, 04:39:19 pm
In INS13, is the tilt less than 10 degrees with less than 3 degrees of actual jitter?
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: Donny on August 31, 2018, 08:55:14 am
Hi Cliff :),
   Now, I have  bought a NAZA GPS with  mag and connect by receive port at revolution board. And I calibrate aux mag sensor by oplink and away from mag source,example car, pc and so on. you can look the result after calibrated by the picture.
    But when i set algorithm to INSindoor,  autopilot has still gone all over the place.  please look my frame and provide some advice about the problem.thank you.
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: Donny on August 31, 2018, 08:57:38 am
 :)
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: Donny on August 31, 2018, 09:00:57 am
FYI
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: TheOtherCliff on August 31, 2018, 05:30:28 pm
If the GPS is mounted in back, then you have GPS mounted wrong.  Not because it is mounted in back, but because arrow on GPS points to rear.  You can fix this in Attitude->Magnetometer->AuxMagOrientation->Yaw by setting it to 180

Most DJI GPSs have cable coming out the front.  It makes sense if you think about it.
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: f5soh on August 31, 2018, 09:28:19 pm
Quote
But when i set algorithm to INSindoor,  autopilot has still gone all over the place.  please look my frame and provide some advice about the problem.thank you.
Using INSIndoor, jumping position in map is normal, without data from GPS sensor.
You should use INS13 instead and adjust correct Auxmag orientation as already reported.

Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: Donny on September 01, 2018, 05:13:12 am
I label the frame nose in the picture, please loot it <250-3-3.png file>.  my frame nose and GPS orientation is same.

In INS13Indoor, I reset Aux mag orientation yaw to 180, but all bargraphs show not zero. i think i don't need to adjust the orientation because they are same.

thanks your reply.
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: Donny on September 01, 2018, 05:23:41 am
i re-set aux mag orientation to [0,10,20], the bargraphs show zero.
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: TheOtherCliff on September 01, 2018, 05:32:35 am
The alignment bars must show 0,0,0 in all possible rotations.  Move it slowly around and you will probably see that you made it worse at some angles by setting orientation to 0,10,20.

If the GPS is mounted in front of the quad then it is rotated correctly, with GPS arrow pointing forward, and then the Aux Mag Orientation should be set to 0,0,0.  Do not set it to 0,10,20
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: Donny on September 01, 2018, 06:27:26 am
Hi Cliff:
     I re-mount GPS mast and mag, but the aug mag orientation Y axis show -6, and the orientation all are zero. how to fix the problem?
     
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: f5soh on September 01, 2018, 08:53:44 am
Bargraphs show the difference between the measured Mag vector by onBoard mag sensor and Auxmag sensor but your onBoard sensor is more disturbed so you cannot trust him completely.
After you set the Mag usage to AuxOnly, it can be used for navigation because is far away from disturbances sources :
- Lipo saver with permanent mag inside .
- Strong currents from motors/esc/power wires.

Of course calibration is also affected by the above magnetic sources.

With onBoard mag less disturbed, you should show something like that while rotating Quad in various orientations
(jump to 8:29 (https://youtu.be/o4V_ZGG0Hk0?t=8m29s)):

https://www.youtube.com/watch?v=o4V_ZGG0Hk0


Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: TheOtherCliff on September 01, 2018, 04:14:08 pm
   But when i set algorithm to INS13Indoor or GPS Navigation (INS13), the autopilot goes all over the place, it is not horizontal, but aircraft is still. I check all setting and redo configure,but this problem keep exist. :'( :'( :'(

"Autopilot goes all over the place" is the original problem.  When you say autopilot, I am guessing that you mean the Primary Flight Display; the box in the top left corner of the Flight Data page.

Leave the Aux Mag Orientation set to 0,0,0, and Mag Usage set to AuxOnly.  I assume the GPS is mounted in front of the quad.  Is that the place it is mounted?  If so, that means the arrow on the GPS is pointing forward and so the Aux Mag Orientation should be 0,0,0.  From the pictures, I see that the Revo is also mounted correctly if I assume the GPS is in front.

Added about mag calibration:
When you calibrate the mag, be aware that the GCS is always gathering data, not just when you push the button 6 times.  Move the quad slowly (at least 1 whole second) from position to position.  Do not set it on the ground at any time during calibration.  Calibration must also be done far away from metal things like cars, metal fuel tanks, metal beams in buildings, etc.  Calibration should ideally be done via telemetry, not USB, but USB may be OK for AuxOnly usage if you carefully keep the USB cable away from the GPS during calibration.

When using INS13, it is normal for the PFD to be tllted by as much as 10 degrees, and for it to wiggle as much as 3 degrees.  Is it worse than that?

Does PFD respond correctly?  Whild hilding the quad in hand, pitch the front down and PFD shows more brown dirt.  Roll left (left side down) to tilt the quad left, and the PFD should roll right.

If all this is working now, and the motors respond reasonably (zero throttle stick is motors off, low stick is low motor speed, etc.) I would test hover it outside.  Plug battery in and wait for 12 or more minutes (for GPS to download almanac) before first flight of the day.

If PFD still looks crazy to you, maybe make a video of it for us to see.
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: Donny on September 11, 2018, 04:20:49 pm
hello cliff:
  I have already upload my test movies to Youtube, the website is :https://www.youtube.com/watch?v=HlhBvxdkTeU
Donny
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: TheOtherCliff on September 11, 2018, 09:18:26 pm
The PFD tilt and jitter in that video are normal amounts.

I see that you are still running with 10 degrees of Aux Mag Orientation: Pitch.  You are using 0,10,0.  This should very probably be 0,0,0.  This orientation is relative to how the craft hovers.  If it hovers level and GPS/mag is mounted level, this needs to be 0,0,0 unless your GPS/mag is mounted with a tilt.  If mounted with a tilt, maybe you need -10 instead of 10, but I think that positive is correct.  The mount may be tilted, but it looks much less than 10 degrees.

The only time you should need Aux Mag Orientation pitch is if your quad has "race mount" motors that are mounted tilting forward, or GPS/mag mount is tilted.  In these cases the GPS/mag is not level when hovering.

I see and hear several problems.

I see and hear an oscillation at about 4Hz.  Are you running stock PIDs?  I suggest you go to stock PIDs.  Equally important is that you MUST set ESC signal protocol to PWMSync or PWM@490 for all banks that have an ESC connected.  Using PWM@50 makes it very sluggish to respond and hard to fly.  It also makes these 4Hz oscillations if you use default PIDs.  See the Output page for these settings.

I see a very slow and large movement oscillation building up.  This can be caused by the 0,10,0 previously mentioned.  Set it to 0,0,0.

I see that you are using DJI GPS/mag.  The DJI "smooths" the GPS data, which slows the information down.  This can cause a large east-west movement oscillation.  There is a patch to fix this.  Use the patched firmware.  It is 100% compatible with 16.09.  No settings changes or saving is needed.  I assume you are using LP version 16.09
https://forum.librepilot.org/index.php?topic=3012.msg21154#msg21154

You were getting some mag alarms when flying.  You should twist all your pairs/triplets of thick (high current) wires: battery to PDB, PDB to ESC, ESC to motor.

So:
- Save your settings before making changes, so you can go back if you want
- flash the patched firmware
- EKF to default values
- PIDs to default values
- Aux Mag Orientation to 0,0,0
- ESC signal protocol to PWMSync, PWM@490 (or faster, but not for example PWM@50)
- I really suggest PWMSync or PWM@490 at least for a test
- twist high current wire sets

Good luck.  Make another video and post your settings UAV file (File->ExportUAV...).
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: Donny on September 12, 2018, 04:34:05 am
Hi Cliff:
  thank you for your reply. :) :)
  I will compile code and flash firmware today, and upload test movie soon.
  I just try PWM@490, this effect is very good, the frame flight is steady than pwm@50 in cf algorithm. Because EKF algorithm update cycle is 490hz? I set pwm@400 ago,but it's effect is very bad, and the store of ESC tell me to need set default parameter, so i set pwm@50. why? i don't kown.
  thank you for your advice again.
Donny
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: TheOtherCliff on September 12, 2018, 05:56:29 am
490Hz is used because if you use normal servo pulses of 1.0ms to 2.0ms and you try to have 500 pulses at 2.0ms then there is no time for the pulse to be inactive since 500 times 2ms is 1.0s (the whole second is used up with "on time").  Be aware that this is the reason that it is recommended to use 1.0ms to 1.9ms; that leaves 0.1ms of "off time" when running at 500Hz.  PWMSync runs at 500Hz.
https://librepilot.atlassian.net/wiki/spaces/LPDOC/pages/12058743/ESC+Calibration

50Hz is bad because then the ESC response time is about 10 times slower than 490Hz.  You get oscillations with stock PIDs and very mushy response to sticks.

So is your problem fixed now?
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: Donny on September 12, 2018, 02:41:25 pm
Hi Cliff: :) :)
  I have already upload latest test movie to Youtube And the website is https://youtu.be/kizSoqO3fNA]https://youtu.be/kizSoqO3fNA
  The frame's firmware has updated according to your get me at website is https://forum.librepilot.org/index.php?topic=3012.msg21154
  And the frame's servo freq has set pwm@490.
  I have some problem about the movie that test today.
  1. the PFD is tilt before i armed the flight, but when i take off it and control it by remote control and land  earth, the PFD is horizontal. take off and land position is same. why PFD change? Because mag leave earth and get good data or else?
  2.last Saturday, i test VelocityRoam mode, result is the frame lose balance and fall. I see this mode and Position hold mode difference that it can position hold and control by remote control in body coordinate. I need note what?
  And today, i also test altitude hold, but the effect is not good. the test movie website is https://youtu.be/TZqGLLhss9U]https://youtu.be/TZqGLLhss9U
  Please look and tell some advice, thank you.
Donny
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: TheOtherCliff on September 13, 2018, 04:36:45 am
First, for your understanding, it is not necessary to set bank 4 to PWM@490
channels 1 and 2 (ESCs 1 and 2) are on bank 1
channel 3 is on bank 2
channel 4 is on bank 3
nothing is on bank 4 that I can see

Setting bank 4 doesn't hurt though.  This is just information.

That much tilt in PFD is close to normal.  I would not like it if it was any more though.  The tilt comes because INS13 uses 3D compass and actually gets some leveling information from compass, so it is accels plus compass for INS13 versus just accels for Basic (AttiEstAlgo).

I like your string!  :)  I have actually done that myself one time to make sure it could not fly away.  :)  Ahh I see now that you are using it to move the quad in PositionHold to see if it returns.

Did you see that your GPS went orange during flight?  You are flying in a challenging area for fine and accurate GPS signals.  There will be GPS signal reflections from the many hard surfaces, buildings and especially if there are any metal surfaces.  Tall buildings are bad two ways.  They can block GPS sats and they can reflect signals to make then incorrect.  Your flight looked fairly reasonable considering the GPS was dropping and adding satellites.  I suggest you try flying GPS modes one time in a grass field in the country, not city, just for a test (if that can be arranged).  Also, it is good to let GPS sit with power on for 13 minutes before the first flight of the day.  It downloads the "almanac".  You have a good GPS with 6 hour memory.  The very tiny cheap GPSs don't have this memory, but almost all other ones do.

Oh, and VelocityRoam is 100 times more fun than PositionHold.  When sticks are centered, VR is exactly the same as PH.  It runs the same code.  VR is so easy to fly.  Just release the sticks to let them center, and the quad stops moving (even in the wind).  Then you have as much time as you need to figure out how to push the sticks.  Just think like Stab1/Attitude mode when you fly VelocityRoam.  Left roll means move left.  Forward pitch means move forward.  Left yaw, rotate (pirouette/compass) left.  Throttle is vertical velocity, not vertical power and is much easier to work with.

Second video said you were using AltitudeVario, not AltitudeHold.  Throttle stick center should hold altitude.  Non-center is vertical velocity.

Try VelocityRoam and move sticks like Stab1/Attitude mode.  :)

I never use PositionHold flight mode or AltitudeHold thrust mode; they don't give any control.  I always use VelocityRoam flight mode or AltitudeVario thrust mode; they give hold or control, you decide.
Title: Re: About IN13indoor and Gps Navigation(INS13) problem on Revolution
Post by: Donny on September 13, 2018, 08:10:33 am
Hello Cliff:

  First, thank you for your reply. :) :)
  I'm in Beijing China, there is deny flight, so i need string to sure the frame is safe, of course, test also need it.
  I see gps signal change yellow from the test movie. At weekend , i will test frame in VR mode in grassland, after i will upload the test movies.

Donny