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

Create a 5-axis gantry (3L+2R) with the BuildMechanism function

Hi everyone!

Me and my colleagues want to create a 5-axis gantry for a client's simulation, with three linear axes and 2 rotative. I have tried creating two (3L, 2R) or three (3L, 1R, 1R) machine instances, but it seems impossible to link them the way we intend to (all axes internal to a single mechanism).

I then started to search through the API documentation, to see if there was a way to create a .robot file in order to create any mechanism. I have found this example in the online documentation, which shows it's pretty easy to model a robot geometry. I have also found the BuildMechanism() function in, but this one raises a lot of questions:

-Should the CAD files of objects be imported already assembled, or can their relative position / orientation be defined later in the mechanism creation process?
-What does the parameters argument need? In the online doc, it says "robot parameters in the same order as shown in the RoboDK menu: Utilities-Build Mechanism or robot", but params vary according to the mechanism type. So what exactly are they, and what's the data type?
-joints_sense: there's absolutely no info about this one, either in the file or online. What's the data type, and what does it need? Boolean values for joint inversion?
-The base and tool matrices, should their pose be given according to the station reference frame, or is the tool pose dependent of the base's?
-DH parameters don't seem to be required. How so? The program must need something to simulate the right geometry.

Is this the right tool to create a .robot, or would we need something more?

It's an awful lot of questions, sorry about that. We're trying to push the software because it seems to have a lot of potential.
I've starting playing with the function, but my simple code makes the software crash everytime. Even changing the parameters argument type from None to int to list doesn't help. What should be a basic code to debug and learn about the function can't be run properly. Any idea why?

from robolink import *    # RoboDK API
from robodk import *      # Robot toolbox
RDK = Robolink()

robot_name = 'LR Mate 200iD'
DOFs       = 6
list_obj   = []
pos_start  = [0,0,0,0,0,0]
pos_home   = pos_start
j_senses   = pos_start
j_lim_low  = [-170, -100, -67, -190, -125, -360]
j_lim_high = [ 170,  145, 213,  190,  125,  360]
ref_base   = xyzrpw_2_pose([0,0,0,0,0,0])
ref_tool   = xyzrpw_2_pose([465,0,365,0,-90,-180])

for i in range(DOFs + 1):
   if i == 0:
       obj = RDK.Item(robot_name + 'Base', ITEM_TYPE_OBJECT)
       obj = RDK.Item(robot_name + 'J' + str(i), ITEM_TYPE_OBJECT)


RDK.BuildMechanism(ITEM_TYPE_ROBOT, list_obj, None, pos_start, pos_home, j_senses, j_lim_low, j_lim_high, ref_base, ref_tool, robot_name)
Hi. It's been more than a week. I'm just replying to keep this thread alive until it's been looked at. No worries, I know it's because you're busy. Thanks!
Hi Gabriel,

I took a look at your file but the robot parameters are missing. This is the most important part as they represent the robot kinematics. These are the parameters must be provided as a list of values in the same order they appear in RoboDK's user interface when you build a robot or mechanism. RoboDK will automatically build the DH table based on these parameters. Some simple mechanisms (such as 1 or 2 translation/rotation axes) don't need these parameters because it is assumed you'll translate/rotate around the Z axis.

I attached your example working for your Fanuc LR Mate 200iD robot.



# Start the RoboDK API
from robolink import *
from robodk import *
RDK = Robolink()

# Define your new robot or mechanism
# Example to create a Fanuc LR Mate 200iD robot
robot_name = 'Fanuc LR Mate 200iD'
DOFs       = 6

# Define the joints of the robot/mechanism
joints_build = [0, 0, 0, 0, 0, 0]

# Define the home position of the robot/mechanism (default position when you build the mechanism)
# This is also the position the robot goes to if you select "Home"
joints_home   = [0, 0, 0, 0, 0, 0]

# Define the robot parameters. The parameters must be provided in the same order they appear
#     in the menu Utilities-Model Mechanism or robot
# Some basic mechanisms such as 1 or 2 axis translation/rotation axes don't need any parameters
#     (translation/rotation will happen around the Z axis)
#parameters = []
parameters = [330, 50, 0, 330, 35, 335, 80, 0, -90, 0, 0, 0, 0]

# Define the joint sense (set to +1 or -1 for each axis (+1 is used as a reference for the ABB IRB120 robot)
joints_senses   = [+1, +1, -1,  -1, -1, -1] # add -1 as 7th index to account for axis 2 and axis 3 coupling

# Joint limits (lower limits for each axis)
lower_limits  = [-170, -100, -67, -190, -125, -360]

# Joint limits (upper limits for each axis)
upper_limits  = [ 170,  145, 213,  190,  125,  360]

# Base frame pose (offset the model by applying a base frame transformation)
#base_pose   = xyzrpw_2_pose([0, 0, 0, 0, 0, 0])
# Fanuc and Motoman robots have the base frame at the intersection of axes 1 and 2
base_pose   = xyzrpw_2_pose([0, 0, -330, 0, 0, 0])

# Tool frame pose (offset the tool flange by applying a tool frame transformation)
tool_pose   = xyzrpw_2_pose([0, 0, 0, 0, 0, 0])

# Retrieve all your items from RoboDK (they should be previously loaded manually or using the API's command RDK.AddFile())
list_objects   = []
for i in range(DOFs + 1):
  if i == 0:
      itm = RDK.Item(robot_name + ' Base', ITEM_TYPE_OBJECT)
      itm = RDK.Item(robot_name + ' ' + str(i), ITEM_TYPE_OBJECT)


# Create the robot/mechanism
new_robot = RDK.BuildMechanism(MAKE_ROBOT_6DOF, list_objects, parameters, joints_build, joints_home, joints_senses, lower_limits, upper_limits, base_pose, tool_pose, robot_name)
if not new_robot.Valid():
   print("Failed to create the robot. Check input values.")
   print("Robot/mechanism created: " + new_robot.Name())
Thank you Albert.

So, it would seem the geometry parameters are set in stone. I have to enter a series of d, a, and θ values, without being able to specify the (α, a, d, θ) values for each joint. I couldn't create my own DH table to model any kind of geometry, say a 3L+2R gantry, could I?

Also, even your script crashes the software on my end. I'm running 4.0.0. How could we resolve this issue?
The script crashes if the objects you retrieve don't exist. Make sure these objects exist (robot base, J1, J2, etc, must be available in the RoboDK station).

The latest version doesn't have this crash.
Thanks a lot.

Users browsing this thread:
1 Guest(s)