Distance measurement using IMU and DVL

Hi,
We are trying to create an Inertial Navigation System . For this, we wish to use a HB100 doppler as DVL to reduce error and an IMU for orientation and cross checking of data. So far, we have not integrated the HB100, and have only used the IMU.

We would like some help with how to use the HB100 for speed sensing, with respect to ground. The datasheet of the HB100 is given below
http://www.limpkin.fr/public/HB100/HB100_Microwave_Sensor_Module_Datasheet.pdf

On the other hand, we have used the IMU to at least get a general view of the distance traveled and orientation. For this, we have used the code below, but the results are unsatisfactory

// I2C device class (I2Cdev) demonstration Arduino sketch for MPU9150
// 1/4/2013 original by Jeff Rowberg jeff@rowberg.net at GitHub - jrowberg/i2cdevlib: I2C device library collection for AVR/Arduino or other C++-based MCUs
// modified by Aaron Weiss aaron@sparkfun.com
//
// Changelog:
// 2011-10-07 - initial release
// 2013-1-4 - added raw magnetometer output

/* ============================================
I2Cdev device library code is placed under the MIT license

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

*/

// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
// is used in I2Cdev.h
#include "Wire.h"

// I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files
// for both classes must be in the include path of your project
#include "I2Cdev.h"
#include "MPU6050.h"

// class default I2C address is 0x68
// specific I2C addresses may be passed as a parameter here
// AD0 low = 0x68 (default for InvenSense evaluation board)
// AD0 high = 0x69
MPU6050 accelgyro;
unsigned long prev=0;
int16_t ax, ay, az;
int16_t gx, gy, gz;
int16_t mx, my, mz;
float gyy=0;
float bx,by,bz;
float cx,cy,cz;
float dx,dy,dz;
float s, lv;
float sy, lvy, sz, lvz;
float ac, chax=0;
float chay=0;
float chaz=0;
float cherror;
int count=0;
float inv=0, invy=0, invz=0;
#define LED_PIN 13
bool blinkState = false;
unsigned long previousMillis = 0;
void setup() {
// join I2C bus (I2Cdev library doesn't do this automatically)
Wire.begin();

// initialize serial communication
// (38400 chosen because it works as well at 8MHz as it does at 16MHz, but
// it's really up to you depending on your project)
Serial.begin(115200);

// initialize device
Serial.println("Initializing I2C devices...");
accelgyro.initialize();

// verify connection
Serial.println("Testing device connections...");
Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
for(int i=0;i<20;i++)
{
accelgyro.getMotion9(&ax, &ay, &az, &gx, &gy, &gz, &mx, &my, &mz);
chax=chax+ax;
chay=chay+ay;
chaz=chaz+az;
}

chax=(float)chax/32768;

chay=(float)chay/32768;

chaz=(float)chaz/32768;

Serial.println("New Chax");
Serial.print(chax);

// configure Arduino LED for
pinMode(LED_PIN, OUTPUT);
}

void loop() {
// read raw accel/gyro measurements from device

count=count+1;

accelgyro.getMotion9(&ax, &ay, &az, &gx, &gy, &gz, &mx, &my, &mz);

bx=(float)ax/(1638.4);
by=(float)ay/(1638.4);
bz=(float)az/(1638.4);
float pitch = atan(bx/sqrt(pow(by,2) + pow(bz,2)));
float roll = atan(by/sqrt(pow(bx,2) + pow(bz,2)));
pitch = pitch * (180.0/PI);
roll = roll * (180.0/PI);
float yawRaw=atan2( (-mycos(roll) + mzsin(roll) ) , (mxcos(pitch) + mysin(pitch)sin(roll)+ mzsin(pitch)*cos(roll)) ) *180/PI;
float YawU=atan2(-my, mx) *180/PI;
bx=bx-chax;
by=by-chay;
bz=bz-chaz;
cx=gx/65.5;
cy=gy/65.5;
cz=gz/65.5;

//Motion in one simple direction, let y=0.
unsigned long currentMillis = millis(); //record time of new reading
float interval = float((float(currentMillis) - float(previousMillis))/1000) ; //Time of previous reading-Time of Current reading= Interval
if(bx>0.03||bx<(-0.03))
{
ac=bxinterval; //acceleration x time=velocity
lv=inv; // initial velocity=lv, final velocity=inv
inv=inv+ac; // vf =vi+1t;
s=s+(lv
interval)+0.5acinterval; // Distance= Previous Distance + Vit + 1/2 x a x t^2

}

if(by>0.02||by<(-0.02)){
ac=by*interval;
lvy=invy;
invy=invy+ac;

sy=sy+(lvyinterval)+0.5ac*interval;
}

if(bz>0.03||bz<(-0.03))
{
ac=bz*interval;

lvz=invz;
invz=invz+ac;

sz=sz+(lvzinterval)+0.5ac*interval;
}

Serial.print("\n");
Serial.print((s100)); //PRINT
Serial.print(" ");
Serial.print((sy
100));
Serial.print(" ");
Serial.print((sz*100));
Serial.print(" ");
Serial.print(interval);
Serial.print(" ");
Serial.print(pitch);
Serial.print(" ");
Serial.print(YawU);
Serial.print(" ");
Serial.println(roll);

//Serial.print(" ");
// Serial.print(interval,10);

previousMillis=millis(); //record current time

// blink LED to indicate activity
blinkState = !blinkState;
digitalWrite(LED_PIN, blinkState);
}

Can anyone help us with integrating the DVL, and also finding a more error free way of finding the orientation of the IMU quickly, as we wish to complete it in the next week?

Please use code tags </> to present code.

Computation of distances from accelerations is not very reliable by design. You may look into open source drone (quadrocopter) code, how it's done there.

A Doppler device may not work on uniform surface, without distinct and reflective objects on it (like cars).

I don't quite get how your going to use Doppler readings of the ground in front of a moving object. If you point it right at the ground, it wont measure anything, because the distance from the ground to the detector isn't changing. If you point if forward but down, then the laws of reflection would indicate that most of your emitted RF is not going to come back, and moreover, the amount coming back may vary depending on changes in the surface.

I wouldn't invest too much time in this until you check out your Doppler idea.

Hi,

Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html
then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks. Tom... :slight_smile:

Extremely sorry for the code tags being wrongly posted

I have seen the Quadcopter code (If it's the control one), but I believe that one's more for stability, while ours would be the primary mode of movement.

Another question I have on this, we could try reducing the sampling time. For that, we could increase the I2C speed, would that work?

All of you say Doppler won't work, and our experiments seem to confirm this as well. So can I run through another suggestion through here, before I buy and if you could please tell me if it'd work?

The car is just our testing module, our main work is on an AUV (Autonomous Underwater vehicle) that is already built, but has no control or navigation systems. Could we attach a flow sensor on our AUV? Say something like the one from here

And could we use the flow rate and the change in it to determine the actual speed?

Thank you so far, DrDiettrich, jrdoner, tom.