Author Topic: Using a Joystick to Control a Robot  (Read 1820 times)

0 Members and 1 Guest are viewing this topic.

Offline SylvestreTopic starter

  • Robot Overlord
  • ****
  • Posts: 221
  • Helpful? 13
Using a Joystick to Control a Robot
« 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
« Last Edit: January 14, 2012, 07:42:51 PM by Sylvestre »

Offline Redcap

  • Full Member
  • ***
  • Posts: 80
  • Helpful? 11
Re: Using a Joystick to Control a Robot
« Reply #1 on: January 15, 2012, 08:53:57 PM »
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 ;)

Offline SylvestreTopic starter

  • Robot Overlord
  • ****
  • Posts: 221
  • Helpful? 13
Re: Using a Joystick to Control a Robot
« Reply #2 on: February 12, 2012, 12:13:33 AM »
ok thanks for the information!  Yeah hopefully helps us out.

Offline Daanii

  • Robot Overlord
  • ****
  • Posts: 138
  • Helpful? 3
Re: Using a Joystick to Control a Robot
« Reply #3 on: February 16, 2012, 12:47:15 AM »
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.

Offline Resilient

  • Full Member
  • ***
  • Posts: 111
  • Helpful? 4
Re: Using a Joystick to Control a Robot
« Reply #4 on: February 16, 2012, 02:15:55 AM »
If you want something cross platform check out SDL

http://www.libsdl.org/

Offline SylvestreTopic starter

  • Robot Overlord
  • ****
  • Posts: 221
  • Helpful? 13
Re: Using a Joystick to Control a Robot
« Reply #5 on: August 26, 2012, 11:38:15 PM »
I need to revisit this topic.  Sorry for my delayed response.  Now to the answers of your questions.

Quote
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.

Quote
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
« Last Edit: August 26, 2012, 11:39:52 PM by Sylvestre »

 


Get Your Ad Here

data_list