Posts tagged “jrk”
You are currently viewing a selection of posts from the Pololu Blog. You can also view all the posts.
I am happy to announce that we have released version 1.2.0 of the configuration software for the Jrk G2 USB Motor Controllers with Feedback.
This release contains a large number of new features for our graphical user interface (GUI) software that let you have more information and control while you are setting up a feedback system with the Jrk.
The graph window received the most striking update: you can now use the mouse to vertically move and zoom the different plots independently of each other. You can change the colors of the plots and save your settings to a file so you don’t have to redo them the next time you start the utility. Colored indicator arrows appear at the top and/or bottom of the graph if one of the values you are plotting is too high or low to be plotted.
The variables shown in the status tab can now be moved into their own, separate window, so you can see them at all times without having to switch back to the status tab. Similarly, the “Manually set target” interface is now visible from every tab, so you can quickly test your feedback system after changing any setting. We added a “Center” button that sets the Jrk’s target to 2048, and we added a moving red dot to the target slider that shows the scaled feedback if feedback is enabled. If feedback is not enabled, the dot is green and shows the duty cycle instead.
The “Apply settings” button now has a blue background and a label to its left when it is enabled, to make it more obvious that you should apply your settings.
The main window and the variables window in the Jrk G2 Configuration Utility (version 1.2.0).
A brief history of Jrk software development
We developed the software for our original Jrk 21v3 and Jrk 12v12 controllers back in 2009. We used the C# language and the WinForms GUI API from Microsoft since that is what we were familiar with, but unfortunately those choices basically locked us into only having the software work on Windows. While you can compile and run C# code on Linux and macOS using Mono, and Mono does have an implementation of the WinForms API, that WinForms implementation was far from adequate. It worked on x86 Linux machines, crashed immediately on ARM Linux machines, and kind of ran but was totally unusable on macOS machines. I reported a few bugs to the Mono project, and the only response I got was that WinForms is no longer being developed actively. We never released Jrk software for Linux, though we did release Maestro and Simple Motor Controller software for x86 Linux using Mono. People have asked us many times over the years about running our software on a Raspberry Pi, and for our C#/WinForms GUI software we always had to tell them that it was not possible because there was no good implementation of the WinForms API for that platform.
Starting with the Wixel in 2011, we switched to using C, C++, and Qt for our configuration software. Qt is a giant cross-platform C++ library with many components. For us, the most important component is Qt Widgets, which makes it easy to develop a cross-platform GUI with the standard elements that people expect, like windows, menus, buttons, checkboxes, and text fields. There are wrappers for accessing Qt in different languages, but we chose to write our GUI software in C++ so that it can directly access Qt, and because C++ code is easier to deploy than a lot of other languages that might require a virtual machine or interpreter. Qt works well on Windows, macOS, and Linux – including on the Raspberry Pi. While we sometimes encounter bugs in Qt or overly-rigid APIs that lack important features, we are usually able to work around those issues and get a good result.
Along with C++ and Qt, we use the C language to write low-level libraries for actually talking to the USB devices. The upper layer of these libraries takes device-specific commands like “set target to 2800” and translates them into USB commands. The lower layer takes the USB commands and passes them to an appropriate USB API provided by the operating system. This is a nice way to split up the software: the device layer knows about the device but doesn’t know about the operating system, and the USB abstraction layer knows about the operating system but doesn’t know about the device.
The Wixel software developed in 2011 used its own minimal USB abstraction layer written in C. The first versions of p-load, developed in 2014 for our P-Star 25K50 Micro, did something similar. In 2015, I built on the lessons learned from these earlier projects to develop a much better USB abstraction library called libusbp. This new library has been working great for us since then, and powers all of the USB communication in the latest versions of p-load, the Pololu USB AVR Programmer v2 software, the Tic software, and the Pololu Jrk G2 software.
In 2017, I developed another piece of the stack: nixcrpkgs. The nixcrpkgs project solves the problem of reliably compiling our portable C/C++ source code into actual executables and installers that work on a variety of different systems. With nixcrpkgs, I can compile our software for Windows, macOS, and Linux (32-bit, 64-bit, and ARM) by just running a single command on one computer. It allows me to control the exact versions of all the dependencies that go into the software. I no longer have to worry about the versions of tools and libraries installed on my development machines. I also do not have to worry about the software installed on the end user’s machine: software compiled with nixcrpkgs uses static linking so all of its dependencies (except for certain things provided by the operating system) are linked directly into the executable. The download for the Jrk G2 software for the Raspberry Pi generated by nixcrpkgs is only 6 MB (compressed), and it installs just 4 files.
Prior to nixcrpkgs, we only provided binary downloads for Windows and macOS. It was difficult to produce these downloads because we relied on third-party software distribution systems like MSYS2 and Homebrew to provide binary versions of the libraries we depended on, and we didn’t have much control over those systems. We required Linux users to compile the software and its dependencies (like libusbp) themselves. Compiling software from source can be a pretty error-prone process: we strive to make our software portable, but it’s hard to test enough combinations of compiler and library versions to avoid all the issues that might come up.
The Jrk G2 software is open source and comes with build instructions for many platforms. I am hoping that this will allow people to do cool things in the future, such as translating the GUI text into their native language, adding buttons to perform custom commands, or using the code in their own software to control the Jrk. It should also provide some confidence that you will be able to use the Jrk in long-term applications and recompile the software for future operating systems.
You can download the new software from the Jrk G2 Motor Controller User’s Guide or the “Resources” tab on a Jrk G2 product page. If you need help using the software or troubleshooting your system, please post on our forum. If you have feedback or additional feature requests for the software, let us know in the comments.
In our last blog post, we announced the release of our second generation of Jrk Motor Controllers with Feedback. If that announcement wasn’t enough to get you excited about the Jrks, here’s a short video to give you a taste of what the Jrks can do:
You totally want one now, right? Well lucky for you, our special introductory coupon is still valid. The first 100 customers to use coupon code JRKG2INTRO can get 40% off up to three units. (Click to add the coupon code to your cart.)