Initial commit
This commit is contained in:
@@ -0,0 +1,162 @@
|
||||
##############################################################################
|
||||
# File: RoboticRulesUserDefinitions.py
|
||||
# Description
|
||||
# This file contains the machine or controller specific code for the tool path processing
|
||||
#
|
||||
# Revisions
|
||||
#
|
||||
# Date Reason
|
||||
# 15-Jul-2015 NX 10.0.3 - Allow named poses in operations, new UDE types
|
||||
# 27-Nov-2015 NX 10.0.3 - Fixed absolute option for positioners
|
||||
# 02-Dec-2015 NX 10.0.3 - OLP Commands in tool path locations
|
||||
# 18-Jan-2016 NX 11.0.1 - Move RoboticRulesScript_Main from RoboticRulesUserDefinitions.py to RoboticRulesSystemDefinitions.py/ExecUtils_Main
|
||||
# 04-Jul-2016 NX 11.0.1 - Added attach UDE
|
||||
# 12-Jul-2018 NX 1847 - Added drilling device UDE
|
||||
# 26-Apr-2021 NX 2007 - Add RobotFindingResolver
|
||||
#
|
||||
#$HISTORY$
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
import sys
|
||||
import math
|
||||
import os
|
||||
import NXOpen
|
||||
import NXOpen.CAM
|
||||
|
||||
|
||||
# This script assumes that all symbols from RoboticRulesSystemDefinitions.py have been imported already
|
||||
# This is usually achieved by loading both RoboticRulesSystemDefinitions.py and this file using special code
|
||||
# from RoboticToolpathProcessor import *
|
||||
|
||||
|
||||
# Define a new simple robotic calculator that computes some process parameters
|
||||
class SampleProcessParameterRoboticDataCalculator(SingleUdeRoboticDataCalculator):
|
||||
""" Just a sample calculator to set process parameters.
|
||||
It sets a value of 1 to all toolpath locations that are close to a specified point.
|
||||
"""
|
||||
def __init__(self):
|
||||
# name of the input UDE
|
||||
SingleUdeRoboticDataCalculator.__init__(self, "robot_mark_point_sample")
|
||||
# input parameter names
|
||||
self.paramName_Point = "point"
|
||||
self.paramName_Distance = "distance"
|
||||
# output parameter name
|
||||
self.paramNameLocationData_SampleParameter = "sample_processparameter"
|
||||
|
||||
# strings to show to the user
|
||||
uiLabels = {
|
||||
self.inputUdeName: "Robot Mark Point Sample",
|
||||
self.paramName_Point: "Point",
|
||||
self.paramName_Distance: "Distance",
|
||||
self.paramNameLocationData_SampleParameter: "Sample Motion Data Param"}
|
||||
|
||||
# Input UDE definition
|
||||
self.inputUdeDefinition = UdeDefinition(self.inputUdeName, uiLabels)
|
||||
self.inputUdeDefinition.AddUdeParameter(UdeParameterPoint(self.paramName_Point, uiLabels))
|
||||
self.inputUdeDefinition.AddUdeParameter(UdeParameterDouble(self.paramName_Distance,uiLabels, 0.0))
|
||||
|
||||
# Output UDE definition
|
||||
self.locationDataUdeDefinition = UdeDefinition("", "")
|
||||
self.locationDataUdeDefinition.AddUdeParameter(UdeParameterInt(self.paramNameLocationData_SampleParameter, uiLabels, 0))
|
||||
|
||||
def HandleSingleInputUde(self, ude):
|
||||
# Read the parameters of the input ude
|
||||
p = ude.GetParameter(self.paramName_Point).Point
|
||||
if p == None:
|
||||
raise ToolPathProcessingException("Parameter " + self.paramName_Point + " is not defined")
|
||||
self.point = p.Coordinates
|
||||
self.distance = ude.GetParameter(self.paramName_Distance).DoubleValue
|
||||
|
||||
def ProcessLocationDataUde(self, input, ude):
|
||||
if self.HasInputUde(): # do only something if the operation has the input ude
|
||||
inputPos = input.CurrentLocation.Position
|
||||
curDistance = RobotMath_Distance(inputPos,self.point)
|
||||
# calculate the output ude parameter
|
||||
if curDistance < self.distance:
|
||||
ude.GetParameter(self.paramNameLocationData_SampleParameter).IntegerValue = 1
|
||||
else:
|
||||
ude.GetParameter(self.paramNameLocationData_SampleParameter).IntegerValue = 0
|
||||
|
||||
|
||||
def RoboticRulesScript_GetCalculators(addAll: bool) -> tuple:
|
||||
"""Compute the calculators for the current cell.
|
||||
param addAll: If true all calculators are added, even those that do not work for the current kinematic.
|
||||
returns: a tuple of (calculator, externalAxisList) """
|
||||
|
||||
# define the list of external axes
|
||||
railAxisName = "RAIL_1"
|
||||
railAxisName2 = "RAIL_2"
|
||||
|
||||
positionerAxisName = "POSITIONER"
|
||||
drillingAxisName = "QUILL"
|
||||
allExternalAxes = [positionerAxisName, railAxisName, railAxisName2, drillingAxisName]
|
||||
|
||||
validExternalAxes = []
|
||||
for i in range(len(allExternalAxes)):
|
||||
if KinUtils_HasAxis(allExternalAxes[i]):
|
||||
validExternalAxes.append(allExternalAxes[i])
|
||||
|
||||
externalAxes = []
|
||||
if addAll:
|
||||
externalAxes = allExternalAxes
|
||||
else:
|
||||
externalAxes = validExternalAxes
|
||||
|
||||
# Define which calculators should be used
|
||||
calc = CompoundRoboticDataCalculator()
|
||||
|
||||
calc.ChildCalculators.append(ConfigurationRoboticDataCalculator())
|
||||
calc.ChildCalculators.append(ParkingPositionRoboticDataCalculator(externalAxes))
|
||||
calc.ChildCalculators.append(ParkingPositionReuseRoboticDataCalculator(externalAxes))
|
||||
calc.ChildCalculators.append(SampleProcessParameterRoboticDataCalculator())
|
||||
|
||||
positionerAxisData = []
|
||||
|
||||
if KinUtils_HasAxis(positionerAxisName):
|
||||
axisData = KinUtils_GetAxisData(positionerAxisName)
|
||||
positionerAxisData.append(axisData)
|
||||
calc.ChildCalculators.append(PositionerRoboticDataCalculator(axisData))
|
||||
elif addAll:
|
||||
axisData = AxisData(positionerAxisName, NXOpen.Vector3d(1.0,0.0,0.0), True)
|
||||
calc.ChildCalculators.append(PositionerRoboticDataCalculator(axisData))
|
||||
|
||||
calc.ChildCalculators.append(ToolOrientationRoboticDataCalculator(positionerAxisData))
|
||||
calc.ChildCalculators.append(RobotFindingResolver(validExternalAxes))
|
||||
|
||||
calc.ChildCalculators.append(DrillingDeviceRoboticDataCalculator(drillingAxisName))
|
||||
|
||||
if KinUtils_HasAxis(railAxisName):
|
||||
railAxisDir = KinUtils_GetAxisDirection(railAxisName)
|
||||
railAxisPos = KinUtils_GetPointOnAxis(railAxisName)
|
||||
railAxisLimits = KinUtils_GetAxisLimits(railAxisName)
|
||||
calc.ChildCalculators.append(RailRoboticDataCalculator(railAxisName, railAxisPos, railAxisDir, railAxisLimits))
|
||||
elif addAll:
|
||||
calc.ChildCalculators.append(RailRoboticDataCalculator(railAxisName, NXOpen.Vector3d(1.0,0.0,0.0), NXOpen.Vector3d(1.0,0.0,0.0), (0.0,1.0)))
|
||||
|
||||
if addAll:
|
||||
# add the calculators that exist only to write CDL file text
|
||||
calc.ChildCalculators.append(RobotZonesDefineUdeCalculator())
|
||||
calc.ChildCalculators.append(OlpCommandDefineUdeCalculator())
|
||||
calc.ChildCalculators.append(OlpCommandMultiLineDefineUdeCalculator(10))
|
||||
calc.ChildCalculators.append(PayloadDataDefineUdeCalculator())
|
||||
calc.ChildCalculators.append(ToolPathOlpCommandsDefineUdeCalculator())
|
||||
calc.ChildCalculators.append(RobotMountComponentDefineUdeCalculator())
|
||||
|
||||
|
||||
return (calc, externalAxes)
|
||||
|
||||
# Uncomment this function to implement your own main function
|
||||
# The function should parse the argument list and return with true if it
|
||||
# handled the call. If it returns false the caller will try to parse the arguments.
|
||||
# def RoboticRulesScript_Main2(args):
|
||||
# NXOpen.Session.GetSession().LogFile.WriteLine("Main called")
|
||||
# return True
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1032
machine/installed_machines/KUKA_MULTI/robots/Robotics.cdl
Normal file
1032
machine/installed_machines/KUKA_MULTI/robots/Robotics.cdl
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
||||
|
||||
* CONFIGURATION
|
||||
|
||||
default_config dont_care ;
|
||||
use_config dont_use ;
|
||||
config_family cf_over_head_pos ;
|
||||
joint_config_family j3 joint_cf_elbow_up ;
|
||||
joint_default_config j3 dont_care ;
|
||||
joint_config_family j5 joint_cf_pos ;
|
||||
joint_default_config j5 dont_care ;
|
||||
|
||||
* TURNS
|
||||
|
||||
* Changes for axis 1 +/- 185 deg
|
||||
* Volker Miegel Dec 1997
|
||||
default_turns j1 0 0.0, j4 0 0.0, j6 0 0.0;
|
||||
joint_default_turn all 0;
|
||||
joint_default_turn j1 5;
|
||||
|
||||
* ZONES
|
||||
* FINE
|
||||
|
||||
zone_define fine no_smooth;
|
||||
|
||||
* MEDIUM
|
||||
|
||||
* $APO.CPTP = 3
|
||||
* Only realistic if angles > 6 deg
|
||||
zone_joint_type medium dist ;
|
||||
zone_joints_param medium 0.052 0.052 0.052 0.052 0.052 0.052 ;
|
||||
|
||||
* $APO.CDIS = 20
|
||||
* Only realistic if distance > 40 mm
|
||||
zone_type medium dist ;
|
||||
zone_cart_param medium 20 ;
|
||||
|
||||
* COARSE
|
||||
|
||||
* $APO.CPTP = 9
|
||||
* Only realistic if angles > 18 degrees
|
||||
zone_joint_type coarse dist ;
|
||||
zone_joints_param coarse 0.157 0.157 0.157 0.157 0.157 0.157 ;
|
||||
|
||||
* $APO.CDIS = 50 mm
|
||||
* Only realistic if distance > 100 mm
|
||||
zone_type coarse dist ;
|
||||
zone_cart_param coarse 50 ;
|
||||
|
||||
* NODECEL
|
||||
|
||||
* PTP: workaround to emulate way smaller than $APO.CPTP/2
|
||||
zone_joint_type nodecel speed ;
|
||||
zone_joints_param nodecel 99.0 99.0 99.0 99.0 99.0 99.0 ;
|
||||
|
||||
* $APO.CVEL 99%
|
||||
* (workaround to emulate way smaller than $APO.CDIS/2)
|
||||
zone_type nodecel speed ;
|
||||
zone_cart_param nodecel 99 ;
|
||||
|
||||
Reference in New Issue
Block a user