News:

  • August 19, 2026, 09:22:38 AM

Login with username, password and session length

Author Topic: Variable velocity jogging with AXJOG?  (Read 1177 times)

JasonO

  • Jr. Member
  • **
  • Posts: 15
Variable velocity jogging with AXJOG?
« on: June 11, 2026, 12:45:35 PM »
I'm retrofitting a control that includes 2 servo axes, which I will control with step and direction outputs from a BRX. I need to be able to move the axes to preset positions, which is easy enough. I also need to be able to jog them manually with analog joystick, with the target velocity scaled from the analog input. In other words, the axis velocity needs to be dynamically updated based on the analog input signal, while the jog is in process. I don't think I've ever done this particular sort of thing before, so I wanted to see if someone can verify that this can work, and how.

Thanks!

JasonO

  • Jr. Member
  • **
  • Posts: 15
Re: Variable velocity jogging with AXJOG?
« Reply #1 on: June 11, 2026, 12:52:39 PM »
Looks like maybe I need to use AXVEL to achieve this, with the .TargetVelocity dynamically update from the scaled analog value, as log as the instruction is active?

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6172
  • Yes Pinky, Do-more will control the world!
Re: Variable velocity jogging with AXJOG?
« Reply #2 on: June 13, 2026, 12:58:29 PM »
Looks like maybe I need to use AXVEL to achieve this, with the .TargetVelocity dynamically update from the scaled analog value, as log as the instruction is active?

Yes, AXVEL will do what you want.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

JasonO

  • Jr. Member
  • **
  • Posts: 15
Re: Variable velocity jogging with AXJOG?
« Reply #3 on: June 19, 2026, 02:43:51 PM »
Another question on this: Along with the dynamic axis velocity while jogging, I also need to implement soft limits to keep the axes from crashing. I think I need to either a: use AXVEL to jog, and every scan calculate at what point I need to stop the jog and ramp to a stop, based on the current velocity, and considering the current acceleration, or b: Use an AXSCRIPT, with a While loop repeating a Ramp to Vel command, until reaching the point where we need to stop, and then transitioning to a Move to Position command, to bring the axis to a stop at exactly the limit of its stroke, or c: use AXVEL and just simply trim the TargetVelocity as I approach the limit, so that it ramps the TargetVelocity to zero by the time the limit is reached.

Not sure I'm thinking through this all correctly. I would prefer to use S-curve accel/decel ramps, so the math gets a bit dense for me. Maybe I'm overcomplicating this too. Just curious if there's any insight from anyone.

Thanks!

JasonO

  • Jr. Member
  • **
  • Posts: 15
Re: Variable velocity jogging with AXJOG?
« Reply #4 on: August 18, 2026, 10:47:33 AM »
In case it's ever of use to anyone else, the way I ended up achieving variable velocity jogging with servo motors from an analog joystick input, was by using an AXSCRIPT, with a WHILE loop, with a Ramp to Velocity step inside the WHILE. The Ramp to Velocity is set to immediately continue on to the next step.
So as long as the axis permissive (referenced by the WHILE step) is ON, it keeps looping and updating the axis velocity based on the analog input. Meanwhile, I have it calculating on every scan how many pulses will be needed to ramp to a stop from the axis current velocity, using a trapezoid ramp.
When the joystick is released OR the axis reaches the soft limit minus the number of pulses needed to stop, the AXSCRIPT leaves the WHILE loop and switches to an Absolute Position Move step to bring the axis to a stop. That way, if the stop is caused by reaching a soft limit, it can ramp to a stop exactly at the soft limit position, from whatever its initial velocity had been.