|
SBB Host
Host communication with the self balancing bike.
|
Application for host communication with the self-balancing-bike microcontroller.
SBB Host is a desktop application used for the communication with the self-balancing-bike microcontroller via USB. It can be used for signal streaming from the microcontroller, control of the motor drivers, and reading of the log files (having extension *.sbb).
Files:
SBBHost.sln, SBBHost.vcxproj, SBBHost.vcxproj.filters,SBBHost.vcxproj.user ,SBBHost.rc ,resource.h: project files necessary for Visual Studio (in Windows only)Makefile: makefile necessary for compilation and installation in LinuxDoxyfile: configuration file for documentation generation from source code using doxygenconfigure: configure script (to use before building or installation)installation_path.txt: installation path (updated by configure). Do not delete this file!Code folders:
./include: contains .h files included in source code./src: contains source .c or .cpp files, inclduing main file main.cpp./lib: contains a folder for each used libraryAdditional folders:
./resource: contains additional resource files necessary for the application./docs/html: contains the documentation in html (generated automatically from source code using doxygen)./bin: contains binary files./.build: contains temporary files created during compilation./.vscode: contains VS code property file(s)Installer files and folders:
./installer: folder containing the installer files./installer/installer.vdproj: installer project necessary for Visual Studio (in Windows only)./installer/win64: contains the Windows x64 installer./installer/linux: contains the Linux installation filesNote that some of the above folders are created during building only.
Building and installation work on Windows x64 or Linux.
For only installation in Windows x64 no prerequisites are necessary: all binary files are provided with the installer.
For Linux installation it is necessary to install
make: this usually can be simple done by using in the terminal
apt install make in Debian/Ubuntu).For building the code and the installer, the following prerequisites are necessary:
./lib for Windows using Visual StudioFor building in Linux or with Mingw-w64 it is racommended to have also Visual Studio Code with C/C+ (ms-vscode) installed. This is not mandatory for compilation but it helps for code completation and make the compilation simpler.
For other distributions the installation is manual and involves:
Use make uninstall for unistalling. Installation requires root permission. This actually adds the following files to the root
/usr/local/bin/sbbhost/usr/local/share/sbbhost-config.ini/usr/local/share/sbbhost/sbbhost-toolbar.xml/usr/local/share/doc/sbbhost/README.md/usr/local/share/applications/sbbhost.desktop/usr/local/share/pixmaps/sbbhost-icon.svgYou may perform local installation (i.e. not system-wide) using .\configure --prefix $HOME/.local.
Windows x64: just use ./installer/win64/SBBHost Installer.msi to install the application in Windows using a setup wizard.
gsettings_dir in the file path_to_installation/sbbhost-config.ini withAfter installation, the configuration file path/to/installation/sbbhost-config.ini may be changed in order to configure the application with special features. These include:
However, modifications should be done carefully by expert users. In Linux, the configuration file is in /usr/share (for ArchLinux) or /usr/local/share.
Documentation for the source code (but not for the used libraries in ./lib) can be generated from the source using doxygen (see https://www.doxygen.nl/download.html for download) with
or also using make
Generated documentation includes only a html version in ./docs/html, with main fil index.html. Documentation is also available on https://stefphd.github.io/SBBHost/. A latex documentation may be also generated by setting
in Doxyfile. The latex version will be in ./docs/latex and can be compiled using latex with
which generates the pdf file ./doc/latex/refman.pdf. Note that this requires having latex installed.
gtkmm4 libraries (including all its dependencies) can be installed with:
Linux:
fftw3 library can be installed with:
Linux:
Alternatively, for Windows you may also use Mingw-w64 with MSYS2 instead of Visual Studio. This requires having the mingw-w64-x86_64-gtkmm-4.0 and mingw-w64-x86_64-fftw packages installed.
Linux and Mingw-w64: building makes use of a makefile. Before building the executable for standalone usage (i.e. without installation), it is necessary to run the configure with
Depending on what you would like to do, there are different options
make build in the terminal (does not rebuild if files do not change)make cleanmake cleanermake remake (regardless if files have changed or not)make or make allIf installed, you may also use Visual Studio Code using ctrl+shift+B to build and generate the documentation (this corresponds to make all).
The gtkmm-4.0 libraries have been initially meant to be used in Linux systems, therefore it is not trivial to use them in Windows, especially with Visual Studio. The workaround is to use vcpkg, which is a tool for installing packages in Windows.
Accordingly to the README file in https://github.com/microsoft/vcpkg, installation is performed with:
Create a path where to install vcpkg. Example path is C:\src\vcpkg or C:\dev\vcpkg, e.g. using the command prompt (with administrator elevation)
Go to C:\src (or the installation path employed), e.g. using
Clone the repository using Git
Bootstrap vcpkg using
Install the gtkmm4 libraries (x64 version)
This includes download and building of all the necessary dependencies. Installation can takes some time.
Install integrate to use vcpkg with Visual Studio (with administrator elevation) using
After having installed gtkmm-4.0, the libraries should appear in C:\src\vcpkg\installed\x64-windows. There the folder ./include contains all the include files to use in the C/C++ source, while ./bin and ./tools contain the corresponding binaries file (i.e. *.dll). You can also find the static libraries in ./lib.
You can test if Visual Studio works by compiling the HelloWorld example in https://gitlab.gnome.org/GNOME/gtkmm-documentation/tree/master/examples/book/helloworld. Make sure to:
If issues are found, these are probably due to an incorrect include directory created by vcpkg for the Visual Studio compiler. The workaround is to install pkg-config, which is a tool for generating the include directories for C/C++ libraries:
Install pkgconf (alias for pkg-config in vcpkg) using
Set an environment variable named VCPKG_ROOT pointing to the vcpkg installation path and restart the command prompt. This may be performed using the terminal (with administrator elevation), e.g. (use your installation path) with
Go to VCPKG_ROOT%\installed\x64-windows\tools\pkgconf
Run pkg-config with gtkmm4 using
This prints a list of include diretories (e.g. -IC:VCPKG_ROOT%/installed/**), which is the flag to pass to the C/C++ compiler for including the necessary directories.
You may also print a nicer list of include directories using in the Windows PowerShell
In Visual Studio put these directories in Additional Include Directory for the C/C++ compiler. You may also add the following additional compiler flag
or alternatively the output of
.\vcpkg\vcpkg install gtkmmand.\vcpkg\vcpkg install pkgconf and replace all x64-windows with x86-windows in all commands.gtkmm you may need to add an environment variable named GSETTINGS_SCHEMA_DIR pointing to C:\src\vcpkg\installed\x64-windows\share\glib-2.0\schemas. You may also make a local copy of this directory in your project folder, which can be copied in the binary folder. This environment variable may be either global or local (you can use putenv command in C)2+2=5
add more gestures to move and zoom in plots: e.g. press roll to move, and roll to zoom
drag and drop in Windows
Implement help but for linux and installation
Implement direct open of a *.sbb file (argv and argc)????
Add plot settings (plot_graph_decim, etc)
Implement PSD in plot mode