Here’s one that proves a hardware project can go beyond blinking LEDs and dumping massive chunks of data onto a serial console. Those practices are fine for some, but [dimtass] has found a more elegant hack for a more civilized age. His 3D Millennium Falcon model gets orientation data from his IMU as an an HID device.
The hardware involved is an MPU6050 6-axis sensor that is interfaced with a Teensy 3.2 board. [dimtass] documents his approach to calibrating the IMU going a bit further by using a Python script to generate offsets. We’ve advocated using Jupyter notebooks in the past and this is a good example of Jupyter plotting the data and visualizing the effect of the offsets in a second pass.
When in action, the Teensy reads IMU data and sends it over a USB RAW HID interface. For the uninitiated, HID transfers are more reliable than USB CDC transfers (virtual serial port) because they use smaller data chunks per event/transaction and usually don’t require special drivers. On the computer side, [dimtass] has written a small application that gets the IMU values over the RAW HID and then provides it to the visualization application.
A 3D Millennium Falcon model is rendered in Unity, the popular open source game development engine. Even though Unity has an API, this particular approach is more OS specific using a shared-memory technique. The HID application writes to a file (/tmp/hid-shared-buffer) which is then read by Unity to make orientation changes to the rendered model.
Uhm. If you are doing USB HID, why not do USB HID joystick, pretty sure that you could access that from unity. No shared memory needed, no platform specific code…
If you are doing a USB HID joystick why not do a custom application?
Maybe it’s a POC for something more complicated.
A joystick doesn’t exactly give orientation information, although I can see how it could (by convention only) transfer that kind of data.
I agree with Daid. A joystick would be a more generic approach and a generally better idea for this application. A joystick can have any number of “axis” Including orientation, position, anything really, so I see no valid reason not to implement a USB joystick, other than lacking the knowledge how to do it.
It might be a exercise of implementing shared memory that can be used for a lot more applications though.
He should print millennium falcon enclosure for the accelerometer.
“Unity, the popular open source game development engine”
Umm, what now?
Unity3d might make use of many FOSS components, but is far from being Open Source.
They DID however put some stuff on github[1] and publish the code for the editor and some components under a reference style license[2]. They even wrote a post about how this wasn’t open source[3].
[1] https://github.com/Unity-Technologies/UnityCsReference
[2] https://unity3d.com/legal/licenses/Unity_Reference_Only_License
[3] https://blogs.unity3d.com/2018/03/26/releasing-the-unity-c-source-code/
(Full Disclosure; long time Unity3D licensee, and I help manage the Unity Wiki/IRC channel – though my attentions have been elsewhere for a while now.)
Hmm. Just wrote a post about the fact that unity isn’t open source complete with references, and it was eaten … What’s going on?
Anything with links is under heavy moderation. But you are right, what was the HaD writer smoking when he wrote that unity is open source. It’s popular, it’s a limited form of free. But it’s by no means open source…
They have released a certain amount of code. But the license is a “look but don’t touch” reference license.
Google “is unity3d open source” … And you get the blog post clearly stating that it’s not in the top three links.
So not even a basic fact checking pass was made.
You can usually get away with a single URL as multiple URLs are moderated.
But still, no-one has edited the article. **sigh**.
The first link is broken: “404 Not Found”