I have to get X,Y,Z position of two granes (in spanish: grœas) that run
on parallel rails and are used to lift very big machines (most, the size of
a medium car). There are collision posibilities, wich now are avoid with the
use of the EYE!!.
I have recived the proposition of solve the problem with an electronic
device, but I have the problem of getting the position on X,Y and Z axis to
calculate the posibility of collision.
Have you got any idea about it ??
If this equation gets near zero, panic <G> Pick A, B, and C values
for weighting (i.e. if the cranes often pass near each other, with OK
clearance, then you want that to not false trigger! But if they're
likely to collide you want enough weight to stop the system in time.)
For "extra credit" (i.e. faster speed) you can predict ahead the
position of each of the cranes' parts, and thus get advanced warning of
a problem; Slow down if a collision is predicted (stop before
collision.) This kind of system has inertia, and takes a while to stop,
so this is a good idea, perhaps... (Could even do look-ahead if pieces
are moving towards each other and closer than a certain threshold.)
On a "mainframe" (AT or better desktop machine) I'd probably go with a
more complex method (calculate wire frame models of the crane parts,
track the closest approaches of the pieces, something like that? I'm
out of practice right now.) The node method would work, I haven't
implemented that on a PIC though. I'll love watching this thread <G> I
think that'll work find on a PIC. I can help with the algorithm if you
need, I'm a little backlogged in coding though so I'd best stay with
algorithm help for now...
Speedup hacks:
Sorting which pieces are closest is a good idea; two pieces of the
crane that are far from each other are quite unlikely to collide! This
could speed up things (prune the evaluations needed to be performed.)
Way to do this: When you evaluate Abs(), you know the whole sum of
three Abs(x, y & Z's) will be quite non-zero if ANY Abs(whatever) is
larger than a certain value - so go on to the next node comparison.
(pick the Abs() value likely to be largest but most critical for
collisions - if your nodes are each always at the same height, start
with Z values of the nodes, as something that's lots higher or lower
than the other something, cannot collide with that other node, except in
case of severe earthquake or other disaster! {Some would have the
system turn itself off, if an earthquake hits. Worth thinking about!
Cheap to do, weight on a microswitch, this can be bought for gas mains
etc. nowadays.})
Abs(x) can be done as Square Root (Square (x)) but quicker to
implement it as (x >= 0 ? X : (-x)) in C (i.e. if the number's positive
return the number, else return 0 - the number <G>) I once saw this
implemented as a sum of Squared numbers, to speed up the process (that
does work, but just sign bit flipping makes more sense!)
>
> Dear Piclisters, I have this problem:
>
> I have to get X,Y,Z position of two granes (in spanish: grœas) that run
> on parallel rails and are used to lift very big machines (most, the size of
> a medium car). There are collision posibilities, wich now are avoid with the
> use of the EYE!!.
> I have recived the proposition of solve the problem with an electronic
> device, but I have the problem of getting the position on X,Y and Z axis to
> calculate the posibility of collision.
> Have you got any idea about it ??
I think I'd go a different approach. Linear algebra is my forte, so I tend
to use it a lot.
You sample your positional data, and turn that into a velocity curve. You
can fit this, for most cases, to a linear or quadratic formula. All the
other parts of the crane, which may rotate or telescope, etc. can be
calculated by summing vectors. In order to predict where the parts will
be, you check the values of the first and second order derivatives (I know,
calculus! ugh!, but this one's easy, really). If f' is acceleration, and
f" is the rate of change of acceleration. You try to solve the system of
equations, if the formulas equate, then you collide. You look at f' to
figure out what the positional data will be like at some point in the
future, and use f" to figure out whether to over or under-estimate your
coordiate values.
Sounds complex, but I used this system in a model train world once. I had
6 trains wizzing around the tracks, and the switching, braking, and power
were all controlled by a TRS-80 CoCo2. Not a whole lot of CPU there (Z80,
of course), but it got the job done admirably.
You may loose some elegance with the lack of an FPU, but the most you have
to do is the occasional square root. All the rest is integer math.
Ken
At 03:53 PM 8/29/98 -0700, you wrote:
>A numerical analysis problem! I love it! <G>
there you'll find more information by the same author as the circuit cellar
article..... and complete downloadable demo's of a fuzzy crane
controller.....