Kangaroo x2 Motion Controller Issues

I’m working with some Kangaroos to command a mecanum wheeled robot. Using just the Sabertooth motor controllers works fine, but now I’m trying to add some speed control into the mix and I’m having difficulty. Contacting their support is like pulling teeth, so I figure I would ask here just in case anyone else has had similar issues.

Now, the code below “works” but the issue that I’m having is that the speed commands seem to take up to 30 seconds to complete. From what I can tell the Kangaroos get the command but they are having issues “getting there” and moving on. I seem to be unable to find a way to 1.) set a deadband around the desired velocity 2.) assign the velocity to the motor controller without blocking my program. I’m going to be controlling the robot over Ethernet and it’s unacceptable to have to wait 10-20 seconds before the next command is executed.

Motor Controller: Sabertooth 2x25

http://www.dimensionengineering.com/pro … rtooth2x25

Motion Controller: Kangaroo x2

http://www.dimensionengineering.com/products/kangaroo

#include <SoftwareSerial.h>
#include <Kangaroo.h>

#define TX_PIN 10
#define RX_PIN 11

unsigned long currentTime = 0;
unsigned long previousTime = 0;

SoftwareSerial  SerialPort(RX_PIN, TX_PIN);

KangarooSerial  K_FRONT(SerialPort);
KangarooChannel K1_F(K_FRONT, '1', 128);
KangarooChannel K2_F(K_FRONT, '2', 128);

KangarooSerial  K_REAR(SerialPort);
KangarooChannel K1_R(K_REAR, '1', 129);
KangarooChannel K2_R(K_REAR, '2', 129);

KangarooStatus K_STATUS;

void setup()
{
  Serial.begin(115200);
  
  SerialPort.begin(9600);
  SerialPort.listen();
  
  delay(2000);
  
  K1_F.start();
  K1_F.home();//.wait();
  
  K2_F.start();  
  K2_F.home();//.wait();

  K1_R.start();
  K1_R.home();//.wait();
  
  K2_R.start();  
  K2_R.home();//.wait();

}

void loop()
{
  int i = 0;
  int j = 0;
  unsigned char kERROR;
  
  previousTime = millis();

  for(i = 0; i < 1250; i = i + 100)
  {
    j = -1 * i;
    Serial.print("[1]");
    K1_F.s(i);
        printTime();
    K2_F.s(i);
        printTime();
    K1_R.s(j);
        printTime();
    K2_R.s(j);
        printTime();
    delay(100);
    Serial.println();
  }
  
  for(i = 1250; i > -1250; i = i - 100)
  {
    j = -1 * i; 
   Serial.print("[2]");   
    K1_F.s(i);
        printTime();
    K2_F.s(i);
        printTime();
    K1_R.s(j);
        printTime();
    K2_R.s(j);
        printTime();
    delay(100);
    Serial.println();
  }
  
  for(i = -1250; i <= 0; i = i + 100)
  {
    j = -1 * i; 
    Serial.print("[3]");
    K1_F.s(i);
        printTime();
    K2_F.s(i);
        printTime();
    K1_R.s(j);
        printTime();
    K2_R.s(j);    
    delay(100);
    Serial.println();
  }
}

void printTime()
{
    currentTime = millis();
    Serial.print("[");Serial.print(currentTime-previousTime);Serial.print("]");
    previousTime=millis();
}

Hello pack34,

You can change the speed deadband in DEScribe, in the Control tab. You can also use .gets() manually if you want to check programmatically or not rely on the deadband. The .wait() method technically waits for the ‘complete’ flag (in Plain Text Serial, 1,GETS returns 1,s123 or 1,S123 depending on completion).

What you are encountering however is something different. Normally the Kangaroo library, when sending a command, uses a per-channel sequence number and verifies that the command has been received correctly. From the return value you can also detect cases such as loss of power since the last command, etc. and it is possible to cover every case for reliability if you want to.

Commands should not be taking 30 seconds. That suggests to me a signal issue. I notice you have two Kangaroos sharing a line. What do you get if you communicate with the shared line using Plain Text Serial, say, 1,GETP? Corrupt data or a proper response?

If corrupt data, have you, in DEScribe, checked “Enable multi-Kangaroo mode” in Serial for both Kangaroos? With this option off (the default), each Kangaroo drives the line high when not busy sending a reply. With this option on, the Kangaroo will instead use a pullup in the idle case. We chose to default to driving high so that there is less likelihood of the single Kangaroo, long wires case having signal problems. The option is necessary for daisy chaining S2 reliably. Otherwise, if the Kangaroo needs to send a 0 bit, it will drive to 0V but the other, idle Kangaroo will be driving to 5V. That’ll be a real gamble for reading as a 0 bit on the Arduino. So, definitely make sure you have that option checked.

The Kangaroo library will happily retry until it gets confirmation the command was received. This can show up as slow responses. If you will be continually streaming data (as it looks like) and only occasionally needing full reliability from retrying, I recently added a .streaming() method to the Arduino library (and an equivalent Streaming property to the .NET library). This mode just sends the commands, doesn’t use sequence codes, and doesn’t wait for a reply at all. It should be substantially faster. The most recent library, K1_F.streaming(true or false) is the syntax.

As a side note, I designed the packet parser to expect one KangarooSerial per serial port. It will likely work anyway since the Arduino library doesn’t really expose asynchronous queries, but if you want to (and I recommend it), all four KangarooChannels can certainly use only one KangarooSerial.

Please let me know if this helps or not, and how it goes. If you have any feedback on the Kangaroo firmware, libraries or DEScribe feel free to contact me.

James

hi i am new to this and i do not under stand what i am donig wrong got two sabertooth motor controllers with two kangaroo x2 bourds connected them up as instruction loaded the software tryed test but it comes back need two cannnels i have got one motor conected for a test can any one help

john

hi thanks for your reply I now have 3 problems . 1 it will not recognize kangaroo x2 or recognize Sabertooth 60x2 also I have no led on the kangaroo x2 to show tuning I have connected a 10k pot to sabertooth and a motor with power and it works fine so I don’t think that the sabertooth are not working

hope you can help

john

can i send my two sabatooth 60x motor controllers and my kangaroo x2 back to you for testing and repair i have tried every thing i can and i am sure they are the problem when i take the 10 k pot off and manuly turn it works as sone as i put it back on it turns the pot to one or the other end puting it out of rang error tried a nother system i have with MDO3 motor drives and all work but not the sabatooth please help

kind regards

john

can i send my two sabatooth 60x motor controllers and my kangaroo x2 back to you for testing and repair i have tried every thing i can and i am sure they are the problem when i take the 10 k pot off and manuly turn it works as sone as i put it back on it turns the pot to one or the other end puting it out of rang error tried a nother system i have with MDO3 motor drives and all work but not the sabatooth please help

kind regards

john

Dude, there is no reason to post the same crap twice. It’s been a year since that post and he’s moved on and so should you.

Go to http://www.dimensionengineering.com/contact for those questions.