Scooter_Downunder
13th October 2008, 04:30 PM
I was wondering if someone could assist with a little project I started developing during the weekend, but a few months in rough planning. I am writing a script for my Pro throttle and Fighter Stick which does the following:
The concept involves a Pro-Throttle being moved up and down it's Z Axis, while (what I term as) a "virtual throttle" waits for engagement by the user pressing JS2.b3. The Virtual Throttle is then moved up and down with the throttle, while maintaining a set constant distance. Where upon release, the virtual throttle disengages and remains until it's engaged again
The "Z" axis is Js2.a3, labeled as True_Throttle and defined to cms.a1
while the "Virtual Throttle" is defined to cms.a3
I have set the Virtual throttle to a location of 128 for testing, and the throttle set for at 255 (At the bottom). If you now inch the throttle up until it reaches 240, and js2.b3 is pressed, this will initiate the WAIT sequence and execute the required calculation:
240 > 128
In this case: if ( [True_Throttle > Virtual_Throttle] ) then //
240 - 128
Throttle_DELTA = True_Throttle - Virtual_Throttle;
endif
The calculation derived = "112"
As js2.b2 is held down the next sequence & calculation is performed with the while sequence:
240 > 128
if ( [True_Throttle > Virtual_Throttle] ) then
240-112
Virtual_Throttle = True_Throttle - Throttle_DELTA;
endif
The Virtual_throttle variable will of course equal 128, and a constant distance of 112 units will be maintained "while" js2.b3 is pressed.
I guess my concept is analogous to a duel throttle set up, with the pilot pushing the right throttle forward, and the left throttle moves forward at the same time, and maintains a constant 112 units seperation in front.
The virtual throttle now reaches "0" and its limit is met, while the True throttle is at 112. As the The true throttle is advanced the Virtual throttle stays at zero until the True throttle rests along side it.
This is where things get a little weird:
With the 2 throttles at the equal position value of "0". Or just picture them both in a fully advanced state sitting alongside each other on throttle console:
If I maintain holding js2.b3, and start to retard the true throttle back. The virtual throttle will lag 112 units behind. Therefore, it will not move until 112 units have passed. This fits the equation as we'd expect. But what I don't get is when I disengage the js2.b3 at Zero , I would expect throttle Delta to be reset to Zero bringing the Virtual throttle and true throttle to equal values on the Z Axis. Hence, they should now move together as one. Except the Virtual throttle maintains the same constant value that's set by Throttle_DELTA ??
I have even tried clearing this variable with its own sequence which attempts to zero upon js2.b3 release. But it had no effect?
I have included the script as below with the variables needed to establish a working concept for anyone brave enough...LOL
I am also using CH Control Manager 4.20
%define FirstScan b255
%define Throttle_DELTA A1 // Calculated difference between
// Virtual and True throttle positions
%define True_Throttle cms.a1 // Display Z Axis
%define Virtual_Throttle cms.a3 // Virtual Throttle Z Axis
True_Throttle = js2.a3; // cms.a1 Display Z Axis
// These are setup for my test run:
If (not FirstScan) then
FirstScan = TRUE;
Virtual_Throttle = 128;
Throttle_DELTA = 0;
endif
sequence
wait (JS2.B3) ; // Wait until Button 2 clicks
Throttle_DELTA=0;
if ( [True_Throttle > Virtual_Throttle] ) then //
Throttle_DELTA = True_Throttle - Virtual_Throttle;
endif
if ( [True_Throttle < Virtual_Throttle] ) then //
Throttle_DELTA = Virtual_Throttle - True_Throttle;
endif
if ( [True_Throttle == Virtual_Throttle] ) then
Throttle_DELTA = 0;
endif
endsequence
sequence
while (js2.b3);
if ( [True_Throttle > Virtual_Throttle] ) then
Virtual_Throttle = True_Throttle - Throttle_DELTA;
endif
if ( [True_Throttle < Virtual_Throttle] ) then
Virtual_Throttle = True_Throttle + Throttle_DELTA;
endif
if ( [True_Throttle == Virtual_Throttle] ) then
Virtual_Throttle = True_Throttle;
Throttle_DELTA = 0;
endif
endsequence
The concept involves a Pro-Throttle being moved up and down it's Z Axis, while (what I term as) a "virtual throttle" waits for engagement by the user pressing JS2.b3. The Virtual Throttle is then moved up and down with the throttle, while maintaining a set constant distance. Where upon release, the virtual throttle disengages and remains until it's engaged again
The "Z" axis is Js2.a3, labeled as True_Throttle and defined to cms.a1
while the "Virtual Throttle" is defined to cms.a3
I have set the Virtual throttle to a location of 128 for testing, and the throttle set for at 255 (At the bottom). If you now inch the throttle up until it reaches 240, and js2.b3 is pressed, this will initiate the WAIT sequence and execute the required calculation:
240 > 128
In this case: if ( [True_Throttle > Virtual_Throttle] ) then //
240 - 128
Throttle_DELTA = True_Throttle - Virtual_Throttle;
endif
The calculation derived = "112"
As js2.b2 is held down the next sequence & calculation is performed with the while sequence:
240 > 128
if ( [True_Throttle > Virtual_Throttle] ) then
240-112
Virtual_Throttle = True_Throttle - Throttle_DELTA;
endif
The Virtual_throttle variable will of course equal 128, and a constant distance of 112 units will be maintained "while" js2.b3 is pressed.
I guess my concept is analogous to a duel throttle set up, with the pilot pushing the right throttle forward, and the left throttle moves forward at the same time, and maintains a constant 112 units seperation in front.
The virtual throttle now reaches "0" and its limit is met, while the True throttle is at 112. As the The true throttle is advanced the Virtual throttle stays at zero until the True throttle rests along side it.
This is where things get a little weird:
With the 2 throttles at the equal position value of "0". Or just picture them both in a fully advanced state sitting alongside each other on throttle console:
If I maintain holding js2.b3, and start to retard the true throttle back. The virtual throttle will lag 112 units behind. Therefore, it will not move until 112 units have passed. This fits the equation as we'd expect. But what I don't get is when I disengage the js2.b3 at Zero , I would expect throttle Delta to be reset to Zero bringing the Virtual throttle and true throttle to equal values on the Z Axis. Hence, they should now move together as one. Except the Virtual throttle maintains the same constant value that's set by Throttle_DELTA ??
I have even tried clearing this variable with its own sequence which attempts to zero upon js2.b3 release. But it had no effect?
I have included the script as below with the variables needed to establish a working concept for anyone brave enough...LOL
I am also using CH Control Manager 4.20
%define FirstScan b255
%define Throttle_DELTA A1 // Calculated difference between
// Virtual and True throttle positions
%define True_Throttle cms.a1 // Display Z Axis
%define Virtual_Throttle cms.a3 // Virtual Throttle Z Axis
True_Throttle = js2.a3; // cms.a1 Display Z Axis
// These are setup for my test run:
If (not FirstScan) then
FirstScan = TRUE;
Virtual_Throttle = 128;
Throttle_DELTA = 0;
endif
sequence
wait (JS2.B3) ; // Wait until Button 2 clicks
Throttle_DELTA=0;
if ( [True_Throttle > Virtual_Throttle] ) then //
Throttle_DELTA = True_Throttle - Virtual_Throttle;
endif
if ( [True_Throttle < Virtual_Throttle] ) then //
Throttle_DELTA = Virtual_Throttle - True_Throttle;
endif
if ( [True_Throttle == Virtual_Throttle] ) then
Throttle_DELTA = 0;
endif
endsequence
sequence
while (js2.b3);
if ( [True_Throttle > Virtual_Throttle] ) then
Virtual_Throttle = True_Throttle - Throttle_DELTA;
endif
if ( [True_Throttle < Virtual_Throttle] ) then
Virtual_Throttle = True_Throttle + Throttle_DELTA;
endif
if ( [True_Throttle == Virtual_Throttle] ) then
Virtual_Throttle = True_Throttle;
Throttle_DELTA = 0;
endif
endsequence