https://wiki.gnuradio.org/api.php?action=feedcontributions&user=Peanut&feedformat=atomGNU Radio - User contributions [en]2024-03-28T10:39:35ZUser contributionsMediaWiki 1.39.5https://wiki.gnuradio.org/index.php?title=YAML_GRC&diff=7558YAML GRC2020-09-15T18:39:34Z<p>Peanut: Clarified how 'Asserts' work</p>
<hr />
<div>[[Category:3.8]]<br />
Starting with release 3.8, YAML replaces XML as the file format for GNU Radio Companion. This is triggered by switching from Cheetah to Mako as the templating engine, since Cheetah does not support Python 3. Specifically, this will impact .grc files, block descriptions and block tree files. This article won’t focus on the .grc files, because they aren’t meant for manual editing.<br />
<br />
The most notable change is of course the absence of XML’s angle brackets in favour of YAML’s colon-separated keys and values, and the change in file names for blocks. The latter is important for GRC to recognise the file. Namely, the “.xml” ending has been replaced with “.block.yml” for block descriptions and the underscore in block tree files has been replaced with a dot. (For example, “qtgui_tree.xml” becomes “qtgui.tree.yml”)<br />
<br />
== Block Descriptions ==<br />
<br />
The content of the block descriptions is still the same, although it has been shuffled around a bit. The parts are elaborated below, in the order they should appear in the files.<br />
<br />
=== ID ===<br />
<br />
<syntaxhighlight lang="yaml" line="line" highlight="1"><br />
id: blocks_multiply_const_vxx<br />
label: Multiply Const<br />
<br />
parameters:<br />
- id: type<br />
label: IO Type<br />
(...)<br />
</syntaxhighlight><br />
<br />
The ID is unique for each block and is used to identify it.<br />
<br />
=== Label ===<br />
<br />
<syntaxhighlight lang="yaml" line="line" highlight="2"><br />
id: blocks_multiply_const_vxx<br />
label: Multiply Const<br />
<br />
parameters:<br />
- id: type<br />
label: IO Type<br />
(...)<br />
</syntaxhighlight><br />
<br />
The label is simply the human-readable name of the block, and will be visible from within GRC. It will not appear in the generated code.<br />
<br />
=== Flags (optional) ===<br />
<br />
<syntaxhighlight lang="yaml" line="line" highlight="3"><br />
id: blocks_throttle<br />
label: Throttle<br />
flags: throttle<br />
<br />
parameters:<br />
- id: type<br />
label: Type<br />
(...)<br />
</syntaxhighlight><br />
<br />
The flags indicate special attributes of the block. The only current example of this is the throttle flag, which is used in the Throttle and hardware blocks. For more information on throttling, see the Guided Tutorial: [https://wiki.gnuradio.org/index.php/Guided_Tutorial_GRC#2.4.3._A_Note_on_the_Throttle_Block]<br />
<br />
=== Parameters ===<br />
<br />
<syntaxhighlight lang="yaml" line="line" ><br />
parameters:<br />
- id: tr_chan<br />
label: Trigger Channel<br />
category: Trigger<br />
dtype: int<br />
default: '0'<br />
hide: part<br />
</syntaxhighlight><br />
<br />
This part describes the parameters to display to the user. A number of keywords is used there:<br />
; id<br />
: A unique name for the parameter, it is not displayed to the user but can be used to reference the parameter inside this file: ${<id>}<br />
; label<br />
: Human readable name to display to the user.<br />
; dtype <br />
: Type of the data handled by the parameter<br />
: This can have many values<br />
:; Numbers<br />
:: raw, complex, real, float, int, hex, bool<br />
:; Vectors of numbers<br />
:: complex_vector, real_vector, float_vector, int_vector<br />
:; Strings<br />
:: string, file_open, file_save, _multiline _mutiline_python_external<br />
:; Other special types<br />
:: gui_hint, import, id, stream_id, name and enum<br />
<br />
; default<br />
: A default value for the parameter<br />
; category<br />
: Used to organise a large number of parameters. If set, a new tab will be created and named as the value of the keyword with the parameter inside.<br />
; hide<br />
: If the value is part, the parameter will not be shown on the block representation inside GRC.<br />
: If it's all, it will not be shown at all, even inside the properties window.<br />
: If it's none, it will never be hidden.<br />
; base_key<br />
: Inherit properties from another parameter. The value given is the id of that parameter.<br />
<br />
<br />
<br />
=== Inputs and Outputs (optional) ===<br />
<br />
<syntaxhighlight lang="yaml" line="line" highlight="6-14"><br />
id: qtgui_freq_sink_x<br />
(...)<br />
default: '1.0'<br />
hide: ${ ('part' if int(nconnections) >= 10 else 'all') }<br />
<br />
inputs:<br />
- domain: stream<br />
dtype: ${ type.t }<br />
multiplicity: ${ (0 if (type == 'msg_complex' or type == 'msg_float') else nconnections) }<br />
optional: true<br />
- domain: message<br />
id: freq<br />
optional: true<br />
hide: ${ showports }<br />
<br />
outputs:<br />
- domain: message<br />
(...)<br />
</syntaxhighlight><br />
<br />
This describes the input ports. '''domain''' can be either '''stream''' or '''message'''. Stream ports need a type, which usually is specified as a parameter. This is true for our example, the type is specified in '''type.t'''. The '''multiplicity''' tells us how many "copies" of this port we want. (Yes, this can be zero!) Finally, the '''optional''' flag tells us whether this port ''must'' be connected or not. (GRC won't generate the flowgraph if a non-optional port isn't connected) <br />
<br />
Message ports[https://wiki.gnuradio.org/index.php/Guided_Tutorial_Programming_Topics#5.3_Message_Passing] don't have a specified type here, but they have IDs. This message port can also be hidden, using the "Show message ports" option in the parameters.<br />
<br />
<br />
The output ports work similarly.<br />
<br />
=== Asserts (optional) ===<br />
<br />
<syntaxhighlight lang="yaml" line="line" highlight="6-7"><br />
id: blocks_throttle<br />
(...) <br />
dtype: ${ type }<br />
vlen: ${ vlen }<br />
<br />
asserts:<br />
- ${ vlen > 0 }<br />
<br />
templates:<br />
imports: from gnuradio import blocks<br />
make: blocks.throttle(${type.size}*${vlen}, ${samples_per_second},${ignoretag})<br />
(...)<br />
</syntaxhighlight><br />
<br />
Asserts (previously known as "checks" for the XML blocks) are expressions that ''need'' to be true, otherwise GRC won't let you generate the flowgraph. Asserts are Python statements that should eval() to 'True' when correct, wrapped with Mako template designators '${' and '}'.<br />
<br />
=== Templates ===<br />
<br />
<syntaxhighlight lang="yaml" line="line" highlight="5-12"><br />
id: blocks_message_strobe_random<br />
(...)<br />
optional: true<br />
<br />
templates:<br />
imports: |-<br />
from gnuradio import blocks<br />
import pmt<br />
make: blocks.message_strobe_random(${msg}, ${dist}, ${mean}, ${std})<br />
callbacks:<br />
- set_msg(${msg})<br />
- set_dist(${dist})<br />
(...)<br />
</syntaxhighlight><br />
<br />
The templates describe the code that is created when GRC generates the flowgraph. This part consists of the imports, the make/initialization statements and the callbacks. The values of these keys often happen to span over multiple lines, in which case you're likely to see the "|-" symbols. This is YAML syntax for a literal block scalar[http://yaml.org/spec/current.html#literal%20style/syntax] and the hyphen means that the line break at the end is omitted. <br />
<br />
<br />
Your block probably utilizes parts of GNU Radio or other modules that need to be imported. These are specified as ''imports''.<br />
<br />
<br />
''make'' holds the initialization code, and often depends on several of the parameters. Some of the more involved blocks may also use the "%" symbol, denoting the use of a YAML directive[http://yaml.org/spec/current.html#directive/syntax]. This can occur both in ''imports'' and ''make''. The snippet below may be helpful:<br />
<br />
<syntaxhighlight lang="yaml" line="line" highlight="7-11"><br />
id: rational_resampler_xxx<br />
(...)<br />
make: |-<br />
filter.rational_resampler_${type}(<br />
interpolation=${interp},<br />
decimation=${decim},<br />
% if taps:<br />
taps=${taps},<br />
% else:<br />
taps=None,<br />
% endif<br />
</syntaxhighlight><br />
<br />
Please note that the "${}" is not valid syntax in a directive.<br />
<br />
=== Documentation ===<br />
<br />
<syntaxhighlight lang="yaml" line="line" highlight="3-4"><br />
id: variable_rrc_filter_taps<br />
(...)<br />
documentation: |-<br />
This is a convenience wrapper for calling firdes.root_raised_cosine(...).<br />
<br />
file_format: 1<br />
</syntaxhighlight><br />
<br />
''documentation'' simply contains information about the block. This information is displayed in the block's Documentation tab in GRC.<br />
<br />
=== File Format ===<br />
<br />
=== Others ===<br />
<br />
==== Variable Make ====<br />
<br />
==== Variable Value ====<br />
<br />
== Block Tree Files ==<br />
<br />
The block tree files are fairly straightforward, and tells GRC how to divide the block tree into categories. The following example snippet from gr-digital (which is part of core GNU Radio) describes two categories, ''Coding'' and ''Equalizers''. The blocks are specified using their ''id''s, which should equal their file names without ".block.yml".<br />
<br />
<syntaxhighlight lang="yaml" line="line" ><br />
'[Core]':<br />
- Coding:<br />
- digital_additive_scrambler_bb<br />
- digital_descrambler_bb<br />
- digital_scrambler_bb<br />
- Equalizers:<br />
- digital_cma_equalizer_cc<br />
- digital_lms_dd_equalizer_cc<br />
(...)<br />
</syntaxhighlight></div>Peanuthttps://wiki.gnuradio.org/index.php?title=Hackfest2001&diff=6471Hackfest20012020-01-02T11:15:53Z<p>Peanut: Added option to visit Dwingeloo telescope on Friday</p>
<hr />
<div>= Pre-FOSDEM GNU Radio Hackfest 2020 at ESA/ESTEC = <br />
<br />
Date: January 28th - January 30th<br />
Location: ESA/ESTEC, Keplerlaan 1, 2201 AZ Noordwijk, The Netherlands<br />
<br />
Registration is open at https://tickets.gnuradio.org/hackfest2001/<br />
<br />
== Travel information ==<br />
<br />
As the hackfest is planned from Tue to Thu, the Friday is left for some sightseeing (space museum, Leiden, Den Haag, Amsterdam)/travelling to Brussels for FOSDEM.<br />
Some information for planning travels & stay during the hackfest follows.<br />
<br />
=== By plane ===<br />
<br />
The closest international airport is Amsterdam Schiphol airport (AMS) 30 minutes <br />
train/car ride away from the venue. If a flight from/to Brussels is required a train ride from <br />
Brussels to Leiden adds 2-3 hours additional travel time.<br />
<br />
=== By train === <br />
<br />
Closest train station is Leiden Centraal, from there a Bus departs directly to ESA/ESTEC. <br />
<br />
=== By car ===<br />
<br />
As registered visitor at ESA/ESTEC you can bring your car and park it on premise during the day.<br />
<br />
=== Places to stay ===<br />
<br />
Organization of dinner and/or drinks will happen in the nearby city Leiden due to a <br />
bigger variety of venues and interesting places.<br />
Therefore booking a stay in the nearby city of Leiden is recommended. There are a variety of <br />
hotels & hostels in Leiden and the possibility to use AirBnB as well. If local travel by train/bus is preferred vicinity to the <br />
train station is advised.<br />
<br />
There are nearby (2-3km from ESTEC) hotels in Katwijk and Noordwijk as well.<br />
<br />
=== Travel from Leiden to ESTEC ===<br />
<br />
For traveling from and to the venue bus lines 30/230 (ESA ESTEC) from Platform F at Leiden Centraal can be used.<br />
It takes about 30 minutes (payment only possible by card, *no cash*). For the way back 30/230 are running from ESTEC to <br />
Leiden Centraal as well.<br />
<br />
== Topics == <br />
<br />
Ideally topics are worked on in breakout groups of 3 or 4.<br />
<br />
* FPGA Accelerators (FPGA people would be useful)<br />
* VRT & SigMF tools<br />
* OOT 3.8 porting support and adding to GNU Radio package feed<br />
* Add ptest support to volk and gnuradio recipes (https://wiki.yoctoproject.org/wiki/Ptest)<br />
* GPU Accelerators<br />
* GUI/Visualization improvements - widgets, graphs, plots, etc.<br />
<br />
== Sessions ==<br />
<br />
=== Tuesday ===<br />
Rooms: Df104 '10'/ESTEC@ESA, Df121 '22'/ESTEC@ESA<br />
<br />
* 09:00 Introduction & Workgroup formation<br />
<br />
* 16:30 Day 1 Wrap up presentations<br />
=== Wednesday ===<br />
Rooms: Na213 '22'/ESTEC@ESA, Na315 '12'/ESTEC@ESA<br />
<br />
* 09:00 Day 2 Init<br />
<br />
* 16:30 Day 2 Wrap up presentations<br />
<br />
=== Thursday ===<br />
Rooms: Ba030 '22'/ESTEC@ESA, Cf106 '10'/ESTEC@ESA<br />
<br />
* 09:00 Day 3 Init<br />
<br />
* 16:00 Final presentations & Wrap up<br />
<br />
== Dwingeloo Visit ==<br />
<br />
If there is sufficient interest, [http://www.camras.nl/ CAMRAS] will be glad to host a tour of the Dwingeloo radio telescope on Friday the 31st. Let's aim for a tour from 12:00 till 14:00, so there is sufficient time to continue to Brussels.<br />
<br />
Depending on the number of participants, we can take public transport, or arrange transportation to and from Meppel or Hoogeveen.<br />
There's a direct train from Leiden to Meppel that takes only 1:45 to get there, and it's a 25 minute car ride from Meppel to Dwingeloo.<br />
<br />
== Participants (preliminary) == <br />
<br />
This participant list of for preliminary planning and does not guarantee participation.<br />
Registration is open at https://tickets.gnuradio.org/hackfest2001/<br />
<br />
# Andrej Rode (noc0lour) (full event)<br />
# Philip Balister (Crofton)<br />
# Nathan West (nwest)<br />
# Bastian Bloessl (bastibl)<br />
# Josh M (mormj)<br />
# Derek Kozel (dkozel)<br />
# Nicolas Cuervo (primercuervo)<br />
# Paul Boven (Peanut)<br />
<br />
[[Category:Hackfests]]</div>Peanuthttps://wiki.gnuradio.org/index.php?title=Hackfest2001&diff=6470Hackfest20012020-01-02T10:09:16Z<p>Peanut: /* Participants (preliminary) */</p>
<hr />
<div>= Pre-FOSDEM GNU Radio Hackfest 2020 at ESA/ESTEC = <br />
<br />
Date: January 28th - January 30th<br />
Location: ESA/ESTEC, Keplerlaan 1, 2201 AZ Noordwijk, The Netherlands<br />
<br />
Registration is open at https://tickets.gnuradio.org/hackfest2001/<br />
<br />
== Travel information ==<br />
<br />
As the hackfest is planned from Tue to Thu, the Friday is left for some sightseeing (space museum, Leiden, Den Haag, Amsterdam)/travelling to Brussels for FOSDEM.<br />
Some information for planning travels & stay during the hackfest follows.<br />
<br />
=== By plane ===<br />
<br />
The closest international airport is Amsterdam Schiphol airport (AMS) 30 minutes <br />
train/car ride away from the venue. If a flight from/to Brussels is required a train ride from <br />
Brussels to Leiden adds 2-3 hours additional travel time.<br />
<br />
=== By train === <br />
<br />
Closest train station is Leiden Centraal, from there a Bus departs directly to ESA/ESTEC. <br />
<br />
=== By car ===<br />
<br />
As registered visitor at ESA/ESTEC you can bring your car and park it on premise during the day.<br />
<br />
=== Places to stay ===<br />
<br />
Organization of dinner and/or drinks will happen in the nearby city Leiden due to a <br />
bigger variety of venues and interesting places.<br />
Therefore booking a stay in the nearby city of Leiden is recommended. There are a variety of <br />
hotels & hostels in Leiden and the possibility to use AirBnB as well. If local travel by train/bus is preferred vicinity to the <br />
train station is advised.<br />
<br />
There are nearby (2-3km from ESTEC) hotels in Katwijk and Noordwijk as well.<br />
<br />
=== Travel from Leiden to ESTEC ===<br />
<br />
For traveling from and to the venue bus lines 30/230 (ESA ESTEC) from Platform F at Leiden Centraal can be used.<br />
It takes about 30 minutes (payment only possible by card, *no cash*). For the way back 30/230 are running from ESTEC to <br />
Leiden Centraal as well.<br />
<br />
== Topics == <br />
<br />
Ideally topics are worked on in breakout groups of 3 or 4.<br />
<br />
* FPGA Accelerators (FPGA people would be useful)<br />
* VRT & SigMF tools<br />
* OOT 3.8 porting support and adding to GNU Radio package feed<br />
* Add ptest support to volk and gnuradio recipes (https://wiki.yoctoproject.org/wiki/Ptest)<br />
* GPU Accelerators<br />
* GUI/Visualization improvements - widgets, graphs, plots, etc.<br />
<br />
== Sessions ==<br />
<br />
=== Tuesday ===<br />
Rooms: Df104 '10'/ESTEC@ESA, Df121 '22'/ESTEC@ESA<br />
<br />
* 09:00 Introduction & Workgroup formation<br />
<br />
* 16:30 Day 1 Wrap up presentations<br />
=== Wednesday ===<br />
Rooms: Na213 '22'/ESTEC@ESA, Na315 '12'/ESTEC@ESA<br />
<br />
* 09:00 Day 2 Init<br />
<br />
* 16:30 Day 2 Wrap up presentations<br />
<br />
=== Thursday ===<br />
Rooms: Ba030 '22'/ESTEC@ESA, Cf106 '10'/ESTEC@ESA<br />
<br />
* 09:00 Day 3 Init<br />
<br />
* 16:00 Final presentations & Wrap up<br />
<br />
== Participants (preliminary) == <br />
<br />
This participant list of for preliminary planning and does not guarantee participation.<br />
Registration is open at https://tickets.gnuradio.org/hackfest2001/<br />
<br />
# Andrej Rode (noc0lour) (full event)<br />
# Philip Balister (Crofton)<br />
# Nathan West (nwest)<br />
# Bastian Bloessl (bastibl)<br />
# Josh M (mormj)<br />
# Derek Kozel (dkozel)<br />
# Nicolas Cuervo (primercuervo)<br />
# Paul Boven (Peanut)<br />
<br />
[[Category:Hackfests]]</div>Peanut