This commit is contained in:
@@ -1,26 +1,31 @@
|
||||
#Imports
|
||||
import plotutils
|
||||
from mathutils import fit_gaussian, Gaussian
|
||||
|
||||
RANGE = [180.0,-180.0]
|
||||
#Parameters
|
||||
RANGE = [-120.0,120.0]
|
||||
STEP = 5.0
|
||||
LATENCY = 0.005
|
||||
RELATIVE = False
|
||||
|
||||
|
||||
robot.set_tool(TOOL_DEFAULT)
|
||||
|
||||
#Enabling and checking
|
||||
#enable_power()
|
||||
#system_check()
|
||||
robot.enable()
|
||||
|
||||
|
||||
#Body
|
||||
robot.set_tool(TOOL_DEFAULT)
|
||||
move_to_laser()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
robot.set_joint_motors_enabled(True)
|
||||
#robot.set_joint_motors_enabled(True)
|
||||
robot.set_motors_enabled(True)
|
||||
robot_rz.move(0.0)
|
||||
robot.set_motors_enabled(True)
|
||||
ret = lscan(robot_rz, ue.readable, RANGE[0], RANGE[1], STEP, latency = LATENCY, relative = RELATIVE, range = "auto", title = "Scan2")
|
||||
|
||||
|
||||
#Cleanup
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ if d<0:
|
||||
if d>20:
|
||||
raise Exception ("Should be near the laser position to perform the scan")
|
||||
|
||||
RANGE = [-1.5, 1.5]
|
||||
RANGE = [-2.0, 2.0] #[-1.5, 1.5]
|
||||
STEP = 0.02
|
||||
Z_OFFSET = 0 #-1.0
|
||||
LATENCY = 0.025
|
||||
|
||||
@@ -2,13 +2,17 @@ import plotutils
|
||||
from mathutils import fit_gaussian, Gaussian
|
||||
|
||||
|
||||
robot.assert_tool(TOOL_CALIBRATION)
|
||||
#robot.assert_tool(TOOL_CALIBRATION)
|
||||
#cal_tool = TOOL_DEFAULT
|
||||
cal_tool = TOOL_CALIBRATION
|
||||
|
||||
robot.set_tool(cal_tool)
|
||||
robot.enable()
|
||||
robot.set_motors_enabled(True)
|
||||
robot.set_joint_motors_enabled(True)
|
||||
move_to_laser()
|
||||
|
||||
|
||||
robot.set_motors_enabled(True)
|
||||
robot.set_joint_motors_enabled(True)
|
||||
initial_pos = robot.get_cartesian_pos()
|
||||
|
||||
robot.enable()
|
||||
@@ -52,7 +56,7 @@ robot.set_pnt(robot.get_cartesian_pos(), "pTemp")
|
||||
robot.set_trsf([off_x, 0,0,0,0,0])
|
||||
c=robot.compose("pTemp", "fTable", "tcp_t" )
|
||||
robot.set_pnt(c, "pTemp")
|
||||
robot.movel("pTemp", TOOL_CALIBRATION, DESC_SCAN, sync=True)
|
||||
robot.movel("pTemp", cal_tool, DESC_SCAN, sync=True)
|
||||
|
||||
|
||||
pos2 = robot.get_cartesian_pos()
|
||||
@@ -66,10 +70,17 @@ print "Position 2: ", pos2
|
||||
xoff = (pos2[0]-pos1[0])/2
|
||||
yoff = (pos2[1]-pos1[1])/2
|
||||
|
||||
print "Offset: ", [xoff, yoff]
|
||||
#print "Offset: ", [xoff, yoff]
|
||||
|
||||
t=robot.get_tool_trsf(TOOL_DEFAULT)
|
||||
t[0]=-xoff
|
||||
t[1]=yoff
|
||||
t[0]=xoff
|
||||
t[1]=-yoff
|
||||
print "Offset: ", [t[0], t[1]]
|
||||
robot.set_tool_trsf(t, TOOL_DEFAULT)
|
||||
|
||||
robot.set_tool(TOOL_DEFAULT)
|
||||
d = robot.get_distance_to_pnt("pLaser")
|
||||
if d<POSITION_TOLERANCE:
|
||||
print "Moving calibrated tool to laser"
|
||||
else:
|
||||
print "Cannot move calibrated tool to laser: toog big offset"
|
||||
|
||||
Reference in New Issue
Block a user