• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5

# Index External Axis

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.
Hi DNikolov,

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

Jeremy

Attached Files
NextBox.py (Size: 636 bytes / Downloads: 451)
Find useful information about RoboDK and its features by visiting our Online Documentation and by watching tutorials on our Youtube Channel

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

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

# Create a new program

# Define a reference pose
#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.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)
If you could join the .rdk station that would help me understand your code.

I feel like it could be way simpler.

Jeremy
Find useful information about RoboDK and its features by visiting our Online Documentation and by watching tutorials on our Youtube Channel

Jeremy,

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

Attached Files
Test Station 3.rdk (Size: 5.44 MB / Downloads: 385)
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

Attached Files
Indexing.rdk (Size: 5.44 MB / Downloads: 397)
Find useful information about RoboDK and its features by visiting our Online Documentation and by watching tutorials on our Youtube Channel

Jeremy,

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

Regards,
Dan

 Users browsing this thread: 1 Guest(s)