# How to change rotation stage configuration and move rotation point

25 Aug 2021 16:30 - 25 Aug 2021 17:03 #218717 by RékaM
TL;DR: How do I change which axes the rotation stages are rotating around, and how do I move the rotation point so the axis isn't necessarily going through the stage itself but is somewhat above it? Please try and explain as simply as you can if possible; I am pretty familiar with Python but unfamiliar with the libraries shown in the documentation.

I am trying to model a 5 axis machine (well 8 but I am not using the 3 tool rotation axes) using LinuxCNC. It has translational stages in X, Y, Z and goniometers that rotate around X and Y (with the X stage being on top of the Y stage.) These goniometers rotate around a shared rotation point which is a bit above the stage, they don't just rotate around axes through the stages themselves. I have never used LinuxCNC before and am kind of lost in the documentation, and the example robots always have rotation around Z which I don't want. I think maybe the "translate" function in Vismach could move my rotation point but I can't tell if it moves just the origin or the entire part. How can I model this? I don't care about the CAD model looking right, and I'm not going to use this to control an actual machine, I'm just trying to figure out if the transformations and coordinates I've worked out to trace the pattern I want with the tool at the angle I want actually work without risking messing up the real machine if I did something wrong.

I have figured out the G code and how to convert the coordinates from the simulation I made in Python into G code; I just am unclear on how to change the configuration of the simulated machine to match my machine's configuration. A lot of the documentation seems to assume you are very familiar with how milling machines work and it's hard for me to find the parts that are just about configuring the axes used in the simulation.

...Also, when you move a rotational axis, are the units in degrees or radians? The documentation says how to set distances to millimeters or inches, but nothing I can find about the units used for rotation. (Edit: I found that it uses degrees after a more careful reread of the Vismach part of the documentation, but still am confused about everything else.)

Thank you very much for your time!
Last edit: 25 Aug 2021 17:03 by RékaM. Reason: found answer to one question (not the main one but a minor one)

25 Aug 2021 18:04 #218725 by Aciera
Documentation for Vismach is a bit thin. A lot of it is trial and error to get an understanding of how it works.
But maybe if you could post your code?

01 Sep 2021 12:07 #219327 by andypugh
Just to clarify, is the issue only with Vismach? Other parts of LinuxCNC have literally no idea where the rotation points are in space. (partly as G-code provides no means to tell them)

To arrange for a part to rotate about the X axis rather than the Z axis, in response to a HAL pin changing, you would set the scaling accordingly.
So, rotation about Z might look like:
`carousel = HalRotate([carousel],c,"carousel",360,0,0,1)`
To make that a rotation about X, you would change the axis parameters (I think that these are actually direction cosines...)
`carousel = HalRotate([carousel],c,"carousel",360,1,0,0)`

To alter where the axis lies inside the part, it is probably easiest to model the part with the origin at the centre of rotation first...
But, otherwise, you would insert the part, then translate to put the axis at the origin, then apply the rotation pin, then translate again to the required location.

github.com/LinuxCNC/linuxcnc/blob/master...oolchange/vmcgui#L88

Shows this, where the carousel is shifted, has a rotation axis inserted, and is then shifted back.
The following user(s) said Thank You: RékaM

08 Sep 2021 15:36 - 08 Sep 2021 15:40 #219963 by RékaM
Sorry for late reply; I was on vacation.

I had not messed with the code at all; I had opened up the default xyzac-trt model and wanted to know how to modify it.

After poking around a bit, I have determined I need a model that just uses trivial kinematics, as I have calculated my forward/inverse kinematics myself and am trying to test them, so I am currently looking at the max5triv model; but I am still figuring out how to change it to fit my needs.

To be very specific about what I want: I have a machine which has a Y stage, then an X stage on top of that, then a pair of stacked goniometers on top of that that rotate around the X and Y axes (with the one rotating around X on top, IIRC) which share a rotation point about 100mm above the stage, then the workpiece is on top of the goniometers, and the tool only moves in the Z axis.

I have created a Python program which should simulate how the tool needs to move to trace the patterns I want on a workpiece; however, I also need to rotate the workpiece so that the tool stays at a certain angle, and while I have incorporated how the rotation will move the workpiece into the way my simulation "moves", I cannot *see* what angle the tool is at in my simulation. So, I want to convert my program into GCode (which I have done) and put it into LinuxCNC so I can see how the tool and workpiece move, and if they stay at the proper angle.

I need the stages to rotate around a certain point because rotating a stage also changes where the workpiece is in space rather than just rotating it, and how much it moves will depend on where the rotation point is. I don't care if the model actually looks like my machine; I only need the workpiece and tool to move the ways I want.

By saying that only Vismach knows where the rotation points are, do you mean that even if I set my rotation point to the proper place, my workpiece will not move properly when I move my rotation stages?

Edit: I also need rotating the lower rotation stage to move the upper rotation stage; they affect each other since they are stacked. Is this possible?
Last edit: 08 Sep 2021 15:40 by RékaM. Reason: added something I forgot

08 Sep 2021 16:56 #219971 by Aciera

By saying that only Vismach knows where the rotation points are, do you mean that even if I set my rotation point to the proper place, my workpiece will not move properly when I move my rotation stages?

The point is that the axis positions from linuxcnc are only used to drive the connected rotations and translations in vismach. Vismach has no knowledge whether the float number it gets is for the linear Z axis or the rotary A axis or whatever.
So to get a working configuration for a machine including a vismach simulation requires:
- first the correct kinematic model of the machine for linuxcnc to calculate the required joint->axis and axis->joint relationships and
- second you need to replicate the kinematic in the geometric vismach model in order to make the visualization behave correctly.

I think of the vismach modelling process as kind of like a sausage maker. You create geometry then the joint (ie HALtranslate, HALrotate) is attached to the base of it and then everything is moved along with the next piece of geometry. I found the model file of the 3-axis simulation config quite helpful to get my head around it when I made the model for my 6-axis melfa-robot:
github.com/LinuxCNC/linuxcnc/blob/master...orial/3axis-tutorial

I also need rotating the lower rotation stage to move the upper rotation stage; they affect each other since they are stacked. Is this possible?

That shouldn't be a problem you just add one HalRotate(..) after the other with the rotational axis' pointing in the same direction.

Maybe you could share a little sketch of your machine to make it a bit clearer.