iNavFlight / inav

INAV: Navigation-enabled flight control software
https://inavflight.github.io
GNU General Public License v3.0
3.18k stars 1.48k forks source link

Sparky 2 target? #538

Closed bazyl78 closed 8 years ago

bazyl78 commented 8 years ago

Any plans for Sparky 2 support in the future? Sparky 1.0 already done.

martinbudden commented 8 years ago

@bazyl78 , it would certainly be possible to make a Sparky 2 target.

I have no Sparky 2 hardware myself, so would you be able to spend some time testing it?

bazyl78 commented 8 years ago

I'm not very expierienced but can try.

martinbudden commented 8 years ago

You don't need to be a great pilot to test!

All we need you to do is build an aircraft with the Sparky2 FC and report back any problems so we can fix them.

You just need to do a bench test (no props), and if that works fine a flight test. And report back with any problems you have.

I'll start looking into making a Sparky 2 target.

anbello commented 8 years ago

@martinbudden I have a quad X 250 with sparky 2 and I can do some testing if you want. The problem is that I have spare time only in the week end.

bazyl78 commented 8 years ago

That is great news cause I stoped using Sparky 2 because problems with navigation in dRonin. With inav it works for me out of the box on Naze32. If it starts working with Sparky 2 then perfect :). I will test when the new target is available.

digitalentity commented 8 years ago

@bazyl78, @anbello Please check out the RC5 - it has a very experimental SPARKY2 support (thanks to @martinbudden)

anbello commented 8 years ago

Thanks I will try as soon as possible, I hope tomorrow.

martinbudden commented 8 years ago

Let us know if you have any problems.

Note that the motor order is different between iNav and dRonin/LibrePilot. So you will have to either rewire your motors or create a custom mixer.

anbello commented 8 years ago

A little bit OT question: is there any way to translate the PID values from dRonin to iNav?

digitalentity commented 8 years ago

I'm afraid not, the core logic is very different, nobody ever did a mapping between OP/LP/dRonin PID controller and INAV

anbello commented 8 years ago

I flashed the RC5 on my Sparky 2 based quad, follow what I see:

Let me know which kind of information I have to post, a dump from the cli or what else?

screenshot from 2016-09-03 10-16-17

oleost commented 8 years ago

Status command from cli would probably be helpful.

anbello commented 8 years ago

status

System Uptime: 108 seconds, Voltage: 0 * 0.1V (3S battery - OK), System load: 0.00 CPU Clock=168MHz, GYRO=MPU9250, BARO=MS5611, MAG=MAG_AK8963 Cycle Time: 2000, I2C Errors: 0, config size: 1996

digitalentity commented 8 years ago

Looks like accelerometer is not detected for some reason. I wonder if there's a bug in MPU9250 init code that prevents the chip from initializing correctly. What we probably see on compass graph is a result of mag.read() returning false. Baro is probably fine, it's the absence of accelerometer that causes the graph to stay at zero. In Configurator it's not really raw baro altitude, but a result of INAV position estimation filtering which will not work w/o accelerometer.

@anbello can you also post output of "bootlog" command?

anbello commented 8 years ago

bootlog

Time Evt Description Parameters 0: 0 CONFIG_LOADED 0: 1 SYSTEM_INIT_DONE 500: 18 TIMER_CHANNEL_MAPPED (0, 0, 0, 0) 500: 18 TIMER_CHANNEL_MAPPED (1, 1, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (2, 2, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (3, 3, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (4, 4, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (5, 5, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (6, 6, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (7, 7, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (8, 8, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (9, 9, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (10, 10, 0, 2) 500: 2 PWM_INIT_DONE 500: 3 EXTRA_BOOT_DELAY 1185: 9 GYRO_DETECTION (8, 0, 0, 0) 1237: 10 ACC_DETECTION (1, 0, 0, 0) 1250: 11 BARO_DETECTION (3, 0, 0, 0) 1291: 12 MAG_DETECTION (6, 0, 0, 0) 1374: 4 SENSOR_INIT_DONE 1924: 8 SYSTEM_READY

2016-09-03 12:02 GMT+02:00 Konstantin Sharlaimov notifications@github.com:

Looks like accelerometer is not detected for some reason. I wonder if there's a bug in MPU9250 init code that prevents the chip from initializing correctly. What we probably see on compass graph is a result of mag.read() returning false. Baro is probably fine, it's the absence of accelerometer that causes the graph to stay at zero. In Configurator it's not really raw baro altitude, but a result of INAV position estimation filtering which will not work w/o accelerometer.

@anbello https://github.com/anbello can you also post output of "bootlog" command?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iNavFlight/inav/issues/538#issuecomment-244538075, or mute the thread https://github.com/notifications/unsubscribe-auth/AEsTIubqG5hY6vTzJP0Ys30h79OA0hRwks5qmUW6gaJpZM4JxUQF .

martinbudden commented 8 years ago

Yes, looks like the accelerometer is not detected. A look at the code seems to indicate that the detection function is not being called. PR on the way.

martinbudden commented 8 years ago

@digitalentity PR https://github.com/iNavFlight/inav/pull/554 should fix this.

martinbudden commented 8 years ago

@anbello , I've attached a build with the fix, can you try it out please?

SPARKY2.zip

anbello commented 8 years ago

This new build seems to solve all problems in my list but the mag plot is still weird

status

System Uptime: 349 seconds, Voltage: 0 * 0.1V (3S battery - OK), System load: 0.00 CPU Clock=168MHz, GYRO=MPU9250, ACC=MPU9250, BARO=MS5611, MAG=MAG_AK8963 Cycle Time: 2001, I2C Errors: 0, config size: 1996

bootlog

Time Evt Description Parameters 0: 0 CONFIG_LOADED 0: 1 SYSTEM_INIT_DONE 500: 18 TIMER_CHANNEL_MAPPED (0, 0, 0, 0) 500: 18 TIMER_CHANNEL_MAPPED (1, 1, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (2, 2, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (3, 3, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (4, 4, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (5, 5, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (6, 6, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (7, 7, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (8, 8, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (9, 9, 0, 2) 500: 18 TIMER_CHANNEL_MAPPED (10, 10, 0, 2) 500: 2 PWM_INIT_DONE 500: 3 EXTRA_BOOT_DELAY 1185: 9 GYRO_DETECTION (8, 0, 0, 0) 1237: 10 ACC_DETECTION (9, 0, 0, 0) 1250: 11 BARO_DETECTION (3, 0, 0, 0) 1291: 12 MAG_DETECTION (6, 0, 0, 0) 1374: 4 SENSOR_INIT_DONE 1924: 8 SYSTEM_READY

screenshot from 2016-09-03 14-35-52

martinbudden commented 8 years ago

@anbello , I think the SPARKY2 is the first flight controller that is using the compass in the MPU9250 chip, so this might take a little while to track down.

Can you use an external compass for the moment?

Also if you could test flight modes that don't need a compass, that would be useful as well.

@digitalentity , any thoughts about the compass?

anbello commented 8 years ago

@martinbudden , I have to disable the Compass in some way (I don't know how) or Can I fly in angle with and without althold and don't care about the malfunction of the Compass?

martinbudden commented 8 years ago

You can disable the compass by going into the CLI (bottom tab in the configurator) and typing:

set mag_hardware = 1
save

You can fly in angle mode without the compass.

Remember you are testing a new build, so things could go wrong. Make sure you bench test without props before you fly. Double check all your settings, failsafe etc. And then start off with some very short flights.

anbello commented 8 years ago

I have not done a real test flight. I only armed the quad on the floor and with throttle a little bit up I moved the roll / pitch stick to see the quad go forward - backward - left - right. At first it was good then I saw strange movements so I disarmed and I connected to the configurator and I saw a big roll pitch drift on the attitude (the setup tab).

https://www.youtube.com/watch?v=2wSw0ahLhfo&feature=youtu.be

digitalentity commented 8 years ago

@anbello you probably didn't do a 6-point accelerometer calibration.

digitalentity commented 8 years ago

Hm... PixRacer uses the same MPU9250 gyro/acc/mag combo, I can use it to debug.

anbello commented 8 years ago

@digitalentity I did the 6-point accelerometer calibration before the test in my precedent post, this are the resulting values for accgain:

get accgain

accgain_x = 4035 Allowed range: 1 - 8192

accgain_y = 4033 Allowed range: 1 - 8192

accgain_z = 4046 Allowed range: 1 - 8192

martinbudden commented 8 years ago

Yes, those look like and acc driver/calibration problem. WIthout hardware I can't investigate this further, so I'll leave the rest to @digitalentity .

digitalentity commented 8 years ago

@anbello what does accelerometer graph read when you enable it on "Sensors" tab? Does Z axis read something near 1.00 ?

image

anbello commented 8 years ago

@digitalentity sometime is near 1.0, sometime is less (0.8 - 0.9) and sometime is more (1.1 - 1.2), you can also see on the attached screenshot and the linked video on precedent post.

It's strange ... I have the same behavior also with raceflight but if I re-flash dronin the attitude seem stable even if I observe a long period (about few minutes) and small entity (about 1 degree) drift.

digitalentity commented 8 years ago

@anbello I can't see your video.

On the ground and in stable hover your acceleration should read 1,0 or very close to it. Can you record a blackbox log of your hover test?

jstremmler commented 8 years ago

Own a Sparky2 as well and I am willing to test as well once I have fixed the problem with the bootloader and have flashed the 1.2.0 RC6 Sparky2 hex file. I have an external compass which plugs in the master connector with an additional external magnetometer which is connected to the i2C connector of the Sparky2. So I would have to switch the internal magnetometer off and the external on for testing.

Under TauLabs GCS/firmware I have a working OPLink connection via 433MHz as well.

Will that work with iNav?

anbello commented 8 years ago

@digitalentity now you should see it, i forgot to make it public https://youtu.be/2wSw0ahLhfo

In this condition I can not hover however I tried to do and this are the log blackbox_log.zip

digitalentity commented 8 years ago

@anbello I'd say it's poorly done accelerometer calibration. When sitting still and flat the accelerometer should read 1.00 (0.95 is probably ok)

Can you please re-do the accelerometer calibration?

anbello commented 8 years ago

I will do it as soon as possibile, now I'am not at home

Anyway I'am pretty sure I did it the right way because I already did it several time on a naze32 and on a flip32 and all went right

Furthermore with the other flight controller also without calibration I never saw shuch a big and random drift on the attitude

Maybe my sparky 2 has some problems

Il 04 set 2016 1:13 PM, "Konstantin Sharlaimov" notifications@github.com ha scritto:

@anbello https://github.com/anbello I'd say it's poorly done accelerometer calibration. When sitting still and flat the accelerometer should read 1.00 (0.95 is probably ok)

Can you please re-do the accelerometer calibration?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iNavFlight/inav/issues/538#issuecomment-244597132, or mute the thread https://github.com/notifications/unsubscribe-auth/AEsTIvmP47TMEuiDN67_YLCRTHn8qiMoks5qmqfLgaJpZM4JxUQF .

digitalentity commented 8 years ago

@anbello I've seen accelerometers reading 0.8G when uncalibrated. Even slightly bent PCB causes stress that heavily affects accelerometer. Maybe your FC was sligntly bent when attached to the quad. Try loosening the mounting screws so FC is slightly loose and re-calibrate.

anbello commented 8 years ago

@digitalentity Just to clarify: the accelerometer reading not only is different from 1 but it also change over time from 0.8 to 1 then 1.2 and so on slowly and in a random way

Il 04 set 2016 2:27 PM, "Konstantin Sharlaimov" notifications@github.com ha scritto:

@anbello https://github.com/anbello I've seen accelerometers reading 0.8G when uncalibrated. Even slightly bent PCB causes stress that heavily affects accelerometer. Maybe your FC was sligntly bent when attached to the quad. Try loosening the mounting screws so FC is slightly loose and re-calibrate.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iNavFlight/inav/issues/538#issuecomment-244600767, or mute the thread https://github.com/notifications/unsubscribe-auth/AEsTIsIA02Vfm811DrYV7Y0V7bPfPUoyks5qmrkdgaJpZM4JxUQF .

digitalentity commented 8 years ago

Yes, I understand that. PixRacer has the same accelerometer chip. I haven't verified yet if it's a software problem. So far it looks like either a faulty accelerometer or excess strain on the board.

digitalentity commented 8 years ago

560 fixes compass issue (at least on PixRacer)

anbello commented 8 years ago

I re-did the accelerometer calibration carefully and I obtained the same results: just after the calibration the attitude and sensors are OK, then I try to take off and I see really strange behaviour, when I connect to the configurator with quad steady on the floor I see what you can see on attached image (slowly changing in time but never good).

screenshot from 2016-09-05 16-01-04

digitalentity commented 8 years ago

Hm... intereting. @bazyl78 you have a Sparky2, can you confirm the same behavior?

martinbudden commented 8 years ago

Status: Sparky2 works, but some accelerometer problems. Marking this for 1.3

anbello commented 8 years ago

@martinbudden @digitalentity is it possible to have a build with also the #560 fix for the compass to try it?

gottmoz commented 8 years ago

I tested inav on sparky 2, but frsky sbus wont work! I can not change to sbus option, it wont stick after reboot...

digitalentity commented 8 years ago

@gottmoz let's check the obvious things:

  1. Do you use INAV Configurator?
  2. Did you select Serial RX function in Ports tab?
  3. Did you select Serial RX feature in Configurator tab?
gottmoz commented 8 years ago

Yes, all things good! If i flash regular cleanflight with same setup it works!

Skickat från min iPhone

10 sep. 2016 kl. 08:44 skrev Konstantin Sharlaimov notifications@github.com:

@gottmoz let's check the obvious things:

Do you use INAV Configurator? Did you select Serial RX function in Ports tab? Did you select Serial RX feature in Configurator tab? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

oleost commented 8 years ago

@gottmoz Unsure if it gotten fixed, but I heard there are a bug that forces you to use cli and not the GUI to enable sbus.

oleost commented 8 years ago

If that's the case we should open a issue as I cannot find any open issues regarding it.

digitalentity commented 8 years ago

Yes, all things good! If i flash regular cleanflight with same setup it works!

What board are you testing? Cleanflight does not support Sparky 2.

digitalentity commented 8 years ago

@gottmoz Unsure if it gotten fixed, but I heard there are a bug that forces you to use cli and not the GUI to enable sbus.

@oleost it has been fied in latest versions of Configurator.

gottmoz commented 8 years ago

If i start cleanflight configurator with inav flashed on sparky 2 , the reciewer will work!

Skickat från min iPhone

10 sep. 2016 kl. 11:22 skrev Konstantin Sharlaimov notifications@github.com:

Yes, all things good! If i flash regular cleanflight with same setup it works!

What board are you testing? Cleanflight does not support Sparky 2.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.