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

# Control robot and turn table through python api

Hello everyone,

I'm doing a project involving external axis. A turn table is synchronized with robot. The target trajectory requires to slope the turning disc and cotrol the tool in parallel to the surface of the rotating disc.

The tool moves by steps, and for each step the turndisc moves from -180° to 180°. The trajectory is as depicted in attached file.

I'm wondering how to manage external axis in this case ? The rdk is in attached file.

Thanks,

Attached Files Image(s)

You should create target items and move to those targets to have control over the tool position, orientation and joint axes for external axes.

This thread shows how to deal with targets and external axes:

This is a similar example closer to what you need:
Code:
```# Set the value of the external axis e1 = 45 # in deg for a turntable e2 = 30 # in deg for a turntable # Create target and set the desired external axes and pose t = RDK.AddTarget("MyTarget", reference, robot) t.setJoints([0,0,0,0,0,0, e1, e2]) t.setPose(robot.Pose()) # Recalculate the joint position based on the new position of the external axis # Robot joints are updated but not external axis t.setAsCartesianTarget() t.Joints() jnts = t.Joints() print(t.Name() + "-Joints: " + str(jnts.list()))```
(03-01-2022, 02:58 PM)Albert Wrote: You should create target items and move to those targets to have control over the tool position, orientation and joint axes for external axes.

This thread shows how to deal with targets and external axes:

This is a similar example closer to what you need:
Code:
```# Set the value of the external axis e1 = 45 # in deg for a turntable e2 = 30 # in deg for a turntable # Create target and set the desired external axes and pose t = RDK.AddTarget("MyTarget", reference, robot) t.setJoints([0,0,0,0,0,0, e1, e2]) t.setPose(robot.Pose()) # Recalculate the joint position based on the new position of the external axis # Robot joints are updated but not external axis t.setAsCartesianTarget() t.Joints() jnts = t.Joints() print(t.Name() + "-Joints: " + str(jnts.list()))```

Thanks Albert for your reply. How to move one joint of turntable according to a reference rotational speed ? The others joints should not change.
Thanks Albert for your help. How to move one joint of turntable according to a reference rotational speed ? The others joints should not change.
You can calculate the position of the turntable for each point in your path. If you keep the pose constant, the relationship between the tool and your part should not change.
Thank you very much for your help Albert. It works fine !
(03-06-2022, 09:28 AM)Albert Wrote: I reactivate this thread, because I have issue with Joints movement. In simulation it works, but in pactice at the step of "MoveJ(t.Joints)", the joint of tool changes with the move of turntable. Would you like to explain me how to keep the pose constant. In other words, how to move only the joints of external axes and keep fixe the pose ?
You can simply retrieve the current robot joints and modify the external axes.

Example:
Code:
```joints = robot.Joints() # retrieve the current position joints[6] = 0 # Set the 7th axis to 0 (E1) joints[7] = 0 # Set the 8th axis to 0 (E2) robot.MoveJ(joints) # Move the robot```
Thanks Albert for your answer.  For example, with program in bellow, I get the result in the attached file. My purpose, is to have x,y,z,w,p,r format at P[3] and avoit joint fomat in GP1.

p_home = Fanuc_2_Pose([Ox,Oy,Oz,0,0,90])
robot.MoveL(p_home)

p_target = Fanuc_2_Pose([Ox+170,Oy,Oz,0,0,90])
robot.MoveL(p_target)

# Set the value of the external axis
e6 = 30 # in deg for a turntable
e7 = 180 # in deg for a turntable

# Create target and set the desired external axes and pose
t.setJoints([0,0,0,0,0,0, e6, e7])
t.setPose(robot.Pose())

t.setAsCartesianTarget()
t.Joints()

jnts = t.Joints()
print(t.Name() + "-Joints: " + str(jnts.list()))

robot.MoveJ(t)

 Users browsing this thread: 2 Guest(s)