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 250884 times)

Martin (Admin)

  • Administrator
  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 23,359
  • 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?!" -  Visit the Mayhem FaceBook Groups!  &  Giant Models

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: 12,171
  • 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: 1,107
  • 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: 12,171
  • 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 - RIP

  • Inactive
  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,255
  • 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,686
  • 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: 1,107
  • 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: 12,171
  • 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: 9,463
  • 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,686
  • 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: 12,171
  • 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 that that C-3PO quite clearly stated in his post that his video that it is a three position solution only. No amount of servo stretch is going to make the aft pointing turrets point in the same direction at the forward facing ones on intermediate bearings and it is this that some people just don't seem to be able to get their heads around. The video demonstrates this visually as opposed to me banging on about it verbally and clearly not getting through! Too many dead zones maybe?  ok2

As far as the language is concerned, Bob, I and the others are simply trying to make it understandable as not everyone is familiar with technical naval terminology although superfiring is pretty obvious I would have thought and so is traverse.

I find it very disappointing that there are some people on here who seem very keen to denigrate what we are trying to do. In your earlier post we seem to be accused of regarding people who build Glynn Guest models as somehow second rate and that we think everyone should be building museum quality models. This is in your own head and simply not true. If you cannot be positive then just watch and learn. There is no magic instantaneous solution, it has to be worked out and refined, but there is more than enough expertise on Mayhem to tackle all the various issues involved, problems will arise and can be worked through. We just don't need this endless carping from the sidelines.

Colin
Logged

derekwarner

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 9,463
  • Location: Wollongong Australia
Re: Rotating seven gun turrets?
« Reply #137 on: December 29, 2016, 12:56:55 pm »

Bob....words are such wonderful things %)...my intention was to take the initial basket full of vagaries and ambiguities out of the picture, to simplify and not complicate anything

Possibly it is best if I sit on a garden chair with C-3PO and watch progress from the sideline :-))

Derek 

Logged
Derek Warner

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

dreadnought72

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,892
  • Wood butcher with ten thumbs
  • Location: Airdrie, Scotland
Re: Rotating seven gun turrets?
« Reply #138 on: December 29, 2016, 12:59:56 pm »

Mention was made earlier of 'degrees'. That draws us into the world of maths, and potentially slowing the processing by calling endless trig functions, which I thought might be required when calculating the vectors and angle between vectors. (One for the ship, one for each turret, one for the target).


My brainwave today (and they're rare enough) was that it's not necessary.


I've just proved to myself that, using a short string of if-thens and numbers alone (specifically the 4096 steps that define one rotation) I can determine whether a turret needs to turn clockwise or anticlockwise based on its training limits to reach a specific target.


Might not sound impressive, but it's going to slice out tonnes of 'ugly' when I start putting it all together.


 :-))


Andy
Logged
Enjoying every minute sailing W9465 Mertensia

Colin Bishop

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 12,171
  • Location: SW Surrey, UK
Re: Rotating seven gun turrets?
« Reply #139 on: December 29, 2016, 01:07:38 pm »

Sounds interesting Andy. As usual with this sort of thing, once the problem is defined and understood then ingenious solutions do often present themselves to those who are also familiar with the capabilities of the software and interfacing. It can be a nice feeling to cut through a lot of heavy stuff with an elegant solution.

Colin
Logged

Plastic - RIP

  • Inactive
  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,255
  • Bobbing Along!
  • Location: Watford
Re: Rotating seven gun turrets?
« Reply #140 on: December 29, 2016, 01:14:45 pm »

Is there going to be a 'park' position for returning to dock that returns all of the turrets to the original start position?

Simply specifiying straight ahead on the front turrets will confuse the rear turrets.
Logged

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,107
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: Rotating seven gun turrets?
« Reply #141 on: December 29, 2016, 01:42:30 pm »

Time for peace, love and harmony!

I was just about to respond to another post when my desk picture display thingy that I was given recently showed a picture of the Hotel Negresco which I walked past a few weeks after the horrible events earlier this year in beautiful Nice.

We all want the same thing - a workable, useable solution. If an individual wants to amend the code to make the turrets dance to their own tune there is nothing to stop them.

The funny thing from my side is that I understand the Arduino/software side heaps but not a clue about the workings of gun turrets and the rules, regs, conditions, factors, no go zones etc etc

PS Andy - is the CustomStepper library (It comes with functions to make the motor rotate a given number of times, a given angle (in degrees) or rotate until you send another command) or the MAP function of use in your journey?

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

dreadnought72

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,892
  • Wood butcher with ten thumbs
  • Location: Airdrie, Scotland
Re: Rotating seven gun turrets?
« Reply #142 on: December 29, 2016, 01:59:48 pm »

Plastic, my reply #82 on page 4. I'll have a dedicated 'park' option.


C-3PO, I haven't looked at the MAP thingmy, just played with the stepper library.


Andy
Logged
Enjoying every minute sailing W9465 Mertensia

Plastic - RIP

  • Inactive
  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,255
  • Bobbing Along!
  • Location: Watford
Re: Rotating seven gun turrets?
« Reply #143 on: December 29, 2016, 03:00:11 pm »

Plastic, my reply #82 on page 4. I'll have a dedicated 'park' option.


C-3PO, I haven't looked at the MAP thingmy, just played with the stepper library.


Andy

Yes - spotted it - why 2 switches? surely just 1 switch - Off=park, on=track
Logged

dreadnought72

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,892
  • Wood butcher with ten thumbs
  • Location: Airdrie, Scotland
Re: Rotating seven gun turrets?
« Reply #144 on: December 29, 2016, 03:56:53 pm »

I need to send 'target bearing' info outwith the options of 'track' and 'park'. The button will send new bearing information overwriting that held in the Arduino. Once sent, that 'local' bearing will be adjusted automatically over time as the ship's heading changes.

Andy


Logged
Enjoying every minute sailing W9465 Mertensia

Plastic - RIP

  • Inactive
  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,255
  • Bobbing Along!
  • Location: Watford
Re: Rotating seven gun turrets?
« Reply #145 on: December 29, 2016, 04:21:04 pm »

Wouldn't it just sit parked until the input knob changed value for the first time?
Logged

Colin Bishop

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 12,171
  • Location: SW Surrey, UK
Re: Rotating seven gun turrets?
« Reply #146 on: December 29, 2016, 04:34:42 pm »

I would have assumed that as Plastic says, the system would start off parked but it would be necessary to be able to to return the turrets to their fore and aft alignment at any time by a separate signal from the TX (push button?) as the TX rotary control would be dedicated to the absolute target bearing.

But then if you wished to start the system off again then another signal would be required. So in fact you need a TX control to turn the training system on or off independently of what the target setting position is. The undercarriage TX switch could do this maybe?

Colin
Logged

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,107
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: Rotating seven gun turrets?
« Reply #147 on: December 29, 2016, 05:05:57 pm »

I have pondered on the switching/control issue - my simple thoughts are:

The concept I am working on involves 2 RC control channels - 1 x 3 way switch and 1 x rotary knob

The rotary knob would be used for manual rotation of all turrets - not sure how effective this will be as if moving a servo 270 degrees or so the smallest movement on the knob will move the servo quite a bit - think this will have to be suck it and see. It would be possible to use the full rotation of the knob to sweep the turrets on just the "active" side of the boat - what is the active side of the boat - don't know yet - how do you swap active sides - don't know yet :)

My thinking for the switch is:

Position 1 : Home
Position 1 : Fire
Position 2 : Manual track - use the knob
Position 3 : Auto track - whilst I will give this a go I don't know how effective this will be as without some "smoothing" of compass data the servo's will start tapping out their own tune

To clarify - at system startup all servos are returned to home position

The switch status is updated in each position.

If you return the switch to Position 1 - home for say <1.5 seconds and then switch back to position 2 or 3 the system will take this as a fire command.
If you return the switch to Position 1 - home for > 3 seconds the system will take this as a return home command

However - If this is to be a solution for all it should be able to be configured and work equally as well with a basic 4 channel 2 stick tx - which is possible - would just be a different tx implementation

PS Please excuse any typo's - I have switch to Firefox and the spill chucker has packed it's bags and gone home

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

Plastic - RIP

  • Inactive
  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,255
  • Bobbing Along!
  • Location: Watford
Re: Rotating seven gun turrets?
« Reply #148 on: December 29, 2016, 05:29:35 pm »

I assumed it would be simpler -

off = parked

on=parked until position knob moved for first time to set target bearing - then compass keeps guns pointed at that bearing regardless of ship direction (auto mode)

off = return to park

Fire

On a simple transmitter, vertical full down = park, middle is on, full up is fire - left in full up, the guns could keep firing - maybe each turret could have a different reload time.
Horzontal = bearing set

No real need for any other modes in my opinion. Why would you need a non-tracking mode?
Or am I missing something?
Logged

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,107
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: Rotating seven gun turrets?
« Reply #149 on: December 29, 2016, 06:05:58 pm »

Plastic - you may well be right with your logic...

I will include the manual option for now- as certainly whilst the system is created it will help with debugging - can soon be dropped.

Any feedback from other contributors re manual mode - keep? - if so what would you use it for?

C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...
Pages: 1 2 3 4 5 [6] 7 8 9 10 11 12 13 14 15 16 17 18   Go Up
 

Page created in 0.089 seconds with 22 queries.