status

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
marcuswolschon
Posts: 22
Joined: Thu Sep 26, 2013 1:52 pm

Re: status

Post by marcuswolschon »

I couldn't find my way around the finer details of the C++ to Python interface.
So I started following "plan B" and wrote the first code for my new C++ TPG plugin.

Aparently having 2 TPGs in a single plugin doesn't work out.
(Switching to the CAM workbench gives errors about unimplemented methods in the second plugin.)
Having a second plugin seems to work out. But it just isn't displayed in the list yet.
(Working on that.)

My repository:
https://github.com/MarcusWolschon/FreeCAD_sf_master

My plan:

Status: working on step (0).
Adding comments as I go along to make not-obvious parts of the code,
that I manage to understand, easier to understand for later developers.

0)
The plugin shall load and pass-through the config options of another TPG.
(first compiled in, later as a configurable TPGDescriptor)
1)
This plugin shall execute that TPG.
2)
Since the output is a python program, I can't post-process a single g-code line at a time but will have to store it.
3)
Then execute the stored python program to generate the g-code and store that g-code
4)
Then post-process the g-code one line at a time,
changing 3(4) axis coordinates into 4(5) axis coordinates with inverse kinematic.
The coordinates are chosen, so the tool hits the geometry with the tip at the same location in space and
the tool is parallel to the surface normal of the geometry at that point.
5)
Doing hit-tests to determine if the tool, collet or spindle hits another part of the geometry and
a) defaulting to the original coordinates or
b) finding a less perfect alignment.
6)
Analyse if the single movement needs to be broken up into smaller parts to avoid such a collision.
marcuswolschon
Posts: 22
Joined: Thu Sep 26, 2013 1:52 pm

Re: status

Post by marcuswolschon »

I haven't posted in a while.
Sadly I'm still stuck that my plugin doesn't produce an .so file and thus of cause doesn't load.
It does compile and the any cmake reference to the existing, working plugin also exists for mine.
I didn't expect my own progress to be so slow :/
DavidNicholls
Posts: 20
Joined: Sat Feb 22, 2014 10:11 pm

Re: status

Post by DavidNicholls »

Marcus,

are you pushing your changes back to your github repository? If so, which branch are you using. Maybe a second set of eyes might help (if you like). My progress is particularly slow too. My eagerness ebbs and wanes depending on how successful my code changes are.

Thanks
David Nicholls
marcuswolschon
Posts: 22
Joined: Thu Sep 26, 2013 1:52 pm

Re: status

Post by marcuswolschon »

I'm not pushing anything upstream until it works.
My repository in the start-posting.
I'm working on it every thursday during the local Chaos Computer Club meetings.
marcuswolschon
Posts: 22
Joined: Thu Sep 26, 2013 1:52 pm

Re: status

Post by marcuswolschon »

https://github.com/MarcusWolschon/FreeC ... pp/Plugins

I guess I haven't pushed my changes to my own repository.
I'll do so later today, so you can have a look.
DavidNicholls
Posts: 20
Joined: Sat Feb 22, 2014 10:11 pm

Re: status

Post by DavidNicholls »

Marcus, can you post a reply once you've uploaded your code to your repository? If you've already done it then can you tell me which files they are?
marcuswolschon
Posts: 22
Joined: Thu Sep 26, 2013 1:52 pm

Re: status

Post by marcuswolschon »

DavidNicholls wrote:Marcus, can you post a reply once you've uploaded your code to your repository? If you've already done it then can you tell me which files they are?
The new directory InverseKinematicPlugin
https://github.com/MarcusWolschon/FreeC ... pp/Plugins

And it's entry in CMakeList.txt
https://github.com/MarcusWolschon/FreeC ... eLists.txt
DavidNicholls
Posts: 20
Joined: Sat Feb 22, 2014 10:11 pm

Re: status

Post by DavidNicholls »

Marcus,
I stumbled about with the CMakeLists.txt file until I came across the problem. We use the 'TPG_' prefix for some of the 'local' variables in the CMakeLists.txt file. eg: 'TPG_TARGET' etc. The problem is that these variable names must still be valid from one local directory to the next. I renamed these to use the 'IKP_' prefix just so that it was different to that used in the TestPlugin directory. This seemed to do the trick.

I had trouble compiling the rest of FreeCAD using your branch but I copied your new files into my own branch and it compiled and ran fine. I could see your new TPG listed along with the test plugin and I was able to create an instance of your new plugin. I could save the file and re-read that file to see the InverseKinematicsPlugin TPG object still there.

I will rename the corresponding variables in the TestPlugin/CMakeLists.txt file in my branch so that the next developer knows that these variables must be renamed when using the TestPlugin directory as a template.

I can understand why we use cmake but my limited knowledge of it means I always have difficulty messing around with it. I spend much more time using a 'trial and error' approach than reasoned logic.

I also used a command line utility on the Windows build (which is what I'm using here) called 'uuidgen' to generate a UUID. I modified your TPG's UUID with this generated value. That was the only change to the CppInverseKinematicTPG.cpp file that I made.

I'm having trouble uploading the modified files so I'll email them directly to you.

Thanks
David Nicholls
marcuswolschon
Posts: 22
Joined: Thu Sep 26, 2013 1:52 pm

Re: status

Post by marcuswolschon »

Thank a lot!
I don't think I'd have found that variable name issue.
It's quite unobvious.
marcuswolschon
Posts: 22
Joined: Thu Sep 26, 2013 1:52 pm

Re: status

Post by marcuswolschon »

Thanks. The fix is applied and works. :)
I can now continue to make it a faccade for another plugin.
Then write the code to execute and modify another plugin's output on the fly.
Post Reply