The question about Kinect-V REP connection

Typically: "How do I... ", "How can I... " questions
Post Reply
youngsea
Posts: 18
Joined: 11 Apr 2016, 12:40

The question about Kinect-V REP connection

Post by youngsea » 10 May 2016, 09:19

Recently I want to use the kincet to control the Asti Robot in the V-REP.And I have downloaded the scene 'astiKinectControl'.But I still have some questions as follow,
1.I try to compiel the sourse code for the 'kinectServer.exe',but there are two error.And the message is ‘ can not open the “XnOpenNI.h” and “XnCppWrapper.h”,No such file or directory c:\program files (x86)\v-rep3\v-rep_pro_edu\programming\windowsonlyprojects\kinectserver\scenedrawer.h 26’.I have installed openNI but not NITE and the tool is VS2013.
2.From the 'interface to kinect',I knowed that I should install the kinect driver,openNI,NITE.But they have many version.Which version is suitable for V-REP.Could you give me some download address.The address ‘http://www.codeproject.com/articles/148 ... -open.aspx’ is invalid.

coppelia
Site Admin
Posts: 7226
Joined: 14 Dec 2012, 00:25

Re: The question about Kinect-V REP connection

Post by coppelia » 11 May 2016, 15:59

Hello,

the Kinect example project that you have is quite old (probably 3-4 years old). The best would be to use the newest drivers and to adjust the project to it. But there are many ways you can connect an application to V-REP, e.g. via the remote Api or ROS, instead of handling the socket communication directly as in the example.

Cheers

youngsea
Posts: 18
Joined: 11 Apr 2016, 12:40

Re: The question about Kinect-V REP connection

Post by youngsea » 17 May 2016, 13:25

Hi~coppelia.When I run the 'Interface to haptic device.ttm' and 'astiKinectControl.ttt',it will pop up a window which will disappear quickly ,while the model do not have any response.Clould you tell me what's wrong with it?

coppelia
Site Admin
Posts: 7226
Joined: 14 Dec 2012, 00:25

Re: The question about Kinect-V REP connection

Post by coppelia » 17 May 2016, 17:23

It is important to first make individual models work correctly before combining them into one scene, otherwise it will be very difficult to debug your simulation. Does the haptic device work with the haptic device interface model? Can you read data from your kinect? There are several kinect models: one that simply simulates a kinect, and another one that provides an interface to a real kinect.

Cheers

youngsea
Posts: 18
Joined: 11 Apr 2016, 12:40

Re: The question about Kinect-V REP connection

Post by youngsea » 18 May 2016, 12:54

Yes,now I can use my haptic device to connecte the V-Rep by CHAI3D.In another research topic,I want to connect the V-REP with kinect. and now I can't read data from my kinect.
1.In most case,they use OpenNI and NITE to solve this problem,but I cannot get it.
2.According to your advice,connecting an application to V-REP by remote API,is it need OpenNI or NITE?

coppelia
Site Admin
Posts: 7226
Joined: 14 Dec 2012, 00:25

Re: The question about Kinect-V REP connection

Post by coppelia » 19 May 2016, 08:30

You will in any case need the drivers for the Kinect. This has nothing to do with V-REP. You first need to make a small executable application that can talk to the Kinect driver and that can read data from the kinect. Once that is done, you can connect your executable application to V-REP via the remote API or ROS. You could also, instead of writing that executable, directly write a plugin for V-REP. This would be better (since there is no need to send the kinect data to V-REP via the remote API or ROS), but is a little bit more complicated if you have not so much experience programming.

Cheers

youngsea
Posts: 18
Joined: 11 Apr 2016, 12:40

Re: The question about Kinect-V REP connection

Post by youngsea » 25 May 2016, 09:42

Hi~Can I use Matlab to program a executable application.Now through some examples,I can connect the V-REP with Matlab and simulink.How can I do next step?Which code should I use in Matlab and which remote API should I ues in V-REP?
http://pan.baidu.com/s/1qY49G52

coppelia
Site Admin
Posts: 7226
Joined: 14 Dec 2012, 00:25

Re: The question about Kinect-V REP connection

Post by coppelia » 25 May 2016, 16:51

Try first a simple example for the Matlab remote API. The example is programming/remoteApiBindings/matlab/matlab/simpleTest.m
To make the remote API work on Matlab side, you need to have a few files in the same location. Have a look here.

Finally, the example will try to connect to V-REP on port 19999. That port is not open by default, and you will have to add a small non-threaded child script in your scene with following content:

Code: Select all

if (sim_call_type==sim_childscriptcall_initialization) then
    simExtRemoteApiStart(19999)
end
Then start your V-REP simulation. At the start, a remote API server service will be started on port 19999. When you stop the simulation again, the remote API server service will be stopped again on port 19999.
Once the server service is running, you can run your Matlab test program.

You can also connect to the continuous remote API server service that runs on port 19997 as soon as V-REP starts. In that case, you do not need the small child script.

Cheers

youngsea
Posts: 18
Joined: 11 Apr 2016, 12:40

Re: The question about Kinect-V REP connection

Post by youngsea » 27 May 2016, 03:22

I have recompiled a new KinectServer.exe and it work well.I can get skeleton in V-REP through 'Interface to haptic device.ttm'.
http://pan.baidu.com/s/1qYN6CXY
But when I run 'astiKinectControl.ttt',it can't work and the message is shown as follow.

Lua runtime error: [string "SCRIPT Asti"]:26: attempt to index local 'client' (a nil value)
stack traceback:
[string "SCRIPT Asti"]:256: in function <[string "SCRIPT Asti"]:256>
[string "SCRIPT Asti"]:26: in function 'writeSocketData'
[string "SCRIPT Asti"]:69: in function <[string "SCRIPT Asti"]:63>
[C]: in function 'xpcall'
[string "SCRIPT Asti"]:256: in main chunk

So how could I improve it?

coppelia
Site Admin
Posts: 7226
Joined: 14 Dec 2012, 00:25

Re: The question about Kinect-V REP connection

Post by coppelia » 27 May 2016, 09:04

You don't give us enough information. But from the error output it seems that client is not defined. So make sure that client is defined! You have probably modified the example code.

Cheers

Post Reply