Pages: [1]   Go Down
Author Topic: Gyro/Compass turns counter  (Read 882 times)
0 Members and 1 Guest are viewing this topic.
Lake District, UK
Offline Offline
Jr. Member
**
Karma: 0
Posts: 72
Electronics needs smoke to work, if it escapes its broken
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 654
Posts: 50931
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
would be most interested to hear if anyone has any ideas
Ooh, I do. I do. Call on me.

Post your code!
Logged

Lake District, UK
Offline Offline
Jr. Member
**
Karma: 0
Posts: 72
Electronics needs smoke to work, if it escapes its broken
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Leeds, England
Offline Offline
God Member
*****
Karma: 16
Posts: 761
Quick, chuck it in the bin before the boss finds out...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 654
Posts: 50931
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Pages: [1]   Go Up
Jump to: