NEWS
LinuxCNC 2.5.2 Release
LinuxCNC 2.5.2 Update Released (changelog).
 
LinuxCNC 2.5.1 Release

LinuxCNC 2.5.1 Update Released (changelog). If the Package Manager does not prompt you to upgrade see this page.

 
LinuxCNC 2.5.0 Release
New major release (changelog). See the instructions to update your system from EMC 2.4 to LinuxCNC 2.5.
 
Home Forum Configuring LinuxCNC Advanced Configuration comp a function - sudo apt-get linuxcnc-dev

Welcome, Guest
Username: Password: Remember me

TOPIC: comp a function - sudo apt-get linuxcnc-dev

Re:comp a function - sudo apt-get linuxcnc-dev 04 Apr 2012 09:29 #18973

  • Fremder
  • Fremder's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 45
  • Karma: 0
Hi ArcEye
...
its not verry importend actual - for >interesting< i install the full git ..
but the troubles to much :-)
...
: yours: Much easier to write the C routine in the FUNCTION() portion of the .comp and leave the comp macros to generate the rest for you.

its there a "PATH" for the comp(iling) the c file - when inside a #include "rtapi.h" ... / hal.h ?
....
btw. can i copy the rtapi.h / hal.h in the directory from the C file ? and then

thanks for your help
The administrator has disabled public write access.

Re:comp a function - sudo apt-get linuxcnc-dev 04 Apr 2012 10:19 #18975

  • ArcEye
  • ArcEye's Avatar
  • OFFLINE
  • Moderator
  • Posts: 1336
  • Thank you received: 102
  • Karma: 129
Hi,

I have no idea what you are trying to write, but you are making things too difficult for yourself.

Save this simple example into a file called test.comp
component test               "This is a test component";

pin in bit testinbit;
pin in s32 testins32;
pin out bit testoutbit;
pin out s32 testouts32;
param rw s32 testrwparam = 0;

// internal variables

variable bool testbool = false;
variable float testfloat = 0;
variable int progress_level = 0;
function _;
author "ArcEye ";
license "GPL";
;;

FUNCTION(_)
{
    switch (progress_level)
        {
        case 0:
                 break;
        default:    
                rtapi_print_msg(RTAPI_MSG_ERR, "Unknown state");            
                break;
        }
}

Then run comp test.comp and it will generate test.c

Reading this will show you exactly what the comp program does to generate code to produce a module.

You can then build a module with comp --install test.comp

From the commandline
$ # halrun
halcmd: loadrt test
halcmd: show pin

Component Pins:
Owner Type Dir Value Name
4 bit IN FALSE test.0.testinbit
4 s32 IN 0 test.0.testins32
4 bit OUT FALSE test.0.testoutbit
4 s32 OUT 0 test.0.testouts32

halcmd: unloadrt test
halcmd: exit


Which will demonstrate that the module loads and the pins were created.

Now just use this as a template and replace pins and variables with what you want and replace the code in FUNCTION() with something meaningful.

The code in FUNCTION() needs to do something and return quickly, no calls to sleep(), no while() loops etc.

Hence why a switch() statement, allowing you to do something, change the progress_level and next visit do the next stage and so on, is useful for a module which checks state of the pins and does stuff dependent upon that state.

Simple as that (in theory):woohoo:

regards
Last Edit: 05 Apr 2012 01:12 by ArcEye.
The administrator has disabled public write access.

Re:comp a function - sudo apt-get linuxcnc-dev 05 Apr 2012 08:05 #18992

  • Fremder
  • Fremder's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 45
  • Karma: 0
Hi,

thanks for your sample... its going ...
===
but i have a full new (Nr. 101) installation make - to many progams installd....
===
after update to 2.5x
install gladevcp and the others
i found no way to make the gladefiles with *.UI ???

the 1000 sides with emc2/linuxcnc make me trouble ...
======== this is the actual link: from www.linuxcnc.org/docs/2.5/html/gui/gladevcp.html
3. Creating and Integrating a Glade user interface
3.1. Prerequisite: Glade installation

To view or modify Glade UI files, you need glade installed - it is not needed just to run a GladeVCP panel. If the glade command is missing, install it with the command:

$ sudo apt-get install glade

Verify the version number to be greater than 3.6.7:

$ glade --version
glade3 3.6.7
===============
i have this. version its ok ... but now files are with *.ui going.

sorry ... i think its a smal "think" to do but a LOOOOONG way for me ,-)

can help

thanks
The administrator has disabled public write access.

Re:comp a function - sudo apt-get linuxcnc-dev 05 Apr 2012 08:32 #18994

  • ArcEye
  • ArcEye's Avatar
  • OFFLINE
  • Moderator
  • Posts: 1336
  • Thank you received: 102
  • Karma: 129
. but now files are with *.ui going
Sorry, don't know what you are asking.

.ui stands for 'user interface' and are a common extension used by GUI creating software like QT Designer or Glade for their output files.

If you want to create one, just open Glade and create an interface and it will be saved as something.ui

If you want to open and or edit one open glade and File>Open and choose the .ui file

Anything deeper on Glade you need to ask in Linuxcnc Forum > Configuring Linuxcnc > GladeVCP

I have found pyVCP adequate for all my needs so far and have avoided it and all its pythonic twists.

regards
The administrator has disabled public write access.

Re:comp a function - sudo apt-get linuxcnc-dev 05 Apr 2012 08:41 #18995

  • Fremder
  • Fremder's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 45
  • Karma: 0
ohoh....

i put on save ... and the name was test.glade

now i put on save with extension test.ui
and its ok :)

in german:
so mancher (ich) sieht den wald vor lauter bäumen nicht
at english:
i am not see the forest becouse of the threes

,-)

thanks for yours patience
The administrator has disabled public write access.

Re:comp a function - sudo apt-get linuxcnc-dev 04 Sep 2012 11:06 #23890

  • andypugh
  • andypugh's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 4138
  • Thank you received: 141
  • Karma: 130
I am starting to understand the original question.

With emc2.4 you could compile .comp modules by installing only emc2-dev and build-essential.
For simple components that was all that was needed, no requirement to have all the EMC2 source.

There does not seem to be a similar linuxcnc-dev package, and if you install emc2-dev it uninstalls LinuxCNC and takes you back to EMC2.

(guess who is bored in a hotel room with a work laptop and VirtualPC?)
The administrator has disabled public write access.
Time to create page: 1.248 seconds
Powered by Kunena Forum
© 2013 LinuxCNC.org
Joomla! is Free Software released under the GNU General Public License.