Joystick control

An unusual problem here! I remember using another SCADA package years ago, which had an impressive looking demo that customers liked (despite it being relatively impractical). It had a button that could be moved about within a container. This acted like a joystick and updated a couple of variables, which were used to animate a robot arm with a couple of joints.

I have tried to replicate this in Ignition with mixed success. The joystick control seems to work OK (although it sometimes throws up NullPointerExceptions which keep happening until the window is reloaded?). However, the rotation of the 2 parts of the ‘robot’ is not working well at all. I tried to rotate the ‘forearm’ part with the y variable and the whole arm (as a group) with the x variable.

I have attached a window which shows what happens. It would be nice to know the reason for the rather spectacular results! I think part of the problem might be that the rotation point of a group changes as the shapes within the group change, throwing everything off in some kind of positive feedback loop, but I’m open to suggestions.
Joystick control.proj (8.16 KB)

Right, that is exactly what is happening. As you rotate the object inside the group it changes the width, height of the group. Then when you rotate the group it compounds the issue. You will have to rotate the two objects independently but that will present problems since you not only want to rotate you want to move it from left to right.

What I like to do is break them up into two separate objects. Make a really large rectangle (one that can allow the blue rectangle to freely rotate within) that is transparent and group that with the blue rectangle. That you you can rotate the blue rectangle the way you are right now. You just need to bind the new group’s x and y properties to the appropriate expressions to move it up or down, left or right.

Hope this makes sense.

I had another go at this, but if you move the centre of rotation of an item away from its actual centre and then put this inside another rotating item, it goes haywire.

The best results we had were when we grouped the ‘forearm’ with a box so that the centre of rotation of the group coincided with the required centre of rotation for the forearm. We then grouped this with the upper arm and another box, so that the centre of rotation of the outer group coincided with the centre of rotation of the upper arm. Even then, it was still prone to moving around slightly and isn’t really a practical approach.

At the moment it seems that the animation type functions using the new drawing tools are limited to single objects or groups and nesting is not supported.