By Kyle Vogt


The RoboteQ AX3500.
Contents
  • What is a Roboteq?
  • Download
  • Usage
  • In Action (with video!)
  • What is a Roboteq?

    RoboteQ is a company that makes intelligent controllers for high-power electric motors. I like them. They sell an OEM-like version called the AX3500, which can handle some pretty large motors. It was really useful in my Robotic Wheelchair project and for MIT's Tour Guide. This model connects to a computer or microcontroller using a regular serial port. It has an extensive feature set, which is great if you're really good at programming. I like simplicity, so I've created a little serial port and RoboteQ library for use in Linux (and probably Mac OSX). It's not complete, but it will at least give you a starting point and make a motor spin.

    Download

    I think this is a necessary extension to the Roboteq product and should help others use it in a Linux environment. The library is available as two C++ classes: Serial and Roboteq. They are a part of my little Open Source Robot Controls library, which is fully-documented and includes sample programs. You will need the following files to make everything work:

  • roboteq.h
  • roboteq.cpp
  • serial.h
  • serial.cpp
  • Usage

    using the motor controller is as simple as putting the following lines in your C++ file and compiling it using GCC or something similar:

    #include "../include/roboteq.h"
    void main() {
    Roboteq ax3500; // Creates an instance of the Roboteq class
        ax3500.dev = "/dev/ttyS0"; // Name of serial port used
        ax3500.connect(); // Connects to the Roboteq
        ax3500.setSpeed(1, DIRECTION_FORWARD, 50); // Speed 50
    }

    This was a quick example, but there is more documentation at http://web.mit.edu/kvogt/Public/osrc/doc/html/ (Click on "Class List", then "Serial" or "Roboteq") There are also a few applications I've written that use the Roboteq and a sample makefile in the code folder listed above that may be useful. Note: Not all functions listed in the documentation are implemented yet, but it should be trivial to fill in the functions that I haven't written.

    The Serial class can be used by itself, and is much more complete than the Roboteq class. If you have trouble with the Roboteq class, just use the Serial class and write your own wrapper for the Roboteq. Please send me an email if you found this to be useful. That would be cool.

    In Action

    Here's a short video of MIT's Tour Robot (in an early state) running some derivative of the code listed below.

    A quick sample program (joycontrol.cpp) to drive a two-wheeled robot using a joystick in linux is listed below. If you dig through the other programs, you'll find some goodies like a networked version of the joycontrol program. This will let you drive your robot using an internet connection from anywhere in the world. Any joystick should work, as long as it's visible to Linux. Under Ubuntu, it's something like "/dev/input/js0". BE CAREFUL running this for the first time. The directions might not be set right for you, so don't let a robot back up into your leg. Especially if it's a big robot.

    #include "joystick.h"
    #include "roboteq.h"
    
    int main(int argc, char** argv) {
    
    int speed1, speed2;
    
    Joystick joy;
    joyParams params;
    joy.dev = "/dev/input/js0";	
    joy.init();
    
    Roboteq ax3500;
    ax3500.dev = "/dev/ttyS0";	
    ax3500.connect();
    
    while (1) {
    params = joy.update();
    if (params.updated == TRUE) {
    usleep(25000);
    speed1 = params.axisData[0];
    if (params.buttonData[0] == 1) {
    ax3500.setSpeed(1, DIRECTION_FORWARD, 0);
    ax3500.setSpeed(2, DIRECTION_FORWARD, 0);
    printf("BREAK! \n");
    }
    else if (params.buttonData[1] == 1) {
    ax3500.reset();
    printf("RESET! \n");
    }
    else {
    if (speed1 >= 0) {
    	ax3500.setSpeed(1, DIRECTION_FORWARD, speed1/259);
    	printf("Motor 1 going fowards at %i.\n", speed1/259);
    }
    else {
    	ax3500.setSpeed(1, DIRECTION_REVERSE, -(speed1/259));
    	printf("Motor 1 going backwards at %i.\n", -(speed1/259));
    }
    speed2 = params.axisData[1];
    if (speed2 <= 0) {
    	ax3500.setSpeed(2, DIRECTION_FORWARD, speed2/259);
    	printf("Motor 2 going fowards at %i.\n", -(speed2/259));
    }
    else {
    	ax3500.setSpeed(2, DIRECTION_REVERSE, -(speed2/259));
    	printf("Motor 2 going backwards at %i.\n", speed2/259);
    }
    }
    }
    }
    
    return -1;
    }
    

    To top of page