[solved]Unable to WRITE float pin OUT

More
16 Dec 2014 01:49 - 12 Jan 2015 17:07 #54032 by bkt
I try to write this tipe of GCODE:

X100 Y[40 + #<_hal[mycomp.yo]>] Z800 .... in my gcode I use already #<_hal[mycomp.value] pin with success.

in my comp have this:
pin in float my = 0   "some description";
...
...
pin out float yo = 0   "some description";

void usermainloop(void)
{
   while(true)
{
   FOR_ALL_INSTS()

      yo = my;
......

In my hal file:

net encoder2 encoder.2.position => mycomp.my


In hal configuration I can see change both the value but the GCODE don't work properly ......


WHY??? where is My Mystake .... some ideas? :blush:

I CHANGE THE TITLE BECAUSE BETTER DESCRIBE MY REAL PROBLEM
Last edit: 12 Jan 2015 17:07 by bkt.

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

More
16 Dec 2014 18:32 - 16 Dec 2014 23:32 #54057 by bkt
I understand my problem ..... but probabily I have posted in wrong session .... moderator can change post location ....

I can't load pin in float on user_mainloop in this way: myPinOutFloat = myPinInFloat.... I understand that is not possible this way too:
void myfunction (float var)
{
......
}


void usermainloop(void)
{
   while(true)
{
   FOR_ALL_INSTS()

     myFloatGlobalVariable = myPinInFloat;
     myfunction(myFloatGlobalVariable);

........
......


there is some way to do this ?????? :ohmy: :ohmy: :ohmy: :ohmy:


THE PROBLEM RESULT: I READ THE PIN VALUE BUT NOT SPREADS ALONG THE CODE .

I TRY TO MAKE AN OTHER COMPONENT NOT USER.
Last edit: 16 Dec 2014 23:32 by bkt.

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

More
16 Dec 2014 23:24 - 16 Dec 2014 23:26 #54067 by bkt
I can not understand ....

I try to make a component non user ... similar to this:
component  tcomp "";

pin in float value "";
pin out float vx1 "";    
pin out float vy1 "";   
pin out float vx2 "" ;  
pin out float vy2 "" ;  

function _ ;
;;

FUNCTION(_){

float cx = 0;

cx = value;
vx1 = 40.0;
vy1 = value - 40.0;
vx2 = -200.0;
vy2 = value - 300.0;
}

than I install it with sudo --install tcomp.comp, and put it in myhal.hal file in this way:
loadrt mycustomkinematics
loadusr -W myfirstcomp
loadrt tcomp

.....
....

at start of myhal file obtai this error:

tcomp.value pin do not exist 4232 ?????????? :angry: :angry: :angry: :angry:
Last edit: 16 Dec 2014 23:26 by bkt.

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

More
17 Dec 2014 00:20 #54068 by ArcEye
Hi

than I install it with sudo --install tcomp.comp, and put it in myhal.hal file in this way:

loadrt mycustomkinematics
loadusr -W myfirstcomp
loadrt tcomp

.....

at start of myhal file obtai this error:

tcomp.value pin do not exist 4232 ?????????? :angry: :angry: :angry: :angry:


I thought that perhaps 'value' was a protected name, but it is not

I built your code (had to add license "LGPL" before it would build but thats it) and ran halrun
msgd:0 stopped
rtapi:0 stopped
halcmd: loadrt test
halcmd: show pin
Component Pins:
Owner   Type  Dir         Value  NameEpsilonFlags
 32770  float IN              0  test.0.value0.0000100
 32770  float OUT             0  test.0.vx10.0000100
 32770  float OUT             0  test.0.vx20.0000100
 32770  float OUT             0  test.0.vy10.0000100
 32770  float OUT             0  test.0.vy20.0000100

Normally this error occurs because the pin is referenced before it is created and properly initialised

That is why userspace modules are normally started with loaduser -W to force a wait until ready before continuing.

Alternately it could be you forgot to add it to a thread ( or you added it to a non fp thread?)

regards
The following user(s) said Thank You: bkt

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

More
17 Dec 2014 02:02 - 17 Dec 2014 02:03 #54073 by bkt
ok .... halrun show me the pin correctly.

I have load my compom in this way ... is wrong? (yess .... i not correctly addf tcomp .... tanks ... now work but not solve my problem)
loart kins
loadusr -W myusrcomp
loadrt tcomp


loadrt thread name=myth period2=1100000 fp2=1
.....
addf tcomp.0 myth 

PROBLEM:

My intention is to grab encoder position (value .... or some other name ex: valy) and put out a float value for Gcode. Es:
component  tcomp "";

pin in float value "";
pin out float vx1 "";    
pin out float vy1 "";   
pin out float vx2 "" ;  
pin out float vy2 "" ;  

function _ ;
license "LGPL";
;;

FUNCTION(_){

float cx = 0;

cx = value;
vx1 = 40.0;                    <----real x value
vy1 = value - 40.0;      <----real y value
vx2 = -200.0;                <----real x value
vy2 = value - 300.0;   <----real y value
}

and in gcode
X#<_hal[tcomp.vx1]> Y#<_hal[tcomp.vy1]> Z100
.....
.....
X#<_hal[tcomp.vx2]> Y#<_hal[tcomp.vy2]> Z100
......
.....

problem2: tcomp.vx1/2 is OK AND WORK PERFECT
tcomp.vy2/1 never updated ... why??????

The second idea is to use sampler and take the data from the FIFO . I already have a component that works and that reads from an ethernet port .
But utilize the fifo it seems ridiculous to do this simple thing.

Why the encoder pin in in tcomp seems not to be used ?
Last edit: 17 Dec 2014 02:03 by bkt.

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

More
17 Dec 2014 02:11 #54074 by bkt
The same problem if I use an other user-component (load with loadusr -W ...) .... the encoder value is not utilized ...

NOTE: the encoder value change always .... my operation in real world (from a request to an other) is every 0.7 sec.

basically I have a delta pik & place . Every 0.7-0.9 sec try to remove an offset on a Cartesian axis .

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

More
17 Dec 2014 02:43 #54076 by ArcEye

problem2: tcomp.vx1/2 is OK AND WORK PERFECT
tcomp.vy2/1 never updated ... why??????


The obvious difference is that the x values are set and always the same, so they will work.

You transfer the value to cx but never use it?

I would be debugging by printing out the contents of 'value' and cx, even though it will soon fill the terminal, just to see what is happening and if there is some way of printing the encoder output to compare do that too.

regards
The following user(s) said Thank You: bkt

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

More
17 Dec 2014 03:13 - 17 Dec 2014 04:31 #54077 by bkt

The obvious difference is that the x values are set and always the same, so they will work.


ok ... I had it figured out I also .... but I not undesrtand why .... how cat printf to terminal the result?? I use rtapi_print ... but how terminal call??
Last edit: 17 Dec 2014 04:31 by bkt.

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

More
17 Dec 2014 15:08 - 17 Dec 2014 15:28 #54085 by bkt
ok I run linuxcnc from terminal whit "linuxcnc mydir/mymachine.ini" ...... after some row I have an error:
........
........
Sratting Linuxcnc ....
ERROR: channel 0 realtime part is not loaded

no other .... but in my tcomp I have already insert
rtapi_print("cx, %3.2f", cx);
at this point I think the tcomp work without realtime.

I don't know the origin of this error..... :blush: :blush:

OK OK my mystache .... i have not cancel loadrt halsampler that not use yet.

But not print value in my terminal ....
Last edit: 17 Dec 2014 15:28 by bkt.

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

More
17 Dec 2014 15:52 #54086 by bkt
I find debug set ......

Ok the terminal fills up early ... but if I see all EMC_TRAJ_LINEAR_MOVE .... i see only GCode coordinate or coordinates that originate from the numbers and not by the variablexample:
FUNCTION(_){

float cx = 0;

cx = valy;
vx1 = 40.0;                    <----real x value
vy1 = cx - 40.0;      <----real y value
vx2 = -200.0;                <----real x value
vy2 = cx - 300.0;   <----real y value    CX  value seems to be always 0 
}

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

Time to create page: 0.106 seconds
Powered by Kunena Forum