Agreed, I have done it before where we didn't need tight control, in this case +/- 0.1", and didn't have motion controllers.It's not too difficult.
Those 7 equations for position are correct but you need to compute the times too. t56 should always be positive unless the deceleration rate is so low that the peak decel ( negative accel ) is not reached. In that case t56 is 0 and that segment does not exist. The same can happen with t12.View attachment 57845QED
- One of many possible approaches
- Only solves for 7-segment-capable cases
- If t56 is negative, invert sign of all PVA knowns and repeat (I think)
- There will almost certainly be at least one sign error, but the basic form is correct.
Deriving optimal solutions for all general case is based on those 17 equations, or a subset of same, plus a boatload of bookkeeping.
The problem is too hard for most to solve by hand but it can be done. However, you should use the simply package of python.
When moving in the positive direction the INITIAL jerk should always be positive.If t34 (not t56 - there is a typo in post #31) is negative, it means one of two things:
It should be possible to figure out whether to start with a negative or positive jerk, but inverting the PVAs is probably simpler to code.
- The 7-segment profile should start with a negative jerk instead of positive, which is why I said invert the sign of the PVA inputs.
- It needs to limit the peak velocity i.e. it's a 5- or 3-segment profile (jerk=+J,0,-J,0,+J and t34=0 and t23 is combined with t45, or jerk=+J,-J,+J and t12=t34=t67=0 and t23 is combined with t45).
t12, t34, t56 can NEVER be negative. If you get a negative solution for t34 that means segment 4 doesn't exist and the commanded velocity is not reached.
The only case the initial jerk should be negative is if the actuator needs to slow down. This happens when a command is given while moving. We haven't even touched calculating/changing motion profiles on-the-fly.
NO! I listed the 17 unknowns above. You need 17 equations to solve for the 17 unknown and that solution only works for the case where all 7 segments exist.Oh, and by the way, there are only four equations:
The target generator must determine which segments will exist and each case will require a different set of equations.
You guys should know I am trolling all of you because of the comments about how easy this should be to program in a PLC.
A good motion controller is much more than a PID between an encoder or MDT rod and an output. The PID and feed forward parts are such a small part of the program. It is the target generator that really separates the the good, the bad and the ugly.
You guys should know I am trolling all of you because of the comments about how easy this should be to program in a PLC.
Yep, we figured that much. I certainly trust what you're saying Peter. You know way more about motion than I do, or probably anyone else here!! I wasn't one that suggested it was easy, only that I believe a PLC is capable, depending on the PLC being used. That doesn't necessarily mean I think its "easy" with a PLC. It's one of the reasons on our next machine build, I'm going with an RMC controller married with a PLC. That, and the RMC software makes it so much easier for a technician to create his/her own programs without me having to write PLC code and/or create special software for them, every time they require a new motion program, which will be rather frequently.
I love the product. If/when it gets full EtherCAT support, it will be perfect. But not until then. . Oh, and being able to create motion programs, add/omit motion commands via .NET would be really nice too.
Oh, and by the way, there are only four equations:
Troll complete. Thank you .NO!...
Peter, you really gotta come to Rochester some time so we can meet.
Although to be fair, those integrals, plus the discrete jerk function, do represent the same system and are the basis for the 17 equations. And OP did say it was great to know the math and physics. That said, I agree the integrals are in a somewhat less than solvable form.
Obviously the OP found a solution but it is not perfect and is not optimal. I started a thread over a year about PLC vs motion controllers over a year ago where I listed many reasons one should use a motion controller. I/we often get asked, "can your motion controller do this"busarider said:only that I believe a PLC is capable,
We can meet using Skype. We can share screens. I did this MANY Saturday mornings with forum member Pandiani. We would often talk for an hour or more. Pandiani first came to the forum when he was a college student. He had a control problem that I knew that was contrived. I helped him through getting his masters degree. He now is in charge of the controls for the power plants in Tuzla, Bosnia. Pandiani bought Mathcad and has followed me on my Peter Ponders PID YouTube channel.drbitboy said:Peter, you really gotta come to Rochester some time so we can meet.
The problem is how do you generate the 17 equations?Although to be fair, those integrals, plus the discrete jerk function, do represent the same system and are the basis for the 17 equations. And OP did say it was great to know the math and physics. That said, I agree the integrals are in a somewhat less than solvable form
Obviously the OP found a solution but it is not perfect and is not optimal. I started a thread over a year about PLC vs motion controllers over a year ago where I listed many reasons one should use a motion controller. I/we often get asked, "can your motion controller do this"busarider said:only that I believe a PLC is capable,
We can meet using Skype. We can share screens. I did this MANY Saturday mornings with forum member Pandiani. We would often talk for an hour or more. Pandiani first came to the forum when he was a college student. He had a control problem that I knew that was contrived. I helped him through getting his masters degree. He now is in charge of the controls for the power plants in Tuzla, Bosnia. Pandiani bought Mathcad and has followed me on my Peter Ponders PID YouTube channel.drbitboy said:Peter, you really gotta come to Rochester some time so we can meet.
The problem is how do you generate the 17 equations?Although to be fair, those integrals, plus the discrete jerk function, do represent the same system and are the basis for the 17 equations. And OP did say it was great to know the math and physics. That said, I agree the integrals are in a somewhat less than solvable form
The problem is how do you generate the 17 equations?
BTW, do you know about RMCLink? It is a .NET assembly that lets you program the RMC using Excel, C, Visual Basic, python etc.
When moving in the positive direction the INITIAL jerk should always be positive.
Short moves require only 3 segments.You mean only for a full 7- or 5-segment move, right?
I am pretty sure I was wrong that changing the signs would be a cheap trick to deal with a negative initial jerk.
Short moves require only 3 segments.
I've used a lookup table with 1024 entries for square roots. If the input is > 1024 then you simply scale up the inputs an outputs by factors of 4 and 2 (i.e by bit shifting) It's all integer arithmetic, but the encoder is only integer after all.... heron's method square roots, 3d map interpolation, ...you can do in in a cheap controller.