u32 image

More
11 Jul 2011 11:53 #11387 by piasdom
u32 image was created by piasdom
how do i set the halpin to interger value ?
in the xml file or hal ?
if in hal, pyvcp.testimage0
pyvcp.testimage1
etc ...



The "image_u32" is the same as "image_bit" except you have essentially an unlimited number of images and you "select" the image by setting the halpin to a integer value with 0 for the first image in the images list and 1 for the second image etc.


Thanks
kenneth

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

More
11 Jul 2011 12:47 #11393 by andypugh
Replied by andypugh on topic Re:u32 image
I am not completely sure what the question is, but if you want to choose different images based on a number of bit-type inputs then the "weighted_sim" component might help.
(I don't know why it is called that, a better description would be "bit2binary")

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

More
11 Jul 2011 13:16 #11397 by piasdom
Replied by piasdom on topic Re:u32 image
i'm trying to use u32 image

linuxcnc.org/docs/html/hal_pyvcp.html section 1.6.6.2 Image u32

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

More
11 Jul 2011 13:23 #11398 by andypugh
Replied by andypugh on topic Re:u32 image
Yes, I understand that you are trying to use u32Image. My question is about how you want to control it.

What is the data type of the date you want to indicate?

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

More
11 Jul 2011 14:44 #11409 by piasdom
Replied by piasdom on topic Re:u32 image
well, i'm trying to use a button to change the image three times.as with image_bit.
i found a u_32 pin(halui.joint.selected) and used that to get the pyvcp button to show in axis.
now i'm trying to click the button to change the images. i have the button and the
first image is displayed but never changes. but the way you asked the question makes me think
i don't understand u32 :)


Thanks
kenneth

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

More
11 Jul 2011 15:09 #11415 by andypugh
Replied by andypugh on topic Re:u32 image
piasdom wrote:

well, i'm trying to use a button to change the image three times.as with image_bit.
i found a u_32 pin(halui.joint.selected) and used that to get the pyvcp button to show in axis.
now i'm trying to click the button to change the images. i have the button and the
first image is displayed but never changes. but the way you asked the question makes me think
i don't understand u32 :)


I think you will find that the image change if you select a different joint....
Click the X Y Z buttons in the Axis UI and you will probably see the image change.

You need to have a u32 pin which has a value that changes as a result of your button press.
I can think of ways to make a value count up by one every time a pyvcp button is pressed, but it is likely to involve a lot of edge detectors and other functions

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

More
11 Jul 2011 15:24 #11416 by piasdom
Replied by piasdom on topic Re:u32 image
it doesn't change no matter which i select. i ever selected y ... click button
select x ... click button and no change.
but i think i have my lick wrong. when i try to connect halui.joint.selected to
test-pin, says i can't connect 32 to bit. i tried toggle, and2 and or2 and get the
error about crossing u to bit. 32




#testing
net test-pin pyvcp.test
net tested-pin halui.joint.selected pyvcp.testimage

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

More
11 Jul 2011 15:36 #11417 by andypugh
Replied by andypugh on topic Re:u32 image
You need to understand the different data types:
www.linuxcnc.org/docview/2.5/html/hal/ba..._a_id_sec_hal_data_a
There are functions in HAL to convert between them:

conv_bit_s32
conv_bit_u32
conv_float_s32
conv_float_u32
conv_s32_bit
conv_s32_float
conv_s32_u32
conv_u32_bit
conv_u32_float
conv_u32_s32

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

More
11 Jul 2011 16:05 #11421 by piasdom
Replied by piasdom on topic Re:u32 image
Thanks andy, gone areading.

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

More
11 Jul 2011 16:53 #11423 by piasdom
Replied by piasdom on topic Re:u32 image
i've got the below to half way work. i click and hold the mouse button and the image
changes to the second gif. i let go and it goes back the the first gif. the images are some
i already had. should i try a toggle or and2 in the net ?

<labelframe text = "test">

<image name='on' file='on.gif'/>
<image name='off' file='off.gif'/>
<image name='estop' file='Estop.gif'/>
<vbox>
<image_u32 halpin='testimage' images='on off estop'/>
</vbox>

<button>
<halpin>"test"</halpin>
<text>"testing"</text>
<font>('Helvetica 2',14)</font>
<fg>"midnightblue"</fg>
</button>
</labelframe>


post.hal

#testing
net test-pin conv-bit-u32.0.in == pyvcp.test
net tested-pin conv-bit-u32.0.out == pyvcp.testimage

Thanks
kenneth

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

Time to create page: 0.106 seconds
Powered by Kunena Forum