Software Basics
As its name would suggest, the use of software-defined radio to implement communication algorithms requires some programming ability along with knowledge of related software development tools and processes. Although the number of topics included can be a bit daunting at first, a strong understanding of programming and computing in general is invaluable to engineers of all disciplines. Strong computing skills can offer you additional flexibility and opportunities in terms of career progression.
This page provides a number of references you may find useful in getting up to speed for the CDC design project.
Contents
The Linux Command Line
The primary software environment used in CDC will be an Ubuntu Linux virtual machine (VM). An efficient way for interacting with Linux is the use of the command line (also called the terminal, shell, or prompt), a textual interface to issue commands for execution by the Linux OS. In the CDC Ubuntu VM, you can open the terminal by clicking on the following icon:
If you are unfamiliar with the Linux command line or feel you need a refresher, the following tutorials and guides are helpful.
A number of your CDC peers likely also have experience with Linux, so they will be good resources for help. When forming a project team you may consider ensuring at least one team member has a moderate programming background.
Python Programming Language
A key design feature of GNU Radio is the use of the Python programming language for creating application flowgraphs, computationally non-intensive signal processing blocks, and scripting work. Python is an interpreted general-purpose programming language that is very popular among computer scientists, data analysts, and engineers. It consistently ranks as one of the most widely used languages.
The design philosphy behind Python is to make programming easy and fun, which has resulted in a very accessible and readable syntax. The following is an example of defining a simple Python function.
# example of Python's clean syntax
def my_divide(a, b):
c = a / b
return c
Python has an extensive standard library and is easily extended by others. See the Python Package Index (PyPI) for a large collection of third party libraries adding to Python's functionality. Chances are, whatever you are trying to do, someone has already created a Python module that can help you.
Some Python programming knowledge will be needed to develop applications in GNU Radio. The following are useful tutorials and references to start learning the language.
Scientific computing functionality, similar to that of MATLAB, is also possible with Python using the NumPy, SciPy, and Matplotlib libraries. NumPy adds array and matrix support to Python along with a host of efficient mathematical calculation routines. You will need basic knowledge of NumPy arrays when creating or analyzing GNU Radio blocks in Python.
As an interpreted language, Python code is not precompiled to executable machine code but rather parsed and then executed by an intermediate interpreter. This makes Python very flexible and easy to use but means it is often not fast enough to implement computationally intensive signal processing blocks. See the next section on C++ for these cases.
C++ Programming Language
In GNU Radio, most signal processing blocks are implemented using C++, as it is a highly efficient compiled language. C++ is another very popular language that is an object-oriented extension of the C programming language. You should have some familiarity with C through Embedded System Design. An understanding of C++ will be helpful in understanding what certain GNU Radio blocks are doing as well as creating your own blocks should you choose to do so.
Git Version Control
A version control tool tracks changes to the software codebase of a project, allowing multiple team members to develop concurrently. Such tools allow for rolling back to previous versions of code when mistakes are introduced and for the merging of conflicting changes made to the codebase by different developers. These days, Git is the most widely used version control tool for managing source code.
We will maintain a number of GNU Radio modules, useful code and templates, and this wiki (!) in a CDC project hosted on the university's Gitlab server.
You can create your own projects and repos on Gitlab and are strongly encouraged to do so as part of the management of your design project. Login to Gitlab with your normal university credentials.
Git takes a little bit of practice, so make sure to checkout the following tutorials and references.
- Atlassian Bitbucket Tutorial
- Git Handbook on Github Guides
- Git cheatsheet on Github
- MUEEC's Basics of Git Workshop
Important Note: Version control tools like Git work best with textual programming languages such as Python and C++. They have more limited functionality for resolving conflicts in the graphical flowgraphs created with GRC (*.grc). They do, however, allow reverting to older versions of your flowgraph.