- LinuxCNC
- General LinuxCNC Questions
- How would you design a real time application for cnc control in c / c++ ???
How would you design a real time application for cnc control in c / c++ ???
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).
Please Log in or Create an account to join the conversation.
Video of Scurve with motors connected to Robot.
The robot has to go through 4 points.
Points :
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 or Create an account to join the conversation.
- thefabricator03
- Offline
- Platinum Member
- Posts: 1130
- Thank you received: 533
Please Log in or Create an account to join the conversation.
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 or Create an account to join the conversation.
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 or Create an account to join the conversation.
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
Attachments:
Please Log in or Create an account to join the conversation.
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 or Create an account to join the conversation.
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.
Attachments:
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
- Posts: 19188
- Thank you received: 6432
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 or Create an account to join the conversation.
GitHub, Inc. is a subsidiary of Microsoft which provides hosting for software development and version control using Git.
Please Log in or Create an account to join the conversation.
- LinuxCNC
- General LinuxCNC Questions
- How would you design a real time application for cnc control in c / c++ ???