Script execution
This commit is contained in:
@@ -6,7 +6,6 @@ add_device(CamTool("image_stats", prefix = "SINEG01-DSCR190:", latch = True, ca
|
||||
add_device(CamTool("image_stats", prefix = "SINEG01-DSCR190:", latch = True, camera = "SINEG01-DSCR190"), True)
|
||||
|
||||
image_stats.start()
|
||||
image_stats.setNumberOfImages(5)
|
||||
image_stats.setNumberOfImages(5)
|
||||
laser_off()
|
||||
image_stats.captureBackground(10)
|
||||
@@ -20,8 +19,9 @@ def before_sample():
|
||||
image_stats.update()
|
||||
|
||||
class FitnessFunction(ReadonlyRegisterBase):
|
||||
def doRead(self):
|
||||
r = lscan(gun_solenoid, [image_stats.com_x_mean, image_stats.com_y_mean] , 110.0, 120.0, 1.0, 0.1, before_read = before_sample)
|
||||
def doRead(self):
|
||||
r = lscan(gun_solenoid, [image_stats.com_x_mean, image_stats.com_y_mean] , 110.0, 120.0, 1.0, 0.1, before_read = before_sample)
|
||||
bounding_area = abs(max(r.getReadable(0)) - min(r.getReadable(0))) * abs(max(r.getReadable(1)) - min(r.getReadable(1)))
|
||||
return bounding_area
|
||||
|
||||
add_device(FitnessFunction("fitness"), True)
|
||||
@@ -38,7 +38,9 @@ print len(r.getRecords())
|
||||
print r.print()
|
||||
print len(r.getRecords())
|
||||
|
||||
"""
|
||||
"""
|
||||
|
||||
#Hill Climbing Search
|
||||
#r = hsearch([gsx, gsy, gsrx, gsry], fitness,[-1.0,-1.0,-1.0,-1.0], [1.0,1.0,1.0,1.0], [0.1, 0.1, 0.1, 0.1], [0.01, 0.01, 0.01, 0.01], 3, relative = False, maximum=False, latency = 0.01, title = "Hill Climbing")
|
||||
r = hsearch([gsrx, gsry], fitness,[-1.0,-1.0], [1.0,1.0], [ 0.1, 0.1], [0.01, 0.01], 3, relative = False, maximum=False, latency = 0.01, title = "Hill Climbing")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user