Shop OBEX P1 Docs P2 Docs Learn Events
Gyroscope Module 3-Axis L3G4200D...wow — Parallax Forums

Gyroscope Module 3-Axis L3G4200D...wow

joy1joy1 Posts: 32
edited 2012-12-02 19:21 in General Discussion
I've purchased the gyroscope to help with a robot we're building. We have a robot with 2 wheels at the front controlled by two seperate motors. We have to place pallets on a shelf. Problem is, there is a 3/4" piece of plywood in our way (can't be moved) which is OK for the center shelves since both wheels are on the plywood. for the shelves on the side, one wheel is up on the plywood and one wheel is down. So, we thought a gyroscope would help us with this. We were thinking we only need one axis to determine if the base of the robot is "flat"...when one wheel is up and one down, the gyroscope would give us the degree of angle it is off and we would use linear actuators to raise whatever side of the robot to bring it to "flat" again. This way, we would always be able to enter the shelving unit level.

We're using BasicStamp BS2.
That's our story. So we purchased the Gyroscope and i'm not sure but this seems very complicated than anticipated. I downloaded the code online and it reads 0 for all three axis. I move the unit and I get readings but then it goes back to 0 no matter what the position is.

What I want it to do is:

For example:
Focus on "x" axis...if base is "flat"...measure 0
if the robot tilts to the left then I would like to see what the angle is and then record the value
if the value is at let's say 15 degrees, then move therobot back to flat by activiating the left linear actuator
the same would happen for the right.

Can anyone help...do I need something else to make this happen?

thanks

Comments

  • SRLMSRLM Posts: 5,045
    edited 2012-12-02 16:55
    A gyroscope cannot tell you your current angle without a reference point. A gyroscope tells you your rotation rate, not position.* You have the reference point by driving on the flat terrain before you hit the plywood, but you'll constantly have to be integrating (calculus style) the gyro to get your rotational position. This assumes that the gyro doesn't drift, which it does: the gyro will tell you you are rotating, even when you're not. The general solution is to use an IMU to compensate.

    *Ok, that's not true for a mechanical gyro. But it is for a MEMS gyro.

    A better solution would be to use an accelerometer. You drive the robot until you're sure it's on the plywood, then stop. You use the accelerometer to measure the tilt, and you compensate.

    A better solution than that would be to use some sort of sensor by each wheel: the sensor detects the plywood or lack of plywood, and you can calculate your tilt from that (since the plywood is constant, the tilt is constant. You don't need to actually measure it). I suggest some sort of color sensor, or an IR sensor to do the detection.

    The best solution would be to put plywood all the way across, so you don't have to worry about it.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-02 18:11
    SRLM wrote: »
    The best solution would be to put plywood all the way across, so you don't have to worry about it.

    I'm guessing the plywood is part of a course made for robots. This sounds like some sort of contest or challege. I doubt they get to modify the environment.

    I think the accelerometer would be the easiest of the solutions offered by SRLM. I think it best solves the problem of the robot not being level.
  • SRLMSRLM Posts: 5,045
    edited 2012-12-02 18:32
    Duane Degn wrote: »
    I'm guessing the plywood is part of a course made for robots. This sounds like some sort of contest or challege. I doubt they get to modify the environment.

    That makes sense. I didn't think of this as part of a contest.
  • joy1joy1 Posts: 32
    edited 2012-12-02 19:21
    Thanks for you input...I guess I didn't fully understand the use of the gyroscope...I will consider your suggestions...Yes, this is part of a competition where we are trying to have our robot do things automatically saving us time and effort (hopefully)
Sign In or Register to comment.