Need help about EMC2 error (HAL)

More
10 Feb 2011 22:31 #7118 by dubostjp
Need help about EMC2 error (HAL) was created by dubostjp
Hi all,

I got an error whith the EMC2 tools. I wrote a small code to test
the HAL loadusr environment. My goal is to get the M67 command pass some
value into the zzlaser code.

When I run the following code into a halrun command started from a
bash shelf, this code is working OK.

halrun cmd ********************************************************

$ halrun
halcmd: loadusr -W zzlaser
halcmd: net ppp zzlaser.0.xxpos
halcmd: show
Loaded HAL Components:
ID Type Name PID State
3 User zzlaser 6262 ready
2 User halcmd6261 6261 ready

Component Pins:
Owner Type Dir Value Name
3 float IN 0 zzlaser.0.xxpos <== ppp

Pin Aliases:
Alias Original Name

Signals:
Type Value Name (linked to)
float 0 ppp
==> zzlaser.0.xxpos
...
sets ppp 2.000
...

*****************************************************************

From the above code, I can track the 2.000 value into the zzzfff file.

But if I run the same code from the EMC2 AXIS window, I got an error
message that zzlaser.0.xxpos pin does not exist as showed bellow.
Note: In order to get the zzlaser started when I start the EMC2 window,
the custom_postgui.hal file is filled with:
source zzlaser.hal

Error EMC2 window *************************************************

Print file information:
RUN_IN_PLACE=no
EMC2_DIR=
EMC2_BIN_DIR=/usr/bin
...

Loaded HAL Components:
ID Type Name PID State
13 User zzlaser 6943 ready
12 User halcmd6942 6942 ready
11 User axisui 6928 ready
...

Component Pins:
Owner Type Dir Value Name
...
8 float OUT 0 stepgen.2.position-fb ==> zpos-fb
8 bit OUT FALSE stepgen.2.step ==> zstep
13 float IN 0 zzlaser.0.xxpos
...

Debug file information:
/home/beldent/emc2/src/hal/components/zzlaser.hal:4: Pin 'zzlaser.0.zzpos' does not exist
6881
PID TTY STAT TIME COMMAND
6927
PID TTY STAT TIME COMMAND
Stopping realtime threads
Unloading hal components
...

*****************************************************************

File zzlaser.hal:

loadusr -W zzlaser
show # to show the error message at EMC2 start-up
net Xpos motion.analog-out-00 => zzlaser.0.zzpos

*****************************************************************

File zzlaser.comp:

// zzlaser to read a laser distance
//
component zzlaser "zzlaser";
option userspace;
option extra_cleanup;

pin in float xxpos;
license "GPL";
;;

#include <stdio.h>
#include <unistd.h>

FILE *fdp;
int zzcount = 0;

void user_mainloop(void) {
// open file
fdp = fopen("/home/beldent/emc2/src/hal/components/zzzfff", "w+");

if (fdp == NULL) {
// return -EBUSY;
exit(1);
}
else {
fprintf(fdp, "init: open OK\n");
fflush(fdp);
}

fprintf(fdp, "main loop: started\n");
fflush(fdp);

while(1) {
FOR_ALL_INSTS() {

if (xxpos == -1.000)
break;

zzcount++;
fprintf(fdp, "cnt=%d, Xpos=%f\n", zzcount, xxpos);
fflush(fdp);
}
sleep(2);
}
}

EXTRA_CLEANUP() {
fclose(fdp);
}

*****************************************************************

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

More
11 Feb 2011 10:56 #7139 by andypugh
Replied by andypugh on topic Re:Need help about EMC2 error (HAL)
dubostjp wrote:

3 float IN 0 zzlaser.0.xxpos <== ppp

/home/beldent/emc2/src/hal/components/zzlaser.hal:4: Pin 'zzlaser.0.zzpos' does not exist

net Xpos motion.analog-out-00 => zzlaser.0.zzpos

pin in float xxpos;


Is the problem just that you can't decide if the pin is called xxpos or zzpos?

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

Time to create page: 0.076 seconds
Powered by Kunena Forum