Well. First I would like to say HELLO to all of you.
You have a nice website with lots of information!
This, and a few others, made me jump into the world of robotics. My name is Robert Jacobs and I’m 20 years old (or young? )
Anyway. As said before I’ve jumped into the world of robotics. Starting with building a hexapod from scratch. This had two reasons:
I would like to show people, who are new to robotics, that you can do a lot for yourself. This will save you money, and will satisfy you more.
I love working with visual basic. I love to program and control hardware via a windows-interface. This started with USB experiment boards.
So I started creating a hexapod. This took a while actually. Took a few months of time. Of course a lot of research on the internet etc.
At the moment it is assembled, but I’ve discovered some bugs in the design. Will take care of those later though. Started a topic at the robosavvy forum too. Click here (if it’s not allowed to mention other sites, please edit the post then)
But now I would also like to contribute on this site too. Because I believe this site has a great community.
Anyway. I should get back ontopic and show some pics and a video! 8)
As said it’s assembled. Working on the visual basic .net code at the moment. I’m working on a flexible program. This means a user-interactable program.
At the moment there is a real time change possible in the servo speed. In the future there will be tilt and height variables. Also in real time.
This is it for the moment, I’ll keep posting here if you don’t mind, haha
OK. I couldn’t find any USB joypad stuff on google, so I thought about a other way.
Using software, I can input joypad inputs as keyboard inputs. This means I can load joypad input as keypresses into VB.net. Tested this yesterday and it works. My robot can wake and sleep by using the joypad.
In another windows programming language I’ve used the below for the stick and button inputs:
[code]calldll #winmm, “joyGetPos”, JOYSTICK2 as long, JOYINFO as struct , result as long
posJoyX2 = JOYINFO.x.struct
posJoyY2 = JOYINFO.y.struct
Button1=JOYINFO.buttons.struct and 1
Button2=JOYINFO.buttons.struct and 2
Button3=JOYINFO.buttons.struct and 4
Button4=JOYINFO.buttons.struct and 8
Button5=JOYINFO.buttons.struct and 16
Button6=JOYINFO.buttons.struct and 32
Button7=JOYINFO.buttons.struct and 64
Button8=JOYINFO.buttons.struct and 128
Button9=JOYINFO.buttons.struct and 256
Button10=JOYINFO.buttons.struct and 512
Which language is this? C#? C++?
Found a way to read joypad inputs with visual basic. This is able when you convert joypad input into keydowns. In example the X-button is F1 (or whatsoever).
A direct way would be great though.
Looks like VB Script to me.
Do you know any Visual C#? There’s XNA Game Studio which can take input from an Xbox 360 controller. I wrote a example program for doing this - It’s somewhere in the General Programming section. It’s very easy to do with only a few lines of code.
This code is from a programming application called Liberty Basic. The dll is a standard windows dll and should be available to any windows programming application that can use dlls.
But, does anyone know how to do this using VB.net?
This would be very helpful. Been on google for a few hours,and I’ve found a source code. But after conversion it has a lot of errors. And I cannot get the newest source code of this, because the site which it’s hosted on requires activation after registration. And, because the site is kindda dead, I cannot download.
Thanks for your reply!
Currently I’m working on a joypad application wich seems to become working. It’s using DirectX and DirectX.Directinput components. I can read joystick X and Y axis now and also buttons.
I will work further on this tomorrow or even tonight. I will see how things work out.
Thanks the both of you for providing me help and links! Stay tuned 8)
If possible, can you post the specific vb.net code that acquires the joystick/gamepad info? The VB.net express programming application is free from MS, and some other interesting applications might be made being able to acquire the joystick/gamepad info.
Maybe later on. For now I’m focusing at my program first.
I’ve ordered a new power supply via the internet. I hope it will be shipped soon. Currently I’m having too less power for the robot to stand up from wake.
Once it’s here, I can go on with programming the hexapod movements 8)
There are a ton of resources out there for connected a joystick using VB. You will need a reference to DirectInput.dll (part of the DirectX library) in your application, though.
Nice example. As said before, my program also works with the DirectX and DirectX.Directinput components.
I will re-code my part now. Since I’m having a bug. The problem is, when you click the activate joypad checkbox, the program checks for a joypad. If you have no joypad attached, it will give you a messagebox. But! If you are running the program with a joypad, and then disconnect the joypad, the program doesn’t “see” this. So I really have to get that fixed. I’ve found a program example on the internet which I will re-code a bit to (hopefully) fix this bug…
This looks pretty much like the code. But this is also called once. I’m thinking of a way to get this fixed. I could do it with a timer. But you’ll all know the disadvantage of a timer…
This is what I’ve thought of. It’s a simple check, and after the check it stops. This is important, or the message box keeps appearing in a loop. But I have no clue on how to do this without a timer, yet. Maybe I could build this into the code which transfers the input into the labels. And then, instead of displaying a msgbox turning the labels red or something…?
I think the easiest thing to do would be to place a button on the form somewhere that reads “Check for joystick”, and when the users clicks it, a message box will appear with the current status.