Startup
This commit is contained in:
12
script/test/TestRelays.py
Normal file
12
script/test/TestRelays.py
Normal file
@@ -0,0 +1,12 @@
|
||||
for i in range(500):
|
||||
relay1.write(True)
|
||||
time.sleep(1.2)
|
||||
relay1.write(False)
|
||||
time.sleep(1.2)
|
||||
"""
|
||||
for i in range(5):
|
||||
relays.write(to_array([True,]*16, 'z'))
|
||||
time.sleep(0.2)
|
||||
relays.write(to_array([False,]*16, 'z'))
|
||||
time.sleep(0.2)
|
||||
"""
|
||||
32
script/test/TestRobotCmds.py
Normal file
32
script/test/TestRobotCmds.py
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
import java.lang.System as System
|
||||
|
||||
index = 0
|
||||
max_time = 0
|
||||
while True:
|
||||
start = System.currentTimeMillis()
|
||||
robot.execute(1,1,1)
|
||||
time.sleep(0.01)
|
||||
robot.execute(2,1,1)
|
||||
time.sleep(0.01)
|
||||
robot.execute(1,1,1)
|
||||
time.sleep(0.01)
|
||||
robot.execute(2,1,1)
|
||||
time.sleep(0.01)
|
||||
robot.execute(1,1,1)
|
||||
time.sleep(0.01)
|
||||
robot.execute(2,1,1)
|
||||
time.sleep(0.01)
|
||||
robot.execute(1,1,1)
|
||||
time.sleep(0.01)
|
||||
robot.execute(2,1,1)
|
||||
time.sleep(0.01)
|
||||
robot.execute(1,1,1)
|
||||
time.sleep(0.01)
|
||||
robot.execute(2,1,1)
|
||||
time.sleep(0.01)
|
||||
cur_time = System.currentTimeMillis() - start
|
||||
max_time = max(cur_time, max_time)
|
||||
print index, cur_time, max_time
|
||||
index = index + 1
|
||||
|
||||
25
script/test/TestRobotCmds2.py
Normal file
25
script/test/TestRobotCmds2.py
Normal file
@@ -0,0 +1,25 @@
|
||||
if robot_req.read() != 0:
|
||||
raise Exception("Ongoing command")
|
||||
if robot_ack.read() != 0:
|
||||
raise Exception("Robot is not ready")
|
||||
robot_cmd.write(1)
|
||||
args = [0,0,0,0,0,0]
|
||||
|
||||
robot_args.write(to_array(args, 'i'))
|
||||
|
||||
|
||||
robot_req.write(1)
|
||||
while robot_ack.read() == 0:
|
||||
time.sleep(0.001)
|
||||
|
||||
err = robot_ack.take()
|
||||
if err == 1:
|
||||
ret = robot_ret.read()
|
||||
print ret
|
||||
if err == 2:
|
||||
print ("Invalid command: " + str(command))
|
||||
print ("Unknown error: " + str(err))
|
||||
robot_req.write(0)
|
||||
while robot_ack.read() != 0:
|
||||
time.sleep(0.001)
|
||||
|
||||
28
script/test/TestRobotTCP.py
Normal file
28
script/test/TestRobotTCP.py
Normal file
@@ -0,0 +1,28 @@
|
||||
print robot_tcp.is_powered()
|
||||
print robot_tcp.get_monitor_speed()
|
||||
#print robot_tcp.set_monitor_speed(20)
|
||||
print robot_tcp.enable()
|
||||
print robot_tcp.disable()
|
||||
print robot_tcp.is_calibrated()
|
||||
print robot_tcp.read_working_mode()
|
||||
print robot_tcp.get_emergency_stop_sts()
|
||||
print robot_tcp.get_safety_fault_signal()
|
||||
print robot_tcp.stop()
|
||||
print robot_tcp.resume()
|
||||
print robot_tcp.resetMotion()
|
||||
print robot_tcp.is_empty()
|
||||
print robot_tcp.is_settled()
|
||||
print robot_tcp.get_move_id()
|
||||
print robot_tcp.set_move_id(10)
|
||||
print robot_tcp.get_joint_forces()
|
||||
#print robot_tcp.open("gripper")
|
||||
#print robot_tcp.close("gripper")
|
||||
print robot_tcp.herej()
|
||||
print robot_tcp.distance_t("t", "t")
|
||||
print robot_tcp.distance_p("p", "p")
|
||||
print robot_tcp.compose( "p", "world", "t")
|
||||
print robot_tcp.here("gripper", "world")
|
||||
print robot_tcp.joint_to_point("gripper", "world", "j")
|
||||
print robot_tcp.point_to_joint("gripper", "j", "p")
|
||||
print robot_tcp.position("p", "world")
|
||||
print robot_tcp.mount(1, 2)
|
||||
24
script/test/test.py
Normal file
24
script/test/test.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from ijutils import *
|
||||
import java.awt.Color as Color
|
||||
|
||||
|
||||
#ip = load_array(img.getData().getMatrix())
|
||||
ip = load_image(img.getOutput())
|
||||
#ip = load_image("{images}/test3.png", title="Image")
|
||||
|
||||
|
||||
aux = grayscale(ip, in_place=False)
|
||||
aux.show()
|
||||
|
||||
#convolve(aux, KERNEL_SOBEL); aux.repaintWindow()
|
||||
|
||||
invert(aux); aux.repaintWindow()
|
||||
subtract_background(aux); aux.repaintWindow()
|
||||
auto_threshold(aux); aux.repaintWindow()
|
||||
binary_open(aux); aux.repaintWindow()
|
||||
|
||||
(table, image) = analyse_particles(aux, 250,1000,
|
||||
fill_holes = False, exclude_edges = True,print_table=True,
|
||||
output_image = "outlines", minCirc = 0.82, maxCirc = 1.0)
|
||||
|
||||
image.show()
|
||||
Reference in New Issue
Block a user