Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add individual channel status information to Telecommand #419

Draft
wants to merge 5 commits into
base: next
Choose a base branch
from

Conversation

acebrianjuan
Copy link
Contributor

@acebrianjuan acebrianjuan commented Aug 31, 2020

The purpose of this PR is to address issue #418
I will be adding more commits here as I make progress.

To-do list:

  • Print basic channel info (channel number, system, signal and PRN)
  • Print channel mode/state info
  • Print telemetry and ephemeris status
  • Print Doppler and CN0

Available info: channel number, system, signal and PRN.
Missing info: mode, telemetry status, ephemeris status, Doppler and CN0
@acebrianjuan
Copy link
Contributor Author

As far as my research goes, it looks like the channel status information that we need to fill the table is in the GNSSFlowgraph class. In particular, I've tracked down the channels_ member variable, which is a collection of smart pointers to each of the ChannelInterface objects.

So, in order to be able to access the channels_ object from the TcpCmdInterface class, I've created the GNSSFlowgraph::get_channels() and TcpCmdInterface::set_channels() functions, which let me pass a channels_sptr_ pointer to the class, in the same fashion as GNSSFlowgraph::get_pvt() and TcpCmdInterface::set_pvt() do with the pvt_ object.

Then, in the TcpCmdInterface::status() function, I cast each std::shared_ptr<ChannelInterface> to a std::shared_ptr<Channel> and access its members (see changes).

So far, said changes lead to the following result:

$ telnet 127.0.0.1 3333
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
status
----------------------------------------------------------------------------
| Ch  | System  |  Signal   | PRN | Mode | Tlm | Eph |  Doppler  |   CN0   |
|     |         |           |     |      |     |     |   [Hz]    | [dB-Hz] |
----------------------------------------------------------------------------
|   0 | GPS     | 1C        |   1 | ---  | --- | --- |   23412.5 |    44.3 |
|   1 | GPS     | 1C        |   7 | ---  | --- | --- |   23412.5 |    44.3 |
|   2 | GPS     | 1C        |   8 | ---  | --- | --- |   23412.5 |    44.3 |
|   3 | GPS     | 1C        |   9 | ---  | --- | --- |   23412.5 |    44.3 |
|   4 | GPS     | 1C        |  10 | ---  | --- | --- |   23412.5 |    44.3 |
|   5 | GPS     | 1C        |  11 | ---  | --- | --- |   23412.5 |    44.3 |
|   6 | Galileo | 1B        |  13 | ---  | --- | --- |   23412.5 |    44.3 |
|   7 | Galileo | 1B        |   2 | ---  | --- | --- |   23412.5 |    44.3 |
|   8 | Galileo | 1B        |   9 | ---  | --- | --- |   23412.5 |    44.3 |
|   9 | Galileo | 1B        |  19 | ---  | --- | --- |   23412.5 |    44.3 |
|  10 | Galileo | 1B        |   1 | ---  | --- | --- |   23412.5 |    44.3 |
|  11 | Galileo | 1B        |  21 | ---  | --- | --- |   23412.5 |    44.3 |
----------------------------------------------------------------------------
No PVT information available.

I have managed to print the channel number, system, signal and PRN values for each channel.

The mode, telemetry status, ephemeris status, Doppler and CN0 are missing at the moment.
(The numbers shown in the Doppler and CN0 columns are hardcoded values used for testing)

@acebrianjuan
Copy link
Contributor Author

UPDATE:

The channel status table now looks like this:

$ telnet 127.0.0.1 3333
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
status
-------------------------------------------------------------------------
| Ch  | System  | Signal | PRN | Mode | Tlm | Eph |  Doppler  |   CN0   |
|     |         |        |     |      |     |     |   [Hz]    | [dB-Hz] |
-------------------------------------------------------------------------
|   0 | GPS     | L1 C/A |   1 | TRK  | --- | --- |   23412.5 |    44.3 |
|   1 | GPS     | L1 C/A |   7 | TRK  | --- | --- |   23412.5 |    44.3 |
|   2 | GPS     | L1 C/A |   8 | TRK  | --- | --- |   23412.5 |    44.3 |
|   3 | GPS     | L1 C/A |   9 | TRK  | --- | --- |   23412.5 |    44.3 |
|   4 | GPS     | L1 C/A |  10 | TRK  | --- | --- |   23412.5 |    44.3 |
|   5 | GPS     | L1 C/A |  11 | TRK  | --- | --- |   23412.5 |    44.3 |
|   6 | Galileo | E1     |   2 | TRK  | --- | --- |   23412.5 |    44.3 |
|   7 | Galileo | E1     |  19 | TRK  | --- | --- |   23412.5 |    44.3 |
|   8 | Galileo | E1     |   9 | TRK  | --- | --- |   23412.5 |    44.3 |
|   9 | Galileo | E1     |  12 | TRK  | --- | --- |   23412.5 |    44.3 |
|  10 | Galileo | E1     |  21 | TRK  | --- | --- |   23412.5 |    44.3 |
|  11 | Galileo | E1     |  13 | TRK  | --- | --- |   23412.5 |    44.3 |
-------------------------------------------------------------------------
No PVT information available.

@carlesfernandez & @Arribas I have a question for you.

Does each channel have its own finite state machine? Or do channels share the same fsm instance?

The reason I am asking this is because I see that all channels are showing the same mode/state value in the table. For instance, when I start GNSS-SDR, all channels show the tracking (TRK) mode, which doesn't seem right to me as most channels should be in acquisition (ACQ) right after starting up the receiver.

As you can see in my last commit 15713fc, for each channel in the channels_ vector I am getting the channel state information from the state_ member variable of the channel_fsm_ pointer using a couple of getter functions I created (Channel::fsm_state() and ChannelFsm::state()).

I might be missing something or doing something wrong with the shared pointers.

@carlesfernandez
Copy link
Member

Hi @acebrianjuan

Each channel has its own instance of the state machine, so they are independent. If you already have Doppler and CN0 values, it means the channels are already in tracking. The ACQ stage takes a very short time (in a human time scale), so maybe it is not cached on the screen. Try to limit the number of channels in acquisition with Channels.in_acquisition=1, or set Channels_1B.count=0 to check if this is working.

Please also consider than state_ can take the value of 3 (see

), so you will need to expand your map for this value.

Great work!

Copy link
Member

@carlesfernandez carlesfernandez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some inline comments

src/algorithms/channel/adapters/channel.h Outdated Show resolved Hide resolved
src/algorithms/channel/libs/channel_fsm.h Outdated Show resolved Hide resolved
@acebrianjuan
Copy link
Contributor Author

Thank you for your inputs @carlesfernandez

I have resolved the issues you raised in your inline comments in commits 585754a and b6b7cc7

Each channel has its own instance of the state machine, so they are independent.

That makes complete sense.

If you already have Doppler and CN0 values, it means the channels are already in tracking.

The Doppler and CN0 values you currently see printed in the table are hardcoded dummy values that I have put for wireframing. Please disregard them by now, they are just noise. I will fix this in upcoming commits.

<< std::right << std::setw(9) << 23412.46
<< " | "
<< std::right << std::setw(7) << 44.32

The ACQ stage takes a very short time (in a human time scale), so maybe it is not cached on the screen. Try to limit the number of channels in acquisition with Channels.in_acquisition=1, or set Channels_1B.count=0 to check if this is working.

Yes, the transition from STBY to ACQ and then to TRK is very fast indeed. I have managed observe this transition of states during the initial startup of the receiver (see table below) by putting breakpoints in the main event loop and performing a step by step debugging of the code.

$ telnet 127.0.0.1 3333
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
status
-------------------------------------------------------------------------
| Ch  | System  | Signal | PRN | Mode | Tlm | Eph |  Doppler  |   CN0   |
|     |         |        |     |      |     |     |   [Hz]    | [dB-Hz] |
-------------------------------------------------------------------------
|   0 | GPS     | L1 C/A |   1 | TRK  | --- | --- |   23412.5 |    44.3 |
|   1 | GPS     | L1 C/A |   7 | ACQ  | --- | --- |   23412.5 |    44.3 |
|   2 | GPS     | L1 C/A |   3 | STBY | --- | --- |   23412.5 |    44.3 |
|   3 | GPS     | L1 C/A |   4 | STBY | --- | --- |   23412.5 |    44.3 |
|   4 | GPS     | L1 C/A |   5 | STBY | --- | --- |   23412.5 |    44.3 |
|   5 | GPS     | L1 C/A |   6 | STBY | --- | --- |   23412.5 |    44.3 |
|   6 | Galileo | E1     |   1 | STBY | --- | --- |   23412.5 |    44.3 |
|   7 | Galileo | E1     |   2 | STBY | --- | --- |   23412.5 |    44.3 |
|   8 | Galileo | E1     |   3 | STBY | --- | --- |   23412.5 |    44.3 |
|   9 | Galileo | E1     |   4 | STBY | --- | --- |   23412.5 |    44.3 |
|  10 | Galileo | E1     |   5 | STBY | --- | --- |   23412.5 |    44.3 |
|  11 | Galileo | E1     |   6 | STBY | --- | --- |   23412.5 |    44.3 |
-------------------------------------------------------------------------
No PVT information available.

I have added a to-do list to keep track of the remaining work items.

Thanks again! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants