I finally wanted to get into RC planes. Almost 20 years ago I built a glider (The Spirit from Great Planes) and never flew it because I had no experience in flying and I disliked the idea of blowing up several weeks of work in a couple of seconds. When I recently came across the Flite-Test site and saw their foam-built planes, I thought that I could try to build one of these. I downloaded the plans for the FT Simple Cub, grabbed some foam and started building it from scratch.
While building it, I thought it might be a good idea to check out how RC simulators evolved in the past 20 years. After some research, I decided to buy a basic version of the AeroFly RC Simulator. It appealed to me, because of its price and for one special feature: the permanent ground view which largely enhances the orientation of the pilot, especially during the landing approach.
After installing the program, I grabbed one of my kids' PS4 controllers and started to (sim-)fly around. Very soon I discovered though, that the feel wasn't right. The next step was to look for a way to connect my newly acquired FlySky FS-I6X transmitter to the simulator. Unfortunately, the FS-I6X has no USB connector to hook it up to the computer, but some more research revealed that the trainer port can be used together with some virtual joystick middleware: SmartPropoPlus. I than grabbed a SVGA (or PS/2) plug and a mono mini-jack and soldered the required cable.
The way this works is, that the PPM output of the transmitter is fed into the audio-input of the computer where it is sampled by SmartPropoPlus which sends movement data to a virtual joystick device. The RC simulator sees a regular joystick device mimicked by the vJoy device driver. So far so good! But, the resolution was poor and random glitches introduced some weird behavior during flight.
Wait! I still have an old Hitec Flash 5 transmitter lying around. As I did not plan to use it anymore, it was time to re-purpose it. It has 4 potentiometers on the two gimbals, 8 trim buttons and 4 switches, one of which is momentary. It quickly became clear, that an Arduino Nano could do the trick to handle all these Inputs.
The hardware conversion of the transmitter took about 2 hours and the result looks like this:
The software consists of a simple Arduino sketch to read the potentiometers' and switches' states and transmit them over the serial port in a compact text format. This text stream is read by a python script, decoded and fed into the vJoy device driver with this library.
Arduino Script:
Python Script:
Now, the transmitter, well the Arduino Nano, plugs via USB into the computer and the Python script can be run in a terminal window. The resolution and precision have greatly increased and flying became very precise. After several hours of "training", I went to a nearby field and gave my plane its maiden flight without crashing!
While building it, I thought it might be a good idea to check out how RC simulators evolved in the past 20 years. After some research, I decided to buy a basic version of the AeroFly RC Simulator. It appealed to me, because of its price and for one special feature: the permanent ground view which largely enhances the orientation of the pilot, especially during the landing approach.
After installing the program, I grabbed one of my kids' PS4 controllers and started to (sim-)fly around. Very soon I discovered though, that the feel wasn't right. The next step was to look for a way to connect my newly acquired FlySky FS-I6X transmitter to the simulator. Unfortunately, the FS-I6X has no USB connector to hook it up to the computer, but some more research revealed that the trainer port can be used together with some virtual joystick middleware: SmartPropoPlus. I than grabbed a SVGA (or PS/2) plug and a mono mini-jack and soldered the required cable.
The way this works is, that the PPM output of the transmitter is fed into the audio-input of the computer where it is sampled by SmartPropoPlus which sends movement data to a virtual joystick device. The RC simulator sees a regular joystick device mimicked by the vJoy device driver. So far so good! But, the resolution was poor and random glitches introduced some weird behavior during flight.
Wait! I still have an old Hitec Flash 5 transmitter lying around. As I did not plan to use it anymore, it was time to re-purpose it. It has 4 potentiometers on the two gimbals, 8 trim buttons and 4 switches, one of which is momentary. It quickly became clear, that an Arduino Nano could do the trick to handle all these Inputs.
The hardware conversion of the transmitter took about 2 hours and the result looks like this:
The software consists of a simple Arduino sketch to read the potentiometers' and switches' states and transmit them over the serial port in a compact text format. This text stream is read by a python script, decoded and fed into the vJoy device driver with this library.
Arduino Script:
String line;
void setup() {
Serial.begin(19200);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
pinMode(9, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(11, INPUT_PULLUP);
pinMode(A4, INPUT_PULLUP);
pinMode(A5, INPUT_PULLUP);
}
void loop() {
line = analogRead(A0);
line += ",";
line += analogRead(A1);
line += ",";
line += analogRead(A2);
line += ",";
line += analogRead(A3);
line += ",";
line += digitalRead(2);
line += ",";
line += digitalRead(3);
line += ",";
line += digitalRead(4);
line += ",";
line += digitalRead(5);
line += ",";
line += digitalRead(6);
line += ",";
line += digitalRead(7);
line += ",";
line += digitalRead(8);
line += ",";
line += digitalRead(9);
line += ",";
line += digitalRead(10);
line += ",";
line += digitalRead(11);
line += ",";
line += digitalRead(A4);
line += ",";
line += digitalRead(A5);
Serial.println(line);
delay(10);
}
Python Script:
import pyvjoy, serial
controller = serial.Serial('COM4', 19200, timeout=5)
joystick = pyvjoy.VJoyDevice(1)
aileron, elevator, throttle, rudder = 512, 512, 512, 512
aileron_trim, elevator_trim, throttle_trim, rudder_trim = 0, 0, 0, 0
aileron_trim_left_clicked, elevator_trim_up_clicked, throttle_trim_up_clicked, rudder_trim_left_clicked = False, False, False, False
aileron_trim_right_clicked, elevator_trim_down_clicked, throttle_trim_down_clicked, rudder_trim_right_clicked = False, False, False, False
data = []
while len(data) != 16:
line = controller.readline().rstrip()
data = line.split(',')
while line:
vals = []
for text in data:
try:
val = int(text)
except:
val = 0
vals.append(val)
# - Throttle -
if vals[7] == 0:
if not throttle_trim_up_clicked:
throttle_trim += 10
throttle_trim_up_clicked = True
else:
throttle_trim_up_clicked = False
if vals[6] == 0:
if not throttle_trim_down_clicked:
throttle_trim -= 10
throttle_trim_down_clicked = True
else:
throttle_trim_down_clicked = False
# - Rudder -
if vals[4] == 0:
if not rudder_trim_left_clicked:
rudder_trim -= 10
rudder_trim_left_clicked = True
else:
rudder_trim_left_clicked = False
if vals[5] == 0:
if not rudder_trim_right_clicked:
rudder_trim += 10
rudder_trim_right_clicked = True
else:
rudder_trim_right_clicked = False
# - Aileron -
if vals[9] == 0:
if not aileron_trim_left_clicked:
aileron_trim -= 10
aileron_trim_left_clicked = True
else:
aileron_trim_left_clicked = False
if vals[8] == 0:
if not aileron_trim_right_clicked:
aileron_trim += 10
aileron_trim_right_clicked = True
else:
aileron_trim_right_clicked = False
# - Elevator -
if vals[11] == 0:
if not elevator_trim_up_clicked:
elevator_trim -= 10
elevator_trim_up_clicked = True
else:
elevator_trim_up_clicked = False
if vals[10] == 0:
if not elevator_trim_down_clicked:
elevator_trim += 10
elevator_trim_down_clicked = True
else:
elevator_trim_down_clicked = False
aileron = vals[0] + aileron_trim
elevator = vals[1] + elevator_trim
throttle = vals[3] + throttle_trim
rudder = vals[2] + rudder_trim
print('A=%s\tE=%s\tT=%s\tR=%s' % (aileron, elevator, throttle, rudder))
joystick.data.wAxisX = aileron * 32
joystick.data.wAxisY = elevator * 32
joystick.data.wAxisZ = throttle * 32
joystick.data.wAxisXRot = rudder * 32
buttons = (1 - vals[12]) + (1 - vals[13] << 1) + (1 - vals[14] << 2) + (1 - vals[15] << 3)
joystick.data.lButtons = buttons
joystick.update()
try:
line = controller.readline().rstrip()
data = line.split(',')
except:
line = ''
Now, the transmitter, well the Arduino Nano, plugs via USB into the computer and the Python script can be run in a terminal window. The resolution and precision have greatly increased and flying became very precise. After several hours of "training", I went to a nearby field and gave my plane its maiden flight without crashing!
There are some natural remedies that can be used in the prevention and eliminate diabetes totally. However, the single most important aspect of a diabetes control plan is adopting a wholesome life style Inner Peace, Nutritious and Healthy Diet, and Regular Physical Exercise. A state of inner peace and self-contentment is essential to enjoying a good physical health and over all well-being. The inner peace and self contentment is a just a state of mind.People with diabetes diseases often use complementary and alternative medicine. I diagnosed diabetes in 2010. Was at work feeling unusually tired and sleepy. I borrowed a cyclometer from a co-worker and tested at 760. Went immediately to my doctor and he gave me prescription like: Insulin ,Sulfonamides,Thiazolidinediones but Could not get the cure rather to reduce the pain but brink back the pain again. i found a woman testimony name Comfort online how Dr Akhigbe cure her HIV and I also contacted the doctor and after I took his medication as instructed, I am now completely free from diabetes by doctor Akhigbe herbal medicine.So diabetes patients reading this testimony to contact his email drrealakhigbe@gmail.com or his Number +2348142454860 He also use his herbal herbs to diseases like:SPIDER BITE, SCHIZOPHRENIA, LUPUS,EXTERNAL INFECTION, COMMON COLD, JOINT PAIN, EPILEPSY,STROKE,TUBERCULOSIS ,STOMACH DISEASE. ECZEMA, PROGENITOR, EATING DISORDER, LOWER RESPIRATORY INFECTION, DIABETICS,HERPES,HIV/AIDS, ;ALS, CANCER , MENINGITIS,HEPATITIS A AND B,ASTHMA, HEART DISEASE, CHRONIC DISEASE. NAUSEA VOMITING OR DIARRHEA,KIDNEY DISEASE. HEARING LOSSDr Akhigbe is a good man and he heal any body that come to him. here is email drrealakhigbe@gmail.com and his Number +2349010754824
ReplyDeleteThere are some natural remedies that can be used in the prevention and eliminate diabetes totally. However, the single most important aspect of a diabetes control plan is adopting a wholesome life style Inner Peace, Nutritious and Healthy Diet, and Regular Physical Exercise. A state of inner peace and self-contentment is essential to enjoying a good physical health and over all well-being. The inner peace and self contentment is a just a state of mind.People with diabetes diseases often use complementary and alternative medicine. I diagnosed diabetes in 2010. Was at work feeling unusually tired and sleepy. I borrowed a cyclometer from a co-worker and tested at 760. Went immediately to my doctor and he gave me prescription like: Insulin ,Sulfonamides,Thiazolidinediones but Could not get the cure rather to reduce the pain but brink back the pain again. i found a woman testimony name Comfort online how Dr Akhigbe cure her HIV and I also contacted the doctor and after I took his medication as instructed, I am now completely free from diabetes by doctor Akhigbe herbal medicine.So diabetes patients reading this testimony to contact his email drrealakhigbe@gmail.com or his Number +2348142454860 He also use his herbal herbs to diseases like:SPIDER BITE, SCHIZOPHRENIA, LUPUS,EXTERNAL INFECTION, COMMON COLD, JOINT PAIN, EPILEPSY,STROKE,TUBERCULOSIS ,STOMACH DISEASE. ECZEMA, PROGENITOR, EATING DISORDER, LOWER RESPIRATORY INFECTION, DIABETICS,HERPES,HIV/AIDS, ;ALS, CANCER , MENINGITIS,HEPATITIS A AND B,ASTHMA, HEART DISEASE, CHRONIC DISEASE. NAUSEA VOMITING OR DIARRHEA,KIDNEY DISEASE. HEARING LOSSDr Akhigbe is a good man and he heal any body that come to him. here is email drrealakhigbe@gmail.com and his Number +2349010754824
ReplyDelete