Hi,I want to build something that works vaguely along the lines of this>>http://youtube.com/watch?v=4eZVGvScbqg

Essentially use 2 step motors, some steel cable/wire and arduino to control azimuth and elevation of a pneumatic launcher (well in this case it would be more like a mortar since the gun would be attached to the ground by a universal joint).

It should work more less like this -> I set azimuth and elevation and the sketch in processing does some maths and translates that into commands for arduino that in turn order each step motor to move X and Y number of steps.

If you can visualise that you'll realise it's pretty clever. Unfortunatelly, I am totally lost when it comes to maths. Can anyone offer some insight into this or post some links ?

With so many variables ( some dynamic like the wind ) you might be better at starting with a rough guess, and having 4 buttons - " up a bit " ,"down a bit " , " left a bit" and " right a bit " , just like real mortars have been aimed for years :-)

external ballistics is completelly different topic... whether or not the projectile hits the intended target depends on more variables but first I have to deal with the end effector here so to speak - ie. what calculations are needed to translate my request -> azimuth 120.5deg; elevation 42deg into numer of steps for the two step motors

Yes, I was suggesting that even working out the angle of the tube, compared to motor steps, would be complicated.You might be better mapping out the result after incrementing each motor, and refer back to the map for subsequent firings.

I think I would punt and either: * determine it empirically by driving the motor n steps and measuring the angle before and after, or * use servos instead of stepper motors. servos are already designed to go to angle X and stay there.

OTOH, I don't see a huge math problem here. You just want to determine degrees of rotation?

So, imagine a 180 step stepper motor. So each step is 2 degrees. If you want 0.5 degree per step, then you'll need a 1:4 drive ratio.

Here are some stepper motors. Note these are all 1.8 degree steps. Or, you could by a 20-step per turn motor, then each step is 360/20 degrees -- for that, 1:20 drive ratio would get you 1 degree per step.

http://www.hansen-motor.com/step-motor-19.php -- 7.5 and 15 degree steppers. You can also get steppers with attached reduction gearboxes.

This is just multiplication and division, to determine how many degrees you get, based on your drive ratio.

... it is poor civic hygiene to install technologies that could somedayfacilitate a police state. -- Bruce Schneier

Thx for all the replies but you've been wrong. I think I know how to do it.The best thing I can do is to model the entire setup in 3D using processing - keeping all the dimensions... that is I've got to setup up a gun model that can move to set elecation and azimuth and then use dist function to get distance from the barrel breacket where the wires are attached to both the step motors

I know it's kind of retarded but it will work, so I am fcking happy and feel damn intelligent (while feeling kind of dumb for not being able to come up with a formula) :-D

If you know how to calculate sin, cos and tan then you can reduce the 3D problem to a set of 2D problems and solve them simultaneously. It's not rocket science. Well, technically it is. But it's not especially hard - it just needs you to solve some simultaneous equations. I'm too lazy to solve them for you, though. If you can use Processing's 3D rendering engine to get it to do the calculations for you, that strikes me as a very sensible approach to take. I suspect that in order to get any sort of accuracy you'll need to use successive approximations anyway, so the accuracy of the initial azimuth/elevation calculation is not critical; the angles you're giving as input are themselves only approximate solutions to the real problem of hitting a specified landing spot.

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

I kind of know how to do it in 2D - I wrote a few lines of code that translate carthesian 2D (x,y - where the mouse is pointing) to numer of steps for the motors. So pretty much something like a typical drawbot. Sure it isn't 100% accurate as I have to convert from float (returned by dist) to integers (number of steps) I would have to do it anyway

Quote

So, you're trying to do this by pulling on your barrel with wires, at some distance away from the pivots? Oooph

Yeah that's pretty much the idea - say what you want but since it would require only TWO motors and very limited hardware to cover 360 deg arc and wide range of elevations - so I guess it's kind of cool idea. If this approach prove to be inaccurate then I might as well switch to theaded rods

Quote

the angles you're giving as input are themselves only approximate solutions to the real problem of hitting a specified landing spot

external ballistics IS very complex - I can assure you I am aware of it and I know there are lots of variables that have effect on it. Whether or not the projectile is stabilised (and how well it's stabilised), its BC value, muzzle velocity etc.

Mind you this post is pretty much about building a platform that can point the launcher in the right direction. It's in no way a complete system.

anyway have a look at this -> not mine but pretty cool >> http://www.spudfiles.com/forums/viewtopic,p,185036.html#185036