Thursday 29 June 2017

Ubuntu has bad memory(management)(fix)

I've had a problem since I switched to ubuntu/linux. It just gets slow and freezes like crazy, and I'm not even doing much. In contrast my Windows PC is able to open about 60 tabs in chrome and allow me to play a game while that's running, with no slow-downs.

So I investigated, finally finding a solution on this askubuntu.com post:
askubuntu-link

So here's what we do:
total memory in KB: +-8000000kb (8gb)
total CPU cores: 4 cores
min_free_kbytes = (total memory * 5%) / cores = 100000kb

Set minimum free ram:
sudo sysctl -w vm.min_free_kbytes=100000

Set how much of the disk to cache:
sudo sysctl -w vm.swappiness=5

Now to make it permanent just add the following to you /etc/sysctl.conf file:
vm.swappiness=5
vm.min_free_kbytes=100000


Hope this helps someone!

Thursday 11 May 2017

Cheap things that will improve your FPV flying the most.

I have learnt a few things in the last few months of flying and I would like to share it with the world. There's no use struggling when others have already made the mistakes for you.

Here goes:

1. Buy good props. (cost: $3)

Or in my case, buy unbreakable 3 blade performance props.
My recommendation is DALProp's CYCLONE Series T5045C.

I am on my second set, only because the first set started looking ugly.
These things just never break, they bend, which means they absorb the shock so your engines won't.
Bent prop? Just bend it back and rip further.

I started off with dual blade props, but seeing all the pros use tri-blades made me want to try it.
I took the plunge and happened to buy the cyclones. They were only $3 a pack, which really isn't bad.
When they arrived I bolted them to my quad and went flying.

What I experienced is stability and a quiet hum of the blades piercing the air. Such a soothing sound.
But that's not all! I got about 15% longer flight time on these babies. 3$ for that kind of improvement is totally worth it!


2. Buy the right FPV lens (about $9)

I remember watching an endless stream of FPV freestyle videos and wondering how the pilots had such confidence about their surroundings, almost a better spacial awareness if you will.
I assumed it's only the GoPros recording the flight that have a wide field of view.
I was wrong!

Following Mr. Steele's advice, I found a similar lens to the one he uses. The GoPro Hero 2 replacement lens.

On the first flight I felt like all my other flights were done while staring through a toilet roll. I could confidently roll, knowing exactly where the ground is. My moves smoothed out and were less jerky as well as crashing becoming a rare event.

Pretty good for a $9 spend!


3. Simulator Cable (price tbc)

I know, I know. You've heard this before and you're getting sick of hearing it.

I can't stress this enough though, especially if you're on a budget build like me.
Simulators have unlimited battery hours, indestructible copters and physics settings to make it harder on yourself while training.

Click here for simulator cable.

Sims I would suggest are:
1. Hotprops - Free, very good for freestyle
2. FPV Freerider - $5, good overall, but controls are a bit iffy.
3.DRL Racing Simulator - Free, nice graphics, iffy settings, can't get a realistic feel from it.


4. Set your PIDs (Free!)

So you were terrible at mathematics in highschool, that doesn't mean you can't set your PIDs.
I'll be putting together an absolute dummies guide to PID tuning. In the meanwhile, check out Joshua Bardwell's videos, he does things proper and takes you through all the steps.

Setting my PIDs has made me feel like I'm the one holding the direct controls of my quad and not the flight controller. When I roll left, it rolls left, when I stop and pitch backwards, it does so. Make your digital-iness disappear in your controls and give yourself more of an analog feel.

Joshua Bardwell's PID vids

Tuesday 11 April 2017

New ECMA Script 6 ES6 Ternary operators

I struggled to wrap my head around these two new operators, the && and the ||.

So I decided to write a post about them to explain them to myself.

var || 'hi'         will return  'hi' when false
var && 'hi'     will return 'hi' when true


So:
var || 'hi' means:

return 'hi' if var is false
    --or--
var ? var : 'hi'

and:
var && 'hi' means:

return 'hi' when var is true
    --or--
var ? 'hi' : var

Wednesday 4 January 2017

Flashing a bricked SP Racing F3 Flight Controller



I've been struggling for two days with this and finally found the solution. Scroll down for that.

Background:
So my UART2 plug broke off after a bad crash causing my quad to drop out of the sky on the next flight. Once I found the broken port, I thought that I could simply plug it into a new one, so I did.

Once connected I had problems getting the RX to be recognised, so I thought that the setting must be in Cleanflight. I went to the ports tab and changed some settings and boom, lost connection after saving. Since then I couldn't reconnect.
I tried the following, to no avail:

  • I tried the Zadig driver fixer when the ports weren't available, 
  • I tried the ImpulseRC Driver fixer
  • I tried the STM flash loader demonstrator - this worked after a few tries, but then I stopped being able to connect to the FC again.
  • I tried various SP Racing firmwares, thinking that perhaps I didn't have the same model
Anyway, finally I find a reddit post and I actually read the whole thread for once, and way at the bottom I get the answer.

Solution:
  • I went to 'Add or Remove Programs or Features' and removed the CP210 drivers(look for software by Silicon Laboratories Inc.)
  • Then I removed the STM3 drivers, just search for STM in the list.
  • Finally I installed the CP210 drivers again, and ignored the STM3 drivers.(these drivers can be downloaded from the links on the Cleanflight landing screen.
  • I opened Cleanflight and in the Firmware Flasher I selected my FC model and firmware version. I also checked:
    "No reboot sequence"
    "Flash on connect"
    "Full chip erase"
    and "Manual baud rate" and I set it to 256000
  • I then clicked on "Load Firmware(Online) and waited for it to be loaded
  • I shorted out the two boot pins(google to find yours) on my FC and then plugged in the USB.
BOOOM! instant flashing, no more USB errrors or bootloader errors like before!

I hope this helps you as it helped me

JavaScript replace() method's deviousness!

There is a trick to this method, if you do:
var test = 'old old old';
test = test.replace('old','new');
console.log(test);

The output would not be as expected, you would get:

'new old old'

However, if you remove the quotes and add regex tags:

test = test.replace(/old/g,'new');

You will get every instance replaced in your string.


My pleasure!

Devlog 8: AI and Radar explanation.