- Posts: 2419
- Thank you received: 0
How would you design a real time application for cnc control in c / c++ ???
5 years 10 months ago #192383
by Grotius
Replied by Grotius on topic How would you design a real time application for cnc control in c / c++ ???
This is a nice example of 4 different s-Curve motion commands.
Picture 1 is a command that can not reach the max velocity.
Therefore the code shorts the motion command into a shorter period of acc and dcc.
Picture 2,3 and 4 are quite nice. These can be used as a motion command between a M3 and M5 traject.
The motioncommand has 4 types to assign the S-curve :
-- type 0 = S-curve at left and right.
-- type 1 = No left S-curve
-- type 2 = No right S-curve
-- type 3 = No S-curve on both sides.
3 motion commands executed from a bucket (vector).
Stopwatch: 9.99986 sec
Calcuations: 24619 (threat pause = 900000 ns).
Picture 1 is a command that can not reach the max velocity.
Therefore the code shorts the motion command into a shorter period of acc and dcc.
Picture 2,3 and 4 are quite nice. These can be used as a motion command between a M3 and M5 traject.
The motioncommand has 4 types to assign the S-curve :
-- type 0 = S-curve at left and right.
-- type 1 = No left S-curve
-- type 2 = No right S-curve
-- type 3 = No S-curve on both sides.
Attachment not found
3 motion commands executed from a bucket (vector).
Stopwatch: 9.99986 sec
Calcuations: 24619 (threat pause = 900000 ns).
Attachment not found
Please Log in to join the conversation.
5 years 10 months ago #192431
by Grotius
Replied by Grotius on topic How would you design a real time application for cnc control in c / c++ ???
Hi,
Video of Scurve with motors connected to Robot.
The robot has to go through 4 points.
Points :
Setup :
- quite old pc
- rtos Skynet iso
- rt Hal
- rt Ethercat + steppers
- rt kdl Kinematics
- rt Scurve motionplanner
- Opencascade step viewer updated every 100ms.
video 1
streamable.com/ss9u4j
video 2
streamable.com/2fcbhj
Video of Scurve with motors connected to Robot.
The robot has to go through 4 points.
Points :
Warning: Spoiler!
Code:
MOTION M;
// A motion;
M.PaX=500;
M.PaY=-300;
M.PaZ=500;
M.PbX=600;
M.PbY=300;
M.PbZ=500;
M.Vo=0;
M.Vel=100;
M.Al=25;
M.CurveType=0;
MotionVec.push_back(M);
// A second motion;
M.PaX=800;
M.PaY=0;
M.PaZ=700;
M.PbX=650;
M.PbY=0;
M.PbZ=500;
M.Vo=0;
M.Vel=50;
M.Al=35;
M.CurveType=0;
MotionVec.push_back(M);
// A thirth motion;
M.PaX=350;
M.PaY=-300;
M.PaZ=700;
M.PbX=500;
M.PbY=0;
M.PbZ=500;
M.Vo=0;
M.Vel=50;
M.Al=25;
M.CurveType=0;
MotionVec.push_back(M);
// A thirth motion;
M.PaX=350;
M.PaY=-500;
M.PaZ=700;
M.PbX=500;
M.PbY=500;
M.PbZ=70;
M.Vo=0;
M.Vel=50;
M.Al=20;
M.CurveType=0;
MotionVec.push_back(M);
Setup :
- quite old pc
- rtos Skynet iso
- rt Hal
- rt Ethercat + steppers
- rt kdl Kinematics
- rt Scurve motionplanner
- Opencascade step viewer updated every 100ms.
video 1
streamable.com/ss9u4j
video 2
streamable.com/2fcbhj
Please Log in to join the conversation.
- thefabricator03
- New Member
-
Less
More
- Thank you received: 0
5 years 10 months ago #192437
by thefabricator03
Replied by thefabricator03 on topic How would you design a real time application for cnc control in c / c++ ???
Great work Grotius!
Please Log in to join the conversation.
5 years 10 months ago #192443
by Aciera
I thought I'd start by building the robot model but I guess I'm a bit confused about the workflow of qt creator:
I notice that FactoryApp.xml that defines the kinematic chain lives in the folder "build-Skynet-Desktop-debug" while in qt-creator I build the file "Skynet.pro" that lives in the folder "Qt-skynet-app". How does the new model get transferred to the qt-project?
I'm sorry you might have pointed that out somewhere but it all a bit of a blur.
[edit]
I notice that the step files for the model also live in the folder "Qt-skynet-app" so having the FactoryApp.xml in a different folder seems a bit odd. Does qt-creator somehow know to fetch the FactoryApp.xml from the folder "build-Skynet-Desktop-debug"?
[edit2]
Just realized that FactoryApp.xml in the folder "build-Skynet-Desktop-debug" seems to be overwritten when building Skynet.pro. So now I'm really wondering where the kinematic chain is defined.
Replied by Aciera on topic How would you design a real time application for cnc control in c / c++ ???
To start and try out a little bit, you have only to edit the FactoryApp.xml file.
I thought I'd start by building the robot model but I guess I'm a bit confused about the workflow of qt creator:
I notice that FactoryApp.xml that defines the kinematic chain lives in the folder "build-Skynet-Desktop-debug" while in qt-creator I build the file "Skynet.pro" that lives in the folder "Qt-skynet-app". How does the new model get transferred to the qt-project?
I'm sorry you might have pointed that out somewhere but it all a bit of a blur.
[edit]
I notice that the step files for the model also live in the folder "Qt-skynet-app" so having the FactoryApp.xml in a different folder seems a bit odd. Does qt-creator somehow know to fetch the FactoryApp.xml from the folder "build-Skynet-Desktop-debug"?
[edit2]
Just realized that FactoryApp.xml in the folder "build-Skynet-Desktop-debug" seems to be overwritten when building Skynet.pro. So now I'm really wondering where the kinematic chain is defined.
Please Log in to join the conversation.
5 years 10 months ago #192519
by Grotius
Replied by Grotius on topic How would you design a real time application for cnc control in c / c++ ???
Hi Arciera,
Normally i copy the folders : gcode, hal and robot to the build directory by hand.
From there it is used by the program.
The FactoryApp.xml is made in the build directory to show it as example. To prevent overwrite you could rename your xml file, or
you could outcomment : Cmainwindow.cpp : // create_xml_templates().create_robot_xml("FactoryApp.xml");
Then it will no longer overwrite the FactoryApp.xml file.
Take a look how the xml file is made. Xml/create_xml_templates.cpp, you could consider to edit this file into your configuration.
That's problably what i would do.
The Chain is readed by : Xml/read_xml.cpp
Take a look by going trough that file.
The robot data is stored by read_xml.h this file contains the data buckets, see struct SEGMENT and struct CHAIN.
Normally i copy the folders : gcode, hal and robot to the build directory by hand.
From there it is used by the program.
The FactoryApp.xml is made in the build directory to show it as example. To prevent overwrite you could rename your xml file, or
you could outcomment : Cmainwindow.cpp : // create_xml_templates().create_robot_xml("FactoryApp.xml");
Then it will no longer overwrite the FactoryApp.xml file.
Take a look how the xml file is made. Xml/create_xml_templates.cpp, you could consider to edit this file into your configuration.
That's problably what i would do.
The Chain is readed by : Xml/read_xml.cpp
Take a look by going trough that file.
The robot data is stored by read_xml.h this file contains the data buckets, see struct SEGMENT and struct CHAIN.
Please Log in to join the conversation.
5 years 10 months ago #192535
by Aciera
Replied by Aciera on topic How would you design a real time application for cnc control in c / c++ ???
So I made a copy of the folder "Qt-skynet-app" and changed the dimensions in Xml/create_xml_templates.cpp, which seems easy enough to do. However now I get errors when trying to build:
I even get this error when trying to build the original Skynet.pro from the unchanged "Qt-skynet-app" that used to build fine before.
Thanks
Attachment not found
I even get this error when trying to build the original Skynet.pro from the unchanged "Qt-skynet-app" that used to build fine before.
Thanks
Please Log in to join the conversation.
5 years 10 months ago #192563
by Grotius
Replied by Grotius on topic How would you design a real time application for cnc control in c / c++ ???
Hi Arciera,
Copying the whole source directory is not a good idea.
What happens is that your copy has overwritten parts of the build directory, but not everything.
To restore this, delete your copy directory. (eventually save your edited xml files).
After that you have to do a => build => clean all projects from your orginal Skynet directory (open qt => skynet.pro)
This will remove all build files except your "hal, robot, gcode folder".
Then compile the orginal source again.
If this is not working, delete all, unzip the downloaded Skynet project again.
changed the dimensions in Xml/create_xml_templates.cpp, which seems easy enough to do.
Oke nice !
Working with Qt takes some experience. I have dealed with most of the issue's already.
My workflow would be,
1. unzip skynet.zip.
2. load project, build one time. (this creates the factoryapp.xml file for you).
3. copy the folders : gcode, hal, etc to your created build dir.
4. run program.
5. edit code to your wishes and compile frequently.
Copying the whole source directory is not a good idea.
What happens is that your copy has overwritten parts of the build directory, but not everything.
To restore this, delete your copy directory. (eventually save your edited xml files).
After that you have to do a => build => clean all projects from your orginal Skynet directory (open qt => skynet.pro)
This will remove all build files except your "hal, robot, gcode folder".
Then compile the orginal source again.
If this is not working, delete all, unzip the downloaded Skynet project again.
changed the dimensions in Xml/create_xml_templates.cpp, which seems easy enough to do.
Oke nice !
Working with Qt takes some experience. I have dealed with most of the issue's already.
My workflow would be,
1. unzip skynet.zip.
2. load project, build one time. (this creates the factoryapp.xml file for you).
3. copy the folders : gcode, hal, etc to your created build dir.
4. run program.
5. edit code to your wishes and compile frequently.
Please Log in to join the conversation.
5 years 10 months ago #192602
by Grotius
Replied by Grotius on topic How would you design a real time application for cnc control in c / c++ ???
Hi,
The motion planner works quite nice. I integrated adaptive feed from -1 to 1. It can move back without restrictions.
In lcnc the restriction is (or was) a maximal reverse run until a M3/M5 is reached.
In the picture the last motion is build up from 2 half assigned Scurve commands. Next thing to do is Dtg (DistanceToGo).
And maybe a live velocity control.
The motor output speeds are still tested oke.
After some trial and error I mentioned that the chrono timer can best be used with a delay command,
instead of calculating the disired delay.
On github is a ngc274 intepreter for download. This one can be attached to the program quite easy when we are ready for it.
Source : projects
The news of today is :
It is now possible to upload video's to your github channel.
Can we now get rid of youtube finally? I hope embedding is possible, not sure, have to try this.
Test video.
user-images.githubusercontent.com/448801...d89-07bfb7872e0a.mp4
Embedding mp4 seems not to work on this forum.
The motion planner works quite nice. I integrated adaptive feed from -1 to 1. It can move back without restrictions.
In lcnc the restriction is (or was) a maximal reverse run until a M3/M5 is reached.
In the picture the last motion is build up from 2 half assigned Scurve commands. Next thing to do is Dtg (DistanceToGo).
And maybe a live velocity control.
The motor output speeds are still tested oke.
After some trial and error I mentioned that the chrono timer can best be used with a delay command,
instead of calculating the disired delay.
On github is a ngc274 intepreter for download. This one can be attached to the program quite easy when we are ready for it.
Attachment not found
Source : projects
The news of today is :
It is now possible to upload video's to your github channel.
Can we now get rid of youtube finally? I hope embedding is possible, not sure, have to try this.
Test video.
user-images.githubusercontent.com/448801...d89-07bfb7872e0a.mp4
Embedding mp4 seems not to work on this forum.
Please Log in to join the conversation.
- tommylight
-
- Offline
- Administrator
-
Less
More
- Posts: 22012
- Thank you received: 4
5 years 10 months ago #192632
by tommylight
Replied by tommylight on topic How would you design a real time application for cnc control in c / c++ ???
Did github get bought by Microsoft?
They are much worse than google/youtube, although lately it is hard to separate them.
If i remember correctly, LinuxCNC server is in someones home, so not much capacity and bandwidth there, but it works properly so i do not mind it does not handle videos.
They are much worse than google/youtube, although lately it is hard to separate them.
If i remember correctly, LinuxCNC server is in someones home, so not much capacity and bandwidth there, but it works properly so i do not mind it does not handle videos.
Please Log in to join the conversation.
5 years 10 months ago #192637
by Aciera
Replied by Aciera on topic How would you design a real time application for cnc control in c / c++ ???
Wikipedia:
GitHub, Inc. is a subsidiary of Microsoft which provides hosting for software development and version control using Git.
Please Log in to join the conversation.
Time to create page: 0.169 seconds
