# gyro for turtlebot

Hi,

I'm looking for a gyro for my turtlbot, but the ones that I've found the drivers are horribly expensive (microstan -> £1592+VAT!). Now I am looking for a normal gyro (arround £50-70), but my question is: will I have to build the drivers or the drivers for the gyro that turtlebot uses by default with iCreate (SparkFun ADXRS613S/623 Breakout Board) will more or less work with any gyro??

Thanks.

edit retag close merge delete

Sort by » oldest newest most voted

In short, yes you should be able to get away with replacing your turtlebot's gyro with another similar one without having to "write a driver" per se--since most cheap gyros operate in the same manner: outputting an analog voltage proportional to the angular rate about the axis of the sensor package it should only require minor modification of the turtlebot's existing gyro.py python module.

A post on how to hook up a rate gyro mimicking the configuration in the turtlebot (its not specific to the ADXRS613 it refers to) can be found here. This can be useful if you don't actually have a turtlebot, but rather just a create with a laptop (no turtlebot power/gyro board).

Unfortunately the main distributor for the ADXRS613 breakout was Sparkfun and they've discontinued that breakout due to the chip being end-of-lifed by the manufacturer. You may be able to find some resellers that still have stock, but I haven't had much success.

UPDATE: There seem to be a few left here, however these will probably dry up soon.

UPDATE 2: It should be noted that ClearPath, one of the distributors of the Turtlebot has apparently switched to the ADXRS652 chip. Since they have in-house fab capability, its unlikely they'll produce a breakout for this chip--you'd have to make your own or wait for someone like Sparkfun to make one.

The MLX90609 breakout might make a suitable replacement (from Sparkfun or Active Robots). Again, if you're just operating with a iRobot Create then you can hook up the analog out of the gyro to the same DB-25 pins described in the first linked post. You may still have to modify gyro.py in the src folder of the turtlebot_node package a bit. Taking a quick glance at that file shows a slightly different formula for calculating orientation than I'm familiar with, so here's the calculation (in C++) that I use on my cheap gyro (from bilibot repo):

    double dt = current_time - last_time; // last time we read ADC
double maxValue = 1024; // using Create's 10-bit ADC
double vRef = 5;  // 5v reference
double zeroRateV = avg * vRef / maxValue; // I calculate zeroRateV from a circular buffer during startup, avg is the average of these values
double sensitivity = 0.013;  // mV/deg/sec from datasheet

rate = (gyro_adc * vRef / maxValue - zeroRateV) / sensitivity;

orientation += rate * dt;


You'll have to figure out from the datasheet what the sensitivity (mV/deg/sec) value is and substitute it in the equation above. It should be relatively trivial to modify gyro.py's publish method if need be to match the above calculation.

more