Merging gnuradio generated python code into the Python web serverCan I send samples from the device made by myself to GNU radio?SDR GnuRadio gr-dsd decode D-STAR voiceChoose the right dongle for NOAA images visualization with GnuRadioI want to know the bandwidth of this signal; problems using “QT GUI Frequency sink” to show itGNU Radio code and data type conversionI want to know how QT GUI Entry is implemented in gnuradio. I am puzzled how the code is like?Using Satnogs' *.ogg files in GnuRadio flowgraphsHow to record fixed number of samples in gnuradioGnuRadio RF transmission, legal and safety issuesSimple Gnuradio TX/RX loopback example/tutorial
RPI3B+: What are the four components below the HDMI connector called?
Shortest hex dumping program
Is there a strong legal guarantee that the U.S. can give to another country that it won't attack them?
Is anyone advocating the promotion of homosexuality in UK schools?
Would a non-attacking Barbarian's rage end the same turn he started it?
Swapping "Good" and "Bad"
Why doesn't sea level show seasonality?
Why isn't pressure filtration popular compared to vacuum filtration?
How to tell someone I'd like to become friends without letting them think I'm romantically interested in them?
Which star / galaxy is moving away from us the fastest?
How can I effectively communicate to recruiters that a phone call is not possible?
Switching interface VLAN ID Mid-Production
Are there any balance issues in allowing two half-feats to be taken without the Ability Score Increase instead of a feat?
How can I truly shut down ssh server?
Is it possible to create a craft with specific bones, like the bones of a forgotten beast?
What specific instant in time in the MCU has been depicted the most times?
Why do we need common sense in AI?
Some interesting calculation puzzle that I made
Why would non-kinetic weapons be used for orbital bombardment?
Would dual wielding daggers be a viable choice for a covert bodyguard?
How can I fix the dull colors I am getting in Ubuntu 19.04 Terminal?
Are there any medieval light sources without fire?
Employers keep telling me my college isn't good enough - is there any way to fix this?
What happens to unproductive professors?
Merging gnuradio generated python code into the Python web server
Can I send samples from the device made by myself to GNU radio?SDR GnuRadio gr-dsd decode D-STAR voiceChoose the right dongle for NOAA images visualization with GnuRadioI want to know the bandwidth of this signal; problems using “QT GUI Frequency sink” to show itGNU Radio code and data type conversionI want to know how QT GUI Entry is implemented in gnuradio. I am puzzled how the code is like?Using Satnogs' *.ogg files in GnuRadio flowgraphsHow to record fixed number of samples in gnuradioGnuRadio RF transmission, legal and safety issuesSimple Gnuradio TX/RX loopback example/tutorial
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
I am trying to figure out how I control a Software Defined Radio over a network, and stream the received baseband samples from my remote hardware back to the gnuradio.
What I'm trying to do here is, this Python code should be able to output a user selectable waveform which can be a CW tone, Broadband Noise, or an arbitrary waveform read from a file containing I/Q values.
So I searched on the internet and the closest thing that I found was the BorIP and unfortunately couldn't get it set-up on my machine because the instructions I found were not helpful (at least for a beginner like me).
I created the Python web server using this script (which I found online):
import http.server
import socketserver
PORT = 8080
Handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print("serving at port", PORT)
httpd.serve_forever()
But didn't know how to merge the generated gnuradio python code into the Python web server.
software-defined-radio gnuradio
New contributor
$endgroup$
add a comment |
$begingroup$
I am trying to figure out how I control a Software Defined Radio over a network, and stream the received baseband samples from my remote hardware back to the gnuradio.
What I'm trying to do here is, this Python code should be able to output a user selectable waveform which can be a CW tone, Broadband Noise, or an arbitrary waveform read from a file containing I/Q values.
So I searched on the internet and the closest thing that I found was the BorIP and unfortunately couldn't get it set-up on my machine because the instructions I found were not helpful (at least for a beginner like me).
I created the Python web server using this script (which I found online):
import http.server
import socketserver
PORT = 8080
Handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print("serving at port", PORT)
httpd.serve_forever()
But didn't know how to merge the generated gnuradio python code into the Python web server.
software-defined-radio gnuradio
New contributor
$endgroup$
add a comment |
$begingroup$
I am trying to figure out how I control a Software Defined Radio over a network, and stream the received baseband samples from my remote hardware back to the gnuradio.
What I'm trying to do here is, this Python code should be able to output a user selectable waveform which can be a CW tone, Broadband Noise, or an arbitrary waveform read from a file containing I/Q values.
So I searched on the internet and the closest thing that I found was the BorIP and unfortunately couldn't get it set-up on my machine because the instructions I found were not helpful (at least for a beginner like me).
I created the Python web server using this script (which I found online):
import http.server
import socketserver
PORT = 8080
Handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print("serving at port", PORT)
httpd.serve_forever()
But didn't know how to merge the generated gnuradio python code into the Python web server.
software-defined-radio gnuradio
New contributor
$endgroup$
I am trying to figure out how I control a Software Defined Radio over a network, and stream the received baseband samples from my remote hardware back to the gnuradio.
What I'm trying to do here is, this Python code should be able to output a user selectable waveform which can be a CW tone, Broadband Noise, or an arbitrary waveform read from a file containing I/Q values.
So I searched on the internet and the closest thing that I found was the BorIP and unfortunately couldn't get it set-up on my machine because the instructions I found were not helpful (at least for a beginner like me).
I created the Python web server using this script (which I found online):
import http.server
import socketserver
PORT = 8080
Handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print("serving at port", PORT)
httpd.serve_forever()
But didn't know how to merge the generated gnuradio python code into the Python web server.
software-defined-radio gnuradio
software-defined-radio gnuradio
New contributor
New contributor
edited 8 hours ago
Kevin Reid AG6YO♦
17.4k4 gold badges35 silver badges76 bronze badges
17.4k4 gold badges35 silver badges76 bronze badges
New contributor
asked 8 hours ago
HadadHadad
334 bronze badges
334 bronze badges
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
GNU Radio Companion (GRC) generates Python code that is something like this (not exact text). (Make sure you chose the "No GUI" option in GRC.)
class my_block(gr.top_block):
# ...
def main():
tb = my_block()
tb.run()
if __name__ == '__main__':
main()
You can just import
this as a module in your Python program (the if __name__
check will skip running the code that wouldn't be appropriate). Once you've done that, the way you use it is to just create the top block and call tb.start()
. This will start the flow graph without also waiting for it to finish, which is exactly what you want when you have a separate main loop like a web server.
import my_block
tb = my_block.my_block()
tb.start()
When you're shutting down, do this to stop the GNU Radio threads:
tb.stop()
tb.wait()
Then you can also use the generated methods (a getter and setter per GRC "variable") to change parameters while the flow graph is running.
There's a lot more that can be said about how to go beyond what GRC generates for you (which would best be asked as separate questions), but this is how you get started with integrating a GNU Radio flow graph into a larger program.
I would recommend expecting to eventually stop using GRC's code generation and write your own Python code. This is because GRC has quite a few limitations in what you can do with it — for example, if you want to decide at runtime which type of signal source block to create, you can't do that in GRC but it's easy when you write your own Python. You can always use GRC to generate examples to copy from, when you're unsure how to configure a block.
$endgroup$
$begingroup$
Thank you so much Kevin for taking time and answering my question. Again, I am a real begginer when it comes to python or programming, but definitely I will do my best to figure this out and what I can do.
$endgroup$
– Hadad
6 hours ago
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
return StackExchange.using("schematics", function ()
StackExchange.schematics.init();
);
, "cicuitlab");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "520"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Hadad is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fham.stackexchange.com%2fquestions%2f14883%2fmerging-gnuradio-generated-python-code-into-the-python-web-server%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
GNU Radio Companion (GRC) generates Python code that is something like this (not exact text). (Make sure you chose the "No GUI" option in GRC.)
class my_block(gr.top_block):
# ...
def main():
tb = my_block()
tb.run()
if __name__ == '__main__':
main()
You can just import
this as a module in your Python program (the if __name__
check will skip running the code that wouldn't be appropriate). Once you've done that, the way you use it is to just create the top block and call tb.start()
. This will start the flow graph without also waiting for it to finish, which is exactly what you want when you have a separate main loop like a web server.
import my_block
tb = my_block.my_block()
tb.start()
When you're shutting down, do this to stop the GNU Radio threads:
tb.stop()
tb.wait()
Then you can also use the generated methods (a getter and setter per GRC "variable") to change parameters while the flow graph is running.
There's a lot more that can be said about how to go beyond what GRC generates for you (which would best be asked as separate questions), but this is how you get started with integrating a GNU Radio flow graph into a larger program.
I would recommend expecting to eventually stop using GRC's code generation and write your own Python code. This is because GRC has quite a few limitations in what you can do with it — for example, if you want to decide at runtime which type of signal source block to create, you can't do that in GRC but it's easy when you write your own Python. You can always use GRC to generate examples to copy from, when you're unsure how to configure a block.
$endgroup$
$begingroup$
Thank you so much Kevin for taking time and answering my question. Again, I am a real begginer when it comes to python or programming, but definitely I will do my best to figure this out and what I can do.
$endgroup$
– Hadad
6 hours ago
add a comment |
$begingroup$
GNU Radio Companion (GRC) generates Python code that is something like this (not exact text). (Make sure you chose the "No GUI" option in GRC.)
class my_block(gr.top_block):
# ...
def main():
tb = my_block()
tb.run()
if __name__ == '__main__':
main()
You can just import
this as a module in your Python program (the if __name__
check will skip running the code that wouldn't be appropriate). Once you've done that, the way you use it is to just create the top block and call tb.start()
. This will start the flow graph without also waiting for it to finish, which is exactly what you want when you have a separate main loop like a web server.
import my_block
tb = my_block.my_block()
tb.start()
When you're shutting down, do this to stop the GNU Radio threads:
tb.stop()
tb.wait()
Then you can also use the generated methods (a getter and setter per GRC "variable") to change parameters while the flow graph is running.
There's a lot more that can be said about how to go beyond what GRC generates for you (which would best be asked as separate questions), but this is how you get started with integrating a GNU Radio flow graph into a larger program.
I would recommend expecting to eventually stop using GRC's code generation and write your own Python code. This is because GRC has quite a few limitations in what you can do with it — for example, if you want to decide at runtime which type of signal source block to create, you can't do that in GRC but it's easy when you write your own Python. You can always use GRC to generate examples to copy from, when you're unsure how to configure a block.
$endgroup$
$begingroup$
Thank you so much Kevin for taking time and answering my question. Again, I am a real begginer when it comes to python or programming, but definitely I will do my best to figure this out and what I can do.
$endgroup$
– Hadad
6 hours ago
add a comment |
$begingroup$
GNU Radio Companion (GRC) generates Python code that is something like this (not exact text). (Make sure you chose the "No GUI" option in GRC.)
class my_block(gr.top_block):
# ...
def main():
tb = my_block()
tb.run()
if __name__ == '__main__':
main()
You can just import
this as a module in your Python program (the if __name__
check will skip running the code that wouldn't be appropriate). Once you've done that, the way you use it is to just create the top block and call tb.start()
. This will start the flow graph without also waiting for it to finish, which is exactly what you want when you have a separate main loop like a web server.
import my_block
tb = my_block.my_block()
tb.start()
When you're shutting down, do this to stop the GNU Radio threads:
tb.stop()
tb.wait()
Then you can also use the generated methods (a getter and setter per GRC "variable") to change parameters while the flow graph is running.
There's a lot more that can be said about how to go beyond what GRC generates for you (which would best be asked as separate questions), but this is how you get started with integrating a GNU Radio flow graph into a larger program.
I would recommend expecting to eventually stop using GRC's code generation and write your own Python code. This is because GRC has quite a few limitations in what you can do with it — for example, if you want to decide at runtime which type of signal source block to create, you can't do that in GRC but it's easy when you write your own Python. You can always use GRC to generate examples to copy from, when you're unsure how to configure a block.
$endgroup$
GNU Radio Companion (GRC) generates Python code that is something like this (not exact text). (Make sure you chose the "No GUI" option in GRC.)
class my_block(gr.top_block):
# ...
def main():
tb = my_block()
tb.run()
if __name__ == '__main__':
main()
You can just import
this as a module in your Python program (the if __name__
check will skip running the code that wouldn't be appropriate). Once you've done that, the way you use it is to just create the top block and call tb.start()
. This will start the flow graph without also waiting for it to finish, which is exactly what you want when you have a separate main loop like a web server.
import my_block
tb = my_block.my_block()
tb.start()
When you're shutting down, do this to stop the GNU Radio threads:
tb.stop()
tb.wait()
Then you can also use the generated methods (a getter and setter per GRC "variable") to change parameters while the flow graph is running.
There's a lot more that can be said about how to go beyond what GRC generates for you (which would best be asked as separate questions), but this is how you get started with integrating a GNU Radio flow graph into a larger program.
I would recommend expecting to eventually stop using GRC's code generation and write your own Python code. This is because GRC has quite a few limitations in what you can do with it — for example, if you want to decide at runtime which type of signal source block to create, you can't do that in GRC but it's easy when you write your own Python. You can always use GRC to generate examples to copy from, when you're unsure how to configure a block.
answered 8 hours ago
Kevin Reid AG6YO♦Kevin Reid AG6YO
17.4k4 gold badges35 silver badges76 bronze badges
17.4k4 gold badges35 silver badges76 bronze badges
$begingroup$
Thank you so much Kevin for taking time and answering my question. Again, I am a real begginer when it comes to python or programming, but definitely I will do my best to figure this out and what I can do.
$endgroup$
– Hadad
6 hours ago
add a comment |
$begingroup$
Thank you so much Kevin for taking time and answering my question. Again, I am a real begginer when it comes to python or programming, but definitely I will do my best to figure this out and what I can do.
$endgroup$
– Hadad
6 hours ago
$begingroup$
Thank you so much Kevin for taking time and answering my question. Again, I am a real begginer when it comes to python or programming, but definitely I will do my best to figure this out and what I can do.
$endgroup$
– Hadad
6 hours ago
$begingroup$
Thank you so much Kevin for taking time and answering my question. Again, I am a real begginer when it comes to python or programming, but definitely I will do my best to figure this out and what I can do.
$endgroup$
– Hadad
6 hours ago
add a comment |
Hadad is a new contributor. Be nice, and check out our Code of Conduct.
Hadad is a new contributor. Be nice, and check out our Code of Conduct.
Hadad is a new contributor. Be nice, and check out our Code of Conduct.
Hadad is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Amateur Radio Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fham.stackexchange.com%2fquestions%2f14883%2fmerging-gnuradio-generated-python-code-into-the-python-web-server%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown