Pokeys_homecomp EncoderSearch / Encoder Arm Topic: Pos_Fb Following errors

More
7 years 10 months ago #121940 by andypugh
Replied by andypugh on topic Pokeys
Well, that's weird.

"show pin" was only meant as a way to get some output to check if the pin existed. It wasn't meant to fix the problem.
Does the problem un-fix if you take the "show pin" back out again?

I don't see any reason for "setp pokets.0.devSerial" to need to be in the postgui call list.

It looks like some sort of race condition, which is odd as the -W should wait for completion.

Do you have the potentiometer values appearing and changing in HAL?

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

More
7 years 10 months ago #122000 by Erikcnc
Replied by Erikcnc on topic Pokeys

andypugh wrote: Well, that's weird.

"show pin" was only meant as a way to get some output to check if the pin existed. It wasn't meant to fix the problem.
Does the problem un-fix if you take the "show pin" back out again?

I don't see any reason for "setp pokets.0.devSerial" to need to be in the postgui call list.

It looks like some sort of race condition, which is odd as the -W should wait for completion.

Do you have the potentiometer values appearing and changing in HAL?



I could try to remove 'show pin' and check if its realy that issue.
Another thing, those arrows are they have a function? Does it make a difirents how you insert them? ( <= or => )

About those potentiometers, i set them as analog input with the pokeys software.
I have to check how i can see values insted of I/0 dots.

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

More
7 years 10 months ago #122004 by andypugh
Replied by andypugh on topic Pokeys

Erikcnc wrote: I could try to remove 'show pin' and check if its realy that issue.

It might just be that "show pin" uses up a couple of mS of CPU time

Another thing, those arrows are they have a function? Does it make a difirents how you insert them? ( <= or => )

No, they are optional, for human legibility.


About those potentiometers, i set them as analog input with the pokeys software.
I have to check how i can see values insted of I/0 dots.

Halmeter (From the "Machine" menu in Axis) will show you the value of a HAL pin or parameter.
You can keep choosing the option and open several.

Other GUIs get it in other ways, except for Touchy where you need to open a terminal and type "halcmd loadusr halmeter" (and that works on all GUIs and none)#

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

More
7 years 10 months ago #122133 by Erikcnc
Replied by Erikcnc on topic Pokeys
So i checkt if there was a value i can read.
The issue is that the pin i use (45, 46, and 47) are bit type. So, i see that they are constand TRUE.

I set these pins in Pokeys software as analog.

In linuxcnc they have to be a FLOAT type output. How can i change this?

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

More
7 years 10 months ago - 7 years 10 months ago #122134 by andypugh
Replied by andypugh on topic Pokeys
You should see some pins called "ain"
Code:
pin out unsigned ain-# [3];

something like pokeys.0.ain-0
They are unsigned int rather than float, to convert to float you would need to convert to float then scale them.

If I was doing it I would modify the HAL component to output scaled float.

change the line above to
Code:
pin out float ain-# [3];
And add
Code:
pin in float analog-scale-# [3];

Then change this
Code:
for(i=0;i<3;i++)ain(i)=dev->Pins[i+44].AnalogValue;
to
Code:
for(i=0;i<3;i++)ain(i)=(dev->Pins[i+44].AnalogValue * analog_scale(i)) /4096.0 ;
Last edit: 7 years 10 months ago by andypugh.
The following user(s) said Thank You: KCJ

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

More
7 years 9 months ago #124681 by Erikcnc
Replied by Erikcnc on topic Pokeys
Hi Andy,

After some other projects i would like to give this another try.
so, i understanding that the comp file should look like this.
Code:
component pokeys "PoKeys IO driver, by Mit Zot"; option userspace yes; pin out bit in-# [55]; pin out fload ain-# [3]; pin out bit err; pin in unsigned devSerial; pin out bit alive; pin in float analog-scale-# [3]; license "GPL"; ;; #include "PoKeysLib.h" #include <unistd.h> /* UNIX standard function definitions */ sPoKeysDevice * dev=0; int i=0; void user_mainloop(void) { while(0xb){ FOR_ALL_INSTS() { while(dev == NULL)dev = PK_ConnectToDeviceWSerial(devSerial, 38163); //waits for usb device alive=1; if ((PK_DigitalIOGet(dev) == PK_OK) && (PK_AnalogIOGet(dev) == PK_OK)){ //gets IO data and checks return value err=0; for(i=0;i<54;i++)in(i)=!dev->Pins[i].DigitalValueGet; //just transfers values for(i=0;i<3;i++)ain(i)=dev->Pins[i+44].AnalogValue * analog_scale(i)) /4096.0 ; } else{ //on connection error PK_DisconnectDevice(dev); dev=NULL; //tries to reconnect err=1; for(i=0;i<54;i++)in(i)=0; for(i=0;i<3;i++)ain(i)=0; } alive=0; usleep(40000); } } exit(0); }

does this looks correct?

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

Time to create page: 0.137 seconds
Powered by Kunena Forum