Board index FlightGear Development Aircraft Cockpit development

speedo Drum settings

Discussion about creating 2d and 3d cockpits.

Re: speedo Drum settings

Postby WoodSTokk » Wed Nov 20, 2019 7:42 am

Thats the textranslate animation of 6 drums where 'drum1' is the lowest and 'drum6' the highest digit:
Code: Select all
  <animation>
    <type>textranslate</type>
    <object-name>drum1</object-name>
    <property>B1b/fuel-tank-selector/displayed-fuel</property>
    <factor>0.1</factor>
    <axis>
      <x>0</x>
      <y>1</y>
      <z>0</z>
    </axis>
  </animation>

  <animation>
    <type>textranslate</type>
    <object-name>drum2</object-name>
    <property>B1b/fuel-tank-selector/displayed-fuel</property>
    <factor>0.01</factor>
    <step>10</step>
    <scroll>10</scroll>
    <axis>
      <x>0</x>
      <y>1</y>
      <z>0</z>
    </axis>
  </animation>

  <animation>
    <type>textranslate</type>
    <object-name>drum3</object-name>
    <property>B1b/fuel-tank-selector/displayed-fuel</property>
    <factor>0.001</factor>
    <step>100</step>
    <scroll>10</scroll>
    <axis>
      <x>0</x>
      <y>1</y>
      <z>0</z>
    </axis>
  </animation>

  <animation>
    <type>textranslate</type>
    <object-name>drum4</object-name>
    <property>B1b/fuel-tank-selector/displayed-fuel</property>
    <factor>0.0001</factor>
    <step>1000</step>
    <scroll>10</scroll>
    <axis>
      <x>0</x>
      <y>1</y>
      <z>0</z>
    </axis>
  </animation>

  <animation>
    <type>textranslate</type>
    <object-name>drum5</object-name>
    <property>B1b/fuel-tank-selector/displayed-fuel</property>
    <factor>0.00001</factor>
    <step>10000</step>
    <scroll>10</scroll>
    <axis>
      <x>0</x>
      <y>1</y>
      <z>0</z>
    </axis>
  </animation>

  <animation>
    <type>textranslate</type>
    <object-name>drum6</object-name>
    <property>B1b/fuel-tank-selector/displayed-fuel</property>
    <factor>0.000001</factor>
    <step>100000</step>
    <scroll>10</scroll>
    <axis>
      <x>0</x>
      <y>1</y>
      <z>0</z>
    </axis>
  </animation>


The property will be multiplied by <factor>.
If your property is '123', your first drum should display the digit '3'.
'123' multiplied by '0.1' is '12.3'.
The part in front of the decimal point is irrelevant for the textranslate animation,
because the texture will allways be interpreted as 1 unit wide and 1 unit high.
If we start on the bottom line of the texture and move 12 units up, we run 12 times over the texture an will end at the bottom line.
So, only the fractional part is important.
The second drum have a factor of 0.01 and so on.

From the second drum upward, the animation look odd.
The value '123' multiplied by '0.01' is '1.23'. The drum will show '2' but allready rotated 30% to '3'. We dont want that.
Therefor, from the second drum upward, we use <step>.
This fix the textranslate to a hard step and the drum flip if the digit is changing.
Like:
0.197 --> stay on 1
0.198 --> stay on 1
0.199 --> stay on 1
0.200 --> stay on 2
0.201 --> stay on 2
0.202 --> stay on 2

To make a smooth rotation in a defined range, we use <scroll>.
<scroll> will be interpreted as percent from full range.
If we set scroll to 10, the animation will do this:
0.100 --> stay on 1
...
0.190 --> stay on 1
0.191 --> stay on 1 + 10% to 2
0.192 --> stay on 1 + 20% to 2
0.193 --> stay on 1 + 30% to 2
0.194 --> stay on 1 + 40% to 2
0.195 --> stay on 1 + 50% to 2
0.196 --> stay on 2 - 40% to 1
0.197 --> stay on 2 - 30% to 1
0.198 --> stay on 2 - 20% to 1
0.199 --> stay on 2 - 10% to 1
0.200 --> stay on 2

Because the meaning of the second drum is 10 times higher then the first one and <scroll> is 10%,
both drums will be animated synchronously if the digit goes from 19 to 20.
If all drums from the second upward have <scroll> set to 10, all animations are syncronized if the digit change from 99999 to 100000.
WoodSTokk
 
Posts: 1077
Joined: Tue Oct 17, 2017 3:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: SX-W57
IRC name: WoodSTokk
Version: 2020.4.0
OS: Debian Bullseye

Re: speedo Drum settings

Postby wkitty42 » Wed Nov 20, 2019 4:19 pm

if i'm reading this properly, scroll is the way to go to implement things like odometers??

i'm guessing that it would be ok, too, for digital clocks built with drums (instead of LEDs) but using only 6 digits for tens of minutes and only 2 digits for tens of hours...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9161
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 22.04

Re: speedo Drum settings

Postby WoodSTokk » Wed Nov 20, 2019 8:20 pm

You can have as many drums as you want.
You must only adjust <factor> and <step> for each drum.
WoodSTokk
 
Posts: 1077
Joined: Tue Oct 17, 2017 3:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: SX-W57
IRC name: WoodSTokk
Version: 2020.4.0
OS: Debian Bullseye

Re: speedo Drum settings

Postby wkitty42 » Wed Nov 20, 2019 9:27 pm

i was also looking at not the number of drums (there's only 4 on a clock) but the length of them... dividing by 10 for 10 digits is easy but if you are doing a clock, you have 2 digits for the tens of hours (0 and 1), 10 digits for the ones of hours (0-9 with two (1 and 2) repeated), 6 digits for tens of minutes (0-5) and 10 digits for ones of minutes (0-9)...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9161
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 22.04

Re: speedo Drum settings

Postby WoodSTokk » Wed Nov 20, 2019 9:43 pm

Aaah, now a got what you mean.
In the case of a 12 hour clock i would do 3 drums (the left most looks as two drums but its only one object).
So the 2 drums of hours are one object and have a digit tape from 01 to 12 (12 steps).
The tens of minutes have a tape cover 0 to 5 (6 steps) and the ones a normal tape with 0 to 9 (10 steps).
If you want seconds, you can reuse the tapes from minutes. So you need only 3 different tapes.
Its a little bit tricky to syncronize it, but its possible.
WoodSTokk
 
Posts: 1077
Joined: Tue Oct 17, 2017 3:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: SX-W57
IRC name: WoodSTokk
Version: 2020.4.0
OS: Debian Bullseye

Re: speedo Drum settings

Postby wkitty42 » Wed Nov 20, 2019 9:56 pm

yeah, now you got it... you also gave me an idea with using only one drum for hours... that would make it easier... of course, one could do it with only two drums, one for hours and one for minutes and go that way... not sure which is the best overall for size and ease of use/implementation, though... being a 30+ year coder, i was raised on small and fast code...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9161
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 22.04

Re: speedo Drum settings

Postby WoodSTokk » Wed Nov 20, 2019 10:04 pm

I think one drum for minutes is to much, because the tape must fit vertically in the texture and 60 positions are realy much for 1024 pixel high.
I think a greater texture is overpowered for one instrument. So we have 1024 / 60 = ~17 pixels for every position.
And thats not the full digit, you need also a space between the digits on the tape. So it will be more a pixel bunch.
So, the biggest tape is for hours with 12 positions.
On 1024 you have ~85 pixel per position and on 512 you have ~42 pixels.
I think in that case 512x512 is enough to show the digits in a nice resolution.
WoodSTokk
 
Posts: 1077
Joined: Tue Oct 17, 2017 3:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: SX-W57
IRC name: WoodSTokk
Version: 2020.4.0
OS: Debian Bullseye

Re: speedo Drum settings

Postby RobAndrew » Thu Nov 21, 2019 12:25 am

I recently just coded the drums for my fuel tank indicator. It's quite different becuase the drums at the end needs to show which tanks you're using (2, L, 1, L or 3, R, 4, R) like you say, you need to make a seperate tape for them, because there are letters in it and less numbers. It's worked out beautifully though! Now I'm just stuck on the ILS drums, which I've almost got and work fine, right up until you get up to 000.50, where, instead of showing 000.50, it shows 000.40, despite just being at 000.45 (it goes up in 000.05 increments) then goes up in .05 from there! An odd one, which I have come across before...
RobAndrew
 
Posts: 153
Joined: Thu Jul 12, 2018 5:59 pm
Callsign: G-RAND
Version: 2020.
OS: Windows 10

Re: speedo Drum settings

Postby WoodSTokk » Thu Nov 21, 2019 7:44 am

Do you mean Instrument Landing System with ILS? I have never seen a instrument with drums for ILS.
Can you show me a picture of that instrument, please. A description will be also nice.
WoodSTokk
 
Posts: 1077
Joined: Tue Oct 17, 2017 3:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: SX-W57
IRC name: WoodSTokk
Version: 2020.4.0
OS: Debian Bullseye

Re: speedo Drum settings

Postby RobAndrew » Thu Nov 21, 2019 8:05 pm

Image
Image

It is used to display the frequency to which you are currently using. This are not clickable, but just to show what frequency you're on. The knobs are "Pwr" and "Volume" Not sure what the volume is though, can you get readouts to say how close you are to the ground? If so That might be it
RobAndrew
 
Posts: 153
Joined: Thu Jul 12, 2018 5:59 pm
Callsign: G-RAND
Version: 2020.
OS: Windows 10

Re: speedo Drum settings

Postby WoodSTokk » Thu Nov 21, 2019 11:37 pm

Ahhh, okay, the frequency :) Thats a NAV radio.
This goes from 108.000 up to 117.950 with 0.050 stepping, so the last digit is allways 0 and therefor most radios dont show it.
The first digit is allways '1', so you need no animation of that digit ;)
Your last digit (second fractional) can only be '0' or '5'. You can make a single tape with only 0 and 5 on it, or (and i prefer this) you make one tape for both frictional digits from '00' to '95'. This tape has than 20 positions.

The volume is to identify the station. If you rise up the volume you should hear the morse code of the station.

For the distance to the ground the aircraft need a radio-altimeter.
This has normally a dial display with one pointer and a scale from 0 to 2500 in feet.
If the aircraft is more than 2500 feet above the ground, the pointer will move behind a cover so it is hidden from view.
WoodSTokk
 
Posts: 1077
Joined: Tue Oct 17, 2017 3:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: SX-W57
IRC name: WoodSTokk
Version: 2020.4.0
OS: Debian Bullseye

Re: speedo Drum settings

Postby RobAndrew » Fri Nov 22, 2019 9:29 am

Okay cool! A few things though:
As mentioned, I have the .05 digit working fine, using the standard "0-9" tape. It's the one next to it that I'm having issues with. Because it needs to turn .1 every time the one next to it turns twice. I would rather not have to make new tapes, as I've already reorganised my image files quite a lot and would rather not do it again.
The issue I'm having as stated above, is that it gets to. 45, and then when the actual value moves to .50, it goes down to .40 and ends up behind the actual value by .05 from there on. This is the code for both .05 and .10...
RobAndrew
 
Posts: 153
Joined: Thu Jul 12, 2018 5:59 pm
Callsign: G-RAND
Version: 2020.
OS: Windows 10

Re: speedo Drum settings

Postby RobAndrew » Fri Nov 22, 2019 9:33 am

Code: Select all
 <animation>
  <type>textranslate</type>
  <object-name>Cylinder.000</object-name>
  <property>instrumentation/dme/frequencies/selected-mhz</property>
  <factor>10</factor>
  <step>1</step>
  <scroll>1</scroll>
  <center>
   <x-m>0.00069</x-m>
   <y-m>0.00872</y-m>
   <z-m>-0.01321</z-m>
  </center>
  <axis>
   <x>0</x>
   <y>-1</y>
   <z>0</z>
  </axis>
 </animation>

 <animation>
  <type>textranslate</type>
  <object-name>Cylinder.001</object-name>
  <property>instrumentation/dme/frequencies/selected-mhz</property>
  <factor>1</factor>
  <step>0.1</step>
  <scroll>-10</scroll>
  <center>
   <x-m>0.00069</x-m>
   <y-m>0.00414</y-m>
   <z-m>-0.01321</z-m>
  </center>
  <axis>
   <x>0</x>
   <y>-1</y>
   <z>0</z>
  </axis>
 </animation>
RobAndrew
 
Posts: 153
Joined: Thu Jul 12, 2018 5:59 pm
Callsign: G-RAND
Version: 2020.
OS: Windows 10

Re: speedo Drum settings

Postby Richard » Fri Nov 22, 2019 10:52 am

Here's how I do it ref: F-15/Models/Cockpit/all-interior.xml:2310
Code: Select all
<animation>
    <type>textranslate</type>
    <object-name>ils-freq-drum-1</object-name>
    <property>instrumentation/nav[0]/frequencies/selected-mhz</property>
    <factor>0.001</factor>
    <offset>-100</offset>
    <step>100</step>
    <scroll>0.5</scroll>
    <axis>
      <y>-1</y>
    </axis>
  </animation>
  <animation>
    <type>textranslate</type>
    <object-name>ils-freq-drum-2</object-name>
    <property>instrumentation/nav[0]/frequencies/selected-mhz</property>
    <factor>0.01</factor>
    <offset>-10</offset>
    <step>10</step>
    <scroll>0.5</scroll>
    <axis>
      <y>-1</y>
    </axis>
  </animation>
  <animation>
    <type>textranslate</type>
    <object-name>ils-freq-drum-3</object-name>
    <property>instrumentation/nav[0]/frequencies/selected-mhz</property>
    <factor>0.1</factor>
    <offset>-1</offset>
    <step>1</step>
    <axis>
      <y>-1</y>
    </axis>
  </animation>
  <animation>
    <type>textranslate</type>
    <object-name>ils-freq-drum-4</object-name>
    <property>instrumentation/nav[0]/frequencies/selected-mhz</property>
    <factor>1</factor>
    <offset>-0.1</offset>
    <step>0.1</step>
    <axis>
      <y>-1</y>
    </axis>
  </animation>
  <animation>
    <type>textranslate</type>
    <object-name>ils-freq-drum-5</object-name>
    <property>instrumentation/nav[0]/frequencies/selected-mhz</property>
    <factor>10</factor>
    <offset>-0.01</offset>
    <axis>
      <y>-1</y>
    </axis>
  </animation>


The 3d objects follows my usual naming convention (left hand clockwise); and thus drum1 is the first digit on the left (hundreds).
Image
Richard
 
Posts: 810
Joined: Sun Nov 02, 2014 11:17 pm
Version: Git
OS: Win10

Re: speedo Drum settings

Postby WoodSTokk » Fri Nov 22, 2019 1:14 pm

This devices have detents in the knobs, so the drums won't scroll smoothly. They will jump hard.
In the animation you need only <factor> and <step>.
If you have rounding problems with the last digit, add <bias>0.005</bias> to the animation.

Smooth animation is good for measuring instruments like speed, altitude, fuel quantity, RPMs and so on .
WoodSTokk
 
Posts: 1077
Joined: Tue Oct 17, 2017 3:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: SX-W57
IRC name: WoodSTokk
Version: 2020.4.0
OS: Debian Bullseye

Previous

Return to Cockpit development

Who is online

Users browsing this forum: No registered users and 1 guest