Harakiri aka multiwii port to stm32

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: Harakiri aka multiwii port to stm32

Post by Crashpilot1000 »

Sorry for the high version number, just had a fight with github to delete unneeded mavlink stuff.
@e_lm_70: You haven't been missing much..
@Hoppsan: "The only thing that didn't work every time was autostart cause the baro some times didn't stop at 0 after the flight. Maybe HW related." I think you mean "Autoland" not autostart. There is no problem with your Baro. Hight=0 is no option to auto-disarm a copter because airpressure will vary or you may not land where you started. The problem with the "has landed" condition is, that it must not become true in flight. If you want the copter to disarm sooner look at these variables: https://github.com/Crashpilot1000/TestC ... fig.c#L179 and define a correct "no fly throttle" that means a throttle where the copter just doesn't fly: https://github.com/Crashpilot1000/TestC ... fig.c#L227 .
@Litneon: No problem!
@mj666: Yep the defined deadband plus the "50" (depending on yawrate) is just too much so it is better to have that removed, when a yaw deadband is defined.

Hoppsan_84
Posts: 51
Joined: Thu Jul 10, 2014 2:13 pm

Re: Harakiri aka multiwii port to stm32

Post by Hoppsan_84 »

@Crash: In fact I meant autostart. Some times it just sat there whit the motors running a little faster than idle. I will try some more to se what casing this behavior. Probably chit behind the transmitter.

mj666
Posts: 186
Joined: Wed Feb 12, 2014 12:02 pm

Re: Harakiri aka multiwii port to stm32

Post by mj666 »

Does it make sense to decrease the 50 to may be 20 for better results? I still see an yaw overshoot for my Nanooctocopters also with this PID controller. May be I should give it try.

Crashpilot1000 wrote:@mj666: Yep the defined deadband plus the "50" (depending on yawrate) is just too much so it is better to have that removed, when a yaw deadband is defined.


UPDATE: Based on this idea I will going to test some changes on the CF PID controller ports to eliminate the yaw overshoot which still can be seen in some cases. There must be some condition which will expose this problem only with some very specific hardware configuration. In our case this are the Nano Octocopters which really show an big yaw overshoot sometimes. With the same setting the Nano Quad or Hexacotpter fly quite well.

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: Harakiri aka multiwii port to stm32

Post by Crashpilot1000 »

Try Yaw-I = 0 to verify that the overshooting is related to the I-Term. If that is the case and the really needed I-Term (that means not too high) still produces overshoot on yaw-stick-recenter with the reduced deadband then you could go for a timeout before the I calculation should kick in after recentering (like 200ms? or so). Or you can fade in the I-Term over that time. Maybe there is something else happening in the Cleanflight codebase since the problem only shows sometimes? Or a problem with the pwm/mixing on your brushed motors octo, since hexa and quads are doing fine?

mj666
Posts: 186
Joined: Wed Feb 12, 2014 12:02 pm

Re: Harakiri aka multiwii port to stm32

Post by mj666 »

This are some realy good hints for more investigations. The I term looks not to be our problem here. So back to more testing. The issue can be seen on multiple small size octos so it looks to be related to the software and not to the hardware. The overshoot looks to be more strong in one direction. Don't want to spam the Harakiri thread with this problem since it is not directly related.

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: Harakiri aka multiwii port to stm32

Post by Crashpilot1000 »

Busy week, damn. Today I had a chance to play with code again. I tried to tackle codesize again. Putting the mixers from float to integer and preserving a resolution of 13 Bit (8192 steps) gave a nice 800 Byte save and a slight speed boost without sacrificing flight performance - so win, win imho. On the other hand I re-introduced the old Yaw algorithm as selectable item since I've read a lot about yaw issues some ppl have (not speaking of mj666 problem wich is isolated for tiny brushed octocopters). I think the very high I-term wind up in the new yaw algo could add to the problem.
@mj666: I know you are on Cleanflight but that is no reason to have no brainstorming in this thread as well about your issue. Let the psychological stuff (or is it about "Donate" buttons??) happen elsewhere. Have you tried an isolated gyro-filter for the yaw axis? Have you tried a different Octomixer that only uses 4 motors for yaw-control?
@all: I am about removing plane-support and heli support completely from Harakiri because I can not test it and it is doubtful if it works at all. I think Baseflight or probably Cleanflight are the way to go for plane-support or heli support. So if no one is against it I will remove them to reduce codesize.

--Washy--
Posts: 2
Joined: Fri Mar 20, 2015 7:55 am

Re: Harakiri aka multiwii port to stm32

Post by --Washy-- »

Hi Guys, sorry for my first post asking for help - but I seem stuck :oops:

I've got a ZMR250 now flashed with the r147 testcode, can connect and all is right with the world.

Stick arming didn't work - so I swapped to a switch and that works now, then when arming I remembered that I have my motors (ZMR250 XQUAD) plugged into 3, 4, 5 and 6 rather than 1, 2, 3 and 4 because motor 1 signal pin doesn't work as the pad went byebye off the board. I was using cleanflight previously and my workaround was simply to enable servo_tilt feature which pushes the motors onto 3 - 6 and leave 1 and 2 for the gimbal control.

This also works with harakiri - but I thought I would try setting up a custom mixer to overcome the problem more properly - but when I try that I cant get it to work?

I input the following in CLI

Code: Select all

# mixer custom
Mixer set to CUSTOM

# cmix 3 1.000 -1.000 1.000 -1.000
Custom mixer:
Motor   Thr   Roll   Pitch   Yaw
Sanity check:   OK   OK   OK   

# cmix 4 1.000 -1.000 -1.000 1.000
Custom mixer:
Motor   Thr   Roll   Pitch   Yaw
Sanity check:   OK   OK   OK   

# cmix 5 1.000 1.000 1.000 1.000
Custom mixer:
Motor   Thr   Roll   Pitch   Yaw
Sanity check:   OK   OK   OK   

# cmix 6 1.000 1.000 -1.000 -1.000
Custom mixer:
Motor   Thr   Roll   Pitch   Yaw
Sanity check:   OK   OK   OK   

# save

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: Harakiri aka multiwii port to stm32

Post by Crashpilot1000 »

@--Washy-- : There is no problem with using servo tilt to shift the motors by 2 out of the way of the broken pin. Overcoming the problem more properly is fixing the hardware :). So the "cmix - method" is not cleaner or something.
Cmix:
First of all you can load a mixer with "cmix load quadx" (that seems to be the case with your ZMR) just to look at the numbers and know what you need. You did that, I want to mention it here just in case someone wonders where the numbers come from.
So putting the first two motorpins out of service will require you to define a hexcopter with the the first two channels "muted" and then followed by the QADX mixer. You can also setup a pentacopter with the first "muted" but setting up a pseudo-hexacopter will resemble your current wiring. (Note: "Muted" means they are just sending the throttlestick value.)
So I would try out this:

Code: Select all

cmix 1 1 0 0 0
cmix 2 1 0 0 0
cmix 3 1 -1 1 -1
cmix 4 1 -1 -1 1
cmix 5 1 1 1 1
cmix 6 1 1 -1 -1


EDIT: BTW "Stick arming didn't work" well it works here.. - so plz check mid and endpoints on your transmitter & gui.

mj666
Posts: 186
Joined: Wed Feb 12, 2014 12:02 pm

Re: Harakiri aka multiwii port to stm32

Post by mj666 »

Last days I did some more testing with the various multicopters. All of the using the same firmware (CF 1.8.0 with G-Tune) and similar PID setting as a starting point. roll/pitch P=4, D=0.03, I=23 yaw P=8.5, I=45, D=0.

Flying an Quad this settings are working perfectly no problems with yaw at all. It really stops at the point. No overshoot.

Flying the Hexacopter the yaw problems are very minor. Only an very small overshoot can be seen with an tendency to turn back a bit. This is only a few degrees nearly undetectable.

The Octocopter shows really an yaw problem. Looks to be this is dependent from the amount and speed of the stick movements. in CW direction there is mostly no overshoot. in CCW direction there is some time an overshoot from more then 30 degrees and it will turn back slowly after this. The amount is not constant an with small yaw stick movements it is usually flyable.

First I set the I part to 0 but the behavior is still present but less. I can use P between 2.5 and 20 and the effect is still there. At the moment fro me P=20 and I=0.012 is the best compromise where the effect is as low as I can get it.

I also tride the idea with the yaw mix on 4 motors only.

From:

Code: Select all

cmix 1 1.000 -0.500 1.000 -1.000
cmix 2 1.000 -0.500 -1.000 1.000
cmix 3 1.000 0.500 1.000 1.000
cmix 4 1.000 0.500 -1.000 -1.000
cmix 5 1.000 -1.000 -0.500 -1.000
cmix 6 1.000 1.000 -0.500 1.000
cmix 7 1.000 -1.000 0.500 1.000
cmix 8 1.000 1.000 0.500 -1.000


To:

Code: Select all

cmix 1 1.000 -0.500 1.000 -1.000
cmix 2 1.000 -0.500 -1.000 1.000
cmix 3 1.000 0.500 1.000 1.000
cmix 4 1.000 0.500 -1.000 -1.000
cmix 5 1.000 -1.000 -0.500 0
cmix 6 1.000 1.000 -0.500 0
cmix 7 1.000 -1.000 0.500 0
cmix 8 1.000 1.000 0.500 0


This will not make any difference. We using a custom mixer anyhow for more straight motor wiring.

The effect can be seen with the ported Harakiri PID controller but is also there with less extend at the ported MultiWii 2.3 PID controller.

What I also can see if the Multicoper get an external impulse in yaw direction it is starting to turn quite fast and not really stabilizing.

I don't understand your hint with the Gyro-filter. We also have omitted the division with 4 for the yaw gyro value in the MW 2.3 PID controller to get better yaw authority:
https://github.com/cleanflight/cleanfli ... pid.c#L496
May be I also should try this for the Harakiri PID controller to minimize the effect:
https://github.com/cleanflight/cleanfli ... pid.c#L616

--Washy--
Posts: 2
Joined: Fri Mar 20, 2015 7:55 am

Re: Harakiri aka multiwii port to stm32

Post by --Washy-- »

Crashpilot1000 wrote:BTW "Stick arming didn't work" well it works here.. - so plz check mid and endpoints on your transmitter & gui.


I'm being thick today it seems I can't make stick arming work my radio inputs look ok for the defaults to work?

Image

Thanks for setting me straight with the cmix :)

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: Harakiri aka multiwii port to stm32

Post by Crashpilot1000 »

@Mj666: I am really clueless what makes your yaw problematic on your tiny octo. The filtering was just an idea to check that as well maybe no hardware lpf on the mpu and individual filterings / resolutions. If there is one yaw algorithm in the currently available pidcontrollers that works for you - that would rule out a mixer/pwm-generation problem. You have probably checked that the heading-adjusting-without-mag is definitely turned off in code (it will take over the yaw stick). I've never been a friend of that for some reasons - (mainly: if you want a heading you need a working mag the other stuff is just fishy farting around with software that will get you screwed sooner or later)

@Washy: Wow what for pictures! rc_minchk = 1100 and rc_maxchk = 1900 are fulfilled so yawstick arming will work (extrapolating from my testing that it works..). But you can not have an armswitch enabled at the same time. If you have an armswitch defined the stickarming will not work anymore. I can not comment on those Android GUIS since I test with original mwii gui.

Hoppsan_84
Posts: 51
Joined: Thu Jul 10, 2014 2:13 pm

Re: Harakiri aka multiwii port to stm32

Post by Hoppsan_84 »

Mr-Fiero wrote:OK, I have been distracted for some time, got into building 3D printers...

I have found a really nice way to use mavlink....and its VERY reliable via OpenLRS @ 19200 baud. I have never seen data so reliable via OpenLRS before! The only thing I have not tried, is to flash....LOL.

First I bought some new modules, and followed this site.
http://www.itluxembourg.lu/site/

Then I even installed a bluetooth HC06 inside the TX module so I could connect via my android. After trying different programs on the android, I realized I would have an issue with having to arm, and then the serial stream switched to mavlink....Bluetooth has to be set to 115200. Also, I should mention, in Harakiri, serial speed set to 19200 and mavlink type set to 2 to match baud rate of serial.

so, eventually I tried droidplanner
https://play.google.com/store/apps/deta ... nner&hl=en

I was trying to find a program that would just connect bluetooth, but go directly into mavlink. I needed statically set it to use one specific bluetooth and change the baud as well. It did, but I found another really neat thing, if you go settings, it will list ALL the options from Harakiri (everything available in CLI) , and you can even change them and send it back and it programs perfectly into the FC. I have had no conflicts, yet....if I do I will post.

Perfect.....now I am printing a bracket so i can snap my phone onto my monitor on my RC-TX.......Its very nice looking and has all the information you could ever wish for from the mavlink. I really enjoy the voice prompts, especially for battery warning. I have had NO dis-connects with the bluetooth and it is VERY reliable and now has the same range as my OpenLRS due to sending the packets over the same TX module. Also another advantage is I dont need a dedicated TX for telemetry!

If I crash, my android will display my current position, and last position update at the same time, so I can go directly to where the unit was. Very nice, but lets hope I dont have to test that to often.....LOL.

Just too simple, and works VERY well for me so I had to share. Take care everyone.




What kind of rc tx do you use? Tried this yesturday and got a solid serial connection but the ppm whas just jumping all over the place. I got a feling it sends to many channels maybe.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Harakiri aka multiwii port to stm32

Post by PatrikE »

Hoppsan.

You can get that if it's too long time between valid msp-packages.
Open protocoll.cpp
search for MSP_SET_RAW_RC

rcSerialCount = 50; // 1s transition
Increase to 150.

Hoppsan_84
Posts: 51
Joined: Thu Jul 10, 2014 2:13 pm

Re: Harakiri aka multiwii port to stm32

Post by Hoppsan_84 »

PatrikE wrote:Hoppsan.

You can get that if it's too long time between valid msp-packages.
Open protocoll.cpp
search for MSP_SET_RAW_RC

rcSerialCount = 50; // 1s transition
Increase to 150.



It did not do the trick. To day the program stops after 4 sec when i connect ppm. No difference if I have the rctx on of off. seams to be sending something default. (failsafe?)

Mr-Fiero
Posts: 216
Joined: Sat Apr 05, 2014 3:26 am

Re: Harakiri aka multiwii port to stm32

Post by Mr-Fiero »

@ Hoppsan_84

It is a Frsky th9x radio. I am using up to 12ch ppm. I have my radio set to 12ch in the menu.

I have bought 1JR module to dedicate for TX, and 6 Futaba modules from HK as my RX. I have not had any issues so far. Its a very reliable link for me. Keep me posted with your results please. I am interested in what you find.

Mr-Fiero
Posts: 216
Joined: Sat Apr 05, 2014 3:26 am

Re: Harakiri aka multiwii port to stm32

Post by Mr-Fiero »

leocopter wrote:That's very cool, Mr-Fiero !
I'm going through the process of configuring UltimateLRS myself. What sketch are you using in Thingiverse for your bracket?
Also you might be interested in Ghetto Station (I'm waiting for mine from the UK). With Guetto Station Proxy (a flashed Mini Micro that converts different telem protocols to a 'light telemetry' protocol : LTM suitable for 1200 and 2400 baud transmissions) you can use the Audio channel of your FPV transmitter to send the telemetry data to the ground station where it is decoded by a FSK modem (using an old TCM3105 TI chip). You can find the FSK modem schematics on kha's Github : kh4 or buy it direct from him (in Finland). Kha is the maintainer of OpenLRSng. Guetto Station is a 3D printed antenna tracker with a built in LCD screen for easy config. With the Guetto Proxy board, you can use only one OSD in the ground station instead of multiple OSDs in your planes/copters. It works with Mavlink, UAVtalk, MSP, Ublox and NMEA protocols (on the To-do list : FRSKY ...) : https://github.com/KipK/Ghettostation

sorry leocopter, i have not been on for a while. been distracted because of 3d printer obsession. damn you. LOL. yep you lit the fire on that one. now I have two printers, the large mutant 420x380x300z, that printed my parts for the WilsonTS. BTW, check seacans dot com for print supplies for your own projects. Just recently I have been very impressed with quality of service, and products! Just a tip. Now to print more multicopters.....

yep, I have been eyeing the Ghetto station already myself. funny how you eventually get into these interests when in this hobby....Thanks for info.

About the bracket. I dont use thingiverse much. I like either drawing myself, or using CAD files. I do not like STL's as you are so limited. If you want, I could give you the CAD for the bracket to fit my frsky th9x. it fits the samsung s4 phone. ties from the TFT monitor bottom screw/centre, to radio centre post.

User avatar
leocopter
Posts: 101
Joined: Mon Jan 27, 2014 7:29 pm

Re: Harakiri aka multiwii port to stm32

Post by leocopter »

Thanks Mr_Fiero, please forward the CAD file for the bracket.
I had to contact RcHobbysUK.co.uk because I haven't received my Ghetto Station (after 2 months ...) : another one is on the way. I printed most of the parts but got delamination on the large body part ... and I've been to lazy to sort it out. For the electronics, the best combo I have found is the Arduino Mega plus I2C OLED display (this is a good one : http://www.ebay.ca/itm/121562421156?_tr ... EBIDX%3AIT). For some reason I didn't get the Teensy 2.0 setup to work (the display is mangled). I got several FSK modems pcbs from Kha himself (a few bucks each).
Winter is the season for building, so I've increase my (all ready large) fleet of copters. Cant way to fully test the latest Harakiri. I've also been obsessed with Flite Test foam board builds ... (they have a very good tri-copter and 'penta'-copter for heavy lifting). I've also been experimenting with BLheli with and without Oneshot enabled firmware (Cleanflight) : very versatile.
Can you give me some info on your Video setup (I read about it on HK forums ...). From what I understood, you have a dipole on the RX and a CP antenna on the Tx ?
(I hope I'm not intruding on the Harakiri project by sharing this info ... ;) ).

Hoppsan_84
Posts: 51
Joined: Thu Jul 10, 2014 2:13 pm

Re: Harakiri aka multiwii port to stm32

Post by Hoppsan_84 »

Mr-Fiero wrote:@ Hoppsan_84

It is a Frsky th9x radio. I am using up to 12ch ppm. I have my radio set to 12ch in the menu.

I have bought 1JR module to dedicate for TX, and 6 Futaba modules from HK as my RX. I have not had any issues so far. Its a very reliable link for me. Keep me posted with your results please. I am interested in what you find.


I have put it a side for the moment.
I believe the problem lying in the number of channels or the timing of the channels.
Sitting on a Spektrum DX8 so I only have 8 channels and the receiver I have use for ppm generation as test only have 6.

User avatar
leocopter
Posts: 101
Joined: Mon Jan 27, 2014 7:29 pm

Re: Harakiri aka multiwii port to stm32

Post by leocopter »

@Crashpilot : Hi Rob, I've been tweaking different FRSKY telemetry setups in Tau labs, Cleanflight and Harakiri.

Concerning the state of the GPS and the number of locked sats :

In Tau Labs, the (openTx) temp2 field returns the same value as the T2 variable of the Taranis : the multiples of 100 (eg. 100, 200, 300, 400) return the state of the GPS and the tens and units (eg : 303, 411) return the number of locked sats (3 and 11 in the given example). The temp1 field is the Taranis T1 variable = board temperature.
In CleanFlight, temp1 is T1 (board temp). Temp2 give 2 alternating (cycles of 1 second) numbers. The first is from 0 to 9999 (I don't know what it refers to) and the second number is the number of locked sats.
In Harakiri, the temp2 field and the T2 variable are 0. The temp1 field and the T1 variable return a single digit number. What does that number represent ?
it would be nice to have the board temperature, specially in enclosed quads like the Aquacopter (which is sealed and waterproof). Things tend to heat up quite a bit in that closed space considering the heat dissipation of 4 Escs, BEC and VideoTx ...
Also the way Tau Labs sends GPS info (State and number of locked sats) via the temp2 field is IMHO a good way of monitoring GPS status in flight.
Could you consider adopting this for Harakiri ?
Cheers from Montreal,
Chris :)

User avatar
leocopter
Posts: 101
Joined: Mon Jan 27, 2014 7:29 pm

Re: Harakiri aka multiwii port to stm32

Post by leocopter »

Bump ... :roll:

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: Harakiri aka multiwii port to stm32

Post by Crashpilot1000 »

leocopter wrote:Bump ... :roll:


Hi, Leo!
Sorry for not answering here for a long time but quiet busy here. I've been doing a lot of codework (https://github.com/Crashpilot1000/HarakiriWebstore1 , note: my English is worse than my coding, it should have been a web storage not a store, so nothing to buy here..). I will look into the taranis stuff but you will have to test it, since I have no Taranis around (I wish I had). At this point I do not advise to fly that repo. I will change some things but codesize has been cut down considerably (around 7,5KB) without sacrificing functionality (except throwing out all airplane stuff). There are also changes in the GPS part that are not fully done yet but are on a good way (like a proportional factor during gps functions to blend in smoothly with stickinputs, like in Horizon mode to blend acro and levelmode together). There are also changes that increase the main pid controllers precision. Some bugs in CLI squeezed, made it a little more comfy (like: "." and "," are both accepted as input for floatnumbers to make it easier for numpad-typers, improved output for different charsets etc.) because when all closed-/opensource google spyware guis (guis are not spyware but google is by default IMHO) and stuff fail the old (t)rusty serial monitor is still your friend and should be usable without hassle. There will be changes back to double float calculations but I will have to check their necessity. So *some* stuff is going on, plz don't feel ignored or anything if I don't post.

User avatar
Bamfax
Posts: 55
Joined: Thu Jan 10, 2013 9:08 pm

Re: Harakiri aka multiwii port to stm32

Post by Bamfax »

Hey Rob,

hail to harikiri :). I was silently hoping you would say one day that you're coding again. I have not yet seen the need to try out other FCs/firmwares, so it's good to read that you're alive and kicking.

Btw, I just had a flight with a standard 400 size copter w/9'' props and latest harakiri, a 25min airtime flight. It is just a pleasant experience, how smooth and quiet a harakiri flight is. The Qr400 has Kiss ESCs and they go along very nice with Harakiri. The copter is barely hearable when gently flown. I am amazing how big a jump it is in terms of steering and precision auf steering, comparing to blueseries w/simonk or maytech slims.
Image


> during gps functions to blend in smoothly with stickinputs
Does that really mean that you are working on implementing smooth flying in GPS mode, leaving GPS mode activated and turtling around with the sticks?

Cheers,
Olli
Attachments
qr400_25min.jpg

User avatar
leocopter
Posts: 101
Joined: Mon Jan 27, 2014 7:29 pm

Re: Harakiri aka multiwii port to stm32

Post by leocopter »

@Rob,
glad to see you're back and coding ! I'll test with pleasure, just tell me when the code on your repo is 'safe enough' ( :o ) to use.
In the mean time I'll be installing BF-airplane on a few birds ...

brm
Posts: 287
Joined: Mon Jun 25, 2012 12:00 pm

Re: Harakiri aka multiwii port to stm32

Post by brm »

Bamfax wrote:Hey Rob,

hail to harikiri :). I was silently hoping you would say one day that you're coding again. I have not yet seen the need to try out other FCs/firmwares, so it's good to read that you're alive and kicking.

Btw, I just had a flight with a standard 400 size copter w/9'' props and latest harakiri, a 25min airtime flight. It is just a pleasant experience, how smooth and quiet a harakiri flight is. The Qr400 has Kiss ESCs and they go along very nice with Harakiri. The copter is barely hearable when gently flown. I am amazing how big a jump it is in terms of steering and precision auf steering, comparing to blueseries w/simonk or maytech slims.
Image


> during gps functions to blend in smoothly with stickinputs
Does that really mean that you are working on implementing smooth flying in GPS mode, leaving GPS mode activated and turtling around with the sticks?

Cheers,
Olli

yes, my last flyduino order didn't include the new frame.
need to wait ...
and the airtime is amazing.
as a 2nd idea - a low passfilter on the motoroutput would also help to stretch the airtime.

User avatar
Bamfax
Posts: 55
Joined: Thu Jan 10, 2013 9:08 pm

Re: Harakiri aka multiwii port to stm32

Post by Bamfax »

brm wrote:yes, my last flyduino order didn't include the new frame.
need to wait ...
and the airtime is amazing.
as a 2nd idea - a low passfilter on the motoroutput would also help to stretch the airtime.


Hey brm, good to hear from you again. Of course, it was clear you are still here :). What is the concept behind the LPF? Do you think it would bring much improvement of a sluggisch oiltanker PID config?

brm
Posts: 287
Joined: Mon Jun 25, 2012 12:00 pm

Re: Harakiri aka multiwii port to stm32

Post by brm »

Bamfax wrote:
brm wrote:yes, my last flyduino order didn't include the new frame.
need to wait ...
and the airtime is amazing.
as a 2nd idea - a low passfilter on the motoroutput would also help to stretch the airtime.


Hey brm, good to hear from you again. Of course, it was clear you are still here :). What is the concept behind the LPF? Do you think it would bring much improvement of a sluggisch oiltanker PID config?


hey men,
the idea of having an lpf working on the motor outputs is removing the spikes which causes the the peaks on your wattage.
for mini quad racers prob. not the best idea but for those flying slower it is ok.
at least i have tried this last summer and it worked.

need to build my mini first.
and my german post office moved to zürich :-(

cheers
rob

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: Harakiri aka multiwii port to stm32

Post by Crashpilot1000 »

leocopter wrote:@Rob,
glad to see you're back and coding ! I'll test with pleasure, just tell me when the code on your repo is 'safe enough' ( :o ) to use.
In the mean time I'll be installing BF-airplane on a few birds ...


Yep! You will get to know it first in this thread :)

Bamfax wrote:Hey Rob,

hail to harikiri :). I was silently hoping you would say one day that you're coding again. I have not yet seen the need to try out other FCs/firmwares, ...

... The Qr400 has Kiss ESCs and they go along very nice with Harakiri....

> during gps functions to blend in smoothly with stickinputs
Does that really mean that you are working on implementing smooth flying in GPS mode, leaving GPS mode activated and turtling around with the sticks?

Cheers,
Olli


Well you should try out BF or CF to enable this Headshot stuff on you KISS. I have currently not implemented that because I am afraid of breaking reliability by messing around with timers.
The proportional factor for GPS functions should produce a more natural feel on the sticks in GPS modes. And this is really important when flying waypoints (actually RTH) because you will find yourself fighting GPS angles with stickangles when something goes wrong (like RTH into a tree).
The "fight" will happen in this codeline: https://github.com/Crashpilot1000/TestC ... /mw.c#L812.
You first reaction will be on the sticks to prevent evil so the sticks have to have more authority. The soultion could be a proportional factor that is derived from the stickinputs to fade out GPS demanded angles like so: https://github.com/Crashpilot1000/Harak ... /mw.c#L409 and then: https://github.com/Crashpilot1000/Harak ... /mw.c#L764
so this https://github.com/Crashpilot1000/Harak ... /mw.c#L836 becomes much less of a fight.
And yes, the PH mode is in rework as well.

brm wrote:..
and the airtime is amazing.
as a 2nd idea - a low passfilter on the motoroutput would also help to stretch the airtime.


Yep Brm, Bamfax is building hell of machines! I am currently farting around with that gyroresolution vs jitter vs filter vs phaseshift stuff vs stack/eeprom usage.
Need further testing but looking usable and better so far.

User avatar
Bamfax
Posts: 55
Joined: Thu Jan 10, 2013 9:08 pm

Re: Harakiri aka multiwii port to stm32

Post by Bamfax »

Rob, I don't need Oneshot to be happy. I know what I have and I am happy with that. For example, a beautifull and smooth flying experience. The Kiss ESCs are great without Oneshot as well. Maybe one one day I will switch, if possible, but if, then primarily for saving power / flying longer.

Here we go, 37:50 with different props (thx Jodi) and battery.

qr400_38min.jpg


DSC_9896_klein.jpg

brm
Posts: 287
Joined: Mon Jun 25, 2012 12:00 pm

Re: Harakiri aka multiwii port to stm32

Post by brm »

to further reduce the command latency synced pwm output would be nice.
it already in but i need more test as a few motors might have problems.
just flashing the latest simonk stuff - in case i am able to download these firmware images ...

franko_
Posts: 15
Joined: Tue Apr 16, 2013 7:56 am

Re: Harakiri aka multiwii port to stm32

Post by franko_ »

Hi Rob,

nice that you continue working on Harakiri.... :-)
Tried your latest Webstore Version, but GPS is not working anymore.. (UBX M8N 38.4K)

Older Versions Testcode3 working fine.. which GUI is preferred?

sorry for dumb questions
Frank

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: Harakiri aka multiwii port to stm32

Post by Crashpilot1000 »

Hi, franko!
No dumb question! That repo is not for general usage since I am ripping stuff apart there, re-arranging and trying out stuff, so currently there are a few "softwarecables" dangling around. I am using Mwii 2.2 gui to set auxchannels, watch RC and sensors Acc cal.

franko_
Posts: 15
Joined: Tue Apr 16, 2013 7:56 am

Re: Harakiri aka multiwii port to stm32

Post by franko_ »

Thx for your info @Rob,

i revert to olderTestcode3, BN-880 (m8n clone) works now fine..
Final results at weekend in the fields ...

Not in the fields, only in my little garden ...
https://www.youtube.com/watch?v=D8Y6UHsSPUo

Next step is to add an servo tilt.. but i have some problems t get it working.
PPM SERVO_TILT GPS
Feature are enabled, but nothing happens..
gbl_flg = 2
gbl_pgn = 10
gbl_rgn = 10
gbl_pmn = 1020
gbl_pmx = 2000
gbl_pmd = 1500
gbl_rmn = 1020
gbl_rmx = 2000
gbl_rmd = 1500

This is the rate of my servo?
srv_pwm = 50

Servo is very busy but nothing happens.. HXT900 and initialize.

Any ideas?

BR
Frank

User avatar
Bamfax
Posts: 55
Joined: Thu Jan 10, 2013 9:08 pm

Re: Harakiri aka multiwii port to stm32

Post by Bamfax »

Hi Guys,

this might be a stupid question and I maybe should know better, but:

I am getting used to my FrSky telemetry display on the Taranis, where part of the data comes in from the mavlink2frsky Teensy converter. If I am not totally mistaken, the telemetry downstream is paused (no more updates) when the copter is disarmed (due to the telemetry autosensing).

So here is the question: Would it be possible to have the mavlink downstream all the time, even when the copter is disarmed? This is probably also a question of how the copter is configured. CLI should still be possible, if I am not completely mistaken. Would it be sufficient to use the CLI to configure the copter? Is there something like a mavlink GUI? Isn't Mission Planner and Meister's GCS completely based on Mavlink? And here goes my old brain, if I remember correctly, Rob said Mavlink writes are not implemented?

Happy to hear your ideas and experiences.

Olli

franko_
Posts: 15
Joined: Tue Apr 16, 2013 7:56 am

Re: Harakiri aka multiwii port to stm32

Post by franko_ »

franko_ wrote:Thx for your info @Rob,

i revert to olderTestcode3, BN-880 (m8n clone) works now fine..
Final results at weekend in the fields ...

Not in the fields, only in my little garden ...
https://www.youtube.com/watch?v=D8Y6UHsSPUo

Next step is to add an servo tilt.. but i have some problems t get it working.
PPM SERVO_TILT GPS
Feature are enabled, but nothing happens..
gbl_flg = 2
gbl_pgn = 10
gbl_rgn = 10
gbl_pmn = 1020
gbl_pmx = 2000
gbl_pmd = 1500
gbl_rmn = 1020
gbl_rmx = 2000
gbl_rmd = 1500

This is the rate of my servo?
srv_pwm = 50

Servo is very busy but nothing happens.. HXT900 and initialize.

Any ideas?

BR
Frank


Got it,

connect the servo signal to the first channel and add checkbox camstab in Gui.
Now my tilt servo works correctly.. thx to Bamfax for help.

BR
Frank

gbl_flg = 2
gbl_pgn = 50
gbl_rgn = 50
gbl_pmn = 1020
gbl_pmx = 2000
gbl_pmd = 1500
gbl_rmn = 1020
gbl_rmx = 2000
gbl_rmd = 1500

User avatar
Bamfax
Posts: 55
Joined: Thu Jan 10, 2013 9:08 pm

Post by Bamfax »

Ah, grats. How does your camstab gimbal look like?

User avatar
Bamfax
Posts: 55
Joined: Thu Jan 10, 2013 9:08 pm

Re: Harakiri aka multiwii port to stm32

Post by Bamfax »

Rob, could you include the IMU in the mavlink updates?

franko_
Posts: 15
Joined: Tue Apr 16, 2013 7:56 am

Re:

Post by franko_ »

Bamfax wrote:Ah, grats. How does your camstab gimbal look like?


Hi Bamfax,

it´s a simple tilt servo that fits perfectly on my QAV280 Frame.

https://www.thingiverse.com/thing:541991

Hoppsan_84
Posts: 51
Joined: Thu Jul 10, 2014 2:13 pm

Re: Harakiri aka multiwii port to stm32

Post by Hoppsan_84 »

@ franko_ Cool

User avatar
Bamfax
Posts: 55
Joined: Thu Jan 10, 2013 9:08 pm

Re: Harakiri aka multiwii port to stm32

Post by Bamfax »

Hoppsan_84 wrote:@ franko_ Cool


Indeed :). Normally people say that a servotilted flycam is difficult to get used to. I would be interested to hear your opinion on that.

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: Harakiri aka multiwii port to stm32

Post by Crashpilot1000 »

Bamfax wrote:Hi Guys,

this might be a stupid question and I maybe should know better, but:

I am getting used to my FrSky telemetry display on the Taranis, where part of the data comes in from the mavlink2frsky Teensy converter. If I am not totally mistaken, the telemetry downstream is paused (no more updates) when the copter is disarmed (due to the telemetry autosensing).

So here is the question: Would it be possible to have the mavlink downstream all the time, even when the copter is disarmed? This is probably also a question of how the copter is configured. CLI should still be possible, if I am not completely mistaken. Would it be sufficient to use the CLI to configure the copter? Is there something like a mavlink GUI? Isn't Mission Planner and Meister's GCS completely based on Mavlink? And here goes my old brain, if I remember correctly, Rob said Mavlink writes are not implemented?

Happy to hear your ideas and experiences.

Olli


Yes we can do mavlink only but you will have to set up the auxchannels in CLI with "auxset" and the Acc and Gyro calibration with Stick-commands - or have a option Mavlink only in the cli that you might want to enable/disable. I haven't checked Meisters GCS.
Concerning the output of raw sensor values, that is no problem, but why do you want to do that?
Just put something like this:

Code: Select all

            mavlink_msg_raw_imu_pack(
                MLSystemID, MLComponentID, &msg2, micros(),
                accADC[0],      accADC[1],      accADC[2],
                gyroADC[0],     gyroADC[1],     gyroADC[2],
                magADCfloat[0], magADCfloat[1], magADCfloat[2]);
            baseflight_mavlink_send_message(&msg2);

In the mavlink loop here: https://github.com/Crashpilot1000/TestC ... ink.c#L445.
Probably you want it in the 30Hz loop (https://github.com/Crashpilot1000/TestC ... ink.c#L538) so it would look something like this:

Code: Select all

        if (!(cycleCNT % 3))                                                    // every 30ms (33Hz) for Attitude
        {
            mavlink_msg_raw_imu_pack(
                MLSystemID, MLComponentID, &msg2, micros(),
                accADC[0],      accADC[1],      accADC[2],
                gyroADC[0],     gyroADC[1],     gyroADC[2],
                magADCfloat[0], magADCfloat[1], magADCfloat[2]);
            baseflight_mavlink_send_message(&msg2);

            mavlink_msg_attitude_pack(
                MLSystemID, MLComponentID, &msg2, currentTimeMS, angle[0] * RADX10, -angle[1] * RADX10,
                heading * RADX, 0.0f, 0.0f, 0.0f);
             baseflight_mavlink_send_message(&msg2);
            return;
        }

Note: The mwii axes are not aligned with the arducopter axes, so depending on what you want you might need to swap them around and/or swap the sign.
Cheers
Rob

User avatar
Bamfax
Posts: 55
Joined: Thu Jan 10, 2013 9:08 pm

Re: Harakiri aka multiwii port to stm32

Post by Bamfax »

Crashpilot1000 wrote:Yes we can do mavlink only but you will have to set up the auxchannels in CLI with "auxset" and the Acc and Gyro calibration with Stick-commands - or have a option Mavlink only in the cli that you might want to enable/disable. I haven't checked Meisters GCS.
Concerning the output of raw sensor values, that is no problem, but why do you want to do that?
Rob


Rob, thanks for the code. I will play around with that and let you know.

The idea to try mavlink-only came one late night, where I was playing with telemetry and was becoming too lazy to flip the switch to get mavlink updates. The thought was that we are just having some initial config on the GUI, and then we are doing 99% on the cli anyways, so wouldn't it be possible to switch to mavlink completely? And, if at all, shouldn't it suffice to just enable MSP manually?

Regarding the acc/gyro values, I would like to see if the copter has vibrations. Most easy would be with the frsky telemetry, as I save and check this log postflight anyway. I am not sure yet if that works out. The frsky updates will probably be too slow to see small vibrations. If it's really too slow, the second option would be to log it on sd card on the copter. This option could possibly be implemented in HaraGndLink. This is one idea I had with that project. That area is not that much covered by Mwii so far. Let's see. Basically, this project here seemed pretty cool and got me interested:
https://github.com/thenickdude/blackbox

User avatar
Bamfax
Posts: 55
Joined: Thu Jan 10, 2013 9:08 pm

Re: Harakiri aka multiwii port to stm32

Post by Bamfax »

Hi Guys,

does someone know if the GPS changes proposed my MrFiero, that the GPS receiver is autoconfigured with MrFiero settings, made it into Crashpilot1000's Testcode3 source of Harakiri? I had a quick look right now and it seems it did not go into Testcode3? Reason I am asking is that I sometimes have a low battery on my GPS receivers where all settings are lost. The batteries seem to run low after a while. Especially if not flown regularly. Which happens quite often when having a couple GPS-enabled copters. So I would be an idea to have flightcontroller software that does a full auto-configure on the GPS device at first, switching the default 9600 baud to 115220 and then pushed the rest of the predefined GPS config.

Would that work, what do you think?

Olli

User avatar
Bamfax
Posts: 55
Joined: Thu Jan 10, 2013 9:08 pm

Re: Harakiri aka multiwii port to stm32

Post by Bamfax »

Hey, anyone still alive here? Yesterday I had one of those "let's make it better" attacks and started playing with my PIDs.

Funny was, I went through all the possible values from low to high (on roll and pitch), and the only thing that had a noticable effect was P. Besides that, maxing out / minimizing D and I did not do much. Is that normal? I do not need to reboot after changing PIDs, do I? mainpidctrl is set to 0.

I remember Rob talking about a different behavior with the default mainpidctrl = 0 (mainpidctrl = 0 or 1 // 0 = OriginalMwiiPid pimped, 1 = New mwii controller pimped). But right now I cannot find to much description of how thats works. Does anyone have some insight?

User avatar
Bamfax
Posts: 55
Joined: Thu Jan 10, 2013 9:08 pm

Re: Harakiri aka multiwii port to stm32

Post by Bamfax »

Btw, this is from the small telemetry converter project I am working on, which logs an extended telemetry set (mavlink incl. IMU / Motor Outputs / GPS time+dop, locally connected current and voltage) down to OpenTX. Basically I wanted to save on weight, not having to use the quite heavy FrSky current / single cell voltage sensors. So this is all running on a teensy, with an ACS715 and a voltage divider.

Qr400-2015-08-20-Flightlog - mit Km - small.jpg
TelemetryScreen1 - small.jpg

User avatar
Bamfax
Posts: 55
Joined: Thu Jan 10, 2013 9:08 pm

Re: Harakiri aka multiwii port to stm32

Post by Bamfax »

Just some quick notes regarding tuning. To be completed later.

PID tuning
------------
When is it applied? PIDs should be written to eeprom / become effective when copter is disarmed (true?). So inflight changes will require a disarm.

Old/standard PID controller or new PID controller?
When was this introduced:
http://fpv-treff.de/viewtopic.php?f=68& ... pid#p39884
viewtopic.php?f=8&t=3671

mainpidctrl = 0: OriginalMwiiPid pimped (Rob's standard)
- Level D: Tiltlimit (not a true D, as on other PIDs)

mainpidctrl = 1: New mwii controller pimped (unsure if anyone besides rob has really flow with this)
- Level P: P for Angle mode.
- Level I: P for Horizon mode.
- Level D: Not used.

Althod PID tuning
--------------------
- alt_p is the strength alt correction are applied. A value of 12 makes climb and descent faster for me.
- alt_d compensates alt drops when starting to move the copter. Set value of 100, now the minor Althold Alt drops are completely eliminated.

GPS general stuff
--------------------
- rtl_mnd; // Minimal distance for RTL, otherwise it will just autoland, prevent Failsafe jump in your face, when arming copter and turning off TX
- gps_ins_vel: (if still valid:) General concept of how GPS position is taken into account with other factors, to finally calculate next flight correction. http://fpv-treff.de/viewtopic.php?f=68& ... e9d#p32305

GPS PH tuning
------------------
http://www.multiwii.com/forum/viewtopic.php?f=23&t=3524&p=55248#p55110 and before. Credit for that goes to MrFiero.
- gps_lag 500: Time (ms) it assumes the copter to be already further and the GPS; time the GPS is lagging behind to where the copter already physically is
- gps_ph_settlespeed 200: Speed lower limit (cm/s), when achieved, GPS PH prebrake is finished and PH code kicks in
- gps_expo 5: Dampening of GPS steering. 20=default, 10=lowest recommended by Rob, 5=aggressive when in strong winds. gps_expo=0 makes the tuned settings more visible.
- gps_pos_p 7: The higher, the more overshot may happen. MrFiero has it on 6.
- gps_maxangle 30: Maximum angle GPS code is allowed to tilt the copter.
Some more settings to look at:
- gps_brkacc [50-500]: How fast the prebrake is slammed on. This may increase the prebrake strength, but I found it to have only little effect on prebrake. Have it on 100.
- gps_ph_brakemaxangle: Maximal 5 Degree Overspeedbrake. Currently on 25 here.
- gps_ph_minbrakepercent: 1-99% minimal percent of "brakemaxangle" left over for braking. Example brakemaxangle = 6 so 50 Percent is 3. Currently on 50 here.
Purpose of PosR NavR and Pos: viewtopic.php?f=16&t=3014

GPS RTH / RTL tuning
------------------
- Speed of return flight, to have a faster RTH to homepos: nav_speed_max. Default is 350 cm/s, which I found to be a little to slow for my taste. Have it now on 1000. Now it zooms back ;). Max is 2000 cm/s.
Some more settings to look at:
- nav_tail_first; // 1 = Copter comes back with ass first (only works with nav_controls_heading = 1)
- nav_controls_heading; // copter faces toward the navigation point, maghold must be enabled for it
- nav_rtl_lastturn; // Something like NAV_SET_TAKEOFF_HEADING on mwii. viewtopic.php?f=8&t=649&p=14217&hilit=NAV_SET_TAKEOFF_HEADING#p14217
- gps_rtl_flyaway; // If during RTL the distance (meant here probably: to homepos) increases beyond this valus in meters, something is wrong, autoland

Autoland tuning:
----------------
al_debounce = 5 // (0-20%) 0 Disables. Defines a Throttlelimiter on Autoland. Percentage defines the maximum deviation of assumed hoverthrottle during Autoland
al_barolr = 75 // [10 - 200cm/s] Baro Landingrate.
al_lndthr = 0 // This is the absolute throttle that kicks off the "has landed timer" if it is too low cfg.minthrottle is taken.
al_tobaro = 2000 // Timeout in ms (100 - 5000) before shutoff on autoland. "al_lndthr" must be undershot for that timeperiod
http://fpv-treff.de/viewtopic.php?f=68& ... pid#p40738
Last edited by Bamfax on Thu Aug 13, 2015 7:30 am, edited 1 time in total.

Hoppsan_84
Posts: 51
Joined: Thu Jul 10, 2014 2:13 pm

Re: Harakiri aka multiwii port to stm32

Post by Hoppsan_84 »

Coll. Right now I mostly flyes 250 FPV but I'm checking here for updates every day.

User avatar
Bamfax
Posts: 55
Joined: Thu Jan 10, 2013 9:08 pm

Re: Harakiri aka multiwii port to stm32

Post by Bamfax »

Well, you don't need to check every day ;) These days it is brm who regularily keeps me from writing monologues.

But besides that, I need to say I am, after all those two years, still absolutely happy with Harakiri. I just finished setting up a new copter and it just "does the job": It has a rock solid PH. The RTH / RTL and failsafe works nicely, adds a second layer of safety and gives me confidence that the flying stuff will return when I overdid it. Thanks to bluetooth, droidplanner and mavlink, I can configure it sitting in the trunk of my car just using a tablet. The FC is cheap hardware and very lightweight, especially all in all, when taking the sensors into account as well. An integrated solution would be lighter, but with this non-integrated, separate components approach, I can built it step by step and also replace single parts, should one get broken. The GPS is a tiny ublox M8, teensy is half the size of the fc, acs715 is a fingernail, voltage divider with its three components is really not worth mentioning. Thanks to its mavlink output it gives me full telemetry logging of 32 values using that "anyway there" FrSky RX, directly down to the SD card in my Taranis. GPS Time, DOP, current, voltage, gyro/acc, motor output channel values is all there. So the last known GPS coordinates where it had GPS reception and battery are definitely logged on the ground. Now, if I would really need it, it could also go out of the taranis via bluetooth, on the smartphone and then using a proxy onto the harddisk at home ;). And last but not least, it has a nice acro flying style.

brm
Posts: 287
Joined: Mon Jun 25, 2012 12:00 pm

Re: Harakiri aka multiwii port to stm32

Post by brm »

:-)
i just launched my mpx panda ... more fixed wing stuff to come.
so i am sidetracked and very happy my little glider survived the maiden flight :-)

User avatar
Bamfax
Posts: 55
Joined: Thu Jan 10, 2013 9:08 pm

Re: Harakiri aka multiwii port to stm32

Post by Bamfax »

Looks good, that sidetrack :). I used not to be much fascinated by fixed wings, but the more I fly copters, the more airplanes also catch my interest. Let's see, copters still keep me busy enough. A vtol would be interesting once. Or a quad with 270° fully titable rotors, like a 4wd and 4w steering car. That would most definitely look interesting in flight.

User avatar
leocopter
Posts: 101
Joined: Mon Jan 27, 2014 7:29 pm

Re: Harakiri aka multiwii port to stm32

Post by leocopter »

Crashpilot 'cleansed' Harakiri of the airplane stuff ... but PatrikE did a very good job with airplane mode in MultiWii, and now it is ported to Baseflight. It flies really well.

Post Reply