How would you design a real time application for cnc control in c / c++ ???

More
24 Oct 2020 15:03 #187108 by Grotius
Hi,

Just a little update. Trying to get things working. WIth a little succes today after studying the linuxcnc robot part.

I studied the linuxcnc puma robot source code and some articles that are made for linuxcnc in the past.

After some trial and error i was able to set up forward interpolation and a inverse interpolation c++ code for a kuka 500 robot config.
I checked the xyz output's from the inverse interpolation and this seem's oke. I checked the outputs with RoKiSim, a free robot viewer.



For the kinematics i used the KDL c++ library. Building op the robot configuration was hard to understand. I did not use the
dh parameter methode. KDL has more robot function's available, quite interesting stuff.

A preview of a working forward kinematics code :

Warning: Spoiler!


A preview of a inverse kinematics code :

Warning: Spoiler!


Now i am planning to integrate the visualisation of the robot stl files into the program.
The Etercat hal problem is solved. So the program can do a good job if the gui interface is ready to go.

Have a nice day !
Attachments:
The following user(s) said Thank You: tommylight, thefabricator03

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

More
31 Oct 2020 14:35 - 31 Oct 2020 14:37 #187916 by Grotius
Hi a little update.

I have learned opencascade a little bit. It is also used by freecad and mayo.
The responce time is increadible fast.

The robot is chucked up in 6 step files. Each step file is loaded in and connected to a transform matrix.
Later on i have to bring back the robot orginal stepfile colors and a nice background gradient view.

The robot forward kinematics is just working within the multiplied opencascade tranform matrixes.

So later on connect the kdl inverse kinematics code to the preview and check everything.

And then connect the ethercat bus and hal layer to get a realtime environment + robot previewer.
I am a little excited about this.

Attachments:
Last edit: 31 Oct 2020 14:37 by Grotius.
The following user(s) said Thank You: bkt, thefabricator03

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

More
01 Nov 2020 15:36 - 01 Nov 2020 15:38 #188012 by Grotius
Hi,

I got it running.

The kinematics are working oke. xyz moves are interpolating nice.

The gui is connected to a ethercat setup with motors.
Everything run's is as expected.

Responce time's is very nice !



For the one's :
github.com/grotius-cnc/Skynet_Robot_Control_Rtos_Ethercat
Attachments:
Last edit: 01 Nov 2020 15:38 by Grotius.
The following user(s) said Thank You: tommylight, bkt, thefabricator03

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

More
01 Nov 2020 16:33 #188018 by Aciera
So is this limited to ethercat or does it also work for other means of communication with the drives.

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

More
01 Nov 2020 16:51 - 01 Nov 2020 16:55 #188019 by Grotius
Hi Arciera,

You can in fact use anything. It's suitable for parport, ethernet, mesa, etc.
Take a look at the source code hal file .

If you load a ini file with it, combined with some hal logic, you can execute gcode files with it trough the lcnc environment.
The program is minimal at the moment. I have to integrate mdi commands, etc. But for now it's oke.

A nice thing to know is, you can edit the robot kinematics to something whole different, like a human shape, with arm's and leg's.
The kdl lib can handle this all including mass rotation inertia calculations. Wich are not included now.

Minimal code = better to understand.
Last edit: 01 Nov 2020 16:55 by Grotius.
The following user(s) said Thank You: Aciera

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

More
01 Nov 2020 17:17 #188021 by Aciera
Forgive my ignorance but say I now have the official LinuxCNC 2.8 on buster with the preemt-rt. Would that be a base to install the OpenCascade library and the KDL kinematics library and your "Skynet_Robot_Control_Rtos_Ethercat. Or is in not quite that simple?

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

More
02 Nov 2020 06:04 #188089 by Grotius
Hi Arciera,

Yes, and a qt install. When you have finished a project it can be transformed (deployed) into a appimage, like freecad. Then it can be distributed.
The following user(s) said Thank You: Aciera

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

More
05 Nov 2020 16:38 #188409 by Grotius
Hi Guy's,

I did some work on the cad preview.
To come this far with the opencascade cad preview was quite a struggle.

It looks already better then my previous post.

The latest release can be downloaded here.

Attachments:
The following user(s) said Thank You: tommylight, thefabricator03

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

More
07 Nov 2020 19:58 #188609 by Grotius
Hi,

After struggling for 2 day's with importing no colors or wrong colors from stepfile's, I finally succeed to do this.
It was a stupid mistake i made.

Just integraded a gcode previewer (parser) This is just a function test for lines and arc's.
It looks quite promising to replace the linuxcnc gremlin gui with opencascade. Then you can see your machine moving while its
running.

The plan next week is to make a template for 3 types of machines :
1. Gantry 3 axis
2. Robots 6 axis
3. Rotary deltakins 3 axis
This includes the kinematic calculations and saving and loading machine config's as xml. Like the ethercat xml file.

A nice thing to mention is that the gcode has to be placed in a xyz coordinate frame. Then it can be moved in place and rotated
very easy.

The blue line is the gcode path.
Attachments:
The following user(s) said Thank You: tommylight, bkt, thefabricator03

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

More
09 Nov 2020 00:49 #188711 by lrak
I think the problems with real-time are often misunderstood. The people the create commercial software products - say live audio or video work - have to move a lot more data than a machine tool takes. They use drivers with unfolded loops - machine coded bits where needed. There are software tools to see what part of the code is burning time.. But the problem for CNC is not machine speed or a better high level language - it is really latency hits.

One bit I worked on was latency problems due to the management engine interrupting. As computers got faster, they decided they didn't want to have warranties claims on uP that overheated ( if hot - they can get to a point of thermal runaway).. so they came up with a supervising processor that would throttle speeds if temperatures got to hot - by interrupting and changing clocks in the processor and memory managing chips. The details were buried in datasheets that no one bothered to read. This was the birth of the dreaded management Engine (ME). There has been work (and success ) to disable the ME.

So part of the key is to keep temperatures down with proper heatsink methods (not found on home computers) and fans.

So I would say that speed isn't the issue - it is latency - max latency - and ME the worst of the problem.

One other thing that changed with modern computers - you can't time loops to the processor clock even in machine code - depends on the processor - running out of flash creates variable delays in ARM chips. (if you look at machinecode instruction sets - each instruction is supposed to take so many cycles - not so anymore..) The bus speed are impressive - but it takes time to set up even a single word transfer. Streaming with buffers is easy - live things - like VoIP/ live audio/ live video get hard. But most of what happens in CNC is slow compared to doing live audio or video, where latency creates nasty glitches..

The other bit, is it probably isn't a good idea to control speeds with a train of pulses that can't be buffered - there are better ways (H-bridge).
The following user(s) said Thank You: tommylight, Grotius, thefabricator03

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

Time to create page: 0.205 seconds
Powered by Kunena Forum