Arduino Leonardo and linears encoders.

More
31 Jan 2013 20:15 #29364 by casetero
Ok, i have done another thing, and i think it works:

Now shuttlexpress does connect with the device because i have change this line in shuttlexpress.c too:

original:

if (devinfo.product != PRODUCT_ID) {
204 fprintf(stderr, "%s: dev %s has unexpected Product ID 0x%04x (expected ShuttleXpress, 0x%04x)\n", modname, s->device_file, devinfo.product, PRODUCT_ID);
205 goto fail1;

changed:

if (devinfo.product == PRODUCT_ID) {
204 fprintf(stderr, "%s: dev %s has unexpected Product ID 0x%04x (expected ShuttleXpress, 0x%04x)\n", modname, s->device_file, devinfo.product, PRODUCT_ID);
205 goto fail1;

So then it doesn´t get in to fail.

Now it shows this:


pablo@Pablo-cnc:~$ halrun
halcmd: loadusr shuttlexpress
halcmd: shuttlexpress: checking /dev/hidraw0
shuttlexpress: error opening /dev/hidraw0: Permission denied
shuttlexpress: make sure you have read permission on /dev/hidraw0, read the shuttlexpress(1) manpage for more info
shuttlexpress: checking /dev/hidraw1
shuttlexpress: error opening /dev/hidraw1: Permission denied
shuttlexpress: make sure you have read permission on /dev/hidraw1, read the shuttlexpress(1) manpage for more info
shuttlexpress: checking /dev/hidraw2
shuttlexpress: error opening /dev/hidraw2: Permission denied
shuttlexpress: make sure you have read permission on /dev/hidraw2, read the shuttlexpress(1) manpage for more info
shuttlexpress: checking /dev/hidraw3
shuttlexpress: found KTURT.LTD on /dev/hidraw3
show all
Loaded HAL Components:
ID Type Name PID State
5 User shuttlexpress 1729 ready
3 User halcmd1718 1718 ready

Component Pins:
Owner Type Dir Value Name
5 bit OUT FALSE shuttlexpress.0.button-0
5 bit OUT TRUE shuttlexpress.0.button-0-not
5 bit OUT FALSE shuttlexpress.0.button-1
5 bit OUT TRUE shuttlexpress.0.button-1-not
5 bit OUT FALSE shuttlexpress.0.button-2
5 bit OUT TRUE shuttlexpress.0.button-2-not
5 bit OUT FALSE shuttlexpress.0.button-3
5 bit OUT TRUE shuttlexpress.0.button-3-not
5 bit OUT FALSE shuttlexpress.0.button-4
5 bit OUT TRUE shuttlexpress.0.button-4-not
5 s32 OUT 0 shuttlexpress.0.counts
5 float OUT 0 shuttlexpress.0.spring-wheel-f
5 s32 OUT 0 shuttlexpress.0.spring-wheel-s32

Pin Aliases:
Alias Original Name

Signals:
Type Value Name (linked to)

Parameters:
Owner Type Dir Value Name

Parameter Aliases:
Alias Original Name

Exported Functions:
Owner CodeAddr Arg FP Users Name

Realtime Threads:
Period FP Name ( Time, Max-Time )

halcmd:



Now if i put it in a hal file it supossed that it will create those PINS?? I´m going to try.

Thank you very much!!

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

More
31 Jan 2013 20:33 #29365 by casetero
Ok, it creates the pins, i can see them in Hal meter, they should read the movements and pressing of the buttons of the pendant, shouldn´t they?

It just work one of them, but the important to me:

5 s32 OUT 0 shuttlexpress.0.counts

doesn´t get excited when i move the wheel, that means that is not compatible or have i to do some hal code to link to the PIN??

if i link the pendant to hidcomp the pins hidcomp.0.PINx.raw get automatically linked to the buttons and the wheel of the pendant.

Another thing i can see is hidcomp and shuttlexpress can´t work together, can they?

Thank you very much.

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

More
01 Feb 2013 00:35 - 01 Feb 2013 00:40 #29388 by ArcEye
As I said previously

After that it is just the small matter of whether component, as written, will do what you want ..................


I looked back through the thread to find out where the idea of using shuttlexpress came from, and found it was based solely upon the fact that the windoze driver zip for the pendant
had a similarly named file called shuttlepro.dll in it

I think you would be better off using hidcomp and trying to map the button presses, or read the hidraw device and try to map it that way

regards
Last edit: 01 Feb 2013 00:40 by ArcEye.
The following user(s) said Thank You: casetero

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

More
01 Feb 2013 00:59 - 01 Feb 2013 01:10 #29391 by casetero
Yes it was a risk, but i had to try it and you and Andy have helped me a lot. I have learnt a lot trying too. I think it is been positive.

Now i´m trying to map it, and i can handle with all the others buttons with te comp function. But i can´t manage with the wheel.

The thing is my wheel doesnt return to the rest point unless i move it slowly. And it decreases or creases (clock-wise or non-clock-wise) its float value as much as faster i move it. Do you know any hal component or parameter that can manage that PIN??

With the comp function it lost almost every count because it doesnt return to the rest point, so the comp.0.out stays in TRUE unless i stop moving the wheel or i move ir very slowly.

This is the code i wrote:
loadrt comp count=1

addf comp.0 servo-thread

setp halui.jog-speed 100
setp halui.jog.0.increment 0.1

setp comp.0.in0 -0.9988
net comparator hidcomp.0.PIN4.fvalue comp.0.in1

net x-jog comp.0.out halui.jog.0.increment-plus

The first value that hidcomp.0.PIN4.fvalue shows when start moving is -0.9922, faster it shows -0.9877, -0.9766.... halui.jog.0.increment-plus stays in TRUE just sending one count until hidcomp.0.PIN4.fvalue goes under -0.9988...

Thank you!
Last edit: 01 Feb 2013 01:10 by casetero. Reason: add info

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

More
01 Feb 2013 01:40 #29396 by andypugh

The first value that hidcomp.0.PIN4.fvalue shows when start moving is -0.9922, faster it shows -0.9877, -0.9766.... halui.jog.0.increment-plus stays in TRUE just sending one count until hidcomp.0.PIN4.fvalue goes under -0.9988...


Forget the fvalues.

What do the other pins do?

I think that the behaviour does sound a lot like the shuttle express, that acts really wierd too. I suspect that it is related.
The following user(s) said Thank You: casetero

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

More
01 Feb 2013 06:20 - 01 Feb 2013 06:21 #29405 by casetero
Sorry Andy, had to go before and didn´t see your post. I think it is related too, but shuttlexpress doesn´t match with the signals correctly.

Tomorrow i´ll put you what the other pins do, i´m not with the machine now. But basicly for the wheel it gives 3 pins:

hidcomp.0.PIN4.raw -s32
hidcomp.0.PIN4.ivalue -u32 ( Can´t remember esactly)
hidcomp.0.PIN4.fvalue -float ( The one i have talk about in the other post)

And all them do basicly the same but with different values. Tomorrow i will put you what they show.

Thank you.
Last edit: 01 Feb 2013 06:21 by casetero. Reason: errates

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

More
01 Feb 2013 16:45 #29428 by andypugh

hidcomp.0.PIN4.raw -s32
hidcomp.0.PIN4.ivalue -u32 ( Can´t remember esactly)
hidcomp.0.PIN4.fvalue -float ( The one i have talk about in the other post)
And all them do basicly the same but with different values.

My concern is that floating-point values are always a bit approximate, so I prefer not to use them

In 3 weeks I will be back at home, I would be willing to see what I can do about a driver for this device then, if you are willing to post it to the UK for as long as it takes.
The following user(s) said Thank You: casetero

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

More
01 Feb 2013 17:17 #29429 by casetero
Ok, i think the easiest to manage is hidcomp.0.PIN4.raw. (s32--->Normal numbers :) )


This pendant is part of my final carreer project, and i have to try to link correctly with linuxcnc, but if i can´t (what it is expected), i would be very gratefull if you could do a driver to it.

I think the better solution would be to make a Hal component that can manage the hidcomp PIN (hidcomp.0.PIN4.raw). This component has to read that PIN and return a variable called for example return.0.counts in s32 type.

return.0.counts has to increase his value everytime that hidcomp.0.PIN4.raw change his value, if it changes between 1-10 it has to excite too the direction PIN positive, and if it changes between 250-0 it has to excite the direction PIN negative.

Something like this maybe works. If it is easier we can work with halui.jog.0.increment-plus (bits) instead of axis.N.jog-counts (s32).

What do you think??

Thank you!

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

More
01 Feb 2013 17:20 - 01 Feb 2013 18:58 #29430 by casetero
Another thing we can do is making more efficient the program i did four post ago.

If there is anyway to make that hidcomp.0.PIN4.fvalue returns to its rest value every 0.10 sec no matter where the wheel is, then it should work fine.

Or pin comp.0.out, if i can manage with a thread or something to reset it to a False value each 0.1 sec it would work fine, doing this it would be changing from TRUE to FALSE every 0.1 sec while i´m moving the wheel.

Thank you!
Last edit: 01 Feb 2013 18:58 by casetero. Reason: add info

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

More
01 Feb 2013 19:57 - 01 Feb 2013 20:09 #29432 by casetero
Ok, i´ll put you easier. Can i make any HAL code to change a mux2.0.sel from values 0 and 1 every 0.2 sec for example?

I´m going to open another thread in the HAL componentes forum to ask this because a post with 10 pages is a little bit scary!

Thank you!
Last edit: 01 Feb 2013 20:09 by casetero.

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

Time to create page: 0.100 seconds
Powered by Kunena Forum