RawInput and calibration

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

Moderator: Moderators

RawInput and calibration

Postby GO » Tue Oct 23, 2007 6:05 am

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 ?
GO
 
Posts: 4
Joined: Tue Oct 23, 2007 5:10 am

Postby jwick » Tue Oct 23, 2007 2:47 pm

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
jwick
Moderator
Moderator
 
Posts: 1756
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA

Postby GO » Wed Oct 24, 2007 2:01 am

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 ?
GO
 
Posts: 4
Joined: Tue Oct 23, 2007 5:10 am

Postby jwick » Wed Oct 24, 2007 1:21 pm

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://ftp-us.3dconnexion.com/HID. The username is: examples, password: examples.

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
jwick
Moderator
Moderator
 
Posts: 1756
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA

Postby GO » Fri Oct 26, 2007 8:19 am

Hi, Jim

Thanks for the info!
GO
 
Posts: 4
Joined: Tue Oct 23, 2007 5:10 am

Postby matilla » Wed May 12, 2010 5:10 am

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
matilla
 
Posts: 7
Joined: Wed May 12, 2010 3:59 am

Postby jwick » Wed May 12, 2010 5:25 am

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.
jwick
Moderator
Moderator
 
Posts: 1756
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA

Postby matilla » Thu May 13, 2010 12:56 am

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
matilla
 
Posts: 7
Joined: Wed May 12, 2010 3:59 am

Postby ngomes » Thu May 13, 2010 1:53 am

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).
ngomes
Moderator
Moderator
 
Posts: 1634
Joined: Mon Nov 27, 2006 7:22 am
Location: EU

Postby matilla » Fri May 14, 2010 12:26 am

Thanks,

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

aitor
matilla
 
Posts: 7
Joined: Wed May 12, 2010 3:59 am

Postby jwick » Fri May 14, 2010 5:04 am

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.
jwick
Moderator
Moderator
 
Posts: 1756
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA

Postby matilla » Fri May 14, 2010 5:15 am

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
matilla
 
Posts: 7
Joined: Wed May 12, 2010 3:59 am

Postby jwick » Fri May 14, 2010 5:45 am

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.
jwick
Moderator
Moderator
 
Posts: 1756
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA


Return to Developer's Forum for Windows

Who is online

Users browsing this forum: No registered users and 3 guests