Robobuilder Controlled by Kinect - Updated Version

Korean company maker of Robot kits and servos designed for of articulated robots. Re-incarnation of Megarobotics.
31 postsPage 2 of 31, 2, 3
31 postsPage 2 of 31, 2, 3

Post by Kondo » Mon Jul 09, 2012 1:38 pm

Post by Kondo
Mon Jul 09, 2012 1:38 pm

Hello MarcoP

Indeed, I've also tried without assigning that port, just put robobuilder port and the program breaks down :(
Hello MarcoP

Indeed, I've also tried without assigning that port, just put robobuilder port and the program breaks down :(
Kondo offline
Savvy Roboteer
Savvy Roboteer
Posts: 48
Joined: Sat Jul 23, 2011 7:35 pm

Post by PedroR » Mon Jul 09, 2012 2:46 pm

Post by PedroR
Mon Jul 09, 2012 2:46 pm

Hi Kondo

From your description you are doing it correctly.

What you describe ahs heppened to us. Therefore we recommend that:
1- You cover the Kinect lens (with your hand for example) to make sure it is not tracking anyone.
2- Enter the Robobuilder COMM Port number
3- Click Connect on the right of the Robobuilder COMM port number.

Wiat for it to connect to Robobuilder.
The window should still be responsive.


Next you can remove the cover of the Kinect lens (what you did in 1) ) and put yourself in front of Kinect and move.

This should work.

On some computers the Windows seems it has stoped responding but the Robot still moves while you are in fron tof Kinect.

To make the window responsive again, cover the lens of kinect.


If this does not work then you can try the following:

- Open the source code (if you have VB .Net 2010) and put a Break point on the function "ConnectToRB"
- Press Play to start the program.

- Connect to Robobuilder. The program will stop inside the Function Conect to RB where you put the Break point

- Run it line by line (by pressing F8 several times) until the COMM port is Open and you connect to Robobuilder.

- Finally press F5 to resume the program.


The issue we found - as I explained before - is that Kinect seems to overloads the USB host with message and trying to operate other USB devices (such as opening a USB adapter) may cause the program to hat.

The two procedures above can be used to work around the problem.


Regards
Pedro.
Hi Kondo

From your description you are doing it correctly.

What you describe ahs heppened to us. Therefore we recommend that:
1- You cover the Kinect lens (with your hand for example) to make sure it is not tracking anyone.
2- Enter the Robobuilder COMM Port number
3- Click Connect on the right of the Robobuilder COMM port number.

Wiat for it to connect to Robobuilder.
The window should still be responsive.


Next you can remove the cover of the Kinect lens (what you did in 1) ) and put yourself in front of Kinect and move.

This should work.

On some computers the Windows seems it has stoped responding but the Robot still moves while you are in fron tof Kinect.

To make the window responsive again, cover the lens of kinect.


If this does not work then you can try the following:

- Open the source code (if you have VB .Net 2010) and put a Break point on the function "ConnectToRB"
- Press Play to start the program.

- Connect to Robobuilder. The program will stop inside the Function Conect to RB where you put the Break point

- Run it line by line (by pressing F8 several times) until the COMM port is Open and you connect to Robobuilder.

- Finally press F5 to resume the program.


The issue we found - as I explained before - is that Kinect seems to overloads the USB host with message and trying to operate other USB devices (such as opening a USB adapter) may cause the program to hat.

The two procedures above can be used to work around the problem.


Regards
Pedro.
Last edited by PedroR on Mon Jul 09, 2012 3:17 pm, edited 1 time in total.
PedroR offline
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

Post by Kondo » Mon Jul 09, 2012 3:17 pm

Post by Kondo
Mon Jul 09, 2012 3:17 pm

Hi PedroR

I just tried the above points and the program is being frozen by giving connect.

I re-tested with the old version and I'm still working.


Now proves the last point you mention, Now I will put the test results :idea:
Hi PedroR

I just tried the above points and the program is being frozen by giving connect.

I re-tested with the old version and I'm still working.


Now proves the last point you mention, Now I will put the test results :idea:
Kondo offline
Savvy Roboteer
Savvy Roboteer
Posts: 48
Joined: Sat Jul 23, 2011 7:35 pm

Post by Kondo » Mon Jul 09, 2012 3:55 pm

Post by Kondo
Mon Jul 09, 2012 3:55 pm

Hi PedroR

Could you elaborate the last point a little more, I can not do anything, sorry :cry:
Hi PedroR

Could you elaborate the last point a little more, I can not do anything, sorry :cry:
Kondo offline
Savvy Roboteer
Savvy Roboteer
Posts: 48
Joined: Sat Jul 23, 2011 7:35 pm

Post by PedroR » Mon Jul 09, 2012 6:44 pm

Post by PedroR
Mon Jul 09, 2012 6:44 pm

[EDIT: we have revised the code for ConnectToRB to eliminate this deadlock.

Please make sure to re-download the ZIP file for this demo to get the latest version. (you may need to clean your browser cache to make sure you get the new version) [/EDIT]


Hi Kondo

I don't have access to the complete set up at the moment (PC with VB 2010, Kinect and Robobuilder) but as soon as I have the opportunity I will look at this bug in more detail.

If you are familiar with VB.Net, then open the VB Solution in the ZIP file, and then open the code for "MainWindow" (it's file MainWindow.xaml.vb)

Now look for the function called "ConnectToRB". I have pasted bellow the code of the function and marked the place where you need to insert a Breakpoint:

Code: Select all
        Private Sub ConnectToRB(ByVal sCOMMNum As String)
            On Error GoTo ErrHandler

            commRb = New SerialPort("COM" & sCOMMNum, 115200, Parity.None, 8, StopBits.One) '''----- INSERT BREAKPOINT HERE
            commRb.Open()

            'rbPCR = New RobobuilderLib.PCremote("COM" & sCOMMNum)
            rbPCR = New RobobuilderLib.PCremote(commRb)
            Thread.Sleep(400)
            rbPCR.setDCmode(False)

            rbPCR.runMotion(7) ' basic posture
            Thread.Sleep(2000)
            rbPCR.setDCmode(True)
            Thread.Sleep(500)

            rbWCK = New RobobuilderLib.wckMotion(rbPCR)
            Thread.Sleep(300)

            Me.txtRBComStatus.Text = "Connected"
            bRBConnected = True

            Exit Sub

ErrHandler:
            MsgBox("Unable to Connect to Robobuilder" & vbCrLf & vbCrLf & Err.Description, vbCritical And vbOKOnly, "Error Connecting")
            rbPCR = Nothing
            If Not commRb Is Nothing And commRb.IsOpen Then commRb.Close()
            commRb = Nothing
            Err.Clear()
        End Sub


Insert the breakpoint on that line because the program sometimes hangs on the next line.
(to insert a breakpoint, put the cursor on that line and press "F9")

After inserting the Breakpoint (the line will become red) start the program.

When you connet to Robobuilder, the program will stop at the line where you inserted the Breakpoint. Now

- Press the keyboard key "F8" to execute the line
- Wait a bit
- Press "F8" again to execute the next line (it may also hang here)
- Wait a bit
- Press "F8" again to execute the next line (it may also hang here)
- Wait a bit
- Press "F8" again to execute the next line (it may also hang here)
- Wait a bit

- If this has succeeded now press F5 to resume the program.

You can see in the code that there are some "Sleep" commands.
This is a Quick and dirty fix for the bug you are experiencing. It seems to have fixed the problem for us but you can also try increasing the amount of time in "Sleep" and see if it solves the problem for you as well.


To work around this issue, the solution is probably to disable Kinect before connecting to Robobuilder and then re enabling it after sucessful connection.
If/when we have the time, we'll modify the code to check if this solves the issue.

Regards
Pedro.
[EDIT: we have revised the code for ConnectToRB to eliminate this deadlock.

Please make sure to re-download the ZIP file for this demo to get the latest version. (you may need to clean your browser cache to make sure you get the new version) [/EDIT]


Hi Kondo

I don't have access to the complete set up at the moment (PC with VB 2010, Kinect and Robobuilder) but as soon as I have the opportunity I will look at this bug in more detail.

If you are familiar with VB.Net, then open the VB Solution in the ZIP file, and then open the code for "MainWindow" (it's file MainWindow.xaml.vb)

Now look for the function called "ConnectToRB". I have pasted bellow the code of the function and marked the place where you need to insert a Breakpoint:

Code: Select all
        Private Sub ConnectToRB(ByVal sCOMMNum As String)
            On Error GoTo ErrHandler

            commRb = New SerialPort("COM" & sCOMMNum, 115200, Parity.None, 8, StopBits.One) '''----- INSERT BREAKPOINT HERE
            commRb.Open()

            'rbPCR = New RobobuilderLib.PCremote("COM" & sCOMMNum)
            rbPCR = New RobobuilderLib.PCremote(commRb)
            Thread.Sleep(400)
            rbPCR.setDCmode(False)

            rbPCR.runMotion(7) ' basic posture
            Thread.Sleep(2000)
            rbPCR.setDCmode(True)
            Thread.Sleep(500)

            rbWCK = New RobobuilderLib.wckMotion(rbPCR)
            Thread.Sleep(300)

            Me.txtRBComStatus.Text = "Connected"
            bRBConnected = True

            Exit Sub

ErrHandler:
            MsgBox("Unable to Connect to Robobuilder" & vbCrLf & vbCrLf & Err.Description, vbCritical And vbOKOnly, "Error Connecting")
            rbPCR = Nothing
            If Not commRb Is Nothing And commRb.IsOpen Then commRb.Close()
            commRb = Nothing
            Err.Clear()
        End Sub


Insert the breakpoint on that line because the program sometimes hangs on the next line.
(to insert a breakpoint, put the cursor on that line and press "F9")

After inserting the Breakpoint (the line will become red) start the program.

When you connet to Robobuilder, the program will stop at the line where you inserted the Breakpoint. Now

- Press the keyboard key "F8" to execute the line
- Wait a bit
- Press "F8" again to execute the next line (it may also hang here)
- Wait a bit
- Press "F8" again to execute the next line (it may also hang here)
- Wait a bit
- Press "F8" again to execute the next line (it may also hang here)
- Wait a bit

- If this has succeeded now press F5 to resume the program.

You can see in the code that there are some "Sleep" commands.
This is a Quick and dirty fix for the bug you are experiencing. It seems to have fixed the problem for us but you can also try increasing the amount of time in "Sleep" and see if it solves the problem for you as well.


To work around this issue, the solution is probably to disable Kinect before connecting to Robobuilder and then re enabling it after sucessful connection.
If/when we have the time, we'll modify the code to check if this solves the issue.

Regards
Pedro.
Last edited by PedroR on Tue Jul 10, 2012 6:23 pm, edited 2 times in total.
PedroR offline
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

Post by Kondo » Mon Jul 09, 2012 6:48 pm

Post by Kondo
Mon Jul 09, 2012 6:48 pm

Thanks for the detailed explanation PedroR, I try it tomorrow when I have time and count the results.

Regards
Thanks for the detailed explanation PedroR, I try it tomorrow when I have time and count the results.

Regards
Kondo offline
Savvy Roboteer
Savvy Roboteer
Posts: 48
Joined: Sat Jul 23, 2011 7:35 pm

Post by MarcoP » Tue Jul 10, 2012 5:07 pm

Post by MarcoP
Tue Jul 10, 2012 5:07 pm

Hi

Pedro has sorted a few issues with the software.

The new version is accessible under the same link in the 1st post.

Just download and try it.

Regards
Hi

Pedro has sorted a few issues with the software.

The new version is accessible under the same link in the 1st post.

Just download and try it.

Regards
MarcoP offline
Savvy Roboteer
Savvy Roboteer
Posts: 81
Joined: Thu Jan 19, 2012 6:14 pm

Post by Kondo » Sun Jul 15, 2012 11:16 am

Post by Kondo
Sun Jul 15, 2012 11:16 am

Hi guys,

Today I tested the new version, but it still does not work, the program detects all fine until I give to connect and does not respond ...

Regards
Hi guys,

Today I tested the new version, but it still does not work, the program detects all fine until I give to connect and does not respond ...

Regards
Kondo offline
Savvy Roboteer
Savvy Roboteer
Posts: 48
Joined: Sat Jul 23, 2011 7:35 pm

Post by nala170190 » Wed May 01, 2013 12:25 am

Post by nala170190
Wed May 01, 2013 12:25 am

Ok, i've been doing my own program to control the arms of Robobuilder using the amazing library that l3v3rz developed. It's all in C#, i managed to calculate the elbow angle, and both azimuth and elevation of the shoulder, my question is if you could explain some of the logic of how to control the wCk's using these angles, i'm a little lost in this part, the elbow is a no brainer, it's pretty straight forward, but the movements of the shoulder are giving me headaches. Please enlighten me a little

By the way, i'm willing to share the code, but i don't know if i should post it here, or in some new thread

Thanks in advance
Ok, i've been doing my own program to control the arms of Robobuilder using the amazing library that l3v3rz developed. It's all in C#, i managed to calculate the elbow angle, and both azimuth and elevation of the shoulder, my question is if you could explain some of the logic of how to control the wCk's using these angles, i'm a little lost in this part, the elbow is a no brainer, it's pretty straight forward, but the movements of the shoulder are giving me headaches. Please enlighten me a little

By the way, i'm willing to share the code, but i don't know if i should post it here, or in some new thread

Thanks in advance
nala170190 offline
Newbie
Newbie
Posts: 3
Joined: Wed May 01, 2013 12:07 am

Post by MarcoP » Wed May 01, 2013 10:09 am

Post by MarcoP
Wed May 01, 2013 10:09 am

Hi nala

It's been a while but what I remember is:

You have to find a way to transform polar coordinates to wCk angles.

I suggest you use a coordinate system where azimuth corresponds to arm moving up and down, because that will be an easier conversion to wCk angles.

But still the direction and offset will not be the same. You will need some math skills to solve this. You will have to do something similar to arduino map function to transform the azimuth angle into a wCk value. They will have different zero, different gain and maybe even contrary direction.

You can post here.

Regards

Marco
Hi nala

It's been a while but what I remember is:

You have to find a way to transform polar coordinates to wCk angles.

I suggest you use a coordinate system where azimuth corresponds to arm moving up and down, because that will be an easier conversion to wCk angles.

But still the direction and offset will not be the same. You will need some math skills to solve this. You will have to do something similar to arduino map function to transform the azimuth angle into a wCk value. They will have different zero, different gain and maybe even contrary direction.

You can post here.

Regards

Marco
MarcoP offline
Savvy Roboteer
Savvy Roboteer
Posts: 81
Joined: Thu Jan 19, 2012 6:14 pm

Post by MarcoP » Wed May 01, 2013 12:42 pm

Post by MarcoP
Wed May 01, 2013 12:42 pm

Hi nala

It's been a while but what I remember is:

You have to find a way to transform polar coordinates to wCk angles.

I suggest you use a coordinate system where azimuth corresponds to arm moving up and down, because that will be an easier conversion to wCk angles.

But still the direction and offset will not be the same. You will need some math skills to solve this. You will have to do something similar to arduino map function to transform the azimuth angle into a wCk value. They will have different zero, different gain and maybe even contrary direction.

You can post here.

Regards

Marco
Hi nala

It's been a while but what I remember is:

You have to find a way to transform polar coordinates to wCk angles.

I suggest you use a coordinate system where azimuth corresponds to arm moving up and down, because that will be an easier conversion to wCk angles.

But still the direction and offset will not be the same. You will need some math skills to solve this. You will have to do something similar to arduino map function to transform the azimuth angle into a wCk value. They will have different zero, different gain and maybe even contrary direction.

You can post here.

Regards

Marco
MarcoP offline
Savvy Roboteer
Savvy Roboteer
Posts: 81
Joined: Thu Jan 19, 2012 6:14 pm

Post by l3v3rz » Wed May 01, 2013 7:19 pm

Post by l3v3rz
Wed May 01, 2013 7:19 pm

Have you checked out my update to the code? - I've incorporated Robosavvy code into a library. It required robobuilderlib to work and as currently written assume you are using DCMP firmware (its works better as its always in Direct control mode)

Here all the code to build:

https://code.google.com/p/robobuildervc ... oboKinnect

The main file is this one and includes the connect and disconnect (checking for DCMP) and a single hook "updaterobot" into animation system for the skeleton and all wck position commands and maths (from robosavvy). It also switches between simple (V1) code based on arm height and not simple (v2) with proper arm and shoulder angles. See:

https://code.google.com/p/robobuildervc ... Kinnect.cs

I also hook into speech recognisers to start and stop program.

Cheers
Have you checked out my update to the code? - I've incorporated Robosavvy code into a library. It required robobuilderlib to work and as currently written assume you are using DCMP firmware (its works better as its always in Direct control mode)

Here all the code to build:

https://code.google.com/p/robobuildervc ... oboKinnect

The main file is this one and includes the connect and disconnect (checking for DCMP) and a single hook "updaterobot" into animation system for the skeleton and all wck position commands and maths (from robosavvy). It also switches between simple (V1) code based on arm height and not simple (v2) with proper arm and shoulder angles. See:

https://code.google.com/p/robobuildervc ... Kinnect.cs

I also hook into speech recognisers to start and stop program.

Cheers
l3v3rz offline
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by nala170190 » Fri May 03, 2013 3:16 am

Post by nala170190
Fri May 03, 2013 3:16 am

MarcoP, thanks for the fast respond, i really apreciate it, as promised i will post my code as soon as i finish it, i've been able to figure out the roll movement of the robot, using the azimuth and elevetion angles together, it's not as neat or clean as one would expect, but so far it moves pretty well.

l3v3rz, you are a god man, really, thanks a bunch, i would check out your code as soon as i'm able, i'm using the standard firmware V2.34, and i have a little error when using playpose and Basic16 to do the standing position, i will post a video of the error later, of course it can be that the servo is malfunctioning, but i works perfectly until i use that command. Anyway, million thanks for your code,i will check it out since i really want to see your logic behind the movement of the roll servos, and i'm interesed in your speech recognition as well.

Thank you both greatly, i will tell how it went as soon as posible
MarcoP, thanks for the fast respond, i really apreciate it, as promised i will post my code as soon as i finish it, i've been able to figure out the roll movement of the robot, using the azimuth and elevetion angles together, it's not as neat or clean as one would expect, but so far it moves pretty well.

l3v3rz, you are a god man, really, thanks a bunch, i would check out your code as soon as i'm able, i'm using the standard firmware V2.34, and i have a little error when using playpose and Basic16 to do the standing position, i will post a video of the error later, of course it can be that the servo is malfunctioning, but i works perfectly until i use that command. Anyway, million thanks for your code,i will check it out since i really want to see your logic behind the movement of the roll servos, and i'm interesed in your speech recognition as well.

Thank you both greatly, i will tell how it went as soon as posible
nala170190 offline
Newbie
Newbie
Posts: 3
Joined: Wed May 01, 2013 12:07 am

Post by nala170190 » Tue May 28, 2013 10:29 pm

Post by nala170190
Tue May 28, 2013 10:29 pm

Sorry, i have been very busy lately, but this is my final code, it is in C# and i use an UI coded in WPF. The only dependecis i have are the kinect toolkit and Robobuilderlib. The version of the SDK is 1.6, and i use a vectorial approach to calculate the angles, and ALL are in the cartesian coordinate space, i didn't use the spherical coordinates in the shoulder, because i didn't liked the results they gave.

I didn't implement speech recognition like l3v3rz, but i added the control of the tilt motor of the kinect using a slider and a button. Overall i liked the results. I tested this in another computer and only needed to install the kinect SDK 1.6 and reference Robobuilderlib, if you have any doubts, i would be happy to answer them.

https://mega.co.nz/#!NZgmSBoK!Gl6DTzWcERrYehLdVjBUE12dLp59Kj4DmwY8tDOjiNE
Sorry, i have been very busy lately, but this is my final code, it is in C# and i use an UI coded in WPF. The only dependecis i have are the kinect toolkit and Robobuilderlib. The version of the SDK is 1.6, and i use a vectorial approach to calculate the angles, and ALL are in the cartesian coordinate space, i didn't use the spherical coordinates in the shoulder, because i didn't liked the results they gave.

I didn't implement speech recognition like l3v3rz, but i added the control of the tilt motor of the kinect using a slider and a button. Overall i liked the results. I tested this in another computer and only needed to install the kinect SDK 1.6 and reference Robobuilderlib, if you have any doubts, i would be happy to answer them.

https://mega.co.nz/#!NZgmSBoK!Gl6DTzWcERrYehLdVjBUE12dLp59Kj4DmwY8tDOjiNE
nala170190 offline
Newbie
Newbie
Posts: 3
Joined: Wed May 01, 2013 12:07 am

Post by chickenkai » Wed May 29, 2013 1:06 pm

Post by chickenkai
Wed May 29, 2013 1:06 pm

has anyone try to controll the lower body, not just upper body?

thanks!
has anyone try to controll the lower body, not just upper body?

thanks!
chickenkai offline
Savvy Roboteer
Savvy Roboteer
Posts: 30
Joined: Thu Jul 26, 2012 10:09 am

PreviousNext
PreviousNext
31 postsPage 2 of 31, 2, 3
31 postsPage 2 of 31, 2, 3