RawInput and calibration

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

Moderator: Moderators

Post Reply
GO
Posts: 4
Joined: Tue Oct 23, 2007 5:10 am

RawInput and calibration

Post by GO »

I am using WM_INPUT / RawInput to get information from
3Dx SpaceNavigator in Win32 application (Delphi).
Using this method bypasses the 3DxWare driver. I need to calibrate the SpaceNavigator bypassing the 3DxWare driver. Who can help ?
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

Hello GO,

There isn't any RawInput support for the special USB packets required to "calibrate" the device. I think you can run the 3DxWare driver at the same time. You can thus use the 3DxWare GUI to "calibrate" the device. Or, you could write a small SDK application that would call SiRezero, or you could write a small HID application to do the same thing.

Why do you find that you have to calibrate it? This is a very rare operation.

Jim
3Dx Software Development
GO
Posts: 4
Joined: Tue Oct 23, 2007 5:10 am

Post by GO »

Hello Jim

SpaceNavigator is used for machine manual control. If the operator may change calibration by 3DxWare he can calibrate device accidentally wrong, it means there was pressure on the sensor while calibration was done, i.e. wrong values are saved as calibration values. In this case machine begins to run fast though sensor is not pressed but only was touched, i.e. operating regime will be destroyed.
I would like to keep device calibration under control to prevent this problem.

Where can I get more information about a "small HID application" to calibrate device ?
Where the calibration data are saved and how can I get it ?
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

Hi GO,

The calibration information is kept inside the firmware. It is set when the device powers up and also when it is sent a "rezero" command.

I've put an example of how to use HID to rezero the device on our examples ftp site: ftp:/ *** ***. The username is: *** , password: *** .

I suggest you incorporate that code into your app. You can also run it as a separate executable. If you do the latter, I'd remove all the pretty print statements I put in it. :)

You can run this while the 3DxWare driver is running. You will rezero the device behind the back of the driver. I don't see a problem with doing that. If you did something that affected the state of the device, that would mess it up.

Jim
3Dx Software Development


Moderator Edit: the sample code is no longer available from the FTP service. Please contact 3Dconnexion API Support if you need further assistance.
GO
Posts: 4
Joined: Tue Oct 23, 2007 5:10 am

Post by GO »

Hi, Jim

Thanks for the info!
matilla
Posts: 7
Joined: Wed May 12, 2010 3:59 am

Post by matilla »

Hi,

I'm in the same situation, rawinput works fine but i'd need a device calibration.

I'm trying to use the HID example with C++ Builder without success.
I added to my include directory the wdk headers needed although It didn't work.
Do I need to add any library?

thanks,
matilla
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

If it is just a matter of finding the right build settings, I suggest you port the HIDRezero example from our ftp site to C++ Builder. That should make finding the correct settings for your build environment easier.

There's obviously HidD and setupapi calls in there.

Your users can also just use the 3DxWare GUI to issue the Calibrate. It isn't something that should need to be done often.
matilla
Posts: 7
Joined: Wed May 12, 2010 3:59 am

Post by matilla »

Thank you,

Yes, I think right now I have a problem with the compiler because adding the headers (hidsdi.h, ...) I get some conflicts.

However, there is one thing I don't understand using rawinput. This is the value of the limit for each direction. It's different depending on the axis but always close to 350.

Could I know these values?
Thanks in advance

matilla
ngomes
Moderator
Moderator
Posts: 3344
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Post by ngomes »

matilla wrote:However, there is one thing I don't understand using rawinput. This is the value of the limit for each direction. It's different depending on the axis but always close to 350.

Could I know these values?
What we recommend is that you "scale" the data to [0..1] if input is [0..350]. Your code, after scaling the raw data, should allow for values of higher than 1. This can happen if the user increases the sensitivity of the device (higher "tick" count for same applied force/torque).
matilla
Posts: 7
Joined: Wed May 12, 2010 3:59 am

Post by matilla »

Thanks,

Using the SDK, I can get the rotation angle. How could I get this with rawinput ?

aitor
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

You can use the sample code in the Standard 3D Mouse SDK to do the same thing. Keep in mind the units of the rotation are fairly arbitrary.
matilla
Posts: 7
Joined: Wed May 12, 2010 3:59 am

Post by matilla »

I'm sorry, I don't understand what you mean.

In the SDK example I can get the rotation angle, there is no problem.
However, in the rawinput example I can get the rotation values but not the angle (at least looking at these bytes):

short* pnData = reinterpret_cast <short> (&event->data.hid.bRawData[1]);
short x = pnData [0];
short y = pnData [1];
short z = pnData [2];

What should I do?

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

Post by jwick »

I thought for certain that we distributed sample code that showed how to use those numbers. Do you recall seeing Vector3D/Matrix3D classes?

Well anyway, the length of that vector is the angle, the direction vector (normal) gives the axis of rotation.

Again the angle is in completely arbitrary units (consistent but arbitrary). You need to scale that angle to achieve a rotation speed appropriate for your task. And don't accumulate the axes, accumulate the current orientation. I'm sure we mention that in the doc.
Post Reply