Shop OBEX P1 Docs P2 Docs Learn Events
Joystick code for linux computer to send instructions to a Prop driven BOE-bot — Parallax Forums

Joystick code for linux computer to send instructions to a Prop driven BOE-bot

J. A. StreichJ. A. Streich Posts: 158
edited 2009-02-14 03:58 in Robotics
So, I've got a bot with prop, servos and XBee on a BOE chasis. (No SD, a bunch of IR LEDs and detecors are in the mail, and I'm looking to salvage an old optical mouse for dead reckoning). For now the bot is running Mike Green's code - http://forums.parallax.com/showthread.php?p=635533 ... It's a thing of true beauty.

So, I have an XBee attached to my EeePC (Debian Lenny) on the other side, and I had an old Logitech gamepad laying around. I've written a C program, using some sample code from the web andhave gotten the Bot to respond to the joystick.... There are delays and it seems to miss some events. Any improvements anyone has are welcome, and your free to play with it or use it as a starting point for your bots.

What it does in a nutshell...

Joystick inputs (-32,767 to 32,767) get turned into servo widths (1000 to 2000), formatted into FemtoBasic and sent to the XBee.

EDIT:
I suppose I should note... The code should work with any modern Linux Distro (newer kernels), any jpystick with multiple analog sticks (can be easily modified can use one analog stick so that the top left corner is full forward, and the lower left is full back), and could work with BOE (with XBee) with minor changes to the scale and translation.

Post Edited (J. A. Streich) : 2/9/2009 4:26:40 PM GMT

Comments

  • GWJaxGWJax Posts: 267
    edited 2009-02-08 23:59
    Nice code structure, good job!

    Jax

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If a robot has a screw then it must be romoved and hacked into..
  • J. A. StreichJ. A. Streich Posts: 158
    edited 2009-02-14 03:58
    Version 2. Object oriented, and separate processes to read results and to send serial signals. Less latency, more responsive. There is still a slight delay, but works a lot smoother than the previous version.
Sign In or Register to comment.