Writing Joystick Code: Part 1: Difference between revisions

Jump to navigation Jump to search
m (Update forum links)
Line 63: Line 63:
   <axis n="1">
   <axis n="1">
     <desc>Elevator</desc>
     <desc>Elevator</desc>
    ''<dead-band type="double">0.0</dead-band>''
     <binding>
     <binding>
       <command>property-scale</command>
       <command>property-scale</command>
Line 69: Line 70:
       ''<power type="int">3</power>''
       ''<power type="int">3</power>''
       ''<offset>0.0</offset>''
       ''<offset>0.0</offset>''
       ''<dead-band type="double">0.0</dead-band>''
       ''<squared type="bool">true</squared>''
      <squared type="bool">true</squared>
     </binding>
     </binding>
   </axis>
   </axis>
Line 77: Line 77:


The optional lines need quite a bit of explanation. For a start, all three these axes have a center-zero action. At this point, they have a value of 0. As you move them to their extreme positions, their value gradually increases (decreases) to +1.0 or -1.0, depending on the direction of movement.
The optional lines need quite a bit of explanation. For a start, all three these axes have a center-zero action. At this point, they have a value of 0. As you move them to their extreme positions, their value gradually increases (decreases) to +1.0 or -1.0, depending on the direction of movement.
<dead-band ..... : You may want a small movement around the center of the axis not to do anything. Or your joystick might be getting old, and it jitters around zero. Jittering is small, continuous value changes in the value. You can then supply a value for dead-band that will eliminate this. And it will be small. A dead-band of 1.0 means that the axis does nothing, a dead-band of 0.25 means that the axis does nothing for the first 25% of its movement.


<factor ...... : If you find that moving an axis results in the aileron, elevator or rudder moving in the wrong direction, change the -1.0 to 1.0 or the 1.0 to -1.0. This will make it work the other way round.
<factor ...... : If you find that moving an axis results in the aileron, elevator or rudder moving in the wrong direction, change the -1.0 to 1.0 or the 1.0 to -1.0. This will make it work the other way round.
Line 83: Line 85:


<offset ..... : If you find that in its center position the axes outputs a non-zero value, you can put that same value here, with opposite + or - sign, to counter-act this. The HUD will show you if you have an offset problem, and can be used to see if you have solved it.
<offset ..... : If you find that in its center position the axes outputs a non-zero value, you can put that same value here, with opposite + or - sign, to counter-act this. The HUD will show you if you have an offset problem, and can be used to see if you have solved it.
<dead-band ..... : You may want a small movement around the center of the axis not to do anything. Or your joystick might be getting old, and it jitters around zero. Jittering is small, continuous value changes in the value. You can then supply a value for dead-band that will eliminate this. And it will be small. A dead-band of 1.0 means that the axis does nothing, a dead-band of 0.25 means that the axis does nothing for the first 25% of its movement.


For aileron and rudder you replace ''>/controls/flight/elevator'' with ''/controls/flight/aileron'' and ''/controls/flight/rudder''. Don't forget to change the the name between <desc> and </desc>.
For aileron and rudder you replace ''>/controls/flight/elevator'' with ''/controls/flight/aileron'' and ''/controls/flight/rudder''. Don't forget to change the the name between <desc> and </desc>.


=== Other axes ===
=== Other axes ===
49

edits

Navigation menu