PDA

View Full Version : Simple Feedback Yoke (OpenCockpits DCMotors Card)



Siky737
10-31-2015, 07:40 AM
Hi everybody


I'm trying to build a simple FFB yoke as an alternative to still very expensive
products out there. I'm calling it "simple FFB" because the idea is very simple.
The yoke's axis will freely move and rotate when the aircraft is still. With raising
airspeed, tensors will tighten four bungee cords and build up a tension forcing the
yoke to it's central position.
After some research I decided to buy Opencockpits DCmotors card to do the job.
Although I would like to add more motors in the future for runway vibration, prop
wash effect and other forces, I will begin with simple setup using only one motor
driving the tension of the bungee cords.

I'm quite good with mechanical stuff, basic/advanced understanding of electronics but
newbie to coding. I also understand that most of you guys don't really want to become
a full time tutors when it comes to beginners :cool:
Therefore I set on the long and steep road of SIOC code learning even after very
flustrating realisation that most of the manuals and tutorials available online are
either badly translated or quite advanced to catch up with..

So far I set up my DCmotors card with one pot, one motor and managed to run simple
test script provided within the card's original manual. That pretty much covered the
"very" basics.
Now I am going through the pile of code examples trying to understand
correct procedure and here I really need someone to give me a clue about what to
"write" next.
Very simple description of my application could be "Airspeed Gauge driven by DCmotors
card". Simply one DC motor and potentiometer, turning the motor into certain position
defined by IAS.

Could anyone pleeease give me a hand here?


My code (if we can call it that) :lol:


/////////////////////////////////////////////////////////////////////////////////////////////////
//
// SIOC Simple-FFB Yoke file
// Date 31/10/2015
// v 0.1
//
Var 100, Value 0 // Initialisation
Var 001, name Motor_1_out, Link USB_DCMOTOR, Output 1
Var 002, name Pot_1_value, Link USB_ANALOGIC Input 1, PosL 0, PosC128, PosR 255
Var 003, name IAS_from_FS, Link FSUIPC_IN Offset $02BC, length 4

Siky737
11-02-2015, 10:53 AM
guys please, I don't think this is something too complicated for someone who understand SIOC code..
I'm even willing to appreciate your effort financially as there is much more work to this project then just the coding therefore I need to start rolling.
I only have few weeks for the whole build because I'll be away from my workshop for couple of months and really want to finish this before I leave.

Thanks

sstusek
11-03-2015, 09:24 AM
Hi,

Try to use this part of script, it`s from Opencockpits USBservo manual. Of course, it won`t work directly because it is written for USB_SERVOS card but it can trigger some ideas. Unfortunately at the moment I don`t have the time to really look into it!

//
Var 9003, name IAS, Link FSUIPC_IN, Offset $02BC, Length 4 // IAS from FSX
{
L0 = DIV &IAS 128
L1 = L0 * 1.91 // Calculate Servo Slope
L2 = L1 + 271.5 // Calculate Servo Intercept
V9000 = L2
}
Var 9000, name Servo, Link USB_SERVOS, Output 3, PosL 271, PosC 606, PosR 940, Type 2 // ASIgauge

I hope it will help http://www.opencockpits.com/uploads/manual_usbservos_eng.pdf
or this http://mutleyshangar.com/reviews/jack/usb/usb.htm

Siky737
11-03-2015, 11:26 AM
Thanks for reply sstusek

These are the exact code examples I'm going through over and over again for several days and I just cat get my head around it.
The servo card doesn't need to worry about potmeters therefore the code is quite simple and missing chunk of lines that I need to implement. I think the closest model I could find is the code for motorised TQ . Here the position of a physical throttle lever is compared with VC lever and a command I executed to move DC motors and match those positions.

Here is a bit from Hessel Oosten's B767 TQ code:


Var 0000 value 0
{
&lev1_max = 220
&lev1_idle = 60
// &lev1_min = 20 // not used, educational
&lev2_max = 220
&lev2_idle = 60
// &lev2_min = 20 // not used, educational
&speed_fast = 100
&speed_slow = 40
&range_slow = 15
&dead_area = 10
call &lev1_FS_cf
call &lev2_FS_cf
call &FS_mot1_cf
}
Var 1001 name lev1_max
Var 1002 name lev1_idle
// Var XXXX name lev1_min // not used, educational
Var 1003 name lev2_max
Var 1004 name lev2_idle
// Var XXXX name lev2_min // not used, educational
Var 1005 name speed_fast
Var 1006 name speed_slow
Var 1007 name range_slow
Var 1008 name dead_area
Var 1009 name lev1_FS_cf
{
L0 = &lev1_max - &lev1_idle
L1 = 16383 / L0
L1 = TRUNC L1
4
&lev1_FS_cf = L1
}
Var 1010 name lev2_FS_cf
{
L0 = &lev2_max - &lev2_idle
L1 = 16383 / L0
L1 = TRUNC L1
&lev2_FS_cf = L1
}
Var 1011 name FS_mot1_cf
{
L0 = &lev1_max - &lev1_idle
L1 = 12800 / L0
L1 = TRUNC L1
&FS_mot1_cf = L1
}
Var 1012 name lev1_to_Fs link FSUIPC_OUT Offset $089A length 2
Var 1013 name lev2_to_Fs link FSUIPC_OUT Offset $0932 length 2
Var 1014 name pot1_value link USB_ANALOGIC Input 1 PosL 0 PosC 128 PosR 255
{
L0 = &pot1_value - &lev1_idle
L0 = L0 * &lev1_FS_cf
L0 = TRUNC L0
&lev1_to_FS = L0
}
Var 1015 name pot2_value link USB_ANALOGIC Input 2 PosL 0 PosC 128 PosR 255
{
L0 = &pot2_value - &lev2_idle
L0 = L0 * &lev2_FS_cf
L0 = TRUNC L0
&lev2_to_FS = L0
}


I think that my answer is there somewere I just can't see it..
Also what does it mean if "The value is TRUNCated to have only integers" ?

Jay