Control cylinder explanation

  • Hello,

    I am developing a custom plane (a hangdlider -_-) for Aerofly, and I am now trying to add some virtual controls it, so that virtual reality works. However, unlike traditional airplanes that have a stick to control the aircraft, hanggliders have a bar, which is horizontal and held by the pilot with two hands. I started to fiddle with control_cylinder in the file controls.tmd, but I am now stuck because I couldn't really figure out what are all the parameters that it takes.

    Could someone explain how control cylinder works in more details (I couldn't find the necessary details in the documentation unfortunately):

    • How does B0 work ? I understand that it is the transform of the cylinder, but then in what direction is the cylinder when B0 is the identity ?
    • What are Direction and Direction2 ? If B0 already handles the orientation of the cylinder, then why are those two needed ? Are theyused to give the two axes along which the virtual stick can be moved ?
    • To simulate the bar of the hangglider, I have set the type of the cylinder to "stick" (i.e. <[string8][Type][stick]>). Is there something else that would be more appropriate in my case ? And what does that exactly mean ?

    That's a lot of questions, but I really want to bang my head at the wall trying to understand how all those config files work without a precise documentation. Also, the controls cannot be easily visualized or debugged within Aerofly, so it is really hard to know what are the effects of my changes in the TMD file...

    Anyway, I would be very grateful if anyone could shed some light on those mysteries :)...


    Antoine Brunner

  • We have started the documentation over in our wiki but it doesn't have much info yet on the controls... could be extended later on. I wish the day had 48 hours then I could do everything at once.

    B0 is a 3x3 rotation matrix, you can use this tool for example:…rotation-matrix-generator

    The components are: first three: x0, x1, x2 -> the primary cylinder axis. In a conventional stick or yoke this points up or down (orientation does not affect controls), in your case it runs left to right, so 1.0 0.0 0.0 for the first three values.

    The second set of three values are for y0, y1, y2 -> secondary axis of the cylinder, orientated 90 degrees from the first one. In your case 0.0 0.0 1.0 for example.

    Third set of three values is for z0, z1, z2 -> thirds axis to complete the right hand rule, in your case 1.0 0.0 0.0.

    That makes the B0 matrix: [ 0.0 1.0 0.0 0.0 0.0 1.0 1.0 0.0 0.0 ]. Using my right hand thumb and my two brain cells this should be a correct right handed matrix.

    Direction is the control movement axis. For a normal stick the direction would be forward for a positive nose down deflection. Then the axis would be x = 1.0, y = 0.0, z = 0.0 (or Direction = 1.0 0.0 0.0).

    In your case pushing the bar forward probably causes a pitch up effect. So your Direction value should be [ -1.0 0.0 0.0 ].

    Direction2 is the secondary movement axis, only used for two axes inputs like a stick or yoke. This requires the type "stick" to be set as the type, so keep it as is. The secondary axis should be oriented at 90 degrees to the first one ideally. On the left hand grip of a yoke the second direction points straight up for the control wheel rotation (Direction2 0.0 0.0 1.0), on the right hand grip it points straight down (0.0 0.0 -1.0) to perform the same wheel rotation (positive to the right).

    For a regular stick the axis would point towards the right, so a Direction2 = 0.0 -1.0 0.0, positive direction for right aileron.

    In your case moving the bar right probably causes a left turn. So you want to invert that as well, use Direction2 of [ 0.0 1.0 0.0 ].

    Fine tuning:

    If you grab the bar with VR controllers you should be able to move it left and right and forward and back in the right direction first. Once you have that figured out you can fine tune it so that the VR hand movement corresponds 1:1 with the visible control bar movement. For this you need to adjust the "StepDistance", "StepAngle" and the message "Value" properties.

    StepDistance is the movement distance with VR hands that triggers one message to be send to the aircraft. It's a value in meters. The message value determines how much the control input will be moved when receiving the message.

    There is also a StepAngle value but that's not used in the case of a stick if I'm not mistaken. (That would be the VR hand rotation angle needed to send one message. For a discrete selector knob that could be pretty high).

  • Thank you so much for your quick response !! Now I know what those mean, that should make my life so much more easier !

    Well, I also wished the day had more hours, no worries on that side ;) ! The forums act as some kind of documentation anyway, as long as the info is somewhere...

    Thank you once more !