- Posts: 2419
- Thank you received: 2349
LinuxCNC S-Curve Accelerations
- Grotius
- Offline
- Platinum Member
-
Less
More
3 years 8 months ago - 3 years 8 months ago #264835
by Grotius
Replied by Grotius on topic LinuxCNC S-Curve Accelerations
Hi,
After some testing try to improve just one function, it helped a little bit, this are netto times :
step 1, local vars : function time:0.001308 ms
step 2, using inline : function time:0.001219 ms
step 3, removing jm,as calculation : function time:0.001027 ms
step 4, using std::min : function time:0.001704 ms <= only increased the time.
Then the 9 axis test was improved from 4.6 to 2.8 ms. I think this is just only from adding "inline" in
front of functions who are repeatedly used.
Tomorrow i will make some work to split up functions into fast functions to reduce the cycle time.
I have no other option left.
After some testing try to improve just one function, it helped a little bit, this are netto times :
step 1, local vars : function time:0.001308 ms
step 2, using inline : function time:0.001219 ms
step 3, removing jm,as calculation : function time:0.001027 ms
step 4, using std::min : function time:0.001704 ms <= only increased the time.
Then the 9 axis test was improved from 4.6 to 2.8 ms. I think this is just only from adding "inline" in
front of functions who are repeatedly used.
Tomorrow i will make some work to split up functions into fast functions to reduce the cycle time.
I have no other option left.
Last edit: 3 years 8 months ago by Grotius. Reason: editor meshed up.
The following user(s) said Thank You: Bari
Please Log in or Create an account to join the conversation.
- rodw
- Offline
- Platinum Member
-
Less
More
- Posts: 12170
- Thank you received: 4153
3 years 8 months ago #264839
by rodw
Replied by rodw on topic LinuxCNC S-Curve Accelerations
If your error reporting is called repeatedly to print messages, replace the text with Error #defines or enums as printing is very resource intensive (eg time consuming).
Linuxcnc has a function called rtapi_print (or similar) which may help. I'm not actually sure how it works.
PREEMPT_RT has some recent patches to allow the linux kernel print statements to be queued and print when possible. I wonder if you could borrow the kernel printk() statement?
Be sure to share your code in git so otheres can review and help.
Linuxcnc has a function called rtapi_print (or similar) which may help. I'm not actually sure how it works.
PREEMPT_RT has some recent patches to allow the linux kernel print statements to be queued and print when possible. I wonder if you could borrow the kernel printk() statement?
Be sure to share your code in git so otheres can review and help.
The following user(s) said Thank You: Grotius
Please Log in or Create an account to join the conversation.
- robh
- Offline
- Premium Member
-
Less
More
- Posts: 111
- Thank you received: 24
3 years 8 months ago #264902
by robh
Replied by robh on topic LinuxCNC S-Curve Accelerations
just want to say thank you for taking the time and effort into this topic and i hope you do resolve, jerk limiting for us guys running bigger faster machines would be a night and day change for sure to linuxcnc. will keep watching this space
The following user(s) said Thank You: Grotius, Darium
Please Log in or Create an account to join the conversation.
- Grotius
- Offline
- Platinum Member
-
Less
More
- Posts: 2419
- Thank you received: 2349
3 years 8 months ago #264911
by Grotius
Replied by Grotius on topic LinuxCNC S-Curve Accelerations
Hi,
A little update.
jerk limiting for us guys running bigger faster machines would be a night and day change for sure to linuxcnc.
Yes. For all of us. This is a game changer, when integrated.
I think we where lucky today. I programmed for 10 hours, with some succes.
Not all the functions are optimized now, but i optimized those so i could do a another test.
Now i reached a peak time of : 0.49 ms on a 9 axis scurve thread.
Now i reached a peak time of : 0.73 ms on a 16 axis scurve thread.
This is done with a curve with periods : t1,t2,t3,t5,t6,t7 without "vm" sampling.
I hope the final performance will stay like above.... We will see.
@ Rod,
During the performance test, no print output is done. This will slow down the process a lot.
For hal components we use indeed the rtapi print, no problem for that.
I am now working a little bit on the front end.
User interface is like the ruckig lib. The ruckig update cycle is quite clever, so i use that too, and
i will explain a little what i mean by a clever update cycle :
Not clever way:
1. The program can calculate a scurve for a motion, given vo,vm,ve, etc. Then user will request a time point on the curve
and program will do a interpolation on that given time point. So curve is calculated from begin to end.
Clever, ruckig way :
2. The program calculates a curve from current pos,acc,vel up to the endpoint for every request.
The program then gives a new waypoint for next 1ms. Then the new waypoint is as input again.
A little update.
jerk limiting for us guys running bigger faster machines would be a night and day change for sure to linuxcnc.
Yes. For all of us. This is a game changer, when integrated.
I think we where lucky today. I programmed for 10 hours, with some succes.
Not all the functions are optimized now, but i optimized those so i could do a another test.
Now i reached a peak time of : 0.49 ms on a 9 axis scurve thread.
Now i reached a peak time of : 0.73 ms on a 16 axis scurve thread.
This is done with a curve with periods : t1,t2,t3,t5,t6,t7 without "vm" sampling.
I hope the final performance will stay like above.... We will see.
@ Rod,
During the performance test, no print output is done. This will slow down the process a lot.
For hal components we use indeed the rtapi print, no problem for that.
I am now working a little bit on the front end.
User interface is like the ruckig lib. The ruckig update cycle is quite clever, so i use that too, and
i will explain a little what i mean by a clever update cycle :
Not clever way:
1. The program can calculate a scurve for a motion, given vo,vm,ve, etc. Then user will request a time point on the curve
and program will do a interpolation on that given time point. So curve is calculated from begin to end.
Clever, ruckig way :
2. The program calculates a curve from current pos,acc,vel up to the endpoint for every request.
The program then gives a new waypoint for next 1ms. Then the new waypoint is as input again.
The following user(s) said Thank You: Bari, tommylight, itsme, Darium
Please Log in or Create an account to join the conversation.
- Grotius
- Offline
- Platinum Member
-
Less
More
- Posts: 2419
- Thank you received: 2349
3 years 8 months ago - 3 years 8 months ago #264924
by Grotius
Replied by Grotius on topic LinuxCNC S-Curve Accelerations
Hi,
This is the front end interface in progress.
It sets up a scurve motion program, user can input the nr. of joints.
The ammount of joints is dynamicly loaded at startup.
User can set parameters for each joint by id.
Then to update the values, user can select a Joint id "j1, j2 etc.".
It's now limited up to 16 joints.
This is the front end interface in progress.
It sets up a scurve motion program, user can input the nr. of joints.
The ammount of joints is dynamicly loaded at startup.
User can set parameters for each joint by id.
Then to update the values, user can select a Joint id "j1, j2 etc.".
It's now limited up to 16 joints.
Code:
sc_motion *motion = new sc_motion();
sc_motion_in in;
sc_motion_out out;
sc_status status;
motion->nr_of_joints(3);
sc_motion_joint_id id=sc_motion_joint_id::id_J1;
sc_motion_params params={a,dv};
motion->set(id,params);
in.curacc=acs;
in.curpos=0;
in.curvel=vo;
in.endacc=ace;
in.endpos=s;
in.endvel=ve;
in.maxvel=vm;
//! From here runs in thread.
status=motion->update(0.001,id,in,out);
if(status==sc_status::Error){
std::cerr<<"motion error"<<std::endl;
}
if(!out.finished){
in.curvel=out.newvel;
in.curpos=out.newpos;
in.curacc=out.newacc;
} else {
//! Set new position.
}
Now let's fix the rest of the code. I hope it won't take too long if we are lucky.
Last edit: 3 years 8 months ago by Grotius.
Please Log in or Create an account to join the conversation.
- rmu
- Offline
- Elite Member
-
Less
More
- Posts: 279
- Thank you received: 101
3 years 8 months ago #264948
by rmu
Replied by rmu on topic LinuxCNC S-Curve Accelerations
How would you program a linear move involving more than one joint?
Please Log in or Create an account to join the conversation.
Time to create page: 0.197 seconds