Society of Robots - Robot Forum
Software => Software => Topic started by: Sylvestre on January 14, 2012, 06:25:15 PM
-
Hey everyone,
I am thinking of using a joystick such as one in the link below to control my rescue robot. If I used this, I would just have it connected (Usb obviously) to the laptop I'm controlling the robot from.
How difficult would it be to program something like this? Would someone who has done this before care to share some example code? (preferably in C)
http://www.amazon.com/Logitech-Extreme-Joystick-Silver-Black/dp/B00009OY9U/ref=sr_1_4?ie=UTF8&qid=1326586764&sr=8-4 (http://www.amazon.com/Logitech-Extreme-Joystick-Silver-Black/dp/B00009OY9U/ref=sr_1_4?ie=UTF8&qid=1326586764&sr=8-4)
-
I'll be the first to admit I don't know a great deal about joysticks, but to get the replies started...
Most joysticks I've seen have a setup interface where you can define which each movement/button press should be such as tilt to the left = left arrow, "fire" button = spacebar etc.
I'm only assuming, but from there it may just be a case of having the code look for a press of the left arrow key, which (I assume) would also see the Joystick being tilted to the left as this key being pressed. etc
Hopefully someone with more experience with this comes along very soon to enlighten us both ;)
-
ok thanks for the information! Yeah hopefully helps us out.
-
What operating system are you using? If you use Windows, the thing I use is DirectInput. You can then get a value from the various axes and buttons on the joystick.
How will you send signals to your robot from the laptop?
I have some code that might be helpful, if you are using Windows.
-
If you want something cross platform check out SDL
http://www.libsdl.org/ (http://www.libsdl.org/)
-
I need to revisit this topic. Sorry for my delayed response. Now to the answers of your questions.
What operating system are you using? If you use Windows, the thing I use is DirectInput. You can then get a value from the various axes and buttons on the joystick.
I am using Windows.
How will you send signals to your robot from the laptop?
Serial communication.
I'll check out both SDL and DirectInput. Thanks for the response