Go Down

Topic: Gyro/Compass turns counter (Read 923 times) previous topic - next topic

JT007

Can anyone help me to create some code that will count by increment or decrement a number of times that a robot/vehicles heading passes through zero.

im working on a project building a submersible vehicle and need to remember how many twists have been introduced into the vehicles tether/cable.

Eg. if throughout a dive i managed to go right around the compass rose clockwise 4 times but on heading back to my launch point went once around the compass rose counter-clockwise the result will be 3 positive turns.

this is important with submersibles as the number of twists you put in a cable will start to deform and break the cable.

would be most interested to hear if anyone has any ideas

PaulS

Quote
would be most interested to hear if anyone has any ideas

Ooh, I do. I do. Call on me.

Post your code!

JT007

paul,

The starting comment of
"Can anyone help me to create some code"
should have given the game away, i was asking for help to start writing code that will do what is required.
if i had code asking on the forum would be an obvious waste of time.

where do you get off being such a plonker, if you dont like certain people on this forum then dont reply to them and dont waist your time.

dannable

What hardware have you got? Is the submersible metal?

I would go along the lines of checking current bearing with last, and if it is still rotating in the same direction check against start bearing. If not, reset start bearing to current bearing and direction to current direction.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

PaulS

Quote
i was asking for help to start writing code that will do what is required.

Personally, I would think that worrying about the sub making more than a full turn, and needing to make sure to unwind that number of turns, would be way down on the list. Reading from the compass and making the sub go in the correct direction, etc. would be way higher on the list.

So, when I wanted to see your code, and you way you don't have any, all I can conclude is that you have your priorities out of order.

PeterH

I agree with PaulS that by the time you're down to this level of detail, you should already have a working navigation mechanism. On the specific issue of counting turns, I assume you will have some form of direction sensing either via compass, inertial, or something else.. All you need to do is accumulate all the bearing changes from the start of the mission into a signed integer of an appropriate size. The value at any given moment is the amount you need to turn to unwind the cable.
I only provide help via the forum - please do not contact me for private consultancy.

Go Up