comp a function - sudo apt-get linuxcnc-dev

More
04 Apr 2012 11:52 - 04 Apr 2012 12:06 #18963 by Fremder
Hi ..

to make a function and compile:

i must do this:

sudo comp --install xyz.c


but on my system its not the comp (path) installed ... what i must do ?



;-)
the linuxcnc.org/docs/html/hal/comp.html its ok for the code ... but i found
sudo apt-get linuxcnc-dev (i see in the help on the googlesides ...)
and its not work ...

thanks for help
.......
sudo apt-get install emc2-dev
# its ok ... i hope ;-)
Last edit: 04 Apr 2012 12:06 by Fremder.

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

More
04 Apr 2012 11:56 - 04 Apr 2012 11:57 #18964 by BigJohnT
Fremder wrote:

sudo apt-get linuxcnc-dev
and its not work ...


Can you be a bit more specific about what didn't work?

Also the install command is for a .comp file not a .c file.

Thanks
John
Last edit: 04 Apr 2012 11:57 by BigJohnT.

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

More
04 Apr 2012 12:09 #18965 by Fremder
comp: command not found
was the "error" in the terminal ...

i make this
sudo apt-get install emc2-dev
and now its going ... i think its the old "emc2" but the new with
sudo apt-get linuxcnc-dev
its not actuall

thanks for your FAST answer ,-)
but cut

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

More
04 Apr 2012 13:24 #18966 by BigJohnT
If you upgraded to 2.5 I think you should remove 2.4 in the synaptic package manager. If you still have 2.4 installed then yes it is still emc2-dev.

So are you up and running now?

John

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

More
04 Apr 2012 14:18 #18967 by Fremder
good think :)

its now emc2-dev ... its i hope no problem for the future ...
or its better completly update to 2.5.x ...

actual i install the emc2 packeage - from the git -
here its the em2-dev named !?
>>
i'll make a simple c-function with hal and other
but without the cource from emc2/linuxcnc i have no rtapi.h / hal.h / streamer.h

its my "way" the right to make the functions in c and i ~must~ install the git / source complet ?

:-) thanks

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

More
04 Apr 2012 15:27 - 04 Apr 2012 15:31 #18969 by ArcEye
Hi

It is a bit hard to understand what you are asking or saying.

If you want to write components and develop generally, you will need several things
Linux-2.6.32 source
linux-headers-2.6.32-122
linux-headers-2.6.32-122-rtai
build-essentials

I would recommend that you download the latest stable version of linuxcnc 2.5 source code from buildbot.linuxcnc.org/
and build it as a Run In Place configuration in /usr/src and do all your development from there.
(wiki.linuxcnc.org/cgi-bin/wiki.pl?Installing_LinuxCNC tells you how to build RIP)

That way everything is self contained, all the source and libraries you need are there, without any danger of overwriting the installed files from the 2.4.6 debs.

You can compile a C file if you like, but there is no reason to do so and it is completely re-inventing the wheel.
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.

regards
Last edit: 04 Apr 2012 15:31 by ArcEye.

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

More
04 Apr 2012 16:29 #18973 by Fremder
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

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

More
04 Apr 2012 17:19 - 05 Apr 2012 08:12 #18975 by ArcEye
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 08:12 by ArcEye.
The following user(s) said Thank You: kagouraki

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

More
05 Apr 2012 15:05 #18992 by Fremder
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

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

More
05 Apr 2012 15:32 #18994 by ArcEye

. 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

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

Time to create page: 0.097 seconds
Powered by Kunena Forum