Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Smart/Axes Optimization API
#1
Hello,

I am trying to set the axes optimization settings of a curve follow project with synchronized pair of robots: 6-axis and 2-axis (positioner) .

I can read and modify the "OptimAxes" settings but I can't get them into the curve follow project.

I'm not sure how to check the "Smart Optimization" checkbox through the API. Is that my problem?

Code:
# Get list of current robot joints:
robot_joints = robot.Joint().list()

# Get list of joint keys:
joint_keys = []
for i in range(1,9):
joint_keys.append("AbsJnt_" + str(i))

# Read and modify axes optimization settings:
settings = project.setParam("OptimAxes")

for i in range(1,9):
   settings["OptimAxes"][joint_keys[i]] = robot_joint[i]

# Update project optimization axes settings:
project.setParam("OptimAxes", settings)
#2
I believe "OptimAxes" should not be there. This is the name of the parameter you are changing. The value requires a dictionary which can be a modified version of the dictionary you read.

More precisely, you can enable the Smart optimization option by setting the Active flag to 1:
settings["Active"] = 1
You can also enable the checkbox for joint 1 using this line:
settings["AbsOn_1"] = 1

Also, a Python list index starts at 0, while updating the string parameter requires the first joint index to be 1.

This example shows some parameters you can set (more pose parameters have been added recently):
https://robodk.com/doc/en/PythonAPI/exam...n-settings

Therefore, I believe your code should be updated as follows:
Code:
# Get list of current robot joints:
robot_joints = robot.Joint().list()

# Read axes optimization settings:
settings = project.setParam("OptimAxes")

# Make sure to activate optimization settings:
settings["Active"] = 1

# Activate and update the joint reference weights as desired
# Note the index offset for the string required by RoboDK
for i in range(0,len(robot_joints)):
   settings["AbsOn_" + str(i+1)] = 1
   settings["AbsJnt_" + str(i+1)] = robot_joint[i]
 
# Update project optimization axes settings:
project.setParam("OptimAxes", settings)
#3
Hi Albert,

Thank you for your response. It is working now
  




Users browsing this thread:
1 Guest(s)