
Andy Roid

I have purchased a 4 in One Orientation Sensor. My desire is to use the compass function.
Once loaded and running, I view the compass heading values in the Variable watch window.. The value fail to read correctly. I find when I set the device in 90 degree directions ( 0 - 90 - 180 - 270 - back to zero ) I get value that do not even come close to the set position., nor do they repeat. I have changed my location, and even tried it in a wooden shed without any potential magnetic interferences, and still it did not work.
Has anyone use this sensor and has been able to get it to display correctly?
My reason for buying this was for the compass only and I am disappointed to see it not work.
Ron R
Am I missing something ?
Here's the manual page for the MPU 9150 All In One module:http://www.ez-robot.com/Tutorials/Help.aspx?id=213
Also, unless you wish to perform serious math, as in my previous posts, do not pay attention to the $compassx $compassy $compassz variables - that's a whole new world that you most likely don't want to experience.
Follow the manual page and use the $CompassHeading variable only.
yes, that would be helpful I think. I was going to use a if $bearing <= $heading (or >= depending on which way I am turning), but being able to have a target range would probably be better. Will have to figure out what happens when I cross the 0/360 boundary to keep from turning to far. Figuring out the target $heading (ie $bearing) is easy, but knowing I have hit it trickier. For instance, if I am at 270 and my new target is 5, I need to keep going until I am greater than 360, and then continue until I am up to 5, so probably move in two steps instead of one. I'll figure it out.
Alan
I was wondering about converting 360 degrees to 1 to 179 positive and 181 to 359 as 1 to 179 negative numbers. 0 and 180 unsigned. This would allow the numbers to become directional. I haven't fully thought it thru, but what do you think? It should simplify the math?
Ron R
I forgot to mention invert the numbers, i.e. count + 177, +178, +179,180, -001, -002,-003, etc. 180 for example = South 0=North
I know it took a lot of work to get it right. Thanks very much ! I am sure many of us will put it to good use.
Ron R
I have calibrated it flat by putting it in the slot between JDs legs and again vertically by putting it in the chest slot. When flat it does nothing as I turn JD. In the chest, it only works when I tilt JD side to side.
Did the figure-8 thing and all. That seemed to go well. Ran the calibration once when I placed the sensor in the flat position, and ran it again when I placed it in the chest. When the chest position didn't work either, I put it back in the flat position and ran the calibration yet again. It works in both positions but only when I turned JD such that the board is upright (vertical) and rotated the robot such that the sensor board was turning in a circle with the edge of the board leading the way. Only then did the pointer in the control rotate appropriately, 360 degrees. If I rotated JD around the vertical (Z) axis while he is standing, the pointer did not move.
I just tried it again with the new release. I started the init script., Hit the calibrate button and move it as was requested. Once the time zeroed, I placed the sensor flat on my desk. Rotating it on the horizontal plane I got the readings. I placed the sensor in three stacked ez blocks and found I could angle the sensor about 45 degrees from horizontal and still have it read.
If you get to close to the ezb it seems unable to work correctly.
Ron R
First, Again thanks for the upgrades of the compass.
The Quadrant displays are great. This will help with turns and direction.
Are we still able to get the "degree" numbers also? I want to experiment with both. I want to use them also as coordinates.
EDIT: Oops,, I messed with the setup and found the rounding works. This is great! Now I can go play.
Ron R
Thanks for the input.
Ok, I decided to start from scratch so I made a new project and tried the calibrate and run script with it. I even made sure the servos had no power going to them yet. And ... it worked perfectly! Progress! Set it to nearest 10 degrees and it still worked perfectly.
Then I imported the Auto Position control from the example so I would have a servo setup model from which I could load a servo profile to set and energize the servos. Still worked fine. Even tried another calibration with the servos energized, still perfect.
Finally I went back to the original project I was running last night. Went through the calibration process again and all went well this time.
I kind of hate it when that happens because now I don't know why it didn't work last night. I changed nothing in the project.
Anyway, now I'm going to try another unit (still in the original packaging) and see if the same thing happens with the project from last night.
All of which leads to a question .... Once calibrated, do the calibration values get stored on the MPU9150 itself or in the EZB project file?
Ron R
What can really screw the calibration up is large jolts or bangs. The compass will need to be re calibrated if that happens - this is due to the physics of a compass module and how it works - if they are jolted the calibration will be lost.
The drawing of how to calibrate does not imply the compass should be thrown in a figure 8 :). Simply gently wave it in a figure 8 motion like you do with an iPhone when prompted.
Ron R
Thanks
Alan
Are your tests with the adventure Bot or Roli?
My goal is to get my adventure Bot to track on a compass coordinate until a ping distance then go to next step in the sequence script. The bot compass also is used to trim the straight line track by trimming the wheel servos. The compass also confirms turns are complete. Is this similar to what you are doing?
Ron R
My mid term goal is to put it in or on Roli.
Long term is a custom robot.
Alan