iisu Developer Forum

HomeHomeiisu™ 3.xiisu™ 3.xGeneral Communi...General Communi...registering datahandles in C# problemregistering datahandles in C# problem
Previous
 
Next
New Post
2/15/2012 10:00 AM
 

I am trying to register a data/parameterhandle in C# to get access to those values. But at the moment I am quite stuck at an exception error.

 First: I would like to get the position of the camera. As I understood, the origin of the 'cameraspace' is where the user does the T-stance. So that means that the camera has a position in that space that is not (0, 0, 0). I only found "SCENE.CALIBRATION.EDITING.CameraX" (same for Y and Z) as a reference to the camera position. Isn't there a Vector3 value that defines it?

 Next to that, I am trying to get that data into C#. So I register a ParameterHandle to a value, I wait for a new frame (device.UpdateFrame(true);) and I try to get the value from the handle: handle.Value (which should be a float).

No problem while compiling, but when I execute, I get an exception error saying that

System.NullReferenceException was unhandled
  Message="Object reference not set to an instance of an object."

I have uploaded my entire code, to make it more clear: http://pastebin.com/hPmAD19B

This exception happens at line 84. So, what I conclude is that cam_x is null, but it should get values assigned by Iisu. What is going wrong? If I compare my code to the one in the Skeleton NET example, it seems the same, but it doesn't work (while the Skeleton does work)

I hope you can help me out.

 
New Post
2/15/2012 12:25 PM
 

Hi,

 I will try to help and anylyze your code as soon as possible. In the meantime, 

I can suggest that you try to retrieve the centre of the word using SCENE.CameraToWorld paramter. It gives you access to so called calibration matrix. When you get its value you can also retrieve the translation between the centre of the world coordinate system and camera coordinate system using function. You can retrive it using  getTranslation(); function on the matrix.

Please also refer to chapter 7.2 of iisu developer guide.pdf (C:\Softkinetic\iisu\doc) that treats the calibration subject fully.

 
New Post
2/15/2012 1:33 PM
 

Hi,

 I have taken a look at you code, and the problem is that you are trying to get value of the parameter outside of the update loop. 

Please redo your code so that all the parameters and data are  retrived in the update. That should solve the problem, if it is not let me know.

 

Best regards,

Zofia

 
New Post
2/15/2012 2:47 PM
 

Dear Zofia

I am trying to find out what you mean by 'outside of the update loop'.

 I use device.UpdateFrame(true), which normally is a blocking function? until there is a new frame processed. When it continues, I try to get the Value from the variable. Where would you put that line of code then?

 I also made another function, because I only want to know the position of the camera once in my program. I will try to figure it out a little more

Thanks for your reply!

 
New Post
2/15/2012 4:31 PM
 

And here is an update: so I have no problem getting a datahandle to update, but a parameterhandle fails to update. I think both of them have to be used in different ways, but it's not working yet...

 My matrix skills haven't been what they used to be, but most of the visualizing software that goes with Iisu can display the point where the camera is (toolbox in 3D view for example). Is it possible to get a piece of code of that?

For now I'll just hardcode some things, but I would like to get this kind of data from Iisu.

Thanks
Toon

 
New Post
2/16/2012 10:28 AM
 

hi, 

as for getting a camera position please refer to the sample called Manipulation and Image from iisucsharp.zip which you can download here:  http://www.softkinetic.com/Support/Samples.aspx The sample shows how to get the translation between a camera coordinate system and a world coordinate system, and how to position the virtual camera at the position of the real camera.

As for the problem with getting parameters value: getting data and parameters is working the same.  Would you send me your entire project at support@softkinetic.com so we will analyze further.

Best regards,

Zofia

 

 
New Post
2/17/2012 3:16 PM
 

Dear Zofia

 That is exactly what I need: MathUtils.getMatrix4Translation(mtx); returns the position of the camera as a vector 3 value. MathUtils is part of a compiled Framework library, so I can't really see how it's done, but I'll just include it in our projects.

It seems that most documentation I need, is already present on my computer. But I do have problems finding the things in need in that huge pile of information. Also, registering the handler for the transformMatrixParameter worked without any problems. I guess it was somekind of typo.

Thanks!

 
New Post
2/22/2012 1:21 PM
 

Good! Thank You for your feedback.

 
Previous
 
Next
HomeHomeiisu™ 3.xiisu™ 3.xGeneral Communi...General Communi...registering datahandles in C# problemregistering datahandles in C# problem