Senselosc — OSC interface for the morph (OSX, Linux)

An OSC interface for the sensel morph.
Exposes contact information for up to 16 regions of the sensel morph using the Sensel API.

This is an alternative implementation to @timthompson’s MorphOsc which is Windows-only.
senselosc is currently tested on OSX with SuperCollider.
OSC implementation is straight-forward, so this should also work with any other OSC-capable host (e.g. Reaktor/Pd/…).
The project is written to be cross-platform and should thus also work (with slight changes in the cmake configuration files) on Linux. I did not yet test this, though and would be happy for others to give it a try.

OSC interface

Usage: senselosc [options]
options:
  -h [ --help ]           this help message
  -x [ --nobundle ]       send messages unbundled
  -d [ --scandetail ] arg set scanning detail (0: low, 1:med, 2:high), defaults
                          to high
  -p [ --port ] arg       set output port number (default: 7000)

OSC messages sent:
    /morph      <index> <id> <state> <x> <y> <force> <area> <orient> <major_axis> <minor_axis>
    /morphDelta <index> <id> <d_x> <d_y> <d_force> <d_area>
    /morphBB    <index> <id> <min_x> <min_y> <max_x> <max_y>
    /morphPeak  <index> <id> <peak_x> <peak_y> <peak_force>

with

index       [int]   device index (currently always 0)
id          [int]   contact id (0..15)

state       [int]   one of invalid(0), start(1), move(2), end(3) 
x           [float] x-coordinate in [mm]
y           [float] y-coordinate in [mm]
force       [float] sum of pressure applied [g] 
area        [int]   covered area [sensels]
orientation [float] orientation of bounding elipsis [deg] (0..360)
major_axis  [float] major axis length of bounding elipsis [mm]
minor_axis  [float] minor_axis length of bounding elipsis [mm]

delta_x     [float] x displacement [mm]
delta_y     [float] y displacement [mm]
delta_force [float] change of force [g]
delta_area  [int]   change of covered area [sensels]

min_x       [float] upper-left x-coordinate of bounding-box [mm] 
min_y       [float] upper-left y-coordinate of bounding-box [mm] 
max_x       [float] lower-right x-coordinate of bounding-box [mm] 
max_y       [float] lower-right y-coordinate of bounding-box [mm] 

peak_x      [float] x-coordinate of pressure peak [mm]
peak_y      [float] y-coordinate of pressure peak [mm]
peak_force  [float] force at pressur peak [g]

Comments, suggestions and PRs please via the github issue tracker.

1 Like

Wow, thank you so much for sharing! We’re excited to test this out :slight_smile:

1 Like

(unfortunately, I cannot edit my initial post anymore, so here you have the updated interface)

I implemented some additional features I found useful (average position / force, force-weighted average position, …) and changed the OSC-interface to

/contactAvg index num_contacts x y avg_force avg_dist area x_w y_w total_force avg_wdist
/contact index id state x y force area dist wdist orientation  major_axis  minor_axis
/contactDelta index id delta_x delta_y delta_force delta_area
/contactBB index id min_x min_y max_x max_y
/contactPeak index id peak_x peak_y peak_force

see README for details.

enjoy!

1 Like

Thank you so much, @ifsaw!

1 Like

i am trying to compile senselosc on my manjaro (arch based) linux machine.
i unpacked the files from senselliblinux0.8.2.deb in /usr/lib/, /usr/include/ and senselapp0.19.32.deb in /usr/share/.
the app is working and detects sensel and the L2Ork Pd external (after installing senselliblinux0.8.2) works as well.

but “cmake -S . -B build” outputs the following error:

-- The CXX compiler identification is GNU 11.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Doxygen: /usr/bin/doxygen (found version "1.9.3") found components: doxygen dot 
-- Found Boost: /usr/lib64/cmake/Boost-1.78.0/BoostConfig.cmake (found suitable version "1.78.0", minimum required is "1.73") found components: program_options 
CMake Error at CMakeLists.txt:52 (find_package):
  By not providing "FindSensel.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Sensel", but
  CMake did not find one.

  Could not find a package configuration file provided by "Sensel" with any
  of the following names:

    SenselConfig.cmake
    sensel-config.cmake

  Add the installation prefix of "Sensel" to CMAKE_PREFIX_PATH or set
  "Sensel_DIR" to a directory containing one of the above files.  If "Sensel"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

any idea / hint’s ?

thank you !

1 Like

this looks cmake script cannot find the sensel lib… i do not have a linux system at hand atm and additionally, i cannot get the sensel lib built on my m1 system, so a lottle difficult to help… maybe you could try changing the path to the sensel lib by hand in the cmake script and try again?

hi lfsaw,
thank you for looking at this.
yes. that was the first thing i tried, removing local from the path as it on linux /usr/lib and /usr/include.

/usr/lib
├── libsensel.so
└── libsenseldecompress.so
/usr/include
├── sensel.h
├── sensel_decompress.h
├── sensel_device.h
├── sensel_protocol.h
└── sensel_types.h

so i was wondering if ther are more files like headers etc. missing

FIND_LIBRARY(SENSEL_LIBRARY Sensel
    PATHS /usr/local/lib
    NO_DEFAULT_PATH
)
SET(SENSEL_LIBRARIES ${SENSEL_LIBRARY})
FIND_PATH(SENSEL_INCLUDE_DIR sensel.h
    PATHS /usr/local/include
    NO_DEFAULT_PATH
)
SET(SENSEL_INCLUDE_DIRS ${SENSEL_INCLUDE_DIR})
1 Like

i believe the libs are working as they fixed the pure data external.

good news is that I managed to get the M1 version compiled on my mac here…

to your problem:

could you try to change the content in cmake/findSensel.cmake to

if (APPLE)
    FIND_LIBRARY(SENSEL_LIBRARY Sensel
        PATHS /usr/local/lib
        NO_DEFAULT_PATH
    )
    SET(SENSEL_LIBRARIES ${SENSEL_LIBRARY})
    FIND_PATH(SENSEL_INCLUDE_DIR sensel.h
        PATHS /usr/local/include
        NO_DEFAULT_PATH
    )
    SET(SENSEL_INCLUDE_DIRS ${SENSEL_INCLUDE_DIR})
elseif("${CMAKE_SYSTEM}" MATCHES "Linux")
    FIND_LIBRARY(SENSEL_LIBRARY Sensel
        PATHS /usr/lib
        NO_DEFAULT_PATH
    )
    SET(SENSEL_LIBRARIES ${SENSEL_LIBRARY})
    FIND_PATH(SENSEL_INCLUDE_DIR sensel.h
        PATHS /usr/include
        NO_DEFAULT_PATH
    )
    SET(SENSEL_INCLUDE_DIRS ${SENSEL_INCLUDE_DIR})
endif()

?

no. i m afraid it doesnt help. also tried before removing the “local” from path. same error.
so i wonder if it really doesnt find the lib or if there is some sort of compatibility issue.
is there a way to test this ?
changed the ownership of all sensel files in /usr/lib and /usr/include to root. also no succsess.
did this work on linux before ?

pd external L2Ork Sensel Morph v.1.2.0 and sensel app work well (besides some grafik glitches in the app).

$ /usr/share/sensel/SenselApp.x86_64
Found path: /usr/share/sensel/SenselApp.x86_64
Mono path[0] = '/usr/share/sensel/SenselApp_Data/Managed'
Mono config path = '/usr/share/sensel/SenselApp_Data/Mono/etc'
Preloaded 'ScreenSelector.so'
Preloaded 'libsensel.so'
Logging to /home/username/.config/unity3d/Sensel/SenselApp/Player.log

thank you very much for helping me !

looks like it is a case error:

could you

  1. keep the changes as indicated in my last post and
  2. rename the file to FindSensel.cmake (note the capital F)?

yes. that works ! we are getting closer
now it hangs at:

/home/username/senselosc/extern/oscpack
does not contain a CMakeLists.txt file.

that folder is empty

$ cmake -S . -B build                                                                                             ✔ 
-- The C compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Version: 5.3.0
-- Build type: 
-- CXX_STANDARD: 11
-- Performing Test has_std_11_flag
-- Performing Test has_std_11_flag - Success
-- Performing Test has_std_0x_flag
-- Performing Test has_std_0x_flag - Success
-- Performing Test SUPPORTS_VARIADIC_TEMPLATES
-- Performing Test SUPPORTS_VARIADIC_TEMPLATES - Success
-- Performing Test SUPPORTS_INITIALIZER_LIST
-- Performing Test SUPPORTS_INITIALIZER_LIST - Success
-- Performing Test SUPPORTS_ENUM_BASE
-- Performing Test SUPPORTS_ENUM_BASE - Success
-- Performing Test SUPPORTS_TYPE_TRAITS
-- Performing Test SUPPORTS_TYPE_TRAITS - Success
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS - Success
-- Looking for open
-- Looking for open - found
CMake Error at CMakeLists.txt:64 (add_subdirectory):
  The source directory

    /home/username/senselosc/extern/oscpack

  does not contain a CMakeLists.txt file.


-- Configuring incomplete, errors occurred!
See also "/home/username/senselosc/build/CMakeFiles/CMakeOutput.log".

you are missing the sources for oscpoack.
To get them, you need to do a

git clone --recursive https://github.com/tai-studio/senselosc

when cloning the repository.

alternative is to (after cloning) do

git submodule update --init --recursive

to get the sources for oscpack

sorry. i forgot the recursive ;-(
thanks

1 Like

no worries; did you manage to get it to work now?
i also now updated the repo with the changes mentioned above, so it should work out of the box.