value range obtained by SI_MOTION_EVENT

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
tsk_2jyo
Posts: 2
Joined: Thu Jul 18, 2019 7:38 am

value range obtained by SI_MOTION_EVENT

Post by tsk_2jyo »

Hi,

I'm new to start developing software for my hobby application.
For starters, I tried to execute demos in SDK, (a) Demo3Dx_3DxTest, (b) Demo3Dx_3DxTstMFC and (c) Demo3Dx_TestSiapp.

There is a sentence 'The normal range of the device axes is approximately +/- 350. '
in 'Data Supplied' section of SDK document, and yes, for (a), I can recognize +/- 350 value when I move the sensor cap onto almost maximum position for each axis.
But for (b) MFC and (c) C# demos, the value at maximum position is from about +/- 2000 to 3000 for each axis. (It's hard to find maximum value of each orientation on (b) and (c) because value increases further when I move the sensor cap as following: firstly move the cap to the bottom then the TY shows the value around 2080, secondary move the cap to TX or TZ orientation with keeping the bottom position of cap then it increase up to around 3000. For (a) -350 of TY value is kept when I move the cap like above.)

Why and by what configuration difference in the demo program cause these difference?

Environment:
- Device: SpaceNavigator USB (FW:4.31)
- OS: Windows 10 Home, 64bit
- Driver: 3DxWare64_v10-6-0_r2972
- SDK: 3DxWare-SDK_v3-4-0_r14759

Note:
I do not change any settings by driver's GUI.
So, the positions of slide bars in the GUI show 'center' position for all (a), (b) and (c).

Thanks.
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: value range obtained by SI_MOTION_EVENT

Post by jwick »

The current hardware does not produce values greater than +/- 350. This may change with future hardware.

It isn't a uniform space though. There are mechanical limits inside the device, that you can feel if you push/twist the cap to its extremes. This causes it to not be able to reach the extreme values along all the directions at the same time. The device is a very uniform sensor in the "normal range" that stays away from the mechanical limits.

If you are wondering about the max values your application might receive, you can't (except the max numeric value of the data type). The user is always free to go into the GUI, or into a cfg file and change the scaling, up or down, to their personal taste.

If your application has hard limits, it needs to check for those after it gets data from the device. For example, a robotics application would not want to drive the end-effector through the floor, or in an otherwise uncontrollable way.

Some of the demos use unmodified scaling. Some use higher scale factors. These scale factors are independent of the GUI slider positions.
It's all in the cfg file being used for the application.
nwrobel
Posts: 1
Joined: Tue Aug 18, 2020 6:32 am

Re: value range obtained by SI_MOTION_EVENT

Post by nwrobel »

I'm struggeling as well to normalize the axis input values to the range of [-1, 1]. In the SDK documentation its mentioned the reported values are +-350. But I experienced values above 2000.
I created a config XML with min, max values for the axis like:

<AppCfg xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Default="false" CfgFormatVersion="1.3" ThisFileVersion="1.12">
<Devices>
<Device>
<AxisBank>
<Name>Default</Name>
<ID>Default</ID>
<Axis>
<Enabled>true</Enabled>
<Input>
<ActionID>HIDMultiAxis_X</ActionID>
<Min>-512</Min>
<Max>511</Max>
</Input>
<Output>
<ActionID>HIDMultiAxis_X</ActionID>
<Modifiers>
<Modifier>Shift</Modifier>
</Modifiers>
<Scale>1.00</Scale>
<Reversed>false</Reversed>
</Output>
</Axis>

And it seems that these configuration values are respected. My question is if there is a programmatical way to set these limits. We don't want to distribute a separate configuration for our application.
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: value range obtained by SI_MOTION_EVENT

Post by jwick »

The scaling is probably caused by these lines in the default cfg that you are getting.

Code: Select all

  <Settings>
    <ResponseCurve>1.7</ResponseCurve>
    <ScaleX>4.00</ScaleX>
    <ScaleY>4.00</ScaleY>
    <ScaleZ>4.00</ScaleZ>
    <ScaleRx>4.00</ScaleRx>
    <ScaleRy>4.00</ScaleRy>
    <ScaleRz>4.00</ScaleRz>
  </Settings>
This is for backward compatibility with very old applications that used a previous generation of driver.

You can, and should, tell the driver to use a more up-to-date cfg file. You can send the driver a hint telling it to use a newer default cfg file.
From our 3DxTest SDK demo:

Code: Select all

  
  SiOpenDataEx oData;                    /* OS Independent data to open ball  */ 
  SiOpenWinInitEx (&oData, hWndMain);    /* init Win. platform specific data  */

  // Tell the driver we want to receive V3DCMDs instead of V3DKeys
  SiOpenWinAddHintBoolEnum(&oData, SI_HINT_USESV3DCMDS, SPW_TRUE);

  /* open data, which will check for device type and return the device handle
  to be used by this function */
  if ((devHdl = SiOpenEx(L"3DxTest", SI_ANY_DEVICE, SI_NO_MASK, SI_EVENT, &oData)) == NULL)
With this default cfg file, you will also get our recommended button events.

But as mentioned before, users can always scale the values in the GUI, so if they must not ever exceed a certain value, you must clamp them.
In general, it is a good idea to let users do what they want.
Post Reply