Model Boat Mayhem

Please login or register.

Login with username, password and session length.

Author Topic: T.A.R.G.E.T - Rotating Seven gun turrets?  (Read 92061 times)

Martin [Admin]

  • Administrator
  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 19,242
  • Location: Peterborough, UK
    • Model Boat Mayhem
Re: How to rotate several turrets?
« Reply #125 on: December 29, 2016, 09:10:25 AM »


the only person who "owns" the thread is our leader, Martin


I usually deffer to those that obviously know the subject more than I.   
 I'm only here to direct the traffic!   :police:


Logged
"This is my firm opinion, but what do I know?!"    -   Mayhem FaceBook Group!

Mr.R.Duino

  • Shipmate
  • *
  • Offline Offline
  • Posts: 8
  • Model Boat Mayhem is Great!
  • Location: Duino Land
Re: Rotating seven gun turrets?
« Reply #126 on: December 29, 2016, 09:49:18 AM »

If you want to scratch the surface a little deeper without spending a penny you could

1 - Download and install the free Arduino software (IDE - Integrated Development Environment) from https://www.arduino.cc/en/Main/Software

Once installed you could select - File / Examples/ then pick a subfolder and then a"sketch" - program to the rest of us and view the code

2- Check this out - You could experiment with an Arduino simulator - https://circuits.io/lab - create your own experiment or just load one of the ones written by others

Looks like there are hundreds of servo examples - https://circuits.io/search/designs?q=servo

Logged

Colin Bishop

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 10,393
  • Location: SW Surrey, UK
Re: Rotating seven gun turrets?
« Reply #127 on: December 29, 2016, 09:57:38 AM »

C-3PO, thanks for posting that video, it is really helpful. Clever stuff too.

Firstly you have demonstrated a practical solution for the 3 position idea which is maybe all that some people will want. The fluctuations between the individual 'turrets' are also very impressive and it does make them look as if they are all being trained independently by the turret crews as in real life.

Secondly, your video shows quite clearly that the turrets can only all line up at 90 degrees to the beam of the vessel. At intermediate 'target' bearings the forward facing turrets are pointing in a different direction to the aft facing ones. The ability of one group of turrets to swing right round to line up with the other group is the enhancement we are trying to address in response to Bob K's original request.

I might try and get my brain in gear to attempt some rough pseudo code to try and define what is needed although it is over 10 years since I last did any programming! It is always helpful to put up an 'Aunt Sally' for others to pick holes in, it concentrates the mind!

Colin
Logged

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 837
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: Rotating seven gun turrets?
« Reply #128 on: December 29, 2016, 10:44:55 AM »

The fluctuations between start time, stop time and travel speed is simple - no need for lookup arrays, seperate code etc etc - it can even be pseduo random by turret if you want.

I only have standard 180 degree servo's on hand so can't physically do the clever stuff yet - the code to allow this is not complicated and simply changing variables that allow more than 180 degrees travel is all that is required (and some new servos of course!).

I am very happy to publish my code for others to use and abuse - however to save questions on incomplete code I will wait a while so more of the functionality is implemented, I have had time to anotate the lines with an explanation etc etc. The actual code that does stuff is very short indeed - there are however many setup parameters for each servo e.g. min degrees, mid point degrees, max degrees rotation for each servo - trust me not all servos are born the same even if they are the same make and model!

My initial solution is just one way to do this - I am sticking with the common Arduino Uno for now but I am beginning to push it to it's/my limits :) - I am very interested in Andy's stepper motor version. It will be interesting to compare notes. Kinmel has also thrown his hat in the ring so look forward to updates on progress from him.

All the specification/ desired functionlity type stuff I have seen from contributors to this post should be possible with this Arduino solution.

The initial 3 way switch funtionality in video #1 was just for demo purposes

Watch this space ....

C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

Colin Bishop

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 10,393
  • Location: SW Surrey, UK
Re: Rotating seven gun turrets?
« Reply #129 on: December 29, 2016, 10:55:25 AM »

OK, here is my (probably pathetic) attempt to rough out the turret control code - all constructive criticism welcome!

Colin
__________________________

 Model Warship Fire Control System
Individual Turret Module
 
Note 1: It is assumed that each turret will have its own control module which accepts input from a master control board elsewhere in the model specifying the target bearing relative to the bow of the vessel. I don’t know if it would be possible to house several individual virtual modules with their own output interfaces within the master control board – if so this would reduce the component cost.

 
Note 2: Output from the turret module will directly control the actual turret operating mechanism whether this be servo based or using stepper motors.

 
Note 3: I am not including bells and whistles such as firing arcs, soft start/stop or random delay in starting etc. as these can all be added later with suitable code subroutines.

 
Fixed variables:
In this example the turret module will be pre programmed with two numbers, each of which will define the number of degrees the turret can traverse. Each number will be assigned to a direction to which the turret will train.
Thus for example:
Traverse 1 = 140 (degrees)
Traverse 2 = 130 (there is something which obstructs the full traverse on that side of the ship)

Initial variable
Turretposition=0 (turret position is along the ship centreline)

Coding.
Power= ON (the system is live and receiving data)

Start Main Loop
Do while power= ON (keep looping until data input is switched off from the main control  board)
Read target bearing in degrees (target bearing relative to the bow of ship received from main control board and contained in global variable)
Direction = ? (will be 1 or 2. Evaluate target bearing to see which side of the ship it is on)
Direction 1 loop subroutine
If  Direction=1 and target bearing <= Traverse 1
 
Do While Direction=1 and targetbearing <= Traverse 1
If Turretposition<> target bearing (then we need to move the turret)
If Turretposition< targetbearing
Output command to move turret targetbearing – turretposition degrees (move it further round)
Else
Output command to move turret  turretposition - targetbearing degrees (bring it back inboard from current position
Endif
Endif
Turretposition=targetbearing (reset turret position variable to current turret position)
Endo
Endif
Note: At this point you would have the same set of code for direction 2 although with a bit of thought the two directions could be combined into one loop but this would make it more difficult to understand for the purpose of this exercise.

Note: It would probably be necessary to re read the target bearing within the above subroutine loop as it would be continually changing and just reading it within the main loop could produce jerky movements.

ENDO (back to start of main loop)
 
Logged

plastic

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,001
  • Bobbing Along!
  • Location: Watford
Re: Rotating seven gun turrets?
« Reply #130 on: December 29, 2016, 11:32:18 AM »

Quick question - say all the turrets are pointing to the right of the bow (including rear turrets) and the command is to point to the left of the bow. The front turrets will simply turn and point to the left.
The rear turrets cannot do that because if the superstructure blocking their path - they would have to undestand that they must travel all the way around past the pointing aft position before they can point forwards on the left side.

The same would happen with the front turrets pointing to thre rear quarters - and any midships guns would have to make decisions on which way to travel.

Will this complicate the maths because effectively, they will be rotating away from the target heading to get to their destination?
Logged

Bob K

  • Bob K
  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 3,699
  • Location: Windsor
Re: Rotating seven gun turrets?
« Reply #131 on: December 29, 2016, 11:36:57 AM »

I believe we should get confused between maximum training arcs and regions where a particular gun cannot fire.  For the later this is not just close to superstructure or for wing turrets firing across the deck, but in superfiring turrets not being able to fire directly over the sighting hoods on the gun below (maybe +/- 30 degrees no go).

I suggest a training range of +/- 135 degrees, which could be edited in individual subroutines.

What concerns me more is what happens to a particular gun when the required bearing exceeds its training arc?   Does it stop at that position waiting for a more valid command, or return to a centreline park position.  I prefer the former option as otherwise we will have turrets rotating back and forth as the bearing swings about its end travel rotation.
Logged
HMS Skirmisher (1905), HMS Amazon (1906), HMS K9 (1915), Type 212A (2002), HMS Polyphemus (1881), Descartes (1897), Iggle Piggle boat (CBBC), HMS Royal Marine (1943), HMS Marshall Soult, HMS Agincourt (1912)

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 837
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: Rotating seven gun turrets?
« Reply #132 on: December 29, 2016, 11:40:22 AM »

Colin,

Looks like you've got the job! Once a programmer always a programmer - the logical approach it teaches you never leaves you.

I will read it in more detail later.

Plastic - doesn't complicate the maths - complicates the logic - but even then it's not a show stopper!

Back to my task in hand - PowerPoint slides - great joy!

C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

Colin Bishop

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 10,393
  • Location: SW Surrey, UK
Re: Rotating seven gun turrets?
« Reply #133 on: December 29, 2016, 12:10:11 PM »

Plastic - my rather ropey pseudo code is intended to cover the points you make. The programming can deal with the situation when guns can no longer bear. - see below.

Bob, yes - logically if the target bearing is beyond the maximum angle of traverse for a turret then the turret should stop at the limit as the bearing may shift and fall within the range as the ship 'opens its 'A' arcs to bring all turrets to bear - that is what happened in real life. Just before the Hood was sunk it was reported that one of the aft turrets was able to fire on Bismark but not the other, a minute or so later as the ship turned further all four turrets would have been able to bear.

Once you have got the basic movement geometry working then extra code can usually be added quite easily with sub routines to examine 'what if' situations and deal with them and also to remedy any unexpected anomalies that might manifest themselves with the actual behaviour of the turrets. Also, for those wishing to simulate gunfire then the firing arcs can very easily be added alongside the training data. For example a a command to stop a superfiring turret firing dead ahead might be something like:

If Between turretposition +15 degrees, -15 degrees then nofire=TRUE (Cannot fire within 15 degrees of centreline.)

As I said previously you could have more than one 'dead zone' for a turret although in most cases it would be just a single arc centred on the keel line of the ship for turrets that are obstructed by superstructure in the fore and aft position. The values would be held in pre programmed variables or arrays for the turret in the same way as for the traverse limits.

Get the basics right and efficiently programmed and all sorts of extras become easily possible on the back of them. This is the advantage of the computerised over the mechanical solution for something like this.

Colin
Logged

derekwarner

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 8,140
  • Location: Wollongong Australia
Re: Rotating seven gun turrets?
« Reply #134 on: December 29, 2016, 12:16:51 PM »

Well Colin....I would never be so condescending to suggest your work was pathetic, however I must ask why you suggested to C-PO3.....'that his video shows quite clearly that the turrets can only all line up at 90 degrees to the beam of the vessel' .....without waiting for his reply to answer a question, 'not an assertion'.....to this same to an earlier question of servo stretch in an earlier post. From this I could only assume that you do not read or understand the comments in earlier postings............

Bob...whilst I have been chastised in this thread with a number of polite expletives in being too concerned with detail......'after all it's not rocket science' we now find yourself again proposing to change the specification criteria, introducing new words....'superfiring' ...using terms left side and others talking of the term 'traverse' for a gun turret and also the highly technical nautical term of 'move it further round' or and now a 'dead zone'  {-)

Whilst reading is good for the mind, in untrained minds the same has proven to bear catastrophic results in life 

From this I am not surprised to read the latest posting from C-3PO tonight

Derek
Logged
Derek Warner

Honorary Secretary [Retired]
Illawarra Live Steamers Co-op
Australia
www.ils.org.au

Bob K

  • Bob K
  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 3,699
  • Location: Windsor
Re: Rotating seven gun turrets?
« Reply #135 on: December 29, 2016, 12:38:11 PM »

Derek:  It is you yourself that decided to complicate matters by adding no firing zones to the training arcs
All I have done is to point out that no firing zones also exist outside the extremes of physical  bearing angles.  We need to leave the whole no firing zones out of the definition completely, especially as we aim to have a single control to initiate gunfire, not a multiplicity of controls such as one for each turret.

That was the initial definition, and still remains so.
Logged
HMS Skirmisher (1905), HMS Amazon (1906), HMS K9 (1915), Type 212A (2002), HMS Polyphemus (1881), Descartes (1897), Iggle Piggle boat (CBBC), HMS Royal Marine (1943), HMS Marshall Soult, HMS Agincourt (1912)

Colin Bishop

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 10,393
  • Location: SW Surrey, UK
Re: Rotating seven gun turrets?
« Reply #136 on: December 29, 2016, 12:55:09 PM »

Derek, it's not about servo stretch, it's the fact tha