jogging through Python interface fails for joints/axes != 0 (LinuxCNC master)

More
26 Feb 2017 11:27 - 26 Feb 2017 13:09 #88628 by DaBit
At some point in time I ran into the problem that I cannot jog an axis or joint other than 0 through the Python interface.
LinuxCNC is master, up to date.

When running sim.axis, axis_mm.ini, this code fails:
#!/usr/bin/env python
import linuxcnc

command = linuxcnc.command()
status = linuxcnc.stat()

status.poll()

if status.task_mode != linuxcnc.MODE_MANUAL:
  print "Switching to manual mode.."
  command.mode(linuxcnc.MODE_MANUAL)

# Switching TP mode does not make any difference
#if status.motion_type == linuxcnc.TRAJ_MODE_TELEOP:
  #print "Switching to joint mode.."
  #command.traj_mode(linuxcnc.MODE_FREE)
  #command.teleop_enable(False)

# axis/joint 0, this works
command.jog(linuxcnc.JOG_INCREMENT,0,False,100,1)

# axis/joint 1, produces bad axis num cmd=48 error. It also fails if we want to jog in Joint mode.
command.jog(linuxcnc.JOG_INCREMENT,1,False,100,1)



Link to the doc for the Python interface: linuxcnc.org/docs/devel/html/config/pyth...ommand_tt_attributes


Previously it worked, but I don't know exactly when it stopped doing that. Bug or user error?
Last edit: 26 Feb 2017 13:09 by DaBit.

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

More
26 Feb 2017 14:06 #88630 by dgarrett
In the master branch, as updated for joints_axes, the second
parameter to the jog() command is a joint-flag to select
jointmode (True) or teleop (False) jogging and the third
parameter is an axis-or-joint-number

so your failing commmand:

command.jog(linuxcnc.JOG_INCREMENT,1,False,100,1)

should probably be:

command.jog(linuxcnc.JOG_INCREMENT,False,1,100,1)


updated docs:
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...a457bd6ffdece845920c
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...6fe92f55c04b30937edf

eventually these will show up here:
linuxcnc.org/docs/devel/html/config/python-interface.html
The following user(s) said Thank You: DaBit

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

More
26 Feb 2017 15:45 #88636 by DaBit
I can confirm that swapping axis-num and joint-flag solves the problem

Thanks!

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

Time to create page: 0.115 seconds
Powered by Kunena Forum