Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I'm currently working on a c# program that uses Kinect to check the position of a person's hand. It then "moves" an image of a table that is displayed on a canvas according to the person's hand (x,y) to 4 positions: up, down, left or right.
I’d like to know if I can transfer the program I have already created using Visual C# 2010 and Kinect SDK to interact with NXT directly or via Microsoft Robotics Studio.
I want my code to communicate with NXT and activate a servomotor instead of changing the image position on the NUI. Would that be possible?

It doesn't have to be Lego NXT but any other system that would allow me to move servo motors via my program. I'd appreciate any ideas!

e.g: in this code Kinect tracks my right hand and if the conditions are met it displaces the image in Y (for up movement). Instead of that I'd like to know if I can write a code to send a signal to a servo motor via NXT in a not too complicated way.

C#
if (wristRight.Z > shoulderRight.Z - 0.20 && wristRight.Z < shoulderRight.Z + 0.20)
                {
                    if (sideAngle >= 285 && sideAngle <= 320)
                    {
                        speed = 4;
                        positionY = positionY - speed;
                    }
                 .
                 .
                 .

Canvas.SetLeft(Table, positionX - Table.Width / 2);
Canvas.SetTop(Table, positionY - Table.Height / 2);
Posted

1 solution

Hi There,

Yes you can! And I have an article that details how to control your robot from C# here on CodeProject. Have a look here:

Basic Robot Control using NKH Mindsqualls Libraries[^]

It uses the NKH Mindsqualls library, you may wish to see if there is a new version. It works really well and my article shows how to do the basics which includes running motors.

Hope this helps,
Ed

Edit: Have a look at this page for a quick start guide to getting working with the library, it has all the essentials:
http://www.mindsqualls.net/QuickStart_2_0.aspx[^]

(There is also v2.2 of the library available that I think you may want to download.)
 
Share this answer
 
v3
Comments
petite_paola 1-Jun-12 3:37am    
Thanks a lot, it's really helpful.
Ed Nutting 1-Jun-12 3:39am    
Glad I could help :) By the way that NKH Mindsqualls library is open source so if you need to look at the exact bytes that it sends you can :)

Ed

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900