LinuxCNC S-Curve Accelerations

More
3 years 8 months ago #264981 by Grotius
Replied by Grotius on topic LinuxCNC S-Curve Accelerations
Hi,

Good question.

The code below is tested today. The logged peak is ms : 0.283687 ms in userland.
The input is more or less the same as the ruckig motion planner.

1. Set the nr. of joints.
2. Set the "a" acceleration and "dv" delta velocity.
The delta velocity value gives the "jm" value.
More precicely, Dv is from 0 acc to as and back to 0 acc. Where "as" is 2*a, this is at the scurve inflection point.
Sorry for the confustion.

3. Set the current joint values and target values.
4. Then in the servo cycle, the motion is updated every 1ms.
5. A new input will process a new motion.

motion->nr_of_joints(3);

motion->set(sc_motion_joint_id::id_J0,
            ui->doubleSpinBox_a->value(),
            ui->doubleSpinBox_dv->value());

motion->set(sc_motion_joint_id::id_J1,
            ui->doubleSpinBox_a->value(),
            ui->doubleSpinBox_dv->value());

motion->set(sc_motion_joint_id::id_J2,
            ui->doubleSpinBox_a->value(),
            ui->doubleSpinBox_dv->value());

in_J0.curacc=2
in_J0.curpos=0;
in_J0.curvel=22
in_J0.endacc=2
in_J0.endpos=1000
in_J0.endvel=5
in_J0.maxvel=50;

in_J1.curacc=0;
in_J1.curpos=0;
in_J1.curvel=2;
in_J1.endacc=0;
in_J1.endpos=150;
in_J1.endvel=0;
in_J1.maxvel=10;

in_J2.curacc=0;
in_J2.curpos=0;
in_J2.curvel=1;
in_J2.endacc=0;
in_J2.endpos=150;
in_J2.endvel=0;
in_J2.maxvel=12;
    
And in the servo cycle this is then updated every 1ms.

status=motion->update(0.001,sc_motion_joint_id::id_J0,in_J0,out_J0);
in_J0.curvel=out_J0.newvel;
in_J0.curpos=out_J0.newpos;
in_J0.curacc=out_J0.newacc;

status=motion->update(0.001,sc_motion_joint_id::id_J1,in_J1,out_J1);
in_J1.curvel=out_J1.newvel;
in_J1.curpos=out_J1.newpos;
in_J1.curacc=out_J1.newacc;

status=motion->update(0.001,sc_motion_joint_id::id_J2,in_J2,out_J2);
in_J2.curvel=out_J2.newvel;
in_J2.curpos=out_J2.newpos;
in_J2.curacc=out_J2.newacc;
 
The following user(s) said Thank You: Bari, itsme, Darium

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

More
3 years 8 months ago #265026 by rmu
Replied by rmu on topic LinuxCNC S-Curve Accelerations
So you are doing a move from (0/0/0) to (1000/150/150).

Maybe I'm missing something, but given that initial and terminal conditions for joints are wildly differing those joints will experience different accelerations for different amounts of time and resulting move will not be a straight line but something like a "curveball".

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

More
3 years 8 months ago #265075 by Grotius
Replied by Grotius on topic LinuxCNC S-Curve Accelerations
Hi,

That's correct. Nice spot.

In the example no xyz interpolation and or synchronisation is done.
I have not coded that part yet.

A little update.

For a 9 axis machine i now reach 0.4 ms when curve needs to be sampled. (cpu intensive part).
When the curve is a normal curve, the time is about 0.02 ms for a 9 axis machine.
I think this is acceptable.

I tested it with this : curve

The planning is now finish the lib. I think a few day's from now, hopely without any problems.


 

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

More
3 years 8 months ago - 3 years 8 months ago #265183 by Grotius
Replied by Grotius on topic LinuxCNC S-Curve Accelerations
Hi,

A little update.
Made some progress today. The live mode is working. Perfomance is ok.
Vm interupts are working. You see in the picture multiple keyboard interrupts ca 8x.
After some testing, i found some things to improve. But concept is working now.

You can see in red the velocity curve. It has linear acceleration stage in the scurve profile. t2.
And curve acc-dcc steepness is constant.
This all makes the machine move's more predictible then using a cubic spline scurve.

It's almost time to test some waypoints.
This is interesting because of the acc & dcc end values, where a new move has to start.

Performance for one axis:
peak time only at start of curve : 0.014069 ms.
 avarage cycle time : ~0.002 ms

Link to scurve video

Link to source code

[img
Last edit: 3 years 8 months ago by Grotius.
The following user(s) said Thank You: Darium

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

More
3 years 8 months ago #265202 by automata
Replied by automata on topic LinuxCNC S-Curve Accelerations
I am excitedly following this topic.
For the multiaxis synchronized move, if the line/arc/curve can be paramaterized on distance travelled along the curve and represent it as "s", the same theory used for single axis planner is valid.
At everytime step, we can compute the multiaxis positions using the direction cosines of the line or other parameterized formula from the curve for the individual axes.
The part to take care of would be during setting the max acceleration "a" and max velocity "vm". Here we would have to take into account the limits of each individual axis involved in the move and pro-rate the values of max acceleration and velocity (again using direction cosines for a line) .
-automata

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

More
3 years 8 months ago #265210 by rmu
Replied by rmu on topic LinuxCNC S-Curve Accelerations

I am excitedly following this topic.
For the multiaxis synchronized move, if the line/arc/curve can be paramaterized on distance travelled along the curve and represent it as "s", the same theory used for single axis planner is valid.
At everytime step, we can compute the multiaxis positions using the direction cosines of the line or other parameterized formula from the curve for the individual axes.
The part to take care of would be during setting the max acceleration "a" and max velocity "vm". Here we would have to take into account the limits of each individual axis involved in the move and pro-rate the values of max acceleration and velocity (again using direction cosines for a line) .
-automata
 
jerk-limiting in "parameter-space" doesn't lead to jerk-limited joint movements, just consider tangential "blend" between straight line and circular arc, at the point the arc starts, centripetal acceleration appears as a step in acceleration perpendicular to the line pointing to center of arc. step in acceleration = infinite jerk. 

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

Time to create page: 0.359 seconds
Powered by Kunena Forum