How would i implement position and heading readings into my SLAM robot?


i have posted question on stack exchange yesterday haven't gotten response yet i'm trying luck here.

i trying build low-cost slam system mpu-6050 , gy-271 (magnetometer). currently, have robot arduino collects sensor data , raspberry pi (hopefully) slam calculations.

i want robot able use 3 sensor readings (along pml) in slam create 2d map of environment. however, considering want 2d map, not require axis readings correct?

i read post 1 of answers said yaw gyroscope, , x , y accelerometer needed.

1. question is, how implement slam robot? complementary filter work??

2. need use axis (x, y, , z) readings magnetometer? or 1 or 2 axis?

here code if want have @ it.
code: [select]
#include <wire.h>

long accelx, accely, accelz;
float gforcex, gforcey, gforcez;

long gyrox, gyroy, gyroz;
float rotx, roty, rotz;

long magx, magy, magz;

void setup() {
  serial.begin(9600);
  wire.begin();
  setupmpu();

  //  //find starting angle.
  //  acceldata();
  //  gyrodata();
  //  magdata();
  //  printdata();
  //  delay(1000);
}

void loop() {
  acceldata();
  gyrodata();
  magdata();
  printdata();
  delay(100);
}

void setupmpu() {
  //initialize mpu-6050.
  wire.begintransmission(0x68);
  wire.write(0x6b);
  wire.write(0);
  wire.endtransmission();

  //gyroscope range configuration
  wire.begintransmission(0x68);
  wire.write(0x1b);
  wire.write(0);
  wire.endtransmission();

  //accelerometer range configuration
  wire.begintransmission(0x68);
  wire.write(0x1c);
  wire.write(0);
  wire.endtransmission();

  //magnetometer mode selection
  wire.begintransmission(0x1e);
  wire.write(0x02);
  wire.write(0);
  wire.endtransmission();
}

void acceldata() {
  wire.begintransmission(0x68);
  wire.write(0x3b);
  wire.endtransmission();

  wire.requestfrom(0x68, 6);
  while (wire.available() < 6);
  accelx = wire.read() << 8 | wire.read();
  accely = wire.read() << 8 | wire.read();
  accelz = wire.read() << 8 | wire.read();

  gforcex = accelx / 16384.0;
  gforcey = accely / 16384.0;
  gforcez = accelz / 16384.0;
}

void gyrodata() {
  wire.begintransmission(0x68);
  wire.write(0x43);
  wire.endtransmission();

  wire.requestfrom(0x68, 6);
  while (wire.available() < 6);
  gyrox = wire.read() << 8 | wire.read();
  gyroy = wire.read() << 8 | wire.read();
  gyroz = wire.read() << 8 | wire.read();

  rotx = gyrox / 131.0;
  roty = gyroy / 131.0;
  rotz = gyroz / 131.0;
}

void magdata() {
  wire.begintransmission(0x1e);
  wire.write(0x03);
  wire.endtransmission();

  wire.requestfrom(0x1e, 6);
  while (wire.available() < 6);
  magx = wire.read() << 8 | wire.read();
  magz = wire.read() << 8 | wire.read();
  magy = wire.read() << 8 | wire.read();
}

void printdata() {
  serial.print("gyro (degrees)");
  serial.print(" x=");
  serial.print(rotx);
  serial.print(" y=");
  serial.print(roty);
  serial.print(" z=");
  serial.print(rotz);
  serial.print(" accelerometer (g)");
  serial.print(" x=");
  serial.print(gforcex);
  serial.print(" y=");
  serial.print(gforcey);
  serial.print(" z=");
  serial.print(gforcez);
  serial.print(" magnetometer");
  serial.print(" x=");
  serial.print(magx);
  serial.print(" y=");
  serial.print(magy);
  serial.print(" z=");
  serial.println(magz);
}

quote
however, considering want 2d map, not require axis readings correct?
if robot moves in 2d plane, acceleration in 1 axis (assuming mount accelerometer correctly) constant. gravity still sucks. can ignore 1 axis.

quote
1. question is, how implement slam robot?
what "this" wish implement?

quote
would complementary filter work??
as in, every time pi got x acceleration greater value, sent "great job!" , every time got y acceleration less value, sent "keep great work'?

what, exactly, want filter?



Arduino Forum > Topics > Robotics (Moderator: fabioc84) > How would i implement position and heading readings into my SLAM robot?


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts