A CPP CHOP for TouchDesigner for gathering data from a Slamtec RPLidar scanner
NOTE: I am not actively maintaining this; an alternative that I have not tried but that looks pretty good is https://github.com/Ajasra/SlamtecCHOP (if you try it, let me know how it works so that I can feel better about directing people toward it 😅)
- Lake Heckaman posted a nice video on using this plugin; check it out! https://www.youtube.com/watch?v=fAvF2niosNA
There are downloadable versions of the plugin available in the Releases. Update 2024/08/21: VanTa from the TouchDesigner Discord was kind enough to make an ARM build for modern mac users; it can now be found under the latest release - much gratitude to them!
Caveat: I've got no experience aside from this in building native libraries, so the releases may or may not work for you, which is why I've got the building instructions below.
- Clone the project and submodules (
git clone --recurse-submodules
works well for this) - Go to steps below for your platform
- Start with platform-independent steps above
- Open the .xcodeproj file
- Build
You should now have a .plugin file to use with the cpp chop.
Note: solution and projects are set up for VS2019 (made in VS2019 Community Edition).
- Start with platform-independent steps above
- Open the top level .sln file
- Build
You should now have .dll to use with the cpp chop. (By default, this will be located in a Debug directory that Visual Studio will create within the main directory when you build.)
NB: @AlphaMoonbaseBerlin left this note in the issues:
On windows, if there is not internet or just a metered connection, Windows will not autoDownload the driver for the bridge. Either force it to download via windowsUpdate or download the drivers directly. https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers?tab=downloads
-
Plug in your sensor (being sure to use a USB cable that isn't power only; some of us learned this the hard way)
-
Determine what port your sensor is on
If you've used the command line tools from the rplidar SDK, then you should've had to find this already.
Example ports from my machines:
OSX -
/dev/tty.SLAB_USBtoUART
(the hard-coded default)Win -
\\.\COM3
-
In a TouchDesigner project, make a new CPP CHOP
-
For the path, use the location of the .dll (on Windows) or .plugin (on OSX)
-
Go to the custom parameters page of the CPP CHOP
-
Enter the correct port path in the
COM Port
field -
Click the active toggle
At this point, your lidar sensor should pause and then spin back up, and some data should appear in your CHOP.
Diagram coming soon!
Active - toggle this on to make the plugin attempt to connect to the lidar sensor. If given a bad port, this will currently fail silently and the toggle will stay on. To re-attempt connection, toggle this off and back on again.
COM Port - the port on which the driver will attempt to connect. This should be a COM port on Windows and a /dev/tty
port on OSX.
Coordsystem - the coordinate system in which data will be returned.
Polar: data comes in as an angle channel and corresponding distance channel
Cartesian: data comes in as an x channel and corresponding y channel
Offset - the degrees by which to rotate all incoming data. Example use case: when I have my sensor mounted the way I want, the data as mapped by default looks like it's off by 90 degrees i.e. boxes instanced to what I'd consider data from the ceiling form a vertical line on the left. Using the offset value, I can rotate the ceiling to be a horizontal line across the top of my instances.
Reset - (experimental) a button that will set a "baseline" for the data. Clicking this will store averages of the next several rotations at each half-degree and then only send data through that's significantly different from that baseline data. The idea here was that I might want to situate the sensor and effectively zero out the default distances so that I only really see changing data. Currently disconnected from output, so tapping this should do nothing.
- Data from the device is currently being bucketed into half-degree slots
- BUG: Cartesian data isn't properly filling out the channel
- Try using the hq data methods from the sdk (good for A2, A3)
- Experiment with data representations other than the forced half-degree bucketing
- Make an example TD project