Old: Add to the Old Tool - northern-bites/nbites GitHub Wiki

** WARNING: This page is part of the LEGACY WIKI - information included here is possibly out of date. **

Overview

The Tool is the Northern Bites' offboard data inspection and management tool. You can learn a little about the technical specifics of the tool on its dedicated wiki page. This tutorial will teach you how to create and add new modules to the QTool, expanding its functionality.

Getting started with Qt

The Tool utilizes Qt, a graphical application framework from the friendly folks at Nokia. It's free, open-source, community managed, cross-platform, lightweight and extremely well documented.

Qt is covered more in-depth on our Qt guide page, so before you get started with the QTool, read up on Qt and its capabilities there. Consider doing the linked Qt tutorial if this is your first time using a graphical C++ library.

Compile the QTool

You're now ready to have a look around the QTool, see what it does and what you can add to it. To start the QTool, cd to ~/nbites/src/qtool and first execute the following:

make config

This should open up a options window in the terminal. Make sure that 'cmake_built_type' is set to 'release'. Also if you have never built the tool before, you will need to turn on 'build_protobuf'. Turn on 'using_lab_field' if you are looking at data taken on the lab field. Next run the following:

make tool

This tells the C++ compiler to build and run all of the QTool code. If this is the first time you've done this, it may take quite a while - but don't worry, after this, everything you haven't changed won't need to be recompiled on subsequent runs. The cmake options that you set when you ran 'make config' will be saved, so you do not need to do that step in the future unless something has changed or you ran 'make clean'. Remember to turn off build_protobuf' after compiling the first time. Building is much faster with 'build_protobuf' off. If you want to speed things up, you can try running make with the -jX argument, which tells cmake to split the compiling up into multiple jobs, and thus distribute the load over multiple cores of your computer. To find out how many cores you have, paste the following:

cat /proc/cpuinfo | grep processor | wc -l

and then run make -j[that number]

###Exploring the Tool Have a look around and get an idea of the kinds of things the Tool is used for - mostly offline data viewing and manipulation. You'll also want to get an idea of what modules in the Tool look like in code. Pick a tab in the Tool, then open up src/tool. You should be able to identify different tabs as "namespaces" (folders) that you can explore. For example, the "Field Viewer" tab is an object of type FieldViewer, and is located in namespace viewer (the folder, src/tool/fieldview). Find the source for a tab of your choice there, and explore a functioning Qt module. You can even try changing some things in the source file (make a new git branch first!) and compiling to see how your changes affect the GUI.

###Your Assignment As you've seen, most of the functions in the QTool involve loading, viewing and manipulating captured data. You'll be creating a new, basic module that includes some of this functionality.

Your assignment is to create a new Tool tab which, after loading a log in the Data Loader, will allow you to display what the robot sees and scan through the images in the vision log using the forward and back buttons. This functionality is already in the Log Viewer and Vision Viewer, but those classes include MANY things which you won't need. It may be still be instructional to start by looking at those classes.

You can find an example of a successfully completed assignment in the attached files at the end of this page.

###Tips

  • You'll need to add your module to Tool.cpp
  • You'll need to add your source code and headers to the proper CMakeLists.txt
  • You'll need to become familiar with several useful Tool classes written by Bites of yore, including BMPImageViewer
  • You'll need some data, if you want to view it. Cd to ~/nbites/data/logs. There's a script there for downloading data from our server. Run ./sync down 120-2012, which will download plenty of data to get you started.

###Answers ~/nbites/src/qtool/QTool.cpp

~/nbites/src/qtool/QTool.h

~/nbites/src/qtool/viewer/CMakeLists.txt

~/nbites/src/qtool/viewer/QtDemo.cpp

~/nbites/src/qtool/viewer/QtDemo.h