pyvcp -> Jog Button -> Changing from Continuous mode to Incremental and back.

  • Askjerry
  • Askjerry's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
26 Nov 2023 05:13 #286528 by Askjerry
I have made jog buttons on pyvcp for at least a decade... but they have ALWAYS run in continuous mode... even if the main panel has another mode like "5mm" selected. A couple of times this has caused issues. (Like slamming down the Z-axis.)

A sample panel in the most recent versions of AXIS looks like this... custom-postgui.hal
#---------------------------------------------------------------------------------
# connect the X PyVCP buttons

    net panel-jogxminus     halui.axis.x.minus     <= pyvcp.x-minus
    net panel-jogxplus        halui.axis.x.plus        <= pyvcp.x-plus

#---------------------------------------------------------------------------------
# connect the Y PyVCP buttons

    net panel-jogyminus     halui.axis.y.minus        <= pyvcp.y-minus
    net panel-jogyplus        halui.axis.y.plus           <= pyvcp.y-plus

#---------------------------------------------------------------------------------
# connect the Z PyVCP buttons

    net panel-jogzminus     halui.axis.z.minus     <= pyvcp.z-minus
    net panel-jogzplus        halui.axis.z.plus        <= pyvcp.z-plus

#---------------------------------------------------------------------------------
# connect the PyVCP jog speed slider
 net panel-jogspeed halui.axis.jog-speed     <= pyvcp.jog-speed-f
#---------------------------------------------------------------------------------

I'm thinking that if I put in a SPINBOX (or similar) and the user has "0" that should be continuous mode... and if I set the spinbox to let's say "5.0" it should jump in 5mm steps. (presuming I built a METRIC based machine.)

I even tried making another X+ and X- button pair and attempted pointing them at halui.axis.x.increment-minus and halui.axis.x.increment-plus as an experiment... but that didn't seem to work.

Of course with "normal" jog buttons, if you don't have a slider set up properly, then have something like
net panel-jogspeed halui.axis.jog-speed     <= pyvcp.jog-speed-f

The result is a ZERO feed rate... and nothing happens. (It can't move at 0mm per sec.)
So I'm wondering what is needed to make this happen??

Ideally, I would have normal jog buttons, then a spinbox. (or similar).. if set to "0.0" you continue moving... otherwise you increment. I've tinkered a few hours now... I'm probably missing something obvious.

And... It doesn't have to be a spinbox... I can have predefined buttons for CONT, 5mm, 1mm, 0.5mm and 0.1mm if that's easier.

So... what am I missing on the pyvcp buttons to do this???

Thanks,
Jerry

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

  • andypugh
  • andypugh's Avatar
  • Away
  • Moderator
  • Moderator
More
09 Dec 2023 10:26 - 09 Dec 2023 10:31 #287628 by andypugh
You need to use different HAL pins for incremental jogs.



halui.joint.N.increment float in
pin for setting the jog increment for joint N when using increment-plus/minus

halui.joint.N.increment-minus bit in
a rising edge will will make joint N jog in the negative direction by the increment amount

halui.joint.N.increment-plus bit in
a rising edge will will make joint N jog in the positive direction by the increment amount

halui.axis.L.increment float in
pin for setting the jog increment for axis L when using increment-plus/minus

halui.axis.L.increment-minus bit in
a rising edge will will make axis L jog in the negative direction by the increment amount

halui.axis.L.increment-plus bit in
a rising edge will will make axis L jog in the positive direction by the increment amount
Last edit: 09 Dec 2023 10:31 by andypugh.
The following user(s) said Thank You: Askjerry

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

  • Askjerry
  • Askjerry's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
09 Dec 2023 15:55 #287681 by Askjerry
Thank you Andypugh !

So it looks like I will have my joystick set up to move the tool in continuous mode, then have a set of buttons for incremental mode. I have a WINGMAN joystick (looks like a PlayStation controller) that has a 4-button cluster on the left, and another on the right. I can program them so that they control the tool that way. I'll have an on-screen setting for jog speed and increment. That will allow me to lean over the table and get a closer look as I ease it into position. Very helpful... thanks again.

I find it interesting that EACH AXIS has it's own increment value... I thought they would all be the same. I'll have to see if I can NET them all together. ( halui.axis.L.increment float in )

Once I get it working... or if I run into other issues... I'll follow-up here.
 

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

  • andypugh
  • andypugh's Avatar
  • Away
  • Moderator
  • Moderator
More
09 Dec 2023 18:44 #287706 by andypugh
Different values makes sense if you consider rotary axes.

You can probably use HAL magic to do both incremental and continuous with the same joystick.
The first thing that I would try would be to link each joystick direction to all four pins for the relevant axis and then set the increment to zero and nonzero velocity, or zero velocity and nonzero increment and see what happens.

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

  • Askjerry
  • Askjerry's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
09 Dec 2023 20:39 - 09 Dec 2023 20:41 #287716 by Askjerry
Actually... I'll work with the dual sets of buttons on the joystick. I'll use X/Y on both sets, left will be continuous to roughly get it into position, right will be 10mm, 1mm, 0.1mm to fine-tune it. As for the Z-axis, I have four buttons on the front of the joystick.... left up and down will be continuous, right up and down incremental. The two other buttons will be tied to SET HOME and SAFE MOVE HOME. It has two analog joysticks too... these could set the speed and resolution. The nice thing about it... if I use it a bit and don't like it... I can change it.
For $13 it's a poor-man's pendant,

www.walmart.com/ip/Logitech-WingMan-Prec...n-Game-Pad/175103432
 
Last edit: 09 Dec 2023 20:41 by Askjerry.

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

  • Askjerry
  • Askjerry's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
11 Dec 2023 03:35 #287811 by Askjerry
They say "Go big or go home."

I purchased a WIRELESS Joystick... thinking "Wouldn't it be cool to operate the machine wirelessly???"

I went on Amazon and got this: www.amazon.com/dp/B0CC91XMY4

Then after about 2 hours of tinkering...

custom_postgui.hal
#---------------------------------------------------------------------------------
# To use the next line the proper device must be plugged in or it will fail

  loadusr -W hal_input -KRAL shanwan Android GamePad
# The above is a wireless joystick, buttons have different names from other wired joysticks

# Point the Jog Speed to the slider
net panel-jogspeed <= halui.axis.jog-speed <= pyvcp.jog-speed-f

net joy-x-pos <=  halui.axis.x.plus   <=  input.0.abs-hat0x-is-pos        
net joy-x-neg <=  halui.axis.x.minus  <=  input.0.abs-hat0x-is-neg
net joy-y-pos <=  halui.axis.y.plus   <=  input.0.abs-hat0y-is-neg # Reversed
net joy-y-neg <=  halui.axis.y.minus  <=  input.0.abs-hat0y-is-pos # Reveresd
net joy-z-pos <=  halui.axis.z.plus   <=  input.0.btn-tl
net joy-z-neg <=  halui.axis.z.minus  <=  input.0.btn-tl2

net joy-x-inc-pos <= halui.axis.x.increment-plus  <= input.0.btn-b
net joy-x-inc-neg <= halui.axis.x.increment-minus <= input.0.btn-x
net joy-y-inc-pos <= halui.axis.y.increment-plus  <= input.0.btn-y
net joy-y-inc-neg <= halui.axis.y.increment-minus <= input.0.btn-a
net joy-z-inc-pos <= halui.axis.z.increment-plus  <= input.0.btn-tr
net joy-z-inc-neg <= halui.axis.z.increment-minus <= input.0.btn-tr2

# This run-on line links multiple items together... ugly but functional

net joy-x-increment <= halui.axis.x.increment <= halui.axis.y.increment <= halui.axis.z.increment <= pyvcp.joy-incremental
#---------------------------------------------------------------------------------

And this is the two items I needed to add to my pyvcp to work with them...

pyVCP Panel
<?xml version='1.0' encoding='UTF-8'?>
<pyvcp>
<!-- START OF PANEL -->
<vbox>
        <relief>RAISED</relief>
        <bd>2</bd>

    <label>    <!-- the jog speed slider -->
                <text>"Joystick Jog Speed"</text>
                <font>("Helvetica",8)</font>
                <fg>"#000000"</fg>
                <bg>"#BBBBBB"</bg>
        </label>

        <scale>
                <font>("Helvetica",8)</font>
                <fg>"#000000"</fg>
                <bg>"#BBBBBB"</bg>
                <halpin>"jog-speed"</halpin>
                <orient>HORIZONTAL</orient>
                <resolution>1</resolution>
                <initval>1000</initval>
                <min_>1</min_>
                <max_>2500</max_>
        </scale>  

    <label>    <!-- Increment Distance -->
                <text>"Joystick Incremental"</text>
                <font>("Helvetica",8)</font>
                <fg>"#000000"</fg>
                <bg>"#BBBBBB"</bg>
        </label>

    <spinbox>
        <halpin>"joy-incremental"</halpin>
        <width>5</width>
        <min_>0</min_>
        <max_>25</max_>
        <initval>5</initval>
        <resolution>0.1</resolution>
        <!-- Format is _._f  num-digits.num-digits -->
        <format>"2.1f"</format>
        <font>("Helvetica",15)</font>
    </spinbox>
<!-- ========================================================================== -->
</vbox>

<!-- END OF PANEL -->
</pyvcp>

So tomorrow I'll mount it on the machine and start testing!! (Maybe tonight...)

It has two more signals of interest to me...
  • input.0.btn-select
  • input0.btn-start
These will be tied to routines "Set Work Home" and "Safe Go To Home". (Or I may tie the second to Probe Z Home.

I will be able to lean over the machine and closely see where I'm going... and set the home precisely.

I'll make a video and post it here when I'm finished.
Jerry
 

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

  • Askjerry
  • Askjerry's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
11 Dec 2023 23:59 - 12 Dec 2023 00:01 #287894 by Askjerry
I put the data into the machine in the shop... and it failed.

I looked at the DEBUG and it said the pin was not found... long story short here is the answer in case you have that issue...

This SIMULATION PC has a newer version of AXIS loaded... that PC in the garage is older... it was my experimental machine... some signal names are different.

New Name -->  halui.axis.x.plus
Old Name  -->  halui.jog.0.plus

Once I figured that out... I swapped out the naming convention and it worked perfectly. Now I want to make the joystick SELECT button run my SET WORK HOME routine.  The issue is that I have a pyVCP button doing that now... and I can't have two outputs point to a single input.

What I need to do now is add the or2 command that will take my two outputs and process them into a single output or2.0.out then point that at my SET WORK HOME routine. Pretty sure I know how to do that... so off I go.
Last edit: 12 Dec 2023 00:01 by Askjerry.

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

Time to create page: 0.202 seconds
Powered by Kunena Forum