SI_MOTION_EVENT Data Range

Questions and answers about 3Dconnexion devices on Windows.

Moderator: Moderators

Post Reply
gavarial
Posts: 4
Joined: Mon Dec 02, 2013 2:27 am

SI_MOTION_EVENT Data Range

Post by gavarial »

Apologies if this has been answered before, I have done some searching and cannot find a topic that answers my question.

I have hooked up the 3Dconnexion API to our rendering system and everything works as expected apart from the fact that the magnitude of translations and rotations that I see on screen differ from application instance to instance (or possibly on windows boot to boot).

My windowing system logic is abstracted from my rendering logic and so I am not using the 3Dconnexion maths library. I am normalising the translations of the axes in the range -1 to 1 but this is done using a maximum that I discerned by observing the data structure in the watch window:

Code: Select all

   #define MAX_3D_MOUSE_DISP 4650.0f

   SiSpwEvent Event;
   SiGetEventData Data;

   SiGetEventWinInit(&Data, WM_3DXWARE, wParam, lParam);
   SpwRetVal Val = SiGetEvent(m_3DMouseHandle, WM_3DXWARE, &Data, &Event);

   if(Val == SI_IS_EVENT)
   {
      switch(Event.type)
      {
      case SI_MOTION_EVENT:
         {
            // Convert the data to a normalised 
            // floating point representation.
            float Data[6];
            for(unsigned int i = 0; i < 6; ++i)
            {
               Data[i] = (float)Event.u.spwData.mData[i];
               
               Data[i] = Data[i] < -MAX_3D_MOUSE_DISP ? -MAX_3D_MOUSE_DISP : Data[i];
               Data[i] = Data[i] > MAX_3D_MOUSE_DISP ? MAX_3D_MOUSE_DISP : Data[i];
               Data[i] /= MAX_3D_MOUSE_DISP;
            }

            Handle3DMouseData(Data, (float)Event.u.spwData.period);

            break;
         }
I have been unable to find a function that allows me to query for the maximum and minimum values returned by the SI_MOTION_EVENT. Does this function exist? Do all 3Dconnexion devices report axial diaplcement in the same range?
jwick
Moderator
Moderator
Posts: 3456
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: SI_MOTION_EVENT Data Range

Post by jwick »

The max SI_MOTION_DATA is under the user's control. They can scale the data behind your back using the driver's GUI.

You should "tune" your application to run without any modifications made in the GUI. That is, all scale factors set to 1.0. The users then are allowed to change them in a predictable manner to their own personal preferences.

That should give you a range of about +/- 350 per axis.

I suggest you don't clamp the data to your normalized range for a graphical application (machine control is another story). Seasoned users may very well want to move things faster (or with less force) than you do.

You should be using 3DxWare 10 to do your development. It delivers the most clean data stream direct from the device.
gavarial
Posts: 4
Joined: Mon Dec 02, 2013 2:27 am

Re: SI_MOTION_EVENT Data Range

Post by gavarial »

Thanks for your response. My implementation does allow the user to change the response of the device by clicking the + and - buttons and the app responds accordingly; the speed of response on the screen is not clamped. This is exactly how the user will want to interact with the device.

However, between instances the performance can change without changing the speed settings for the device. It's almost as if when the device is initialised the maximum displacements are initialised differently. This should be consistent from instance to instance.

At some point I have to make a decision about what the maximum displacements are because they need to be converted into rotation and translation. I would rather query this from the device than make assumptions.

Some other questions:
  • Do all devices feature the same maximum displacements values for all axes?
    Is there any way to determine what the maximum displacement values are for an axis?
    When the user adjusts the speed of the device I assumed the driver would return the displacements in a shortened range e.g. -50 to 50 as opposed to a maximum of -100 to 100. Is this correct? This is certainly what I have seen in practise.
What I want to know is how do I determine the maximum possible value of displacement for each axis; as if the user had set the device to full speed. From this I can tune the app at the top and bottom end and the user can control everything in between.
jwick
Moderator
Moderator
Posts: 3456
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: SI_MOTION_EVENT Data Range

Post by jwick »

Which driver are you using?
Which device?
Which profile/cfg/scg is being used when your application is in focus? (hover over the systray icon)

All "modern" 3Dx devices natively produce values under +/- 512. Normal range is around +/- 350. The user should not be forced (by default) to use it over, say, +/- 150, or they will get too much strain on their hand/wrist/fingers.
gavarial
Posts: 4
Joined: Mon Dec 02, 2013 2:27 am

Re: SI_MOTION_EVENT Data Range

Post by gavarial »

Release Version: 3.17.4
Driver Version: 6.17.4
Firmware Version: 4.04
Device Type: SpaceExplorer

Active profile: user01.scg

The typical data range that I'm seeing is +/- 5000.
jwick
Moderator
Moderator
Posts: 3456
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: SI_MOTION_EVENT Data Range

Post by jwick »

Use 3DxWare 10 for your development. You can get it by downloading the "Spacemouse Wireless" driver.
Post Reply