-
Notifications
You must be signed in to change notification settings - Fork 39
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
ZeroMQ #55
ZeroMQ #55
Conversation
Thanks for that. There are a lot of changes. I've had a quick look through them but haven't looked at them in detail yet. Yup I'll ignore the pro file. I've never tried it but you could try telling git not to commit the pro file by saying that the pro file has not been changed with something like I've created a feature branch for the pull request called dev-zmq that way the we can test things work as expected before the merge into master. I'll do the merge into dev-zmq now then I may need to ask a few questions and change a few things. |
Seems the commenting out of "//audioburstoqpskdemodulatorsettings.Fs=48000;" and "//audioburstoqpskdemodulator->setSettings(audioburstoqpskdemodulatorsettings);" in mainwindow.cpp are at least part of the cause. I just realized they were commented out in master too. |
Hmm when I click between burst 10500 and non burst 10500 the settings aren't applying for the burst. I shall do some more looking. |
It seems like the lines 846 to 857 you added to mainwindow.cpp...
make the problem appair. When I remove them things work as normal. I'm not sure why BurstOqpskDemodulator or AudioBurstOqpskDemodulator can't deal with 96000kHz. You only added these lines for oqpskburst is there any reason for that? I'm not really sure that the widebandwidthenable setting is makes sense anymore. I put it in when there was just MSK and nothing else seems to use it as far as I can tell. Maybe we should remove it as a setting? |
Good morning Jonti!
Good to see you are getting into the details already 🙂
Merging this code was a bit of an effort, I had a bunch of local stuff for testing. For instance the 96Khz mode for 10.5. I had some encouraging results in the non-burst mode but in burst mode something was not quite right, I got less decodes than in the 48Khz mode. I gave up because of time constraints. I thought I had not copied over any of the 96 references in the code but clearly I missed this one and I think one other one. You can just use the original. Maybe I will revisit 96Khz at some time.
However the application did crash here when I tried this. I realized I added a delete of pRecThread in two places but those should not be needed as it uses this "deleteLater" concept. I simply forgot about that. So when calling delete too early the application crashes. I added this in 2 places, in MainWindow::connectZMQ() and in the destructor, kindly just remove those. I have updated my fork accordingly.
I started with adding the build script on the SDR but ran into some challenges, looks like rtl sdr is not available in pacman. I see the code is on github so perhaps I can add a similar step to build it like you did for libcorrect etc. All this stuff with building dependencies can be quite frustrating, Work is a little slow this week so I hope I can multi-task a little today.
BR
Jeroen
…________________________________
From: Jonti Olds ***@***.***>
Sent: Thursday, July 22, 2021 4:20 AM
To: jontio/JAERO ***@***.***>
Cc: jeroenbeijer ***@***.***>; Author ***@***.***>
Subject: Re: [jontio/JAERO] ZeroMQ (#55)
It seems like the lines 846 to 857 you added ...
if(!settingsdialog->widebandwidthenable)
{
audioburstoqpskdemodulatorsettings.Fs=48000;
}else
{
audioburstoqpskdemodulatorsettings.Fs=96000;
}
are make the problem appair. When I remove them things work as normal. I'm not sure why BurstOqpskDemodulator or AudioBurstOqpskDemodulator can't deal with 96000kHz. You only added these lines for oqpskburst is there any reason for that?
I'm not really sure that the widebandwidthenable setting is makes sense anymore. I put it in when there was just MSK and nothing else seems to use it as far as I can tell. Maybe we should remove it as a setting?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#55 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHNGZH4HWOWQXZOSLIPSO6TTY556XANCNFSM5AXYHAEQ>.
|
Hi Jeroen, The deletion of the thread you created was the next thing I was going to look at. I only see the deletion in mainwindow.cpp so far around line 717...
I don't see any deletion in MainWindow::connectZMQ(). I've pushed my current local copy of your merge to https://github.com/jontio/JAERO/tree/a1f0470b2646a103c7ee1d8d780d3ab65acc4aa1 on the dev-zmq branch so you can see what I'm looking at. I haven't done much just looking through things. I did notice some changes in Yes I built your SDRReceiver and had to build rtl-sdr. the following is how I build and installed it after cloning https://github.com/osmocom/rtl-sdr ...
I had to make some changes to the pro file as well having to define I haven't had time to run it properly yet as it doesn't seem to run without an ini file and I haven't created one yet. I'm off to bed now but will continue working on it tomorrow. Cheers, |
Hi Jonti,
Right, I don't see that delete in that version. To be honest I have perhaps a few too many copies about with your original master branch, my own github fork and then my own version in my svn, So are you seeing any faults when going into settings and toggling the wideband tickmark? Plus does removing the 96Khz statement resolve the issue you were mentioning? Other than that I hope there are no major problems.
I replaced byte with char in the sdr code, encountered that before but forgot to change it in the svn code. I did get both windows and linux CI builds to run for both jaero and the SDR, so nice! But it took a while for the SDR 🙂 but nice to see the binaries. Tried it as well and it seemed to work fine.
I did some work to try and calculate the number of errors on burst packets. I almost included it but in the end decided not too because it was not ready. But while doing this I found that I never managed to get zero errors on the 1200 burst messages. It turns out the original code "stopped" reading a little too early after a CRC ok check on T packets. I fixed this a while ago so a little fuzzy on the details but it misses the last few bits because of the fec padding. So I left it to collect more data before doing the CRC check. Hope that makes sense, so yes it still works as intended and hopefully a little better than before.
Attached is an ini file that should work for you down there on 143E. Friend of mine in Brisbane is running the SDR both on L and C band. He has a slightly older version which added a few Khz on the lower speed channels. I have tried to manually correct this in the file but I obviously cannot test it directly here. So give it a go and see what you get. What I do is use the VFO name in the ini file as the settings name in jaero. This should then also be the default topic name in the zmq settings.
BR
Jeroen
…________________________________
From: Jonti Olds ***@***.***>
Sent: Thursday, July 22, 2021 10:03 AM
To: jontio/JAERO ***@***.***>
Cc: jeroenbeijer ***@***.***>; Author ***@***.***>
Subject: Re: [jontio/JAERO] ZeroMQ (#55)
Hi Jeroen,
The deletion of the thread you created was the next thing I was going to look at. I only see the deletion in mainwindow.cpp so far around line 717...
if(pRecThrd!=0 && pRecThrd->running)
{
emit ZMQaudioStop();
delete pRecThrd;
}
I don't see any deletion in MainWindow::connectZMQ(). I've pushed my current local copy of your merge to https://github.com/jontio/JAERO/tree/a1f0470b2646a103c7ee1d8d780d3ab65acc4aa1 on the dev-zmq branch so you can see what I'm looking at. I haven't done much just looking through things.
I did notice some changes in ReturnResult updateMSK(int bit) aerol.h that I wondered about. Some 8s are now 11 etc., are you sure this function still works as intended? Was there any reason for the changes in that function. It's been ages since I've looked into the details of the bits so I'm rather rusty.
Yes I built your SDRReceiver and had to build rtl-sdr. the following is how I build and installed it after cloning https://github.com/osmocom/rtl-sdr ...
mkdir build && cd build
cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=/mingw64/ ..
mingw32-make
mingw32-make DESTDIR=/../ install
I had to make some changes to the pro file as well having to define byte.
I haven't had time to run it properly yet as it doesn't seem to run without an ini file and I haven't created one yet.
I'm off to bed now but will continue working on it tomorrow.
Cheers,
Jonti
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#55 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHNGZH5JKAT5QBEB4LY2ET3TY7GGHANCNFSM5AXYHAEQ>.
|
Hi Jeroen, Yup without the 96k in the oqpsk burst setting all the settings seem to be working correctly. I have been looking at the thread destruction this morning and the AudioReceiver object is not being deleted until the program finishes. The...
don't seem to do anything. The ZMQaudioStop() signal in MainWindow still calls all the AudioReceiver objects that are created. So putting a debug line
Also if you write a destructor for AudioReceiver it doesn't get run when you select back and forth between audio and zmq. I have a feeling is not working because there's no event loop in the new thread but I could be wrong. Anyway I'll figure out a solution hopefully by the end of the day. I vaguely remember something about making a member function of a class run in a separate thread rather than moving the whole object into a separate thread. I don't see an ini attachment. I guess it's because you're replying to github via email and I assume they filter out attachments. However, I do see in your samples folder one called "CBAND_143E.ini" I'll try that. I don't have my big dish up anymore so it will just be L band. Cheers, |
Morning Jonti!
Just a quick note, just got up. I recall struggling with the thread deletion earlier. I will also just make sure I did not miss anything in merging the code.
Below is the L band ini file content for 143E
BR
Jeroen
sample_rate=1536000
center_frequency=1545600000
zmq_address=tcp://*:6003
#auto_start=0
#auto_start_tuner_idx=0
#remote_rtl=127.0.0.1:1234
#valid tuner gains r82xx_gains[] = { 0, 9, 14, 27, 37, 77, 87, 125, 144, 157, 166, 197, 207, 229, 254, 280, 297, 328, 338, 364, 372, 386, 402, 421, 434, 439, 445, 480, 496 };
tuner_gain=496
correct_dc_bias=1
mix_offset=0
[main_vfos]
size=2
1\frequency=1545116000
1\out_rate=384000
2\frequency=1546096000
2\out_rate=192000
[vfos]
size=31
1\frequency=1545008000
1\gain=10
1\data_rate=600
1\filter_bandwidth=0
1\topic=VFO01
2\frequency=1545027850
2\gain=10
2\data_rate=600
2\filter_bandwidth=0
2\topic=VFO02
3\frequency=1545028600
3\gain=10
3\data_rate=600
3\filter_bandwidth=0
3\topic=VFO03
4\frequency=1545177800
4\gain=10
4\data_rate=600
4\filter_bandwidth=0
4\topic=VFO04
5\frequency=1545209250
5\gain=10
5\data_rate=600
5\filter_bandwidth=0
5\topic=VFO05
6\frequency=1545067000
6\gain=10
6\data_rate=1200
6\filter_bandwidth=0
6\topic=VFO06
7\frequency=1545131800
7\gain=10
7\data_rate=600
7\filter_bandwidth=0
7\topic=VFO07
8\frequency=1545137800
8\gain=10
8\data_rate=600
8\filter_bandwidth=0
8\topic=VFO8
9\frequency=1545142800
9\gain=10
9\data_rate=600
9\filter_bandwidth=0
9\topic=VFO09
10\frequency=1545147800
10\gain=10
10\data_rate=600
10\filter_bandwidth=0
10\topic=VFO10
11\frequency=1545152800
11\gain=10
11\data_rate=600
11\filter_bandwidth=0
11\topic=VFO11
12\frequency=1545022850
12\gain=10
12\data_rate=600
12\filter_bandwidth=0
12\topic=VFO12
13\frequency=1545035800
13\gain=20
13\data_rate=600
13\filter_bandwidth=0
13\topic=VFO13
14\frequency=1545042800
14\gain=10
14\data_rate=600
14\filter_bandwidth=0
14\topic=VFO14
15\frequency=1545103200
15\gain=10
15\data_rate=600
15\filter_bandwidth=0
15\topic=VFO15
16\frequency=1545053050
16\gain=10
16\data_rate=600
16\filter_bandwidth=0
16\topic=VFO16
17\frequency=1546022000
17\gain=10
17\data_rate=10500
17\filter_bandwidth=0
17\topic=VFO17
18\frequency=1546028000
18\gain=10
18\data_rate=10500
18\filter_bandwidth=0
18\topic=VFO18
19\frequency=1546048000
19\gain=10
19\data_rate=10500
19\filter_bandwidth=0
19\topic=VFO19
20\frequency=1546062000
20\gain=10
20\data_rate=10500
20\filter_bandwidth=0
20\topic=VFO20
21\frequency=1546080000
21\gain=10
21\data_rate=10500
21\filter_bandwidth=0
21\topic=VFO21
22\frequency=1546161000
22\gain=10
22\data_rate=8400
22\filter_bandwidth=10000
22\topic=VFO22
23\frequency=1546166000
23\gain=10
23\data_rate=8400
23\filter_bandwidth=10000
23\topic=VFO23
24\frequency=1546171000
24\gain=10
24\data_rate=8400
24\filter_bandwidth=10000
24\topic=VFO24
25\frequency=1546176000
25\gain=10
25\data_rate=8400
25\filter_bandwidth=10000
25\topic=VFO25
26\frequency=1546181000
26\gain=10
26\data_rate=8400
26\filter_bandwidth=10000
26\topic=VFO26
27\frequency=1546186000
27\gain=10
27\data_rate=8400
27\filter_bandwidth=10000
27\topic=VFO27
28\frequency=1546191000
28\gain=10
28\data_rate=8400
28\filter_bandwidth=10000
28\topic=VFO28
29\frequency=1546145000
29\gain=20
29\data_rate=8400
29\filter_bandwidth=10000
29\topic=VFO29
30\frequency=1546150000
30\gain=10
30\data_rate=8400
30\filter_bandwidth=10000
30\topic=VFO30
31\frequency=1546155000
31\gain=10
31\data_rate=8400
31\filter_bandwidth=10000
31\topic=VFO31
…Sent from my Galaxy
-------- Original message --------
From: Jonti Olds ***@***.***>
Date: 23/07/2021 01:47 (GMT+01:00)
To: jontio/JAERO ***@***.***>
Cc: jeroenbeijer ***@***.***>, Author ***@***.***>
Subject: Re: [jontio/JAERO] ZeroMQ (#55)
Hi Jeroen,
Yup without the 96k in the oqpsk burst setting all the settings seem to be working correctly.
I have been looking at the thread destruction this morning and the AudioReceiver object is not being deleted until the program finishes. The...
connect(pRecThrd, SIGNAL (finished()), pRecThrd, SLOT (deleteLater()));
connect(thread, SIGNAL (finished()), thread, SLOT (deleteLater()));
don't seem to do anything. The ZMQaudioStop() signal in MainWindow still calls all the AudioReceiver objects that are created. So putting a debug line std::cout<<"AudioReceiver::ZMQaudioStop "<<this<<std::endl<<std::flush; in AudioReceiver::ZMQaudioStop I get the following when selecting back and forth between audio and zmq ...
AudioReceiver::ZMQaudioStop 0x1ddfe43d7f0
AudioReceiver::ZMQaudioStop 0x1ddfe43d520
AudioReceiver::ZMQaudioStop 0x1ddfe43d200
Also if you write a destructor for AudioReceiver it doesn't get run when you select back and forth between audio and zmq.
I have a feeling is not working because there's no event loop in the new thread but I could be wrong.
Anyway I'll figure out a solution hopefully by the end of the day. I vaguely remember something about making a member function of a class run in a separate thread rather than moving the whole object into a separate thread.
I don't see an ini attachment. I guess it's because you're replying to github via email and I assume they filter out attachments. However, I do see in your samples folder one called "CBAND_143E.ini" I'll try that. I don't have my big dish up anymore so it will just be L band.
Cheers,
Jonti
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#55 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHNGZH6IBWODU6UBFKVWBEDTZCUYFANCNFSM5AXYHAEQ>.
|
Hi Jeroen, Thanks. I didn't get much done today as I flaked about halfway through the day due to getting over this RSV virus. Yes dealing with thread creation in QT seems to lack good documentation and on the web there is definitely some misleading information. I too have struggled with it and I think I have done it in the same way as you have from time to time. I remembered the function I was thinking of Cheers, |
I've started using qtconcurrentrun and have realized on windows at least setting |
from another thread seem to interrupt edit: nope seems to have issues and I'm getting more freezing Maybe this might work...
|
Hi Jonti!
Last day at work today before vacation so need to close up some stuff.
I debugged through the audio receiver and I don't see it blocking on zmq_recv since the ZMQ_DONTWAIT flag is there. It also stopped on emitting the finished signal breakpoint so I am not really sure what is going wrong, clearly it is leaking memory each time the settings are applied. I am fairly sure the code follows the paradigm as it should, i.e. I may have looked at this article:
https://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/
It is pretty old though so stuff probably changed in the meantime. All this event loop stuff gets a little complicated 🙂
Will try to check further time permitting.
BR
Jeroen
…________________________________
From: Jonti Olds ***@***.***>
Sent: Friday, July 23, 2021 10:38 AM
To: jontio/JAERO ***@***.***>
Cc: jeroenbeijer ***@***.***>; Author ***@***.***>
Subject: Re: [jontio/JAERO] ZeroMQ (#55)
zmq_disconnect(subscriber, _address.toStdString().c_str());
zmq_ctx_destroy(context);
from another thread seem to interrupt zmq_recv but I'm not sure if that's a safe thing to do
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#55 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHNGZHYBKVM355CKSJGVBW3TZETAJANCNFSM5AXYHAEQ>.
|
the loop in you pull request looks like ...
is that right? one of the calls to zmq_recv doesn't have the ZMQ_DONTWAIT flag, that's where it blocking. It looks a little odd and I'm not sure what it does. Yup I've used the same link ( |
Duhh! Yes, you are correct of course. Clearly, I had data coming in when I debugged.
It first awaits a topic message and then reads the following data message with the nowait flag.
I just tried with nowait on both and then sleep in between but this gives other weird issues and CRC errors so the data gets out of whack. Not a nice way out in any case.
I know I searched for ways to interrupt zmq_recv before but clearly I did not succeed. I also tried to see if the thread can be stopped and restarted but this seems not possible either.
/Jeroen
…________________________________
From: Jonti Olds ***@***.***>
Sent: Friday, July 23, 2021 12:18 PM
To: jontio/JAERO ***@***.***>
Cc: jeroenbeijer ***@***.***>; Author ***@***.***>
Subject: Re: [jontio/JAERO] ZeroMQ (#55)
the loop in you pull request looks like ...
while(running){
zmq_recv(subscriber, topic, 20, 0);
int received = zmq_recv(subscriber, buf, recsize, ZMQ_DONTWAIT);
QByteArray qdata(buf, received);
emit recAudio(qdata);
}
is that right? one of the calls to zmq_recv doesn't have the ZMQ_DONTWAIT flag, that's where it blocking. It looks a little odd and I'm not sure what it does.
Yup I've used the same link (
https://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/ ) for creating threads. I think it wasn't working due to the blocking nature of zmq_recv(subscriber, topic, 20, 0) and not the event loop as I first though.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#55 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHNGZH5ZS5GBMEND5RA3WY3TZE6WTANCNFSM5AXYHAEQ>.
|
Right, so indeed when calling zmq_ctx_destroy (context) the zmq_recv call will return -1. So, I added a check for this and set running to false to exit the loop and emit finish. The destructor now gets called, so that is good news. But somehow the main thread hangs up. I had this before too I remember now. Any idea why that would happen?
…________________________________
From: Jonti Olds ***@***.***>
Sent: Friday, July 23, 2021 12:18 PM
To: jontio/JAERO ***@***.***>
Cc: jeroenbeijer ***@***.***>; Author ***@***.***>
Subject: Re: [jontio/JAERO] ZeroMQ (#55)
the loop in you pull request looks like ...
while(running){
zmq_recv(subscriber, topic, 20, 0);
int received = zmq_recv(subscriber, buf, recsize, ZMQ_DONTWAIT);
QByteArray qdata(buf, received);
emit recAudio(qdata);
}
is that right? one of the calls to zmq_recv doesn't have the ZMQ_DONTWAIT flag, that's where it blocking. It looks a little odd and I'm not sure what it does.
Yup I've used the same link (
https://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/ ) for creating threads. I think it wasn't working due to the blocking nature of zmq_recv(subscriber, topic, 20, 0) and not the event loop as I first though.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#55 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHNGZH5ZS5GBMEND5RA3WY3TZE6WTANCNFSM5AXYHAEQ>.
|
Just a quick question before bed. So if I understand it correctly you are alternating between sending topic and audio? I could see that being a synchronization problem. Wouldn't it be better to have a prepended byte (a header) on the message telling the receiver whether or not it's a topic message or an audio message ? Either that or prepend each audio message with the topic. Then the nonblocking zmq_recv can be used and there is only one zmq_recv call as well as no synchronization issues. |
That is pretty much how the pub/sub works, i.e. check this example:
https://www.programmersought.com/article/74596969429/
On the sender side one always sends the topic with the ZMQ_SNDMORE flag followed by the payload. At the receiver you read the topic first and the payload next.
…________________________________
From: Jonti Olds ***@***.***>
Sent: Friday, July 23, 2021 1:12 PM
To: jontio/JAERO ***@***.***>
Cc: jeroenbeijer ***@***.***>; Author ***@***.***>
Subject: Re: [jontio/JAERO] ZeroMQ (#55)
Just a quick question before bed. So if I understand it correctly you are alternating between sending topic and audio? I could see that being a synchronization problem. Wouldn't it be better to have a prepended byte (a header) on the message telling the receiver whether or not it's a topic message or an audio message ? Either that or prepend each audio message with the topic. Then the nonblocking zmq_recv can be used and there is only one zmq_recv call as well as no synchronization issues.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#55 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHNGZH6HYKI5GL4YRLGEJSDTZFFCZANCNFSM5AXYHAEQ>.
|
Hi Jonti!
I believe I managed to resolve it. it turns out that closing the zmq context blocks until the socket is closed also. Instead of doing disconnect I changed to zmq_close on the socket and then the context will close without blocking and the zmq_recv blocking call will receive -1 and the while loop can be exited and finished is emitted, I checked the destructor is called. Also looks like memory does not go up like it did before when repeatedly turning zmq audio on and off.
I pushed the changes to my fork.
BR
Jeroen
…________________________________
From: Jonti Olds ***@***.***>
Sent: Friday, July 23, 2021 1:12 PM
To: jontio/JAERO ***@***.***>
Cc: jeroenbeijer ***@***.***>; Author ***@***.***>
Subject: Re: [jontio/JAERO] ZeroMQ (#55)
Just a quick question before bed. So if I understand it correctly you are alternating between sending topic and audio? I could see that being a synchronization problem. Wouldn't it be better to have a prepended byte (a header) on the message telling the receiver whether or not it's a topic message or an audio message ? Either that or prepend each audio message with the topic. Then the nonblocking zmq_recv can be used and there is only one zmq_recv call as well as no synchronization issues.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#55 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHNGZH6HYKI5GL4YRLGEJSDTZFFCZANCNFSM5AXYHAEQ>.
|
Hi Jeroen, Thanks I'll have a look. Yes the I had a look at https://www.programmersought.com/article/74596969429/ I see they do the same block then non-block thing. That doesn't seem right to me, what if the receiver joins in after the topic has been sent but before the audio has been sent, then the receiver will be getting the audio for the topic and the topic for the audio and be out of sync. I'm finding ZeroMQ hard going. I had a look at https://zguide.zeromq.org/docs/chapter5/ which just gave me brain overload. Anyway I think I'll ignore that until I understand ZeroMQ better. I'll do some more testing, checking, and tidying today. Cheers, |
I finally got the RTL dongle working. The USB cable is too long and I really struggle keeping it going for even a few seconds, I need a better cable or a shorter one but then it wouldn't reach outside. Anyway I found another problem. With my current setup I only just managed to get 600bps. Initially I had it on wideband mode (the setting that I want to get rid of) and the sample rate that your program was outputting at a different rate than what JAERO was expecting. After I realized this I turned off the wideband mode and it worked fine for 600bps. Not quite sure what to do about this problem but it's definitely another reason to get rid of that wideband mode. |
I've pushed a new commit f5b5778 to dev-zmq. I have gotten rid of all the thread stuff and replaced it with QtConcurrent::run . It simplifies things considerably so I do suggest you have a look at what I've done and if you could test that it works just like your code that would be good. Currently I can only test 600bps in real life so that's not a particularly big test. I am going to call it a day for today and deal with the wideband setting mode problem tomorrow. |
As well as the topic if the ZMQ sender could also send the audio data rate that would solve the issue and that would mean JAERO would know the audio data rate should be using, so... Topic, audio rate, audio data |
Hi Jonti!
I merged your changes for the audio receiver back into my fork, works very well and looks great 🙂
I updated the SDR code to send the sample rate and also added reading this back in jaero and emitting on the audio received signal to the demodulators so they will have access to it. Not really sure how you think it should be dealt with from there. Up to now my approach was basically that it is up the SDR to feed jaero with the audio it expects. Perhaps it suffices with a message to state the received rate does not match the current Fs in jaero? The alternative would be to reset the demodulator according to the received rate of course.
As for the window title, I only see the version in there, it does not show the setting name like before, I see you used a timer but have not looked into the details. if you have a whole bunch of jaero's running it is very convenient to see the setting/VFO name on the window title.
BR
Jeroen
…________________________________
From: Jonti Olds ***@***.***>
Sent: Saturday, July 24, 2021 5:44 AM
To: jontio/JAERO ***@***.***>
Cc: jeroenbeijer ***@***.***>; Author ***@***.***>
Subject: Re: [jontio/JAERO] ZeroMQ (#55)
As well as the topic if the ZMQ sender could also send the audio data rate that would solve the issue and that would mean JAERO would know the audio data rate should be using, so...
Topic, audio rate, audio data
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#55 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHNGZH26S3MEAOEKIWAWPALTZIZJ3ANCNFSM5AXYHAEQ>.
|
Hi Jeroen, Thanks for that I'll add that dev-zmq tomorrow. Today I got nothing done. For the wideband setting I think in the interim I'll make it so when zmq audio in is enabled then that'll disable wideband setting. Also if the incoming audio rate isn't something JAERO can deal with I'll make a message show and maybe also drop the audio input if this happens. I also want to have a look at the zmq sender in mainwindow.cpp and put that in a separate class then we have two classes for zmq one for sending data and one for receiving data. Cheers, |
Hi Jonti!
That makes sense, I have a separate sender / receiver class in the SDR, not sure why I did not think to do so in jaero, just lazy probably, sorry about that :-)
I suppose it could be good to have some sort of rate switching mechanism at some point. I ran 600 bps at 6Khz before without any issues, maybe something to consider for raspi users. 10500 at 96Khz may also provide some benefits. Ah well always more to do I guess.
I will be going on holiday tomorrow so a bit limited timewise but I have a laptop with me.
BR
Jeroen
…Sent from my Galaxy
-------- Original message --------
From: Jonti Olds ***@***.***>
Date: 25/07/2021 09:14 (GMT+01:00)
To: jontio/JAERO ***@***.***>
Cc: jeroenbeijer ***@***.***>, Author ***@***.***>
Subject: Re: [jontio/JAERO] ZeroMQ (#55)
Hi Jeroen,
Thanks for that I'll add that dev-zmq tomorrow. Today I got nothing done.
For the wideband setting I think in the interim I'll make it so when zmq audio in is enabled then that'll disable wideband setting. Also if the incoming audio rate isn't something JAERO can deal with I'll make a message show and maybe also drop the audio input if this happens. I also want to have a look at the zmq sender in mainwindow.cpp and put that in a separate class then we have two classes for zmq one for sending data and one for receiving data.
Cheers,
Jonti
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#55 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHNGZH42BPTRYDPNACYTYYTTZO2TXANCNFSM5AXYHAEQ>.
|
Hi Jeroen, I've added the bitrate message to the code and also a way of dealing when the zmq samplerate doesn't match the decoder samplerate for the mskdemodulator. It's super simple and not fancy but should be fine. If the rate is different it tries to change the settings to the incoming samplerate. Currently only the mskdemodulator supports different samplerate so I didn't do anything else with the other demodulators but if you want to add multiple samplerate support for other demodulators such as for oqpsk at 96khz it shows the idea about how it's done. The commit for this is eb76851 I'll do the class for the zmq sender next. Cheers, |
Hi Jeroen, I've moved the zmq compressed audio sender code to a class and done some tidying ( commit 7b87374 ). I've got nothing to test the sender class so I hope it works. If you could test it that would be good. Cheers, |
Hi Jonti,
Greetings from the Netherlands!
Sender class is working nicely 🙂 and the code looks great.
BR
Jeroen
…________________________________
From: Jonti Olds ***@***.***>
Sent: Monday, July 26, 2021 12:51 PM
To: jontio/JAERO ***@***.***>
Cc: jeroenbeijer ***@***.***>; Author ***@***.***>
Subject: Re: [jontio/JAERO] ZeroMQ (#55)
Hi Jeroen,
I've moved the zmq compressed audio sender code to a class and done some tidying ( commit 7b87374<7b87374> ). I've got nothing to test the sender class so I hope it works. If you could test it that would be good.
Cheers,
Jonti
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#55 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHNGZH22LMCYUZFMZCYC7W3TZU43HANCNFSM5AXYHAEQ>.
|
Hi Jeroen, Thanks for that. I'll do a final clean, a test on Linux, test the github build works for both Win and Linux then merge into master. When stopping audio demodulators I noticed that you had things like...
and other times...
Calls to stop that are already stopped shouldn't cause an issue so I removed them in commit d9794d4 if doing this caused a problem then there is something wrong with the stop procedure of the demodulator. I tried various demodulators and didn't see any issue so I think this should be fine but if you find a problem with me doing that let me know. Cheers, |
Hi Jonti!
That was sloppiness on my part, the burstoqpskdemodulator being wrong here but still seems to work I suppose. Basically, the main point is to not get audio from both sources at the same time.
BR
Jeroen
…________________________________
From: Jonti Olds ***@***.***>
Sent: Wednesday, July 28, 2021 12:38 AM
To: jontio/JAERO ***@***.***>
Cc: jeroenbeijer ***@***.***>; Author ***@***.***>
Subject: Re: [jontio/JAERO] ZeroMQ (#55)
Hi Jeroen,
Thanks for that. I'll do a final clean, a test on Linux, test the github build works for both Win and Linux then merge into master.
When stopping audio demodulators I noticed that you had things like...
if(!settings.zmqAudio)
{
if(m_audioInput)m_audioInput->stop();
}
OqpskDemodulator::stop();
and other times...
if(m_audioInput)m_audioInput->stop();
if(!settings.zmqAudio)
{
BurstOqpskDemodulator::stop();
}
Calls to stop that are already stopped shouldn't cause an issue so I removed them in commit d9794d4<d9794d4> if doing this caused a problem then there is something wrong with the stop procedure of the demodulator. I tried various demodulators and didn't see any issue so I think this should be fine but if you find a problem with me doing that let me know.
Cheers,
Jonti
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#55 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHNGZHYSHZJPHZKO5IB6A6DTZ4YNFANCNFSM5AXYHAEQ>.
|
Hi Jeroen, I'm have some issues on Linux. On ubuntu 20.04 I sometimes get freezing when switching between zmq audio input and soundcard audio input but not always. I also got a crash on exiting...
On ubuntu 21.04 qt5-default have been removed and the binaries that github made do other strange things such as the leds not turning off and JAERO randomly crashing. Github uses 20.04 so that's not surprising. So I'll pass on dealing with 21.04 and just focus on 20.04. Cheers, |
Hi Jonti,
I tried it on Ubuntu 20.04 here and got the freezing issue a few times as well with the version from github. I can see if I can debug it tomorrow morning.
BR
Jeroen
…________________________________
From: Jonti Olds ***@***.***>
Sent: Wednesday, July 28, 2021 12:59 PM
To: jontio/JAERO ***@***.***>
Cc: jeroenbeijer ***@***.***>; Author ***@***.***>
Subject: Re: [jontio/JAERO] ZeroMQ (#55)
Hi Jeroen,
I'm have some issues on Linux. On ubuntu 20.04 I sometimes get freezing when switching between zmq audio input and soundcard audio input but not always. I also got a crash on exiting...
Assertion failed: pfd.revents & POLLIN (src/signaler.cpp:261)
/usr/local/bin/jaero: line 2: 4015 Aborted (core dumped) /opt/jaero/JAERO
On ubuntu 21.04 qt5-default have been removed and the binaries that github made do other strange things such as the leds not turning off and JAERO randomly crashing. Github uses 20.04 so that's not surprising. So I'll pass on dealing with 21.04 and just focus on 20.04.
Cheers,
Jonti
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#55 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHNGZH7LD7Q3JRFQZSNWSTTTZ7PJZANCNFSM5AXYHAEQ>.
|
Hi Jeroen, It seems to be freezing on
Cheers, |
Hi Jeroen, I don't see a way that zmq can be stopped nicely when a call is made blocking, I think it's going to have to be non blocking and make it polling, something like...
You said you had errors when doing this kind of non blocking way though? I find zmq odd you set a filter ZMQ_SUBSCRIBE with the topic when setting the socket options Cheers, |
Hi Jonti,
Sorry very tied up today. I think what you wrote below should work. What I tried before was just read topic and data with nowait followed by a sleep period, this seemed to cause strange effects in the demodulator at times. I wonder if it may read the data portion of the message where it should be reading the topic string if the timing is not right. But it looks like you handle this by looping until the topic string arrives to then read the rest of the data. On the sender side I set the receive buffer from the dongle to 1/4 of the sample rate so a data message should arrive every 250ms. Of course, if someone else decides to do a similar SDR it may be different. One thing to consider though is that when a ("known" i.e. previously connected) subscriber is down for a short time the publisher will buffer data until it reaches the high water mark. If and when the subscriber comes back it will send all the buffered data so data packets may come at much shorter intervals. So setting the sleep time very high might mean we won't be able to or it may take a long time to consume the publisher buffer.
BR
Jeroen
…________________________________
From: Jonti Olds ***@***.***>
Sent: Thursday, July 29, 2021 4:32 AM
To: jontio/JAERO ***@***.***>
Cc: jeroenbeijer ***@***.***>; Author ***@***.***>
Subject: Re: [jontio/JAERO] ZeroMQ (#55)
Hi Jeroen,
I don't see a way that zmq can be stopped nicely when a call is made blocking, I think it's going to have to be non blocking and make it polling, something like...
void ZMQAudioReceiver::process()
{
// allocate enough for 96Khz sampling with 1 buffer per second
int recsize = 192000;
context = zmq_ctx_new();
subscriber = zmq_socket(context, ZMQ_SUB);
zmqStatus = zmq_connect(subscriber, _address.toStdString().c_str());
zmq_setsockopt(subscriber, ZMQ_SUBSCRIBE, _topic.toStdString().c_str(), 5);
char buf [recsize];
unsigned char rate[4];
quint32 sampleRate;
int received;
running = true;
while(running)
{
//blocking call alternative for topic, here we wait for the topic. we don't use the topic so don't bother loading it into memory.
//I guess the sleep has to be less then the idle period between messages???
while(((received = zmq_recv(subscriber, nullptr, 0, ZMQ_DONTWAIT))<0)&&running)
{
usleep(10000);
}
if(!running)break;
//rate message is next
received = zmq_recv(subscriber, rate, 4, ZMQ_DONTWAIT);
if(!running)break;
memcpy(&sampleRate, rate, 4);
//then audio data
received = zmq_recv(subscriber, buf, recsize, ZMQ_DONTWAIT);
if(!running)break;
if(received>=0)
{
qDebug()<<"sampleRate="<<sampleRate;
QByteArray qdata(buf, received);
emit recAudio(qdata,sampleRate);
}
}
if(subscriber)zmq_close(subscriber);
if(context)zmq_ctx_destroy(context);
subscriber=nullptr;
context=nullptr;
}
You said you had errors when doing this kind of non blocking way though?
I find zmq odd you set a filter ZMQ_SUBSCRIBE with the topic when setting the socket options zmq_setsockopt but then the first message you receive is the topic. I guess that would be useful if you subscribe to multiple publishers. However if you are just subscribing to one publication then you don't need to look at the first message and you can just use zmq_recv(subscriber, nullptr, 0, ZMQ_DONTWAIT)) I think. I do wonder if the syncing the way this code is written needs a timing pause between sets of messages. Maybe the best way would be look at each messages and compare it with the topic for syncing purposes.
Cheers,
Jonti
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#55 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHNGZH5LFP37CMOWKQSCRSTT2C4TBANCNFSM5AXYHAEQ>.
|
Hi Jeroen, If there is buffering that causes no delay between sets of the 3 messages that should still be OK because eventually there will be a pause between the sets which will sync the messages. Once it is in sync and as long as no message is dropped then synchronization should still be maintained. Also if we are expecting the topic message and it's already available then the code won't call the usleep function until it's flushed all buffered messages. So it should be OK. If we cater for other implementations of an SDR maybe adding a check that the topic message matches to be sure about syncronization. As one can call two I'll do some testing tomorrow and let you know how it goes. Cheers, |
Hi Jeroen, Yup that seems to work fine and I have no issues with stopping starting or sync. I however have noticed another issue. The audio playback class Cheers, |
Seems like might just be zmq not being able to keep up over an internet connection. I'll put it down as that and won't make any modifications to |
Hi Jonti!
As mentioned earlier I have done some work with ZeroMQ and JAERO. I will drop you an email as well.
ignore the .pro file I guess, just need to add libzmq.
BR
Jeroen