FlyHow

Arne Ansper arne@cyber.ee

News

I have added new feature to the filter: measuring the speed of the model using Doppler effect. More...

Introduction

FlyHow is a simple system that visualizes how you control your glider. Since a picture is worth a thousand words I will present a small clip showing the FlyHow in action:

Debugging my discus launch (this is a DivX encoded video. If you cannot see it, download and install the free codec)

This video is in slow motion - it runs 10 times slower than normal. The scrolling number on the right side is framecounter - the video has 50fps, so each frame is 20ms. Slow motion and framecounter are added using AviSynth - excelent free video processing package for Windows.

The black transparent rectangle on the left corner is drawn by FlyHow. It visualizes the position of the control surfaces of the glider. In this video you can see left flaperon, elevator, rudder and right flaperon. Numbers show the amount of deflection of the trailing trailing edge in mm-s. Red and negative is up and left. Green and positive is down and right.

How it is done

You probably noticed that the video had no sound. This is because the sound track was not used for real sound but for PPM signal sent by the transmitter.

This idea is really not mine - I got it from CRRCSIM-F3F audio interface. You take the PPM signal from the student socket of your TX and send it to the input of your audio card. The precision of the audio card is sufficient for measuring the timing of the PPM signal and extracting the position data for all 8 channels.

I connected the cable to the external microphone input of my camcoder and stored the PPM signal on the DV tape.

FlyHow itself is an AviSynth filter that analyzes the audio track as PPM signal, extracts the timing information for up to 10 channels and produces the video clip that shows the movements of the control surfaces. This clip is later overlayed over the original video using AviSynth Overlay filter that produces this nice transparent effect.

How to use it

Cable

You need a cable. The cable is really simple: two plugs, two resistors and two wires.

The resistors are needed to lower the voltage. TX normally outputs 9V, but mic input sensitivity is around 0,2mV. I bought many resistors and then made the cable by trial and error. The original audio interface cable is made for soundcard line-in that accepts much higher voltage and does not require so much attenuation. But for use with camcoder mic input the upper resistor much be much bigger than suggested in the CRRCSIM page.

You do not need a video camera to test your cable. If it works with the mic input of your PC, it will also work with the camera.

Best test for the cable is to get the CRRCSIM-F3F working using the audio interface by connecting the cable to the microphone input.

The TX connector type depends from your trasmitter. I have a robbe Futaba FX-18 transmitter that uses simple 2.5mm mono audio plug. You can find this information for all kind of transmitters from the TX2TX page.

Software

You must download and install at least AviSynth. I also recommend to install VirtualDub for previewing and encoding the videos. I use DivX for final encoding. If you need a general instructions about how to create a good looking and well compressed videos you should go through www.100fps.com site.

You must also download the FlyHow filter: flyhow.zip.

I have included both source code and Visual C++ 6 project file and a precompiled DLL for AviSynth 2.5.

Calibration

Before you can start using FlyHow you must calibrate it for your plane. The idea is to measure the maximum possible deflections and the corresponding servo signal values.

For each channel you must find out:

  1. Center value for servo signal. Put the control surface to the neutral position and measure the servo signal.
  2. Maximum up or left throw in mm and also corresponding servo signal.
  3. Maximum down or right throw in mm and also corresponding servo signal.

There is special FlyHowCalibrate plugin that shows the servo timing for each channel:

First number in each row is the servo position for the current frame. If you put the control into neutral position you can get the value for the servo center signal from the first column.

Second and third numbers and min and max servo signals. One of them is for maximum up and another for maximum down throw. Tape your plane (with FlyHow cable attached) and find out what is what.

Here is the AviSynth script that is used for calibaration:

#LoadPlugin("videotools\SmoothDeinterlacer.dll")
LoadPlugin("videotools\flyhow.dll")
LoadPlugin("videotools\audgraph.dll")
avisource("visual\test.04-06-05_14-16.00.avi")
separatefields()
assumeframebased()
lanczosresize(384,288)
#SmoothDeinterlace(tff=false, doublerate=true)
#BilinearResize(384, 288)
video=Converttorgb32()
FlyHowCalibrate(AudioGraph(video,1))

Configuration

FlyHow supports currently crosstail gliders with up to four wing servos. Adding support for other configurations is quite easy.

I present the AviSynth script first and then explain the FlyHow parameters:

# prepare video

LoadPlugin("videotools\SmoothDeinterlacer.dll")
loadplugin("videotools\flyhow.dll")
avisource("visual\test.04-06-05_14-07.00.avi")
separatefields()
#assumeframebased()
#showframenumber(true)
#videoin=bilinearresize(360,288)
#videoin=bicubicresize(360,288)
videoin=lanczosresize(384,288)
#SmoothDeinterlace(tff=false, doublerate=true)
#videoin=BilinearResize(384, 288)

# create blank clip that is like original
overvideo = FlyHow( \
		AudioDub(BlankClip(videoin, width=Width(videoin)/2, \
		height=Height(videoin)/5, pixel_type="rgb32"), GetChannel(videoin, 1, 2)), 96, \
		"rudder",4,-3,-17,19,-518,597, \
		"elevator",2,-120,-16,10,400,-592, \
		"left_flap",1,-43,-22,23,-407,600, \
		"right_flap",5,68,-22,23,430,-595, \
		"",0,0,0,0,0,0, "",0,0,0,0,0,0)

# now overlay it
mutevideo=KillAudio(videoin)
Overlay(mutevideo, overvideo, y=(Height(videoin) * 4)/5 - 5, x = 5, mode="blend", opacity=0.5)
#assumefps(5)

FlyHow filter requires following parameters:

  1. Suitably sized input clip with PPM audio. In my example this is created by AudioDub(BlankClip(videoin, width=Width(videoin)/2, height=Height(videoin)/5, pixel_type="rgb32"), GetChannel(videoin, 1, 2)) - I make a blank clip that has same properites as original video, except that it is smaller and it is of type RGB32. Then I mix in the audio from original video.
  2. Size of the font that is used to display the deflection. 0 disables the display.
  3. Name of the control. Following controls are know: "rudder", "elevator", "left_aileron", "left_flap", "right_aileron", "right_flap". The order in which you describe the controls is not important.
  4. Servo channel for this control.
  5. Servo signal for center position.
  6. Amount of up or left throw in mm. This must be negative number!
  7. Amount of down or right throw in mm. This must be positive number!
  8. Servo signal for maximum up or left.
  9. Servo signal for maximum down or right.
  10. Repeat 3.-9. again for all six channels. If you have less servos, leave the name and servo channel empty.

Configuration is mostly one-time thing, but you should repeat it when you change your planes setup (including changing the servo endpoints, etc).

The values for deflections are not critical, but the values for servo signals are critical.

Improvement ideas

I have already several ideas how to improve the system:

  1. Add support for V-tails. Small software change.
  2. Add support for planes with motor and for helis. Bigger software change.
  3. Add support for R/C submarines :)
  4. Support for MoM racing. Use left channel for the data from one TX and right channel for the data from other TX. Create two overlays. This one is really easy and does not require any software modifications, only camcoder with stereo mic input and special cable for two planes. You will get the video with two planes racing and you can see the servo movements for both of them.
  5. Wireless system. Instead of cable use scanner or spare RX to capture the transmitted signal. Scanner must have suitable output that can be connected to camcoder mic input. Both Futaba and JR have receivers that can output undecoded PPM signal. Or you can get sufficiently old and simple RX and solder extra wire to the input pin of the decoder chip. Wireless system is really create because you can then tape everybody, no matter what TX they are using (as long as they are not using PCM).
  6. Improve the error handling. Currently if you enter way off calibration values the filter crashes.

More videos

Some more videos. I later found out that plane was tail heavy and therefore the videos show really poor flying. Unfortunately the camcoder battery died before I found it out. I got one 8 minute 20 second flight later this day :)

Notice the launch settings: reflex, little bit of up elevator and right rudder.

How I learned to do rolls :) First video shows three rolls. I also added some explanations. Second video is same but plays five times slower:

Doppler

I have added a new filter that can measure the speed of the model using the Doppler effect.

In order to use this filter you must attach a sounding device to the model that beeps on a constant frequency. I bought a small piezo buzzer that works without external circuitry and taped it to the model together with 9V battery. The speed measurement is only accurate if the plane is moving directly towards to the microphone or directly away from it. If the plane is also moving sideways then the measured speed will be lower than the real speed.

The filter is named Doppler and has three parameters:

  1. size of the font - 128 is used in my clips
  2. frequency of the buzzer. It is not measured in Hz but rather in FFT slots. In order to determine this parameter tape the model that is not moving and watch the Peak parameter. Use some small value for initial run where you determine the correct value
  3. Precision of the Fast Fourier Transform - this number determines the number points in FFT. The actual number is 1 << parameter (e.g. 12 means 4096 point FFT, etc).

The The DLG launch clips use this command for speed overlay:

Doppler(128,200,12)

Feedback

I created the FlyHow for one reason: to become a better pilot. I think that it is a great way for teaching and training the complex manouvres like launching, thermal circling, etc.

I would really like to see the best DLG pilots and planes in action using FlyHow. So please share your videos. I can also provide some diskspace for the best videos. I also hope to get some suggestions how to improve my launch and thermal circling and how to trim the plane better. (I hope to get some better videos up soon).

Acknowledgments

I would like to thank all the people who created all those wonderful programs that I used: AviSynth, VirtualDub, CRRCSIM and CRRCSIM-F3F. Also the kind folks from the SALglider group who have helped me immensely with my DLG.