Rods "Spaceship" Scratch built Plasma Cutter build

More
9 years 9 months ago #86654 by rodw

Joco wrote: I'm probably being thick but if you are controlling the velocity with PID what is making the decisions around the size of the move of the Z axis? Is that part of the same PID? Or is there another module I have missed understood from the thread doing this? I recognize that 0 velocity means no move but a non 0 velocity still needs a vector to operate on, yes?


I've not done anything with PID yet at all other than to research how to code it.

Distance of a commanded move does not come into it. If I am right, we just need to worry about the velocity the axis is to travel at for the next PID time period.

The vector is the Z axis and LinuxCNC has a pin that tracks at what velocity the joint is moving at with the sign designating travel direction. So if the THC was tracking the desired volts within the dead band we want, Z axis velocity would be zero as it is not moving. Outside of that deadband tolerance, the PID would return a velocity (and therefore direction) that the Axis should be moving at for the next PID time period to return to a zero state.

You have however, brought the spaceship back to reality as I have to work out how to tell the Z axis to be moving at this calculated velocity. I thought the current THC was already doing that int this line of code, but maybe its not.
Code:
z_pos_out = z_pos_in + offset;
.

If we do have to add a distance to travel, couldn't that be the calculated from the desired velocity and the distance that could be travelled in the next PID timeperiod?

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago - 9 years 9 months ago #86663 by Joco
Well I'm trying to come at it from first principles while lacking a whole lot of context you and others probably already have re the inner workings of linuxcnc in this space. So if I'm raising a red herring just say so. :-)
But I would expect something needs to be deciding how many steps the stepper motor needs to turn before stopping. So while the velocity can set the rate of movement and the sign sets the direction on the fixed axis (Z) something needs to say how long do I keep moving? Or can the movement signal be continuous and the velocity just sets the size and +\- of the resulting vector at any given point in time? The risk might be that your head oscillates a bit on the Z as it tries to settle. Of course good tuning of the dead zone could solve that
Last edit: 9 years 9 months ago by Joco. Reason: Clarity

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago #86685 by rodw
Joco,

I probably don't know much more than you. I may have it wrong. I don't think you need to control distance becasue you don't do that with a cruise control in a car. It just controls velocity (eg. Speed).

You made me dig though a lot of stuff to see if I can independently control an axis the way I want but I think the concept is sound. It will just be how it is implemented within the constraints of LinuxCNC.

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago #86686 by rodw
Hmm, this does the trick!

linuxcnc.org/docs/html/man/man9/stepgen.9.html

stepgen has two control modes, which can be selected on a channel by channel basis using ctrl_type. Possible values are "p" for position control, and "v" for velocity control. The default is position control, which drives the motor to a commanded position, subject to acceleration and velocity limits. Velocity control drives the motor at a commanded speed, again subject to accel and velocity limits. Usually, position mode is used for machine axes. Velocity mode is reserved for unusual applications where continuous movement at some speed is desired, instead of movement to a specific position. (Note that velocity mode replaces the former component freqgen.)

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago #86687 by rodw
And for Mesa cards which i'm using, there is a setting to select this mode.
linuxcnc.org/docs/master/html/drivers/hostmot2.html#_stepgen

13.1. Pins
control-type - (Bit, In) Switches between position control mode (0) and velocity control mode (1). Defaults to position control (0).

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago #86689 by Joco

rodw wrote: Hmm, this does the trick!

linuxcnc.org/docs/html/man/man9/stepgen.9.html

stepgen has two control modes, which can be selected on a channel by channel basis using ctrl_type. Possible values are "p" for position control, and "v" for velocity control. The default is position control, which drives the motor to a commanded position, subject to acceleration and velocity limits. Velocity control drives the motor at a commanded speed, again subject to accel and velocity limits. Usually, position mode is used for machine axes. Velocity mode is reserved for unusual applications where continuous movement at some speed is desired, instead of movement to a specific position. (Note that velocity mode replaces the former component freqgen.)

That's the business. Velocity mode gets you your continuous movement signal I referred to so your +/- acceleration approach should work. I hope you have a chance to get to it. Looks like a promising line of investigation.

Cheers,
J.

Please Log in or Create an account to join the conversation.

Time to create page: 0.608 seconds
Powered by Kunena Forum