TUDelft-CNS-ATM / bluesky

The open source air traffic simulator
GNU General Public License v3.0
380 stars 249 forks source link

True Airspeed display #524

Closed n-wuttiphan closed 2 months ago

n-wuttiphan commented 2 months ago

Hi BlueSky Team,

I want the interface to display the true airspeed value instead of the usual calibrated airspeed. I have edited some lines of code from screen.py by changing the variable 'cas' to 'tas'. Nonetheless, it still displays 'cas'. Can you please help me point out what I did wrong? The edited section is on screen.py, I changed 'cas' to 'tas' in if sentences as shown below.

            if self.swlabel > 2:
                tas = bs.traf.tas[i] / kts        #changed cas to tas
                label.append(str(int(round(tas))))  # changed cas to tas
            else:
                label.append(" ")

            # Check for changes in traffic label text
            if  not (type(bs.traf.label[i])==list) or \
                  not (type(bs.traf.label[i][3])==str) or \
                    not (label[:3] == bs.traf.label[i][:3]):

                bs.traf.label[i] = []
                labelbmp = pg.Surface((100, 60), 0, self.win)
                if not bs.traf.cd.inconf[i]:
                    acfont = self.fontrad
                else:
                    acfont = self.fontamb

                acfont.printat(labelbmp, 0, 0, label[0])
                acfont.printat(labelbmp, 0, dy, label[1])
                acfont.printat(labelbmp, 0, 2 * dy, label[2])

                bs.traf.label[i].append(label[0])
                bs.traf.label[i].append(label[1])
                bs.traf.label[i].append(label[2])
                bs.traf.label[i].append(labelbmp)

            # Blit label
            dest = bs.traf.label[i][3].get_rect()
            dest.top = trafy[i] - 5
            dest.left = trafx[i] + 15
            self.win.blit(bs.traf.label[i][3], dest, None, pg.BLEND_ADD)
ProfHoekstra commented 2 months ago

Your edit is good, but this only affects the pygame interface. Check out the gltraffic.py in lines 295-297 for the QtGL interface, that's where you can change it.

From: NineNW @.> Sent: dinsdag 27 augustus 2024 10:09 To: TUDelft-CNS-ATM/bluesky @.> Cc: Subscribed @.***> Subject: [TUDelft-CNS-ATM/bluesky] True Airspeed disply (Issue #524)

Hi BlueSky Team,

I want the interface to display the true airspeed value instead of the usual calibrated airspeed. I have edited some lines of code from screen.py by changing the variable 'cas' to 'tas'. Nonetheless, it still displays 'cas'. Can you please help me point out what I did wrong? The edited section is on screen.py, I changed 'cas' to 'tas' in bold characters as shown below.

        if self.swlabel > 2:

            **tas** = bs.traf.**tas**[i] / kts

            label.append(str(int(round(**tas**))))  # line 3 of label: speed

        else:

            label.append(" ")

        # Check for changes in traffic label text

        if  not (type(bs.traf.label[i])==list) or \

              not (type(bs.traf.label[i][3])==str) or \

                not (label[:3] == bs.traf.label[i][:3]):

            bs.traf.label[i] = []

            labelbmp = pg.Surface((100, 60), 0, self.win)

            if not bs.traf.cd.inconf[i]:

                acfont = self.fontrad

            else:

                acfont = self.fontamb

            acfont.printat(labelbmp, 0, 0, label[0])

            acfont.printat(labelbmp, 0, dy, label[1])

            acfont.printat(labelbmp, 0, 2 * dy, label[2])

            bs.traf.label[i].append(label[0])

            bs.traf.label[i].append(label[1])

            bs.traf.label[i].append(label[2])

            bs.traf.label[i].append(labelbmp)

        # Blit label

        dest = bs.traf.label[i][3].get_rect()

        dest.top = trafy[i] - 5

        dest.left = trafx[i] + 15

        self.win.blit(bs.traf.label[i][3], dest, None, pg.BLEND_ADD)

- Reply to this email directly, view it on GitHubhttps://github.com/TUDelft-CNS-ATM/bluesky/issues/524, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABWT2BBAX3URC5LC7V7IZU3ZTQXZ3AVCNFSM6AAAAABNFR6U5SVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ4DQNRQGM2DQNQ. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

n-wuttiphan commented 2 months ago

Thank you for the answer. I sincerely appreciate it.