Problems with Gyro-Module of the Electronic-Kit for Scratch&Arduino


#13

Thanks @srothe, I’m going to give it another crack over the next couple of days and will let you know how I get on.
Always possibility of ‘operator error’ (brain fade) so to speak, so I’ll check I’m not doing anything ultra dumb.
I’ll also look at a timestring as you suggest.

What seemed to be happening is the at the x and y just wobbled with a small ± 0.1 and essentially stayed locked, but the z axis ticked away like a clock.

I was indeed hoping it was going to be super simple as you describe. Just read value and go for a target offset.

A slow drift of even a degree or two a minute would not be disaster, but this is quite a lot more rapid than that.

Any pointers at useful documentation for either the Gyro or the compass would also be massively appreciated, but maybe nothing quite as technical as that datasheet. Thanks again, Nick


#14

Ah ha! Might have found a culprit or at least an accessory to the fact.

I disconnected the Me Compass and the drift reduced I would say 20 fold. Apologies if this sounds like nonsense, I’ve tried it with and without 3 times and am just calling what I see.

Gyro z-axis still drifts a bit (more than the x and y), but in a much slower way that I think will be manageable during most turns.

Going to return to the original plan, thanks again for your help (I might well need more!).

Cheers, Nick


#15

Could you upload a picture of your program if it’s in scratch? I’ve been struggling to figure out how to program my gyro sensor in Mblock.


#16

Now, that’s an interesting one. Could you post an image showing your setup, with both, the gyro and the compass mounted? Should be interesting to hear a comment from @tec_support regarding mounting instructions.


#17

Hi Bill, afraid my code will be very disappointing as at that stage I was just trying to get my head round how the compass and gyro worked.
Initially I was just using the Show Face command in a forever loop to display the Z-axis angle of the gyro on the basic LED screen, and I was rotating the bot around by hand to see what happened.

I am yet to come up with an elegant solution to the axes jumping between -180 and +180 that I am happy with, and to be honest, was going to do a bit more research rather than banging my head against it.

In fact, I suspect @srothe would be a much better person to ask than me (I was plucking up courage to ask to see his work, as it happens).

Instead, once I discovered how to calibrate the compass, I switched to that as it gave me a bigger range to play with before I have to address the issue of the leap from 360 to 0. All I am doing at this stage is experimenting with how best to get the bot to do consistent relatively precise 45 or 90 degree turns, and trying out different motors (encoders unsurprisingly seem much better than the standard DC ones), as well as playing with different grippers and servos for a claw.

I’ll try to take a screen grab of that code if you like and can post it, although it is very basic.

I’ve also just received an Auriga board, so was going to rebuild the bot with that and see how its gyro fares. Not enough hours in the day though.


#18

Hi Stefan,
Since the earlier post, I’ve taken off the gyro and put on two servo controllers instead. To give you an idea of how it was laid out, I’ve just balanced the gyro on top of them for these photos.

If you imagine the gyro was mounted on that long thin plate/beam (with some plastic spacers to stop it actually touching), in the same orientation as the compass,and obviously the two controllers weren’t there.

So effectively both the gyro and the compass were mounted on the same long strut.


#19

Hi @Bill_W , here is my rough code for testing the compass. It only works though if you have a start orientation for the bot that steers clear of crossing from 360 to 0, so not terribly useful as yet.

I was mainly trying to see if I could get some precision despite the Bluetooth lag, whilst using Scratch and running the code from the laptop and not uploading it to the bot.

Slow moving encoder motors seem to help, although you’ll notice that I actually only ask it to turn 85 degrees, even though I’m aiming for (and largely getting) a 90 degree turn.

I imagine the gyro could work in much the same way reading the z-axis, but am yet to put it through its paces, and that has twice the flipping axis problem than the compass has, so needs a bit of thought. Might need some help myself with that bit.


#20

BTW, I’m actually finding that the driving forward in a straight line is less accurate than my turns now!

The endless Show Face commands are just so I can keep an eye on what the bot is trying to do


#21

Hi srothe,

The mounting for the electronic modules are very flexible, since the hole on the modules are all M4 hole, it can be fixed to any Makeblock mechnical components which have M4 hole with the screw. So it is totally determined to personal DIY style to moute it.


#22

@tec_support, thanks for your explanation of the mechanical basics of makeblock. The question however was rather whether the gyro should eventually be mounted so as to avoid magnetic or electric fields, in order to achieve minimal drift.
Stefan


#23

Thanks


#24

Hi Srothe,

I see, I am afraid we do not have deep research for this part and there is no serious limitation with such concerning for mouting the modules. Maybe someone who has deep research on this can sharing it.


#25

Hey @srothe -
I’m putting aside the bluetooth issues for the moment and working on turning by degrees. I’d rather code my own than copy/paste someone else’s code simply because I learn far better doing. But I’m wondering how you correct using the MeCompass while driving straight. Just slow one side down a bit while constantly checking against the heading?


#26

@BigAl,

That is how I would do it. If you think about your car, you don’t stop and adjust your heading just because there is a bend in the road. Since steering is controlled by wheel speed on the mBot, adjusting the speed of one wheel (not stopping it), should have the desired effect. It may take a little longer to get on course, but you will avoid over correcting.

Mike


#27

Oooh, so that’s why people are always honking at me. With all the hand signals, I just thought I was #1. :slight_smile:


#28

@BigAl,

LOL, Just saying that I have seen a lot of robots that stop one wheel to make a turn.


#29

I’d been wondering why there aren’t more robots with traditional car type steering systems.
The turn by degrees function has been fun but not necessarily easy. I can imagine the challenge of getting the angle right on a traditional steering mechanism.


#30

Can someone explain that difference in the drifting in z-axis between been connected by battery or by USB serial?


My mBot Ranger gyro-Z value keep increasing
#31

Hi All,

Just wanted to add that most robots either use car steering where the outer wheel spins faster than the inner wheel or tank steering where turns are accomplished by spinning the inner wheel in the opposite direction of the outer wheel. The selection of turning type depends on the type of turns that are required, i.e., if you need to turn in place (spin) then you would need to use a tank turn, not a steering turn. :smiley:


#32