RoboDK Forum
Index External Axis- Printable Version

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API)
+--- Thread: Index External Axis (/Thread-Index-External-Axis)



Index External Axis-DNikolovBA-12-10-2020

Is there a way to address indexing of a 7th and 8th axis of an external turntable using movJ, joints or similar command?

I am trying to conduct an operation and then rotate the turntable by a set amount and repeat the same operation.


RE: Index External Axis-Jeremy-12-11-2020

Hi DNikolov,

I think this would help.
I'm using this macro to index a conveyor, but it's the same exact concept.

Jeremy


RE: Index External Axis-DNikolovBA-12-11-2020

Jeremy,

Can you expand a little on the implementation with the turntable. While my turntable is set and valid, how would I modify the move joints command to encapsulate the two axis of the turn table. Cobbling some code together I came up with the following 'clunky' code:

from robolink import * # RoboDK API
from robodk import * # Robot toolbox
angle = 180
layers = 10

RDK = Robolink()

# Retrieve the robot, reference frame and create a program
robot = RDK.Item('', ITEM_TYPE_ROBOT)
reference = robot.Parent()

# Create a new program
program = RDK.AddProgram('Test')

#定义一个参考姿势
#pos = transl(100,200,300)*rotx(pi)

# Turn Off automatic rendering (faster)
RDK.Render(False)

# Don't show instructions (faster)
program.ShowInstructions(False)

# Specify the reference frame you want to use
program.setPoseFrame(reference)

xx = (layers*360.0)/angle
x = int(xx)

newvalues = {'Speed': 200}


for i in range(x):
targetname='Target %i' % i
target=RDK.AddTarget(targetname,reference,robot)
#target.setPose(transl(0, 0, 0) * pos)

# Set the external axes
axes = [0, i*angle]

# For cartesian targets RoboDK will ignore robot joints but not external axes
all_axes = [90,0,0,0,0,-90] + axes
# Quick way to create an array:
# [0,0,0,0,0,0, ext_axis_1, ext_axis_2]

# Set the target and create a move instruction
target.setJoints(all_axes)
target.setAsJointTarget()
program.MoveJ(target)

# If you are creating a long program, this helps keeping the tree small (faster)
if i % 20 == 0:
program.ShowTargets(True)

program.ShowTargets(True)


RE: Index External Axis-Jeremy-12-14-2020

If you could join the .rdk station that would help me understand your code.

I feel like it could be way simpler.

Jeremy


RE: Index External Axis-DNikolovBA-12-15-2020

Jeremy,

Yes I believe that I can be much simpler as this method creates a host of targets for each index.


RE: Index External Axis-Jeremy-12-15-2020

Here's a station that should work and here the python code.

Code:
#------ CONSTANT ------
ROBOT_NAME = 'Motoman MH50'
INCREMENT_EXT_1_DEG = 5
INCREMENT_EXT_2_DEG = 20

joints = []

robot = RDK.Item(ROBOT_NAME,itemtype=ITEM_TYPE_ROBOT)

if robot.Valid():
joints = robot.Joints()
joints[6] += INCREMENT_EXT_1_DEG
joints[7] += INCREMENT_EXT_2_DEG
robot.MoveJ(joints)


Jeremy


RE: Index External Axis-DNikolovBA-12-16-2020

Jeremy,

Thanks a lot. This is exactly the code prototype I was looking for.

Regards,
Dan