go_away

Author Topic: Need a direction sensor. Compass, Accelerometer or Gyro?  (Read 2441 times)

0 Members and 1 Guest are viewing this topic.

Offline cpctc1234Topic starter

  • Beginner
  • *
  • Posts: 5
  • Helpful? 0
Need a direction sensor. Compass, Accelerometer or Gyro?
« on: November 30, 2010, 11:24:44 AM »
Hey guys I'm building a robot that needs to know its orientation based of a starting direction. Like a compass in way that if the robot starts off in the North direction it will always know which direction it started in and finishes in.

I've been looking at a compass module, but I'm worried about EMF interference so I was leaning toward an accelerometer or gyro, but I'm unsure if they can be used to measure orientation.

Do you guys have any idea of what I can use if any of these above? 

Offline LunchBox!

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 2
Re: Need a direction sensor. Compass, Accelerometer or Gyro?
« Reply #1 on: December 01, 2010, 12:28:51 AM »
couldn't it be done with encoders?

encoders could keep it straight, and you would know how much it turned and could turn it back on track.


Offline rbtying

  • Supreme Robot
  • *****
  • Posts: 452
  • Helpful? 31
Re: Need a direction sensor. Compass, Accelerometer or Gyro?
« Reply #2 on: December 01, 2010, 01:21:44 AM »
You can use all of them (encoders, accelerometers, compasses, gyros - in order of drift), but you'll need to write a closed control loop.  Take a look at Admin's PID control tutorial.  If you decide to use accelerometers, be aware they have integral drift - correction with a gyro is the best way to avoid it, using a Kalman filter.  Then you'll have an IMU (inertial measurement unit)

Offline cpctc1234Topic starter

  • Beginner
  • *
  • Posts: 5
  • Helpful? 0
Re: Need a direction sensor. Compass, Accelerometer or Gyro?
« Reply #3 on: December 02, 2010, 10:15:53 AM »
couldn't it be done with encoders?

encoders could keep it straight, and you would know how much it turned and could turn it back on track.



Yeah I thought of using encoders. I was really wanting to use something else because I'm not sure if my wheels will accommodate encoders.

Offline cpctc1234Topic starter

  • Beginner
  • *
  • Posts: 5
  • Helpful? 0
Re: Need a direction sensor. Compass, Accelerometer or Gyro?
« Reply #4 on: December 02, 2010, 10:22:07 AM »
You can use all of them (encoders, accelerometers, compasses, gyros - in order of drift), but you'll need to write a closed control loop.  Take a look at Admin's PID control tutorial.  If you decide to use accelerometers, be aware they have integral drift - correction with a gyro is the best way to avoid it, using a Kalman filter.  Then you'll have an IMU (inertial measurement unit)

So your saying that in order to accelerometers I would have to predict the error and account for it. So are you saying in your opinion wheel encoders would be best?

Offline rbtying

  • Supreme Robot
  • *****
  • Posts: 452
  • Helpful? 31
Re: Need a direction sensor. Compass, Accelerometer or Gyro?
« Reply #5 on: December 03, 2010, 10:44:22 PM »
Encoders are easier.  Arguably, an IMU would be "best", but likely the total error over total runtime will be pretty small, so it's not much different.

 


Get Your Ad Here

data_list