Cartesian to Diamond coordinate translation for joystick to differential drives

    General discussion

  • To anyone interested,

    I have a simple telepresent robot that I built.  The user drives the differential drive robot using a joystick, specifically an XBox controller.  In code I had to deal with translating the X and Y Cartesian coordinates from the joystick to values that can be applied to the left and right drive motors.  This isn't a trivial task if you want a smooth translation.

    After coming up with a unique approach and making it work in my robot, I thought others might be interested in my solution.  I created a Dot Net DLL containing the basic functionality so that it could be implemented in any Dot Net application.  I also created a document describing the algorithm for anyone who wished to convert it to a different environment as well as a description of the DLL and how to use it.  I provide both of these for free with the usual "use at your own risk" provision.

    I invite any interested people to look at my document and/or the kit and give me feedback.


    Monday, January 25, 2010 7:32 PM

All replies

  • file not found. BTW I am kind of interested in this since I'm doing it myslef in Java at the moment.
    Thursday, January 27, 2011 2:54 AM
  • Spiked3,

    Sorry for the bad link.  I changed around my website and forgot about this post.  Try this.

    If you still have problems, let me know.  You can also contact me through the website.



    Tuesday, February 08, 2011 3:20 PM
  • yeah, actually I had run across that in my searches - but it gets a 404 there as well when you go to get the files.

    for the time being I snagged an algorithm out of MRDS. it looks like this;

    static void tankDrive(float x, float y) {
    double left = 0, right = 0;
    // lifted from mrds
    left = y + x / 4;
    right = y - x / 4;
    System.out.printf("tankDrive %f %f / %f %f\n", x, y, left, right);

    I know its not perfect, but dang its close and simple and does the job.

    Tuesday, February 08, 2011 10:06 PM
  • Spiked3,

    Ok.  I think I have it fixed now.  I had someone outside of my network to try it and they had no problem.  If you're still interested, give it another shot.



    Wednesday, February 09, 2011 6:50 PM
  • By the way, an alternative location is here:



    Wednesday, February 09, 2011 9:04 PM
  • By the way, an alternative location is here:



    I know this is an older post, but I wanted to comment and say that I recently used this algorithm in a project and it was way better than any other that I found. It handles full forward, reverse, and full left and right (turn on a dime) much better than others I tried. If anyone is interested let me know. Douglas has given me permission to re-distribute his algorithm. He provided the c# version. I have a Java converted version I used on an Android.
    • Edited by Spiked3 Thursday, May 10, 2012 9:40 PM
    Thursday, May 10, 2012 9:39 PM
  • I know this thread is a bit old (~5 years), however I am looking to get a copy of the PDF that Douglas mentioned. None of the links provided have worked.

    Does anyone have a copy to share or can you point me in the right direction? In the interim, I will take a look at the MRDS that Spike3 mentioned.

    Thank you all.



    Friday, March 24, 2017 2:33 PM
  • Just in case if someone wants the doc:

    Monday, January 29, 2018 9:53 PM