This commit is contained in:
gac-S_Changer
2018-12-03 12:17:40 +01:00
commit bdf5049f96
204 changed files with 18029 additions and 0 deletions

31
config/config.properties Normal file
View File

@@ -0,0 +1,31 @@
#Mon Dec 03 12:00:22 CET 2018
autoSaveScanData=true
commandExecutionEvents=false
createSessionFiles=true
dataLayout=default
dataPath={data}/{year}_{month}/{date}/{date}_{time}_{name}
dataProvider=h5
dataScanFlushRecords=true
dataScanPreserveTypes=false
dataScanReleaseRecords=false
dataServerPort=-1
depthDimension=0
hostName=null
instanceName=X06SA
logDaysToLive=30
logLevel=Fine
logLevelConsole=Off
logPath={logs}/{date}_{time}
notificationLevel=null
scanStreamerPort=-1
serverEnabled=true
serverPort=8080
simulation=true
terminalEnabled=false
terminalPort=3579
userAuthenticator=
userManagement=false
versionTrackingEnabled=true
versionTrackingLogin={context}/svcusr-hlapp_robot
versionTrackingManual=false
versionTrackingRemote=git@git.psi.ch\:tell/X06SA.git

View File

@@ -0,0 +1,67 @@
img=ch.psi.pshell.prosilica.Prosilica|25001 "PacketSize=1522;PixelFormat=Mono8;BinningX=1;BinningY=1;RegionX=300;RegionY=200;Width=1000;Height=1000"|||false
gripper_cam=ch.psi.pshell.imaging.MjpegSource|http://129.129.110.114/axis-cgi/mjpg/video.cgi||-1000|
microscan=ch.psi.pshell.serial.TcpDevice|129.129.100.200:2001|||
microscan_cmd=ch.psi.pshell.serial.TcpDevice|129.129.100.200:2003|||
ue=LaserUE|COM4|||false
#robot=RobotTcp|127.0.0.1:1000|||
#onewire=ch.psi.pshell.serial.TcpDevice|129.129.126.83:5000|||
puck_detection=ch.psi.mxsc.PuckDetection|tell-raspberrypi:5556|||
#robot_modbus=ch.psi.pshell.modbus.ModbusTCP|129.129.126.100:502|||
#jf1=ch.psi.pshell.modbus.AnalogInput|robot_modbus 0||100|
#jf2=ch.psi.pshell.modbus.AnalogInput|robot_modbus 1||100|
#jf3=ch.psi.pshell.modbus.AnalogInput|robot_modbus 2||100|
#jf4=ch.psi.pshell.modbus.AnalogInput|robot_modbus 3||100|
#jf5=ch.psi.pshell.modbus.AnalogInput|robot_modbus 4||100|
#jf6=ch.psi.pshell.modbus.AnalogInput|robot_modbus 5||100|
#robot_sts=ch.psi.pshell.modbus.AnalogInputArray|robot_modbus 6 6||100|
#robot_cmd=ch.psi.pshell.modbus.AnalogOutput|robot_modbus 12|||
#robot_args=ch.psi.pshell.modbus.AnalogOutputArray|robot_modbus 47 12|||
#robot_req=ch.psi.pshell.modbus.AnalogOutput|robot_modbus 13|||
#robot_ack=ch.psi.pshell.modbus.AnalogInput|robot_modbus 14|||
#robot_ret=ch.psi.pshell.modbus.AnalogInputArray|robot_modbus 15 12|||
#wago_back=ch.psi.pshell.modbus.ModbusTCP|SF-TEST-WAGO1:502|||
wago=ch.psi.pshell.modbus.ModbusTCP|wago-mxsc-1:502|||
led_ok_1=ch.psi.pshell.modbus.DigitalInput|wago 0||1000|
led_ok_2=ch.psi.pshell.modbus.DigitalInput|wago 1||1000|
led_ok_3=ch.psi.pshell.modbus.DigitalInput|wago 2||1000|
feedback_local_safety=ch.psi.pshell.modbus.DigitalInput|wago 3||1000|
feedback_psys_safety=ch.psi.pshell.modbus.DigitalInput|wago 4||1000|
filling_phase_separator=ch.psi.pshell.modbus.DigitalInput|wago 5||1000|
filling_dewar=ch.psi.pshell.modbus.DigitalInput|wago 6||1000|
dewar_level_high_alarm=ch.psi.pshell.modbus.DigitalInput|wago 7||1000|
guiding_tool_park=ch.psi.pshell.modbus.DigitalInput|wago 8||1000|
air_pressure_ok=ch.psi.pshell.modbus.DigitalInput|wago 9||1000|false
n2_pressure_ok=ch.psi.pshell.modbus.DigitalInput|wago 10||1000|
he_chamber_valve_1=ch.psi.pshell.modbus.DigitalInput|wago 15||1000|
he_chamber_valve_2=ch.psi.pshell.modbus.DigitalInput|wago 16||1000|
relays=ch.psi.pshell.modbus.DigitalOutputArray|wago 0 16||1000|
release_local_safety=ch.psi.pshell.modbus.DigitalOutput|wago 0|||
release_psys_safety=ch.psi.pshell.modbus.DigitalOutput|wago 1|||
ln2_main_power=ch.psi.pshell.modbus.DigitalOutput|wago 2|||
rim_heater=ch.psi.pshell.modbus.DigitalOutput|wago 3|||
phase_separator_ln2=ch.psi.pshell.modbus.DigitalOutput|wago 4|||
dewar_ln2=ch.psi.pshell.modbus.DigitalOutput|wago 5|||false
valve_he_chamber=ch.psi.pshell.modbus.DigitalOutput|wago 6|||
gripper_dryer=ch.psi.pshell.modbus.DigitalOutput|wago 7|||
valve_1=ch.psi.pshell.modbus.DigitalOutput|wago 8|||
valve_2=ch.psi.pshell.modbus.DigitalOutput|wago 9|||
valve_3=ch.psi.pshell.modbus.DigitalOutput|wago 10|||
valve_4=ch.psi.pshell.modbus.DigitalOutput|wago 11|||
#spare_do_1=ch.psi.pshell.modbus.DigitalOutput|wago 12|||
#spare_do_2=ch.psi.pshell.modbus.DigitalOutput|wago 13|||
#spare_do_3=ch.psi.pshell.modbus.DigitalOutput|wago 14|||
#spare_do_4=ch.psi.pshell.modbus.DigitalOutput|wago 15|||
phase_separator_level=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 0||10000|
dewar_level=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 1||10000|
rim_heater_temp=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 2||10000|
air_pressure=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 3||10000|
n2_pressure=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 4||10000|
#spare_ai_1=ch.psi.pshell.modbus.AnalogInput|wago 5|||
#spare_ai_2=ch.psi.pshell.modbus.AnalogInput|wago 6|||
#spare_ai_3=ch.psi.pshell.modbus.AnalogInput|wago 7|||
led_ctrl_1=ch.psi.pshell.modbus.ProcessVariable|wago 0|||
led_ctrl_2=ch.psi.pshell.modbus.ProcessVariable|wago 1|||
led_ctrl_3=ch.psi.pshell.modbus.ProcessVariable|wago 2|||
#spare_ao_3=ch.psi.pshell.modbus.AnalogOutput|wago 3|||
#cam=ch.psi.pshell.epics.AreaDetector|MX-SAMCAM|||
#img_back=ch.psi.pshell.imaging.CameraSource|cam||-100|

View File

@@ -0,0 +1,50 @@
wago=ch.psi.pshell.modbus.ModbusTCP|wago-mxsc-1:502|||
led_ok_1=ch.psi.pshell.modbus.DigitalInput|wago 0||1000|
led_ok_2=ch.psi.pshell.modbus.DigitalInput|wago 1||1000|
led_ok_3=ch.psi.pshell.modbus.DigitalInput|wago 2||1000|
feedback_local_safety=ch.psi.pshell.modbus.DigitalInput|wago 3||1000|
feedback_psys_safety=ch.psi.pshell.modbus.DigitalInput|wago 4||1000|
filling_phase_separator=ch.psi.pshell.modbus.DigitalInput|wago 5||1000|
filling_dewar=ch.psi.pshell.modbus.DigitalInput|wago 6||1000|
dewar_level_high_alarm=ch.psi.pshell.modbus.DigitalInput|wago 7||1000|
guiding_tool_park=ch.psi.pshell.modbus.DigitalInput|wago 8||1000|
air_pressure_ok=ch.psi.pshell.modbus.DigitalInput|wago 9||1000|false
n2_pressure_ok=ch.psi.pshell.modbus.DigitalInput|wago 10||1000|
#spare_di_1=ch.psi.pshell.modbus.DigitalInput|wago 11|||
#spare_di_2=ch.psi.pshell.modbus.DigitalInput|wago 12|||
#spare_di_3=ch.psi.pshell.modbus.DigitalInput|wago 13|||
#spare_di_4=ch.psi.pshell.modbus.DigitalInput|wago 14|||
he_chamber_valve_1=ch.psi.pshell.modbus.DigitalInput|wago 15||1000|
he_chamber_valve_2=ch.psi.pshell.modbus.DigitalInput|wago 16||1000|
smc_magnet_status=ch.psi.pshell.modbus.DigitalInput|wago 17||1000|
smc_mounted_1=ch.psi.pshell.modbus.DigitalInput|wago 18||1000|
smc_mounted_2=ch.psi.pshell.modbus.DigitalInput|wago 19||1000|
relays=ch.psi.pshell.modbus.DigitalOutputArray|wago 0 16||1000|
release_local_safety=ch.psi.pshell.modbus.DigitalOutput|wago 0|||
release_psys_safety=ch.psi.pshell.modbus.DigitalOutput|wago 1|||
ln2_main_power=ch.psi.pshell.modbus.DigitalOutput|wago 2|||
rim_heater=ch.psi.pshell.modbus.DigitalOutput|wago 3|||
phase_separator_ln2=ch.psi.pshell.modbus.DigitalOutput|wago 4|||
dewar_ln2=ch.psi.pshell.modbus.DigitalOutput|wago 5|||false
valve_he_chamber=ch.psi.pshell.modbus.DigitalOutput|wago 6|||
gripper_dryer=ch.psi.pshell.modbus.DigitalOutput|wago 7|||
valve_1=ch.psi.pshell.modbus.DigitalOutput|wago 8|||
valve_2=ch.psi.pshell.modbus.DigitalOutput|wago 9|||
valve_3=ch.psi.pshell.modbus.DigitalOutput|wago 10|||
valve_4=ch.psi.pshell.modbus.DigitalOutput|wago 11|||
#spare_do_1=ch.psi.pshell.modbus.DigitalOutput|wago 12|||
smc_sup_det=ch.psi.pshell.modbus.DigitalOutput|wago 13|||
#spare_do_3=ch.psi.pshell.modbus.DigitalOutput|wago 14|||
#spare_do_4=ch.psi.pshell.modbus.DigitalOutput|wago 15|||
phase_separator_level=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 0||10000|
dewar_level=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 1||10000|
rim_heater_temp=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 2||10000|
#spare_ai_1=ch.psi.pshell.modbus.AnalogInput|wago 3|||true
smc_current_rb=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 4||1000|
#spare_ai_3=ch.psi.pshell.modbus.AnalogInput|wago 5|||
#spare_ai_4=ch.psi.pshell.modbus.AnalogInput|wago 6|||
#spare_ai_5=ch.psi.pshell.modbus.AnalogInput|wago 7|||
led_ctrl_1=ch.psi.pshell.modbus.ProcessVariable|wago 0|||
led_ctrl_2=ch.psi.pshell.modbus.ProcessVariable|wago 1|||
led_ctrl_3=ch.psi.pshell.modbus.ProcessVariable|wago 2|||
smc_current=ch.psi.pshell.modbus.ProcessVariable|wago 3|||

80
config/devices.properties Normal file
View File

@@ -0,0 +1,80 @@
#img=ch.psi.pshell.prosilica.Prosilica|25001 "PacketSize=1522;PixelFormat=Mono8;BinningX=1;BinningY=1;RegionX=300;RegionY=200;Width=1000;Height=1000;MulticastEnable=Off"|||false
#gripper_cam=ch.psi.pshell.imaging.MjpegSource|http://axis-accc8e9cc87b.psi.ch/axis-cgi/mjpg/video.cgi?camera=1 reopen||-200|
#monitoring_cam=ch.psi.pshell.imaging.MjpegSource|http://axis-accc8e9cc87b.psi.ch/axis-cgi/mjpg/video.cgi?camera=2 reopen||-200|
#top_cam=ch.psi.pshell.imaging.MjpegSource|http://axis-accc8e9cc87b.psi.ch/axis-cgi/mjpg/video.cgi?camera=3 true||-200|
#cam=ch.psi.pshell.epics.AreaDetector|MX-SAMCAM|||
microscan=ch.psi.pshell.serial.TcpDevice|MicroHAWK38C528:2001|||
microscan_cmd=ch.psi.pshell.serial.TcpDevice|MicroHAWK38C528:2003|||
ue=LaserUE|COM4|||false
puck_detection=ch.psi.mxsc.PuckDetection|tell-raspberrypi:5556|||
#onewire=ch.psi.pshell.serial.TcpDevice|129.129.126.83:5000|||
#robot=RobotTcp|127.0.0.1:1000|||
#$robot_modbus=ch.psi.pshell.modbus.ModbusTCP|129.129.126.100:502|||
#jf1=ch.psi.pshell.modbus.AnalogInput|robot_modbus 0||100|
#jf2=ch.psi.pshell.modbus.AnalogInput|robot_modbus 1||100|
#jf3=ch.psi.pshell.modbus.AnalogInput|robot_modbus 2||100|
#jf4=ch.psi.pshell.modbus.AnalogInput|robot_modbus 3||100|
#jf5=ch.psi.pshell.modbus.AnalogInput|robot_modbus 4||100|
#jf6=ch.psi.pshell.modbus.AnalogInput|robot_modbus 5||100|
#robot_sts=ch.psi.pshell.modbus.AnalogInputArray|robot_modbus 6 6||100|
#robot_cmd=ch.psi.pshell.modbus.AnalogOutput|robot_modbus 12|||
#robot_args=ch.psi.pshell.modbus.AnalogOutputArray|robot_modbus 47 12|||
#robot_req=ch.psi.pshell.modbus.AnalogOutput|robot_modbus 13|||
#robot_ack=ch.psi.pshell.modbus.AnalogInput|robot_modbus 14|||
#robot_ret=ch.psi.pshell.modbus.AnalogInputArray|robot_modbus 15 12|||
wago=ch.psi.pshell.modbus.ModbusTCP|wago-mxsc-1:502|||
led_ok_1=ch.psi.pshell.modbus.DigitalInput|wago 0||1000|
led_ok_2=ch.psi.pshell.modbus.DigitalInput|wago 1||1000|
led_ok_3=ch.psi.pshell.modbus.DigitalInput|wago 2||1000|
feedback_local_safety=ch.psi.pshell.modbus.DigitalInput|wago 3||1000|
feedback_psys_safety=ch.psi.pshell.modbus.DigitalInput|wago 4||1000|
filling_phase_separator=ch.psi.pshell.modbus.DigitalInput|wago 5||1000|
filling_dewar=ch.psi.pshell.modbus.DigitalInput|wago 6||1000|
dewar_level_high_alarm=ch.psi.pshell.modbus.DigitalInput|wago 7||1000|
guiding_tool_park=ch.psi.pshell.modbus.DigitalInput|wago 8||1000|
air_pressure_ok=ch.psi.pshell.modbus.DigitalInput|wago 9||1000|false
n2_pressure_ok=ch.psi.pshell.modbus.DigitalInput|wago 10||1000|
#spare_di_1=ch.psi.pshell.modbus.DigitalInput|wago 11|||
#spare_di_2=ch.psi.pshell.modbus.DigitalInput|wago 12|||
#spare_di_3=ch.psi.pshell.modbus.DigitalInput|wago 13|||
#spare_di_4=ch.psi.pshell.modbus.DigitalInput|wago 14|||
he_chamber_valve_1=ch.psi.pshell.modbus.DigitalInput|wago 15||1000|
he_chamber_valve_2=ch.psi.pshell.modbus.DigitalInput|wago 16||1000|
smc_magnet_status=ch.psi.pshell.modbus.DigitalInput|wago 17||1000|
smc_mounted_1=ch.psi.pshell.modbus.DigitalInput|wago 18||1000|
smc_mounted_2=ch.psi.pshell.modbus.DigitalInput|wago 19||1000|
relays=ch.psi.pshell.modbus.DigitalOutputArray|wago 0 16||1000|
release_local_safety=ch.psi.pshell.modbus.DigitalOutput|wago 0|||
release_psys_safety=ch.psi.pshell.modbus.DigitalOutput|wago 1|||
ln2_main_power=ch.psi.pshell.modbus.DigitalOutput|wago 2|||
rim_heater=ch.psi.pshell.modbus.DigitalOutput|wago 3|||
phase_separator_ln2=ch.psi.pshell.modbus.DigitalOutput|wago 4|||
dewar_ln2=ch.psi.pshell.modbus.DigitalOutput|wago 5|||false
valve_he_chamber=ch.psi.pshell.modbus.DigitalOutput|wago 6|||
gripper_dryer=ch.psi.pshell.modbus.DigitalOutput|wago 7|||
valve_1=ch.psi.pshell.modbus.DigitalOutput|wago 8|||
valve_2=ch.psi.pshell.modbus.DigitalOutput|wago 9|||
valve_3=ch.psi.pshell.modbus.DigitalOutput|wago 10|||
valve_4=ch.psi.pshell.modbus.DigitalOutput|wago 11|||
#spare_do_1=ch.psi.pshell.modbus.DigitalOutput|wago 12|||
smc_sup_det=ch.psi.pshell.modbus.DigitalOutput|wago 13|||
#spare_do_3=ch.psi.pshell.modbus.DigitalOutput|wago 14|||
#spare_do_4=ch.psi.pshell.modbus.DigitalOutput|wago 15|||
phase_separator_level=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 0||10000|
dewar_level=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 1||10000|
rim_heater_temp=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 2||10000|
#spare_ai_1=ch.psi.pshell.modbus.AnalogInput|wago 3|||true
smc_current_rb=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 4||1000|
#spare_ai_3=ch.psi.pshell.modbus.AnalogInput|wago 5|||
#spare_ai_4=ch.psi.pshell.modbus.AnalogInput|wago 6|||
#spare_ai_5=ch.psi.pshell.modbus.AnalogInput|wago 7|||
led_ctrl_1=ch.psi.pshell.modbus.ProcessVariable|wago 0|||
led_ctrl_2=ch.psi.pshell.modbus.ProcessVariable|wago 1|||
led_ctrl_3=ch.psi.pshell.modbus.ProcessVariable|wago 2|||
smc_current=ch.psi.pshell.modbus.ProcessVariable|wago 3|||
#img_back=ch.psi.pshell.imaging.CameraSource|cam||-100|
#fx=ch.psi.pshell.epics.Motor|SAR-EXPMX:MOT_FX|||true
#fy=ch.psi.pshell.epics.Motor|SAR-EXPMX:MOT_FY|||true
#ry=ch.psi.pshell.epics.Motor|SAR-EXPMX:MOT_ROT_Y|||true
#cz=ch.psi.pshell.epics.Motor|SAR-EXPMX:MOT_CZ|||true
#cx=ch.psi.pshell.epics.Motor|SAR-EXPMX:MOT_CX|||true

11
config/jcae.properties Normal file
View File

@@ -0,0 +1,11 @@
#Tue Sep 06 15:10:24 CEST 2016
ch.psi.jcae.ContextFactory.addressList=
ch.psi.jcae.ContextFactory.serverPort=
ch.psi.jcae.ContextFactory.maxArrayBytes=20000000
ch.psi.jcae.ChannelFactory.retries=1
ch.psi.jcae.ChannelFactory.timeout=500
ch.psi.jcae.impl.DefaultChannelService.retries=2
ch.psi.jcae.impl.DefaultChannelService.timeout=1000
ch.psi.jcae.ContextFactory.autoAddressList=true
ch.psi.jcae.ContextFactory.useShellVariables=false
ch.psi.jcae.ContextFactory.addLocalBroadcastInterfaces=false

9
config/mail.properties Normal file
View File

@@ -0,0 +1,9 @@
#Mon Oct 23 10:53:54 CEST 2017
auth=None
from=
host=
port=0
pwd=
smsSuffix=@sms.switch.ch
to=
usr=

21
config/plugins.properties Normal file
View File

@@ -0,0 +1,21 @@
Commands.java=disabled
Recovery.java=disabled
MXSC-1.10.0.jar=enabled
WagoPanel.java=enabled
LaserUEPanel.java=enabled
BarcodeReaderPanel.java=enabled
PuckDetectionPanel.java=enabled
HexiposiPanel.java=enabled
MjpegSource2.java=enabled
LN2.java=disabled
Hexiposi.java=disabled
NewJPanel.java=disabled
RobotPanel.java=enabled
SmartMagnetConfig.java=disabled
SmartMagnetPanel.java=enabled
LaserUE.java=enabled
TestZMQ.java=disabled
RobotModbus.java=disabled
RobotTcp.java=disabled
Beeper.java=disabled
gui.java=disabled

View File

@@ -0,0 +1,18 @@
#Wed Sep 14 15:16:45 CEST 2016
configFile={config}/config.properties
configFileDevices={config}/devices-modbus.properties
configFilePlugins={config}/plugins.properties
configFileTasks={config}/tasks.properties
configPath={home}/config
contextPath={outp}/context
dataPath={outp}/data
devicesPath={home}/devices
extensionsPath={home}/extensions
imagesPath={outp}/images
libraryPath={script}; {script}/Lib
logPath={outp}/log
pluginsPath={home}/plugins
scriptPath={home}/script
scriptType=py
sessionsPath={outp}/sessions
wwwPath={home}/www

18
config/setup.properties Normal file
View File

@@ -0,0 +1,18 @@
#Wed Sep 14 15:16:45 CEST 2016
configFile={config}/config.properties
configFileDevices={config}/devices.properties
configFilePlugins={config}/plugins.properties
configFileTasks={config}/tasks.properties
configPath={home}/config
contextPath={outp}/context
dataPath={outp}/data
devicesPath={home}/devices
extensionsPath={home}/extensions
imagesPath={outp}/images
libraryPath={script}; {script}/Lib
logPath={outp}/log
pluginsPath={home}/plugins
scriptPath={home}/script
scriptType=py
sessionsPath={outp}/sessions
wwwPath={home}/www

1
config/tasks.properties Normal file
View File

@@ -0,0 +1 @@
tasks/LedMonitoring=120

View File

@@ -0,0 +1,20 @@
#Mon Oct 23 15:10:20 CEST 2017
flipHorizontally=false
flipVertically=false
grayscale=false
invert=false
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
roiWidth=-1
roiX=0
roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
spatialCalOffsetX=NaN
spatialCalOffsetY=NaN
spatialCalScaleX=NaN
spatialCalScaleY=NaN
spatialCalUnits=mm
transpose=false

View File

@@ -0,0 +1 @@
#Fri Feb 10 14:35:38 CET 2017

10
devices/Time.properties Normal file
View File

@@ -0,0 +1,10 @@
#Wed Jun 27 10:48:14 CEST 2018
maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
resolution=NaN
rotation=false
scale=1.0
sign_bit=0
unit=null

View File

@@ -0,0 +1,5 @@
#Thu Mar 01 11:13:34 CET 2018
offset=0.0
precision=-1
scale=1.0
unit=null

17
devices/cx.properties Normal file
View File

@@ -0,0 +1,17 @@
#Fri Aug 10 15:47:53 CEST 2018
defaultSpeed=2.0
estbilizationDelay=0
hasEnable=false
homingType=None
maxSpeed=NaN
maxValue=0.0
minSpeed=NaN
minValue=0.0
offset=0.0
precision=3
resolution=0.001
rotation=false
scale=1.0
sign_bit=0
startRetries=1
unit=mm

17
devices/cz.properties Normal file
View File

@@ -0,0 +1,17 @@
#Fri Aug 10 15:47:15 CEST 2018
defaultSpeed=2.0
estbilizationDelay=0
hasEnable=false
homingType=None
maxSpeed=NaN
maxValue=0.0
minSpeed=NaN
minValue=0.0
offset=0.0
precision=3
resolution=0.001
rotation=false
scale=1.0
sign_bit=0
startRetries=1
unit=mm

View File

@@ -0,0 +1,6 @@
#Wed Aug 08 14:23:54 CEST 2018
offset=-25.81632
precision=2
scale=0.003888
sign_bit=0
unit=%

View File

@@ -0,0 +1,11 @@
#Thu May 03 11:54:38 CEST 2018
disableCompression=false
keepListeningOnStop=false
mappingIncomplete=null
parallelHandlerProcessing=true
sendAwaitFirstMessage=false
sendBuildChannelConfig=null
sendStrategy=null
sendSyncTimeout=0
socketType=DEFAULT
validationInconsistency=null

11
devices/dp1.properties Normal file
View File

@@ -0,0 +1,11 @@
#Fri Jul 08 10:53:26 CEST 2016
motor1=0.0|4.0|8.0|0.0
motor2=0.0|5.0|3.0|NaN
motor3=null
motor4=null
motor5=null
motor6=null
motor7=null
motor8=null
positions=Park|Ready|Out|Clear
precision=-1

17
devices/fx.properties Normal file
View File

@@ -0,0 +1,17 @@
#Fri Aug 10 15:47:14 CEST 2018
defaultSpeed=2.0
estbilizationDelay=0
hasEnable=false
homingType=None
maxSpeed=NaN
maxValue=0.0
minSpeed=NaN
minValue=0.0
offset=0.0
precision=3
resolution=0.001
rotation=false
scale=1.0
sign_bit=0
startRetries=1
unit=mm

17
devices/fy.properties Normal file
View File

@@ -0,0 +1,17 @@
#Fri Aug 10 15:47:14 CEST 2018
defaultSpeed=2.0
estbilizationDelay=0
hasEnable=false
homingType=None
maxSpeed=NaN
maxValue=0.0
minSpeed=NaN
minValue=0.0
offset=0.0
precision=3
resolution=0.001
rotation=false
scale=1.0
sign_bit=0
startRetries=1
unit=mm

View File

@@ -0,0 +1,20 @@
#Thu Jun 28 17:46:46 CEST 2018
flipHorizontally=false
flipVertically=false
grayscale=false
invert=false
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
roiWidth=-1
roiX=0
roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
spatialCalOffsetX=NaN
spatialCalOffsetY=NaN
spatialCalScaleX=NaN
spatialCalScaleY=NaN
spatialCalUnits=mm
transpose=false

24
devices/img.properties Normal file
View File

@@ -0,0 +1,24 @@
#Wed Sep 12 14:06:31 CEST 2018
colormap=Grayscale
colormapAutomatic=false
colormapMax=18.133
colormapMin=6.4
flipHorizontally=false
flipVertically=false
grayscale=false
invert=false
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=899
roiWidth=893
roiX=48
roiY=45
rotation=230.05382605006437
rotationCrop=true
scale=1.0
spatialCalOffsetX=-447.0
spatialCalOffsetY=-450.0
spatialCalScaleX=0.5262180258614136
spatialCalScaleY=0.5227145226413789
spatialCalUnits=mm
transpose=false

View File

@@ -0,0 +1,8 @@
#Tue Jun 20 15:07:30 CEST 2017
maxValue=0.4
minValue=0.0
offset=0.0
precision=2
resolution=NaN
scale=3.0E-4
unit=V

View File

@@ -0,0 +1,9 @@
#Mon Dec 03 11:44:53 CET 2018
maxValue=0.4
minValue=0.0
offset=0.0
precision=2
resolution=NaN
scale=3.0E-4
sign_bit=0
unit=V

View File

@@ -0,0 +1,9 @@
#Mon Dec 03 11:44:53 CET 2018
maxValue=0.4
minValue=0.0
offset=0.0
precision=2
resolution=NaN
scale=3.0E-4
sign_bit=0
unit=V

View File

@@ -0,0 +1,9 @@
#Mon Dec 03 11:44:53 CET 2018
maxValue=0.4
minValue=0.0
offset=0.0
precision=2
resolution=NaN
scale=3.0E-4
sign_bit=0
unit=V

View File

@@ -0,0 +1,9 @@
#Tue Jun 19 16:41:24 CEST 2018
maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
resolution=NaN
scale=1.0
sign_bit=0
unit=null

13
devices/m1.properties Normal file
View File

@@ -0,0 +1,13 @@
#Fri Jun 30 09:37:38 CEST 2017
defaultSpeed=1.0
estbilizationDelay=0
maxSpeed=10.0
maxValue=10.0
minSpeed=0.1
minValue=-10.0
offset=0.0
precision=2
resolution=NaN
rotation=false
scale=1.0
unit=mm

13
devices/m2.properties Normal file
View File

@@ -0,0 +1,13 @@
#Fri Jun 30 09:37:38 CEST 2017
defaultSpeed=1.0
estbilizationDelay=0
maxSpeed=10.0
maxValue=10.0
minSpeed=0.1
minValue=-10.0
offset=0.0
precision=2
resolution=NaN
rotation=false
scale=1.0
unit=mm

View File

@@ -0,0 +1,20 @@
#Thu Aug 09 11:01:09 CEST 2018
flipHorizontally=false
flipVertically=false
grayscale=false
invert=false
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
roiWidth=-1
roiX=0
roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
spatialCalOffsetX=NaN
spatialCalOffsetY=NaN
spatialCalScaleX=NaN
spatialCalScaleY=NaN
spatialCalUnits=mm
transpose=false

View File

@@ -0,0 +1,5 @@
#Thu Mar 01 11:13:34 CET 2018
offset=0.0
precision=-1
scale=1.0
unit=null

9
devices/p1.properties Normal file
View File

@@ -0,0 +1,9 @@
#Fri Jun 30 09:37:38 CEST 2017
maxValue=1000.0
minValue=0.0
offset=0.0
precision=-1
resolution=NaN
rotation=false
scale=1.0
unit=mm

View File

@@ -0,0 +1,8 @@
#Wed Feb 28 17:35:59 CET 2018
maxValue=30000.0
minValue=0.0
offset=0.0
precision=-1
resolution=NaN
scale=0.1
unit=%

View File

@@ -0,0 +1,6 @@
#Tue Jun 19 16:41:20 CEST 2018
offset=-25.81632
precision=2
scale=0.003888
sign_bit=0
unit=%

View File

@@ -0,0 +1,6 @@
#Tue Jun 19 16:41:20 CEST 2018
offset=-25.81632
precision=2
scale=0.003888
sign_bit=0
unit=C

View File

@@ -0,0 +1,9 @@
#Tue Sep 12 15:00:38 CEST 2017
maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
resolution=NaN
rotation=false
scale=1.0
unit=null

8
devices/robot.properties Normal file
View File

@@ -0,0 +1,8 @@
#Thu Jul 21 08:35:47 CEST 2016
offsetReadAnalogInput=0
offsetReadAnalogOutput=0
offsetReadDigitalInput=0
offsetReadDigitalOutput=0
offsetWriteAnalogOutput=0
offsetWriteDigitalOutput=0
timeout=1000

View File

@@ -0,0 +1,10 @@
#Tue Jun 19 16:41:28 CEST 2018
maxValue=180.0
minValue=-180.0
offset=0.0
precision=2
resolution=0.1
rotation=false
scale=1.0
sign_bit=0
unit=deg

View File

@@ -0,0 +1,10 @@
#Tue Jun 19 16:41:28 CEST 2018
maxValue=127.5
minValue=-127.5
offset=0.0
precision=2
resolution=0.1
rotation=false
scale=1.0
sign_bit=0
unit=deg

View File

@@ -0,0 +1,10 @@
#Tue Jun 19 16:41:28 CEST 2018
maxValue=152.5
minValue=-152.5
offset=0.0
precision=2
resolution=0.1
rotation=false
scale=1.0
sign_bit=0
unit=deg

View File

@@ -0,0 +1,10 @@
#Tue Jun 19 16:41:28 CEST 2018
maxValue=270.0
minValue=-270.0
offset=0.0
precision=2
resolution=0.1
rotation=false
scale=1.0
sign_bit=0
unit=deg

View File

@@ -0,0 +1,10 @@
#Tue Jun 19 16:41:28 CEST 2018
maxValue=132.5
minValue=-122.5
offset=0.0
precision=2
resolution=0.1
rotation=false
scale=1.0
sign_bit=0
unit=deg

View File

@@ -0,0 +1,10 @@
#Fri Aug 24 14:56:42 CEST 2018
maxValue=400.0
minValue=-400.0
offset=0.0
precision=2
resolution=0.1
rotation=false
scale=1.0
sign_bit=0
unit=deg

View File

@@ -0,0 +1,8 @@
#Thu Jul 21 12:02:04 CEST 2016
offsetReadAnalogInput=0
offsetReadAnalogOutput=0
offsetReadDigitalInput=0
offsetReadDigitalOutput=0
offsetWriteAnalogOutput=0
offsetWriteDigitalOutput=0
timeout=1000

View File

@@ -0,0 +1,10 @@
#Tue Jun 19 16:41:28 CEST 2018
maxValue=180.0
minValue=-180.0
offset=0.0
precision=2
resolution=0.05
rotation=true
scale=1.0
sign_bit=0
unit=deg

View File

@@ -0,0 +1,10 @@
#Tue Jun 19 16:41:28 CEST 2018
maxValue=180.0
minValue=-180.0
offset=0.0
precision=-2
resolution=0.05
rotation=true
scale=1.0
sign_bit=0
unit=deg

View File

@@ -0,0 +1,10 @@
#Tue Jun 19 16:41:28 CEST 2018
maxValue=360.0
minValue=-360.0
offset=0.0
precision=2
resolution=0.1
rotation=true
scale=1.0
sign_bit=0
unit=deg

View File

@@ -0,0 +1,10 @@
#Tue Jun 19 16:41:28 CEST 2018
maxValue=1000.0
minValue=-1000.0
offset=0.0
precision=2
resolution=0.05
rotation=false
scale=1.0
sign_bit=0
unit=mm

View File

@@ -0,0 +1,10 @@
#Tue Jun 19 16:41:28 CEST 2018
maxValue=1000.0
minValue=-1000.0
offset=0.0
precision=2
resolution=0.05
rotation=false
scale=1.0
sign_bit=0
unit=null

View File

@@ -0,0 +1,10 @@
#Tue Jun 19 16:41:28 CEST 2018
maxValue=1000.0
minValue=-1000.0
offset=0.0
precision=2
resolution=0.05
rotation=false
scale=1.0
sign_bit=0
unit=null

17
devices/ry.properties Normal file
View File

@@ -0,0 +1,17 @@
#Fri Aug 10 15:47:14 CEST 2018
defaultSpeed=50.0
estbilizationDelay=0
hasEnable=false
homingType=None
maxSpeed=NaN
maxValue=0.0
minSpeed=NaN
minValue=0.0
offset=0.0
precision=3
resolution=0.001
rotation=false
scale=1.0
sign_bit=0
startRetries=1
unit=deg

View File

@@ -0,0 +1,8 @@
#Thu Oct 25 16:47:21 CEST 2018
holdingCurrent=30.0
mountCurrent=10.0
remanenceCurrent=-10.0
restingCurrent=10.0
reverseCurrent=-10.0
reverseTime=0.4
unmountCurrent=10.0

View File

@@ -0,0 +1,9 @@
#Tue Jun 19 16:41:20 CEST 2018
maxValue=50.0
minValue=-50.0
offset=0.0
precision=2
resolution=NaN
scale=0.003
sign_bit=0
unit=mA

View File

@@ -0,0 +1,6 @@
#Tue Jun 19 16:45:06 CEST 2018
offset=0.0
precision=2
scale=0.003
sign_bit=15
unit=mA

24
devices/src1.properties Normal file
View File

@@ -0,0 +1,24 @@
#Thu Sep 22 14:45:06 CEST 2016
colormap=Temperature
colormapAutomatic=true
colormapMax=255.0
colormapMin=0.0
flipHorizontally=false
flipVertically=false
grayscale=false
invert=false
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
roiWidth=-1
roiX=0
roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
spatialCalOffsetX=NaN
spatialCalOffsetY=NaN
spatialCalScaleX=NaN
spatialCalScaleY=NaN
spatialCalUnits=mm
transpose=false

24
devices/src2.properties Normal file
View File

@@ -0,0 +1,24 @@
#Thu Sep 22 14:45:06 CEST 2016
colormap=Grayscale
colormapAutomatic=true
colormapMax=255.0
colormapMin=0.0
flipHorizontally=false
flipVertically=false
grayscale=false
invert=false
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
roiWidth=-1
roiX=0
roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
spatialCalOffsetX=NaN
spatialCalOffsetY=NaN
spatialCalScaleX=NaN
spatialCalScaleY=NaN
spatialCalUnits=mm
transpose=false

View File

@@ -0,0 +1,20 @@
#Thu Aug 09 11:46:12 CEST 2018
flipHorizontally=false
flipVertically=false
grayscale=false
invert=false
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
roiWidth=-1
roiX=0
roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
spatialCalOffsetX=NaN
spatialCalOffsetY=NaN
spatialCalScaleX=NaN
spatialCalScaleY=NaN
spatialCalUnits=mm
transpose=false

6
devices/ue.properties Normal file
View File

@@ -0,0 +1,6 @@
#Thu Aug 31 16:41:09 CEST 2017
baudRate=9600
dataBits=DB_8
parity=None
port=null
stopBits=SB_1

8
devices/wago.properties Normal file
View File

@@ -0,0 +1,8 @@
#Wed Feb 28 16:27:51 CET 2018
offsetReadAnalogInput=0
offsetReadAnalogOutput=0x200
offsetReadDigitalInput=0
offsetReadDigitalOutput=0x200
offsetWriteAnalogOutput=0
offsetWriteDigitalOutput=0
timeout=1000

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel3" max="32767" attributes="0"/>
<Component id="deviceValuePanel1" max="32767" attributes="0"/>
<Component id="deviceStatePanel1" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="deviceValuePanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="deviceStatePanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel3">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Commands"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonEnable" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonDisable" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonRead" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonEnable" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonDisable" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonRead" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonEnable">
<Properties>
<Property name="text" type="java.lang.String" value="Enable"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonEnableActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonDisable">
<Properties>
<Property name="text" type="java.lang.String" value="Disable"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDisableActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonRead">
<Properties>
<Property name="text" type="java.lang.String" value="Read"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonReadActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="ch.psi.pshell.swing.DeviceStatePanel" name="deviceStatePanel1">
<Properties>
<Property name="deviceName" type="java.lang.String" value="barcode_reader"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.DeviceValuePanel" name="deviceValuePanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Value"/>
</Border>
</Property>
<Property name="deviceName" type="java.lang.String" value="barcode_reader"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@@ -0,0 +1,162 @@
import ch.psi.pshell.core.Context;
import ch.psi.pshell.swing.DevicePanel;
import ch.psi.utils.swing.SwingUtils;
import java.util.concurrent.CompletableFuture;
/**
*
*/
public class BarcodeReaderPanel extends DevicePanel {
volatile boolean enabled;
public BarcodeReaderPanel() {
initComponents();
this.startTimer(100);
}
CompletableFuture future;
@Override
public void onTimer(){
if ((getDevice()!=null) && enabled){
if ((future==null) || (future.isDone())){
future = Context.getInstance().evalLineBackgroundAsync("barcode_reader.get()");
}
}
}
void execute(String statement, boolean showReturn){
try {
Context.getInstance().evalLineBackgroundAsync(statement).handle((ret, ex) -> {
if (BarcodeReaderPanel.this.isShowing()){
if (ex != null){
showException((Exception)ex);
} else if (showReturn){
if (ret == null){
SwingUtils.showMessage(this, "Return", "No code detected", 20000);
} else {
SwingUtils.showMessage(this, "Return", "Detected code: " +ret, 20000);
}
}
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel3 = new javax.swing.JPanel();
buttonEnable = new javax.swing.JButton();
buttonDisable = new javax.swing.JButton();
buttonRead = new javax.swing.JButton();
deviceStatePanel1 = new ch.psi.pshell.swing.DeviceStatePanel();
deviceValuePanel1 = new ch.psi.pshell.swing.DeviceValuePanel();
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Commands"));
buttonEnable.setText("Enable");
buttonEnable.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonEnableActionPerformed(evt);
}
});
buttonDisable.setText("Disable");
buttonDisable.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonDisableActionPerformed(evt);
}
});
buttonRead.setText("Read");
buttonRead.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonReadActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(buttonEnable)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonDisable)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonRead)
.addContainerGap())
);
jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonDisable, buttonEnable, buttonRead});
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonEnable)
.addComponent(buttonDisable)
.addComponent(buttonRead))
.addContainerGap())
);
deviceStatePanel1.setDeviceName("barcode_reader");
deviceValuePanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Value"));
deviceValuePanel1.setDeviceName("barcode_reader");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(deviceStatePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(deviceStatePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0))
);
}// </editor-fold>//GEN-END:initComponents
private void buttonEnableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonEnableActionPerformed
execute("barcode_reader.enable()", false);
enabled = true;
}//GEN-LAST:event_buttonEnableActionPerformed
private void buttonDisableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDisableActionPerformed
enabled = false;
execute("barcode_reader.disable()", false);
}//GEN-LAST:event_buttonDisableActionPerformed
private void buttonReadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonReadActionPerformed
enabled = false;
execute("barcode_reader.read(5.0) ", true);
}//GEN-LAST:event_buttonReadActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonDisable;
private javax.swing.JButton buttonEnable;
private javax.swing.JButton buttonRead;
private ch.psi.pshell.swing.DeviceStatePanel deviceStatePanel1;
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel1;
private javax.swing.JPanel jPanel3;
// End of variables declaration//GEN-END:variables
}

72
plugins/Beeper.java Normal file
View File

@@ -0,0 +1,72 @@
/*
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.device.*;
import com.sun.jna.Function;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIFunctionMapper;
import com.sun.jna.win32.W32APITypeMapper;
import java.util.HashMap;
import java.util.Map;
/**
*/
public class Beeper extends DeviceBase {
public Beeper(String name) {
super(name);
}
// JNA Mapping
static Map UNICODE_OPTIONS = new HashMap() {
{
put("type-mapper", W32APITypeMapper.UNICODE);
put("function-mapper", W32APIFunctionMapper.UNICODE);
}
};
interface Kernel32 extends StdCallLibrary {
public static final String LIBRARY_NAME = "kernel32";
Kernel32 INSTANCE = (Kernel32) Native.loadLibrary(LIBRARY_NAME, Kernel32.class, UNICODE_OPTIONS);
Kernel32 SYNC_INSTANCE = (Kernel32) Native.synchronizedLibrary(INSTANCE);
boolean Beep(int FREQUENCY, int DURATION);
void Sleep(int DURATION);
int CreateEventW(Pointer securityAttributes, boolean manualReset, boolean initialState, String name);
int CreateThread(/*Pointer*/int lpThreadAttributes, IntByReference dwStackSize, Function lpStartAddress, Structure lpParameter, int dwCreationFlags, IntByReference lpThreadId);
public static final int STILL_ACTIVE = 259;
int GetExitCodeThread(int hThread, IntByReference lpExitCode);
int GetLastError();
boolean CloseHandle(int handle);
}
private final int mEventHandle = Kernel32.INSTANCE.CreateEventW(Pointer.NULL, true, false, null);
//Public interface
public int getLastError(){
return Kernel32.SYNC_INSTANCE.GetLastError();
}
public void sleep(int duration){
Kernel32.SYNC_INSTANCE.Sleep(duration);
}
public void beep(int frequency, int duration){
Kernel32.SYNC_INSTANCE.Beep(frequency, duration);
}
}

803
plugins/Commands.form Normal file
View File

@@ -0,0 +1,803 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jTabbedPane1" alignment="1" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jTabbedPane1" min="-2" max="-2" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JTabbedPane" name="jTabbedPane1">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="tabCommands">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Commands">
<Property name="tabTitle" type="java.lang.String" value="Commands"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="pnDry" alignment="0" max="32767" attributes="0"/>
<Component id="pnTransfer" alignment="0" max="32767" attributes="0"/>
<Component id="jPanel1" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="pnDry" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="pnTransfer" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="pnDry">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Drying"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonDry" linkSize="14" min="-2" pref="100" max="-2" attributes="0"/>
<Component id="ckeckParkOnDry" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" pref="25" max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerDrySpeed" linkSize="14" min="-2" pref="100" max="-2" attributes="0"/>
<Component id="spinnerDryTime" linkSize="14" min="-2" pref="100" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonDry" min="-2" max="-2" attributes="0"/>
<Component id="spinnerDryTime" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerDrySpeed" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="ckeckParkOnDry" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="jLabel6" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" value="Heat time(s):"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerDryTime">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="30.0" maximum="30.0" minimum="1.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ch.psi.utils.swing.HorizontalSpinner()"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="buttonDry">
<Properties>
<Property name="text" type="java.lang.String" value="Dry"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDryActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerDrySpeed">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.5" maximum="10.0" minimum="0.1" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ch.psi.utils.swing.HorizontalSpinner()"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="text" type="java.lang.String" value="Speed(%):"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="ckeckParkOnDry">
<Properties>
<Property name="text" type="java.lang.String" value="Park on finish"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="pnTransfer">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Sample Transfer"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonMount" linkSize="11" alignment="0" min="-2" pref="100" max="-2" attributes="0"/>
<Component id="buttonUnmount" linkSize="11" alignment="0" min="-2" pref="100" max="-2" attributes="0"/>
<Component id="buttonScanPin" linkSize="11" alignment="0" min="-2" pref="100" max="-2" attributes="0"/>
<Component id="buttonScanPuck" alignment="0" min="-2" pref="100" max="-2" attributes="0"/>
<Component id="checkAuxiliary" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Component id="jPanel5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel5" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="buttonMount" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonUnmount" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonScanPin" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonScanPuck" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="checkAuxiliary" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonMount">
<Properties>
<Property name="text" type="java.lang.String" value="Mount"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonMountActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel5">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel3" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" linkSize="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerPuck" linkSize="9" alignment="0" min="-2" pref="100" max="-2" attributes="0"/>
<Component id="checkForce" min="-2" max="-2" attributes="0"/>
<Component id="checkDatamatrix" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSample" linkSize="9" alignment="0" min="-2" pref="100" max="-2" attributes="0"/>
<Component id="spinnerSegment" linkSize="9" alignment="0" min="-2" pref="100" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel1" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSegment" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel2" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="spinnerPuck" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel3" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSample" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel4" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="checkForce" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel5" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="checkDatamatrix" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Force:"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="checkForce">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="horizontalTextPosition" type="int" value="10"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerSample">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" maximum="16" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ch.psi.utils.swing.HorizontalSpinner()"/>
</AuxValues>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerPuck">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" maximum="5" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ch.psi.utils.swing.HorizontalSpinner()"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Segment:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Puck:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerSegment">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel type="list">
<ListItem value="A"/>
<ListItem value="B"/>
<ListItem value="C"/>
<ListItem value="D"/>
<ListItem value="E"/>
<ListItem value="F"/>
</SpinnerModel>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ch.psi.utils.swing.HorizontalSpinner()"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Sample:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Read DM:"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="checkDatamatrix">
<Properties>
<Property name="horizontalTextPosition" type="int" value="10"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="buttonUnmount">
<Properties>
<Property name="text" type="java.lang.String" value="Unmount"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonUnmountActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonScanPin">
<Properties>
<Property name="text" type="java.lang.String" value="Scan Pin"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonScanPinActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonScanPuck">
<Properties>
<Property name="text" type="java.lang.String" value="Scan Puck"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonScanPuckActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="checkAuxiliary">
<Properties>
<Property name="text" type="java.lang.String" value="Auxiliary"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="checkAuxiliaryActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Gripper"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonGripperScan" min="-2" pref="100" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonTrash" min="-2" pref="100" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonGripperScan" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonTrash" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonGripperScan">
<Properties>
<Property name="text" type="java.lang.String" value="Scan"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonGripperScanActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonTrash">
<Properties>
<Property name="text" type="java.lang.String" value="Trash"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonTrashActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="tabAdvanced">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Advanced">
<Property name="tabTitle" type="java.lang.String" value="Advanced"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="pnMotion" alignment="0" max="32767" attributes="0"/>
<Component id="pnDatabase" alignment="0" max="32767" attributes="0"/>
<Component id="pnLowLevel" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="pnLowLevel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="pnDatabase" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="pnMotion" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="pnLowLevel">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Low-level Motion Commands"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonMovePark" linkSize="10" alignment="0" min="-2" pref="114" max="-2" attributes="0"/>
<Component id="buttonMoveAux" linkSize="10" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="buttonMoveCold" linkSize="10" alignment="0" min="-2" pref="114" max="-2" attributes="0"/>
<Component id="buttonMoveHeater" linkSize="10" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="buttonGetGonio" linkSize="10" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="buttonGetDewar" linkSize="10" alignment="0" min="-2" pref="114" max="-2" attributes="0"/>
<Component id="buttonGetAux" linkSize="10" alignment="0" min="-2" pref="114" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="64" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonPutDewar" linkSize="10" alignment="0" min="-2" pref="101" max="-2" attributes="0"/>
<Component id="buttonPutGonio" linkSize="10" alignment="0" min="-2" pref="101" max="-2" attributes="0"/>
<Component id="buttonMoveGonio" linkSize="10" alignment="0" min="-2" pref="101" max="-2" attributes="0"/>
<Component id="buttonMoveHome" linkSize="10" alignment="0" min="-2" pref="101" max="-2" attributes="0"/>
<Component id="buttonMoveDewar" linkSize="10" alignment="0" min="-2" pref="101" max="-2" attributes="0"/>
<Component id="buttonMoveScanner" linkSize="10" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="buttonPutAux" linkSize="10" min="-2" pref="101" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonGetDewar" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonPutDewar" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonGetAux" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonPutAux" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonGetGonio" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonPutGonio" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonMoveGonio" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonMoveAux" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonMovePark" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonMoveHome" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonMoveDewar" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonMoveCold" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonMoveHeater" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonMoveScanner" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonMovePark">
<Properties>
<Property name="text" type="java.lang.String" value="Move Park"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonMoveParkActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonMoveCold">
<Properties>
<Property name="text" type="java.lang.String" value="Move Cold"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonMoveColdActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonMoveGonio">
<Properties>
<Property name="text" type="java.lang.String" value="Move Gonio"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonMoveGonioActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonMoveHeater">
<Properties>
<Property name="text" type="java.lang.String" value="Move Heater"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonMoveHeaterActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonGetGonio">
<Properties>
<Property name="text" type="java.lang.String" value="Get Gonio"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonGetGonioActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonPutGonio">
<Properties>
<Property name="text" type="java.lang.String" value="Put Gonio"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPutGonioActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonMoveDewar">
<Properties>
<Property name="text" type="java.lang.String" value="Move Dewar"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonMoveDewarActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonMoveHome">
<Properties>
<Property name="text" type="java.lang.String" value="Move Home"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonMoveHomeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonMoveScanner">
<Properties>
<Property name="text" type="java.lang.String" value="Move Scanner"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonMoveScannerActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonGetDewar">
<Properties>
<Property name="text" type="java.lang.String" value="Get Dewar"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonGetDewarActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonPutDewar">
<Properties>
<Property name="text" type="java.lang.String" value="Put Dewar"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPutDewarActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonMoveAux">
<Properties>
<Property name="text" type="java.lang.String" value="Move Aux"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonMoveAuxActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonGetAux">
<Properties>
<Property name="text" type="java.lang.String" value="Get Aux"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonGetAuxActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonPutAux">
<Properties>
<Property name="text" type="java.lang.String" value="Put Aux"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPutAuxActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="pnDatabase">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Database"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonClearSampleDb" linkSize="12" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Component id="buttonResetPuckIds" linkSize="12" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonClearSampleDb" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonResetPuckIds" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonClearSampleDb">
<Properties>
<Property name="text" type="java.lang.String" value="Clear Sample Db"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonClearSampleDbActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonResetPuckIds">
<Properties>
<Property name="text" type="java.lang.String" value="Reset Puck IDs"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonResetPuckIdsActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="pnMotion">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Motion"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonRecover" linkSize="13" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonEnableAll" linkSize="13" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonRecover" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonEnableAll" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonRecover">
<Properties>
<Property name="text" type="java.lang.String" value="Dewar Recovery"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonRecoverActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonEnableAll">
<Properties>
<Property name="text" type="java.lang.String" value="Enable Motion"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonEnableAllActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

914
plugins/Commands.java Normal file
View File

@@ -0,0 +1,914 @@
/*
* Copyright (c) 2014-2017 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.device.Device;
import ch.psi.pshell.device.DeviceAdapter;
import ch.psi.pshell.device.GenericDevice;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Component;
import javax.swing.JComponent;
import javax.swing.JSpinner;
import javax.swing.JTextField;
/**
*
*/
public class Commands extends Panel {
public Commands() {
initComponents();
((JSpinner.DefaultEditor)spinnerSegment.getEditor()).getTextField().setHorizontalAlignment(JTextField.CENTER);
((JSpinner.DefaultEditor)spinnerPuck.getEditor()).getTextField().setHorizontalAlignment(JTextField.CENTER);
((JSpinner.DefaultEditor)spinnerSample.getEditor()).getTextField().setHorizontalAlignment(JTextField.CENTER);
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
GenericDevice basePlate = getDevice("BasePlate");
if (basePlate != null){
basePlate.addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
if (value!=null){
String segment = ((Object[])value)[0].toString();
spinnerSegment.setValue(segment);
Integer puck = (Integer) ((Object[])value)[1];
spinnerPuck.setValue(Integer.valueOf(puck));
Integer sample = (Integer) ((Object[])value)[2];
if (sample!=null){
spinnerSample.setValue(Integer.valueOf(sample));
}
}
}
});
}
}
@Override
public void onStateChange(State state, State former) {
boolean enabled = (state == State.Ready);
for (Component c: SwingUtils.getComponentsByType(this, JComponent.class)){
c.setEnabled(enabled);
}
spinnerSegment.setEnabled(enabled && !checkAuxiliary.isSelected());
spinnerPuck.setEnabled(enabled && !checkAuxiliary.isSelected());
buttonScanPuck.setEnabled(enabled && !checkAuxiliary.isSelected());
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
//Callback to perform update - in event thread
@Override
protected void doUpdate() {
}
@Override
public boolean isActive() {
return true;
}
void execute(String statement){
execute(statement, false);
}
void execute(String statement, boolean background){
execute(statement, background, false);
}
void execute(String statement, boolean background, boolean showReturn){
try {
evalAsync(statement, background).handle((ret, ex) -> {
if (ex != null){
showException((Exception)ex);
} else if (showReturn){
SwingUtils.showMessage(getTopLevel(), "Return", String.valueOf(ret));
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}
void execute(String script, Object args){
try {
runAsync(script, args).handle((ret, ex) -> {
if (ex != null){
showException((Exception)ex);
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jTabbedPane1 = new javax.swing.JTabbedPane();
tabCommands = new javax.swing.JPanel();
pnDry = new javax.swing.JPanel();
jLabel6 = new javax.swing.JLabel();
spinnerDryTime = new ch.psi.utils.swing.HorizontalSpinner();
buttonDry = new javax.swing.JButton();
spinnerDrySpeed = new ch.psi.utils.swing.HorizontalSpinner();
jLabel7 = new javax.swing.JLabel();
ckeckParkOnDry = new javax.swing.JCheckBox();
pnTransfer = new javax.swing.JPanel();
buttonMount = new javax.swing.JButton();
jPanel5 = new javax.swing.JPanel();
jLabel4 = new javax.swing.JLabel();
checkForce = new javax.swing.JCheckBox();
spinnerSample = new ch.psi.utils.swing.HorizontalSpinner();
spinnerPuck = new ch.psi.utils.swing.HorizontalSpinner();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
spinnerSegment = new ch.psi.utils.swing.HorizontalSpinner();
jLabel3 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
checkDatamatrix = new javax.swing.JCheckBox();
buttonUnmount = new javax.swing.JButton();
buttonScanPin = new javax.swing.JButton();
buttonScanPuck = new javax.swing.JButton();
checkAuxiliary = new javax.swing.JCheckBox();
jPanel1 = new javax.swing.JPanel();
buttonGripperScan = new javax.swing.JButton();
buttonTrash = new javax.swing.JButton();
tabAdvanced = new javax.swing.JPanel();
pnLowLevel = new javax.swing.JPanel();
buttonMovePark = new javax.swing.JButton();
buttonMoveCold = new javax.swing.JButton();
buttonMoveGonio = new javax.swing.JButton();
buttonMoveHeater = new javax.swing.JButton();
buttonGetGonio = new javax.swing.JButton();
buttonPutGonio = new javax.swing.JButton();
buttonMoveDewar = new javax.swing.JButton();
buttonMoveHome = new javax.swing.JButton();
buttonMoveScanner = new javax.swing.JButton();
buttonGetDewar = new javax.swing.JButton();
buttonPutDewar = new javax.swing.JButton();
buttonMoveAux = new javax.swing.JButton();
buttonGetAux = new javax.swing.JButton();
buttonPutAux = new javax.swing.JButton();
pnDatabase = new javax.swing.JPanel();
buttonClearSampleDb = new javax.swing.JButton();
buttonResetPuckIds = new javax.swing.JButton();
pnMotion = new javax.swing.JPanel();
buttonRecover = new javax.swing.JButton();
buttonEnableAll = new javax.swing.JButton();
pnDry.setBorder(javax.swing.BorderFactory.createTitledBorder("Drying"));
jLabel6.setText("Heat time(s):");
spinnerDryTime.setModel(new javax.swing.SpinnerNumberModel(30.0d, 1.0d, 30.0d, 1.0d));
buttonDry.setText("Dry");
buttonDry.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonDryActionPerformed(evt);
}
});
spinnerDrySpeed.setModel(new javax.swing.SpinnerNumberModel(0.5d, 0.1d, 10.0d, 1.0d));
jLabel7.setText("Speed(%):");
ckeckParkOnDry.setText("Park on finish");
javax.swing.GroupLayout pnDryLayout = new javax.swing.GroupLayout(pnDry);
pnDry.setLayout(pnDryLayout);
pnDryLayout.setHorizontalGroup(
pnDryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnDryLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pnDryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonDry, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ckeckParkOnDry))
.addGap(18, 25, Short.MAX_VALUE)
.addGroup(pnDryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel6)
.addComponent(jLabel7))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnDryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerDrySpeed, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerDryTime, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
pnDryLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonDry, spinnerDrySpeed, spinnerDryTime});
pnDryLayout.setVerticalGroup(
pnDryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnDryLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pnDryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnDryLayout.createSequentialGroup()
.addGroup(pnDryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonDry)
.addComponent(spinnerDryTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnDryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerDrySpeed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7)
.addComponent(ckeckParkOnDry)))
.addComponent(jLabel6))
.addContainerGap())
);
pnTransfer.setBorder(javax.swing.BorderFactory.createTitledBorder("Sample Transfer"));
buttonMount.setText("Mount");
buttonMount.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonMountActionPerformed(evt);
}
});
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel4.setText("Force:");
checkForce.setSelected(true);
checkForce.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
spinnerSample.setModel(new javax.swing.SpinnerNumberModel(1, 1, 16, 1));
spinnerPuck.setModel(new javax.swing.SpinnerNumberModel(1, 1, 5, 1));
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("Segment:");
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel2.setText("Puck:");
spinnerSegment.setModel(new javax.swing.SpinnerListModel(new String[] {"A", "B", "C", "D", "E", "F"}));
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel3.setText("Sample:");
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel5.setText("Read DM:");
checkDatamatrix.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel2)
.addComponent(jLabel1)
.addComponent(jLabel4)
.addComponent(jLabel5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerPuck, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(checkForce)
.addComponent(checkDatamatrix)
.addComponent(spinnerSample, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerSegment, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, 0))
);
jPanel5Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2, jLabel3, jLabel4, jLabel5});
jPanel5Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerPuck, spinnerSample, spinnerSegment});
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel1)
.addComponent(spinnerSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel2)
.addComponent(spinnerPuck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel3)
.addComponent(spinnerSample, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel4)
.addComponent(checkForce))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel5)
.addComponent(checkDatamatrix)))
);
buttonUnmount.setText("Unmount");
buttonUnmount.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonUnmountActionPerformed(evt);
}
});
buttonScanPin.setText("Scan Pin");
buttonScanPin.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonScanPinActionPerformed(evt);
}
});
buttonScanPuck.setText("Scan Puck");
buttonScanPuck.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonScanPuckActionPerformed(evt);
}
});
checkAuxiliary.setText("Auxiliary");
checkAuxiliary.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
checkAuxiliaryActionPerformed(evt);
}
});
javax.swing.GroupLayout pnTransferLayout = new javax.swing.GroupLayout(pnTransfer);
pnTransfer.setLayout(pnTransferLayout);
pnTransferLayout.setHorizontalGroup(
pnTransferLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnTransferLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pnTransferLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonMount, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonUnmount, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonScanPin, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonScanPuck, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(checkAuxiliary))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
pnTransferLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonMount, buttonScanPin, buttonUnmount});
pnTransferLayout.setVerticalGroup(
pnTransferLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnTransferLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pnTransferLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(pnTransferLayout.createSequentialGroup()
.addComponent(buttonMount)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonUnmount)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonScanPin)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonScanPuck)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(checkAuxiliary)))
.addContainerGap())
);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Gripper"));
buttonGripperScan.setText("Scan");
buttonGripperScan.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonGripperScanActionPerformed(evt);
}
});
buttonTrash.setText("Trash");
buttonTrash.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonTrashActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(buttonGripperScan, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonTrash, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonGripperScan)
.addComponent(buttonTrash))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout tabCommandsLayout = new javax.swing.GroupLayout(tabCommands);
tabCommands.setLayout(tabCommandsLayout);
tabCommandsLayout.setHorizontalGroup(
tabCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabCommandsLayout.createSequentialGroup()
.addGap(0, 0, 0)
.addGroup(tabCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(pnDry, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(pnTransfer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
);
tabCommandsLayout.setVerticalGroup(
tabCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabCommandsLayout.createSequentialGroup()
.addContainerGap()
.addComponent(pnDry, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(pnTransfer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jTabbedPane1.addTab("Commands", tabCommands);
pnLowLevel.setBorder(javax.swing.BorderFactory.createTitledBorder("Low-level Motion Commands"));
buttonMovePark.setText("Move Park");
buttonMovePark.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonMoveParkActionPerformed(evt);
}
});
buttonMoveCold.setText("Move Cold");
buttonMoveCold.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonMoveColdActionPerformed(evt);
}
});
buttonMoveGonio.setText("Move Gonio");
buttonMoveGonio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonMoveGonioActionPerformed(evt);
}
});
buttonMoveHeater.setText("Move Heater");
buttonMoveHeater.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonMoveHeaterActionPerformed(evt);
}
});
buttonGetGonio.setText("Get Gonio");
buttonGetGonio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonGetGonioActionPerformed(evt);
}
});
buttonPutGonio.setText("Put Gonio");
buttonPutGonio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPutGonioActionPerformed(evt);
}
});
buttonMoveDewar.setText("Move Dewar");
buttonMoveDewar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonMoveDewarActionPerformed(evt);
}
});
buttonMoveHome.setText("Move Home");
buttonMoveHome.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonMoveHomeActionPerformed(evt);
}
});
buttonMoveScanner.setText("Move Scanner");
buttonMoveScanner.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonMoveScannerActionPerformed(evt);
}
});
buttonGetDewar.setText("Get Dewar");
buttonGetDewar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonGetDewarActionPerformed(evt);
}
});
buttonPutDewar.setText("Put Dewar");
buttonPutDewar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPutDewarActionPerformed(evt);
}
});
buttonMoveAux.setText("Move Aux");
buttonMoveAux.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonMoveAuxActionPerformed(evt);
}
});
buttonGetAux.setText("Get Aux");
buttonGetAux.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonGetAuxActionPerformed(evt);
}
});
buttonPutAux.setText("Put Aux");
buttonPutAux.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPutAuxActionPerformed(evt);
}
});
javax.swing.GroupLayout pnLowLevelLayout = new javax.swing.GroupLayout(pnLowLevel);
pnLowLevel.setLayout(pnLowLevelLayout);
pnLowLevelLayout.setHorizontalGroup(
pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnLowLevelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonMovePark, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonMoveAux)
.addComponent(buttonMoveCold, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonMoveHeater)
.addComponent(buttonGetGonio)
.addComponent(buttonGetDewar, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonGetAux, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE)
.addGroup(pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonPutDewar, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonPutGonio, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonMoveGonio, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonMoveHome, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonMoveDewar, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonMoveScanner)
.addComponent(buttonPutAux, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
pnLowLevelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonGetAux, buttonGetDewar, buttonGetGonio, buttonMoveAux, buttonMoveCold, buttonMoveDewar, buttonMoveGonio, buttonMoveHeater, buttonMoveHome, buttonMovePark, buttonMoveScanner, buttonPutAux, buttonPutDewar, buttonPutGonio});
pnLowLevelLayout.setVerticalGroup(
pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnLowLevelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonGetDewar)
.addComponent(buttonPutDewar))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonGetAux)
.addComponent(buttonPutAux))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonGetGonio)
.addComponent(buttonPutGonio))
.addGap(18, 18, 18)
.addGroup(pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonMoveGonio)
.addComponent(buttonMoveAux))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonMovePark)
.addComponent(buttonMoveHome))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonMoveDewar)
.addComponent(buttonMoveCold))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonMoveHeater)
.addComponent(buttonMoveScanner))
.addContainerGap())
);
pnDatabase.setBorder(javax.swing.BorderFactory.createTitledBorder("Database"));
buttonClearSampleDb.setText("Clear Sample Db");
buttonClearSampleDb.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonClearSampleDbActionPerformed(evt);
}
});
buttonResetPuckIds.setText("Reset Puck IDs");
buttonResetPuckIds.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonResetPuckIdsActionPerformed(evt);
}
});
javax.swing.GroupLayout pnDatabaseLayout = new javax.swing.GroupLayout(pnDatabase);
pnDatabase.setLayout(pnDatabaseLayout);
pnDatabaseLayout.setHorizontalGroup(
pnDatabaseLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnDatabaseLayout.createSequentialGroup()
.addContainerGap()
.addComponent(buttonClearSampleDb)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(buttonResetPuckIds)
.addContainerGap())
);
pnDatabaseLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonClearSampleDb, buttonResetPuckIds});
pnDatabaseLayout.setVerticalGroup(
pnDatabaseLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnDatabaseLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pnDatabaseLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonClearSampleDb)
.addComponent(buttonResetPuckIds))
.addContainerGap())
);
pnMotion.setBorder(javax.swing.BorderFactory.createTitledBorder("Motion"));
buttonRecover.setText("Dewar Recovery");
buttonRecover.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonRecoverActionPerformed(evt);
}
});
buttonEnableAll.setText("Enable Motion");
buttonEnableAll.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonEnableAllActionPerformed(evt);
}
});
javax.swing.GroupLayout pnMotionLayout = new javax.swing.GroupLayout(pnMotion);
pnMotion.setLayout(pnMotionLayout);
pnMotionLayout.setHorizontalGroup(
pnMotionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnMotionLayout.createSequentialGroup()
.addContainerGap()
.addComponent(buttonRecover)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonEnableAll)
.addContainerGap())
);
pnMotionLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonEnableAll, buttonRecover});
pnMotionLayout.setVerticalGroup(
pnMotionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnMotionLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pnMotionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonRecover)
.addComponent(buttonEnableAll))
.addContainerGap())
);
javax.swing.GroupLayout tabAdvancedLayout = new javax.swing.GroupLayout(tabAdvanced);
tabAdvanced.setLayout(tabAdvancedLayout);
tabAdvancedLayout.setHorizontalGroup(
tabAdvancedLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabAdvancedLayout.createSequentialGroup()
.addGap(0, 0, 0)
.addGroup(tabAdvancedLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(pnMotion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(pnDatabase, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(pnLowLevel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(0, 0, 0))
);
tabAdvancedLayout.setVerticalGroup(
tabAdvancedLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabAdvancedLayout.createSequentialGroup()
.addContainerGap()
.addComponent(pnLowLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(pnDatabase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(pnMotion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jTabbedPane1.addTab("Advanced", tabAdvanced);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
}// </editor-fold>//GEN-END:initComponents
private void buttonEnableAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonEnableAllActionPerformed
execute("enable_motion()", true);
}//GEN-LAST:event_buttonEnableAllActionPerformed
private void buttonMountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMountActionPerformed
String segment = checkAuxiliary.isSelected() ? "X" : (String) spinnerSegment.getValue();
int puck = checkAuxiliary.isSelected() ? 1 :(Integer) spinnerPuck.getValue();
int sample = (Integer) spinnerSample.getValue();
String force = checkForce.isSelected() ? "True" : "False";
String readDatamatrix = checkDatamatrix.isSelected() ? "True" : "False";
execute("mount('" + segment + "'," + puck + "," + sample + ", force=" + force + ", read_dm=" + readDatamatrix + ")");
}//GEN-LAST:event_buttonMountActionPerformed
private void buttonMoveAuxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveAuxActionPerformed
execute("move_aux()");
}//GEN-LAST:event_buttonMoveAuxActionPerformed
private void buttonUnmountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUnmountActionPerformed
String segment = checkAuxiliary.isSelected() ? "X" : (String) spinnerSegment.getValue();
int puck = checkAuxiliary.isSelected() ? 1 :(Integer) spinnerPuck.getValue();
int sample = (Integer) spinnerSample.getValue();
String force = checkForce.isSelected() ? "True" : "False";
execute("unmount('" + segment + "'," + puck + "," + sample + ", force=" + force + ")");
}//GEN-LAST:event_buttonUnmountActionPerformed
private void buttonGetDewarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonGetDewarActionPerformed
String segment = (String) spinnerSegment.getValue();
int puck = (Integer) spinnerPuck.getValue();
int sample = (Integer) spinnerSample.getValue();
String force = checkForce.isSelected() ? "True" : "False";
execute("get_dewar('" + segment + "'," + puck + "," + sample + ", force=" + force + ")");
}//GEN-LAST:event_buttonGetDewarActionPerformed
private void buttonPutDewarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPutDewarActionPerformed
String segment = (String) spinnerSegment.getValue();
int puck = (Integer) spinnerPuck.getValue();
int sample = (Integer) spinnerSample.getValue();
String force = checkForce.isSelected() ? "True" : "False";
execute("put_dewar('" + segment + "'," + puck + "," + sample + ", force=" + force + ")");
}//GEN-LAST:event_buttonPutDewarActionPerformed
private void buttonGetGonioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonGetGonioActionPerformed
String force = checkForce.isSelected() ? "True" : "False";
execute("get_gonio(force=" + force + ")");
}//GEN-LAST:event_buttonGetGonioActionPerformed
private void buttonPutGonioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPutGonioActionPerformed
String force = checkForce.isSelected() ? "True" : "False";
execute("put_gonio(force=" + force + ")");
}//GEN-LAST:event_buttonPutGonioActionPerformed
private void buttonMoveParkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveParkActionPerformed
execute("move_park()");
}//GEN-LAST:event_buttonMoveParkActionPerformed
private void buttonMoveHomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveHomeActionPerformed
execute("move_home()");
}//GEN-LAST:event_buttonMoveHomeActionPerformed
private void buttonMoveGonioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveGonioActionPerformed
execute("move_gonio()");
}//GEN-LAST:event_buttonMoveGonioActionPerformed
private void buttonMoveDewarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveDewarActionPerformed
execute("move_dewar()");
}//GEN-LAST:event_buttonMoveDewarActionPerformed
private void buttonMoveScannerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveScannerActionPerformed
execute("move_scanner()");
}//GEN-LAST:event_buttonMoveScannerActionPerformed
private void buttonMoveHeaterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveHeaterActionPerformed
execute("move_heater()");
}//GEN-LAST:event_buttonMoveHeaterActionPerformed
private void buttonDryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDryActionPerformed
double dryTime = (Double) spinnerDryTime.getValue();
double streamTime = (Double) spinnerDrySpeed.getValue();
boolean park = ckeckParkOnDry.isSelected();
execute("dry(" + dryTime + ", " + streamTime + (park ? ", wait_cold=-1": "") + ")");
}//GEN-LAST:event_buttonDryActionPerformed
private void buttonRecoverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRecoverActionPerformed
execute("robot_recover()");
}//GEN-LAST:event_buttonRecoverActionPerformed
private void buttonMoveColdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveColdActionPerformed
execute("move_cold()");
}//GEN-LAST:event_buttonMoveColdActionPerformed
private void buttonClearSampleDbActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonClearSampleDbActionPerformed
execute("clear_samples_info()", true);
}//GEN-LAST:event_buttonClearSampleDbActionPerformed
private void buttonResetPuckIdsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonResetPuckIdsActionPerformed
execute("reset_puck_datamatrix()", true);
}//GEN-LAST:event_buttonResetPuckIdsActionPerformed
private void buttonScanPinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScanPinActionPerformed
String segment = checkAuxiliary.isSelected() ? "X" : (String) spinnerSegment.getValue();
int puck = checkAuxiliary.isSelected() ? 1 :(Integer) spinnerPuck.getValue();
int sample = (Integer) spinnerSample.getValue();
String force = checkForce.isSelected() ? "True" : "False";
execute("scan_pin('" + segment + "'," + puck + "," + sample + ", force=" + force + ")", false, true);
}//GEN-LAST:event_buttonScanPinActionPerformed
private void buttonScanPuckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScanPuckActionPerformed
String segment = checkAuxiliary.isSelected() ? "X" : (String) spinnerSegment.getValue();
int puck = checkAuxiliary.isSelected() ? 1 :(Integer) spinnerPuck.getValue();
String force = checkForce.isSelected() ? "True" : "False";
execute("scan_puck('" + segment + "'," + puck + ", force=" + force + ")", false, true);
}//GEN-LAST:event_buttonScanPuckActionPerformed
private void buttonGetAuxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonGetAuxActionPerformed
int sample = (Integer) spinnerSample.getValue();
execute("get_aux('" + sample + ")");
}//GEN-LAST:event_buttonGetAuxActionPerformed
private void buttonPutAuxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPutAuxActionPerformed
int sample = (Integer) spinnerSample.getValue();
execute("put_aux('" + sample + ")");
}//GEN-LAST:event_buttonPutAuxActionPerformed
private void checkAuxiliaryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkAuxiliaryActionPerformed
onStateChange(getState(), null);
}//GEN-LAST:event_checkAuxiliaryActionPerformed
private void buttonGripperScanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonGripperScanActionPerformed
execute("scan_gripper()");
}//GEN-LAST:event_buttonGripperScanActionPerformed
private void buttonTrashActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonTrashActionPerformed
execute("trash()");
}//GEN-LAST:event_buttonTrashActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonClearSampleDb;
private javax.swing.JButton buttonDry;
private javax.swing.JButton buttonEnableAll;
private javax.swing.JButton buttonGetAux;
private javax.swing.JButton buttonGetDewar;
private javax.swing.JButton buttonGetGonio;
private javax.swing.JButton buttonGripperScan;
private javax.swing.JButton buttonMount;
private javax.swing.JButton buttonMoveAux;
private javax.swing.JButton buttonMoveCold;
private javax.swing.JButton buttonMoveDewar;
private javax.swing.JButton buttonMoveGonio;
private javax.swing.JButton buttonMoveHeater;
private javax.swing.JButton buttonMoveHome;
private javax.swing.JButton buttonMovePark;
private javax.swing.JButton buttonMoveScanner;
private javax.swing.JButton buttonPutAux;
private javax.swing.JButton buttonPutDewar;
private javax.swing.JButton buttonPutGonio;
private javax.swing.JButton buttonRecover;
private javax.swing.JButton buttonResetPuckIds;
private javax.swing.JButton buttonScanPin;
private javax.swing.JButton buttonScanPuck;
private javax.swing.JButton buttonTrash;
private javax.swing.JButton buttonUnmount;
private javax.swing.JCheckBox checkAuxiliary;
private javax.swing.JCheckBox checkDatamatrix;
private javax.swing.JCheckBox checkForce;
private javax.swing.JCheckBox ckeckParkOnDry;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel5;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JPanel pnDatabase;
private javax.swing.JPanel pnDry;
private javax.swing.JPanel pnLowLevel;
private javax.swing.JPanel pnMotion;
private javax.swing.JPanel pnTransfer;
private javax.swing.JSpinner spinnerDrySpeed;
private javax.swing.JSpinner spinnerDryTime;
private javax.swing.JSpinner spinnerPuck;
private javax.swing.JSpinner spinnerSample;
private javax.swing.JSpinner spinnerSegment;
private javax.swing.JPanel tabAdvanced;
private javax.swing.JPanel tabCommands;
// End of variables declaration//GEN-END:variables
}

34
plugins/Hexiposi.form Normal file
View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="panel" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="panel" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="panel">
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
</Container>
</SubComponents>
</Form>

78
plugins/Hexiposi.java Normal file
View File

@@ -0,0 +1,78 @@
/*
* Copyright (c) 2014-2018 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.core.Context;
import ch.psi.pshell.ui.StripChart;
import ch.psi.pshell.ui.App;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import java.io.File;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
*/
public class Hexiposi extends Panel {
final StripChart stripChart;
public Hexiposi() {
initComponents();
stripChart = new StripChart(this.getTopLevel(), false, App.getStripChartFolderArg());
panel.add(stripChart.getPlotPanel());
try {
stripChart.open(new File(Context.getInstance().getSetup().expandPath("{home}/stripchart/hexiposi_positon.scd")));
stripChart.start();
} catch (Exception ex) {
showException(ex);
Logger.getLogger(Hexiposi.class.getName()).log(Level.WARNING, null, ex);
}
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
}
@Override
public void onStateChange(State state, State former) {
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
//Callback to perform update - in event thread
@Override
protected void doUpdate() {
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
panel = new javax.swing.JPanel();
panel.setLayout(new java.awt.BorderLayout());
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel panel;
// End of variables declaration//GEN-END:variables
}

View File

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="discretePositionerPanel" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="discretePositionerPanel" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.DiscretePositionerPanel" name="discretePositionerPanel">
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Initialize"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonHoming" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="buttonHoming" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonHoming">
<Properties>
<Property name="text" type="java.lang.String" value="Homing"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonHomingActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

110
plugins/HexiposiPanel.java Normal file
View File

@@ -0,0 +1,110 @@
import ch.psi.pshell.core.Context;
import ch.psi.pshell.device.Device;
import ch.psi.pshell.swing.DevicePanel;
/**
*
*/
public class HexiposiPanel extends DevicePanel {
/**
* Creates new form HexiposiPositionPanel
*/
public HexiposiPanel() {
initComponents();
}
@Override
public void setDevice(Device device){
super.setDevice(device);
discretePositionerPanel.setDevice(device);
}
@Override
public void setEnabled(boolean enabled){
super.setEnabled(enabled);
discretePositionerPanel.setEnabled(enabled);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
discretePositionerPanel = new ch.psi.pshell.swing.DiscretePositionerPanel();
jPanel1 = new javax.swing.JPanel();
buttonHoming = new javax.swing.JButton();
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Initialize"));
buttonHoming.setText("Homing");
buttonHoming.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonHomingActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonHoming)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(buttonHoming)
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(discretePositionerPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(0, 0, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(discretePositionerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
}// </editor-fold>//GEN-END:initComponents
private void buttonHomingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonHomingActionPerformed
try {
//Context.getInstance().evalLineAsync("hexiposi.move_home()").handle((ret, ex) -> {
Context.getInstance().evalLineAsync("homing_hexiposi()").handle((ret, ex) -> {
if (ex != null){
showException((Exception)ex);
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonHomingActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonHoming;
private ch.psi.pshell.swing.DiscretePositionerPanel discretePositionerPanel;
private javax.swing.JPanel jPanel1;
// End of variables declaration//GEN-END:variables
}

34
plugins/LN2.form Normal file
View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="panel" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="panel" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="panel">
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
</Container>
</SubComponents>
</Form>

106
plugins/LN2.java Normal file
View File

@@ -0,0 +1,106 @@
/*
* Copyright (c) 2014-2018 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.core.Context;
import ch.psi.pshell.plot.TimePlotBase;
import ch.psi.pshell.ui.StripChart;
import ch.psi.pshell.ui.App;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Dimension;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
*/
public class LN2 extends Panel {
final StripChart stripChart;
TimePlotBase plot;
public LN2() {
initComponents();
stripChart = new StripChart(this.getTopLevel(), false, App.getStripChartFolderArg());
panel.add(stripChart.getPlotPanel());
try {
stripChart.open(new File(Context.getInstance().getSetup().expandPath("{home}/stripchart/LN2_Monitoring.scd")));
stripChart.start();
} catch (Exception ex) {
showException(ex);
Logger.getLogger(LN2.class.getName()).log(Level.WARNING, null, ex);
}
plot = (TimePlotBase) SwingUtils.getComponentsByType(stripChart.getPlotPanel(),TimePlotBase.class)[0];
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
}
@Override
public void onStop() {
//saveImage();
super.onStop();
}
@Override
public void onStateChange(State state, State former) {
if ( (state == State.Closing) ||
((state == State.Initializing) && (former != State.Invalid))
){
saveImage();
}
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
public void saveImage(){
getLogger().severe("Saving image");
try {
String fileName = new File(getContext().getSetup().expandPath("{images}/ln2/{date}_{time}.png")).getCanonicalPath();
getLogger().severe("File: " + fileName);
plot.saveSnapshot(fileName, "png", new Dimension(1200,800));
} catch (Exception ex) {
getLogger().log(Level.SEVERE, null, ex);
}
getLogger().severe("Done");
}
//Callback to perform update - in event thread
@Override
protected void doUpdate() {
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
panel = new javax.swing.JPanel();
panel.setLayout(new java.awt.BorderLayout());
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel panel;
// End of variables declaration//GEN-END:variables
}

79
plugins/LaserUE.java Normal file
View File

@@ -0,0 +1,79 @@
import ch.psi.pshell.device.Readable;
import ch.psi.pshell.serial.SerialPortDevice;
import ch.psi.pshell.serial.SerialPortDeviceConfig;
import static ch.psi.utils.BitMask.*;
import ch.psi.utils.State;
import java.io.IOException;
/*
*
*/
/**
*
*/
public class LaserUE extends SerialPortDevice{
final Readable readable;
static final double RANGE_MIN = 1.0;
static final double RANGE_MAX = 30.0;
public LaserUE(String name, String port) {
super(name, port, 921600, SerialPortDeviceConfig.DataBits.DB_8, SerialPortDeviceConfig.StopBits.SB_1, SerialPortDeviceConfig.Parity.None);
this.setMode(Mode.FullDuplex);
readable = new Readable() {
@Override
public Object read() throws IOException, InterruptedException {
return take();
}
@Override
public String getName(){
return LaserUE.this.getName()+"_readout";
}
};
}
@Override
protected void doInitialize() throws IOException, InterruptedException{
super.doInitialize();
//TODO: Start DAQ in ILD1320: http://www.micro-epsilon.com/download/manuals/man--optoNCDT-1320--en.pdf
setState(State.Ready);
write("OUTPUT RS422\n\r");
}
public Readable getReadable(){
return readable;
}
int value = 0;
int count = 0;
@Override
protected void onByte(int rx) {
int index = ((rx&BIT7) > 0) ? 2 : (((rx&BIT6) > 0) ? 1 : 0);
if (count==index){
if (index ==0){
value = rx & 0x3F;
count = 1;
} else if (index ==1){
value = ((rx& 0x3F)<<6) + value;
count = 2;
} else if (index ==2){
value = ((rx& 0x0F)<<12) + value;
double val = ((double)value)/1000;
if ((val<RANGE_MIN) ||(val>RANGE_MAX)){
val = Double.NaN;
}
setCache(val);
count = 0;
} else {
count = 0;
}
}
else{
count = 0;
}
}
}

59
plugins/LaserUEPanel.form Normal file
View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="historyChart" pref="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="deviceStatePanel2" pref="297" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="deviceValuePanel1" pref="297" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="historyChart" pref="307" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="deviceStatePanel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="deviceValuePanel1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.DeviceStatePanel" name="deviceStatePanel2">
<Properties>
<Property name="deviceName" type="java.lang.String" value="ue"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.HistoryChart" name="historyChart">
</Component>
<Component class="ch.psi.pshell.swing.DeviceValuePanel" name="deviceValuePanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Value"/>
</Border>
</Property>
<Property name="deviceName" type="java.lang.String" value="ue"/>
</Properties>
</Component>
</SubComponents>
</Form>

98
plugins/LaserUEPanel.java Normal file
View File

@@ -0,0 +1,98 @@
import ch.psi.pshell.core.Context;
import ch.psi.pshell.device.Device;
import ch.psi.pshell.swing.DevicePanel;
import ch.psi.utils.swing.SwingUtils;
/**
*
*/
public class LaserUEPanel extends DevicePanel {
public LaserUEPanel() {
initComponents();
}
@Override
public void setDevice(Device device){
super.setDevice(device);
if (device!=null){
historyChart.addDevice("Laser Distance", device);
} else {
for (Device d: historyChart.getDevices()){
historyChart.removeDevice(device);
}
}
}
void execute(String statement, boolean showReturn){
try {
Context.getInstance().evalLineBackgroundAsync(statement).handle((ret, ex) -> {
if (LaserUEPanel.this.isShowing()){
if (ex != null){
showException((Exception)ex);
} else if (showReturn){
if (ret == null){
SwingUtils.showMessage(this, "Return", "No code detected", 20000);
} else {
SwingUtils.showMessage(this, "Return", "Detected code: " +ret, 20000);
}
}
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
deviceStatePanel2 = new ch.psi.pshell.swing.DeviceStatePanel();
try {
historyChart = new ch.psi.pshell.swing.HistoryChart();
} catch (java.lang.ClassNotFoundException e1) {
e1.printStackTrace();
} catch (java.lang.InstantiationException e2) {
e2.printStackTrace();
} catch (java.lang.IllegalAccessException e3) {
e3.printStackTrace();
}
deviceValuePanel1 = new ch.psi.pshell.swing.DeviceValuePanel();
deviceStatePanel2.setDeviceName("ue");
deviceValuePanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Value"));
deviceValuePanel1.setDeviceName("ue");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(historyChart, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(deviceStatePanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 297, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 297, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(historyChart, javax.swing.GroupLayout.DEFAULT_SIZE, 307, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(deviceStatePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private ch.psi.pshell.swing.DeviceStatePanel deviceStatePanel2;
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel1;
private ch.psi.pshell.swing.HistoryChart historyChart;
// End of variables declaration//GEN-END:variables
}

BIN
plugins/MXSC-1.10.0.jar Normal file

Binary file not shown.

Binary file not shown.

149
plugins/MjpegSource2.java Normal file
View File

@@ -0,0 +1,149 @@
import ch.psi.pshell.imaging.SourceBase;
import ch.psi.pshell.imaging.SourceConfig;
import ch.psi.pshell.imaging.Utils;
import java.awt.image.BufferedImage;
import java.io.BufferedInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.logging.Level;
/**
* Image source receive frames from a mjpeg server.
*/
public class MjpegSource2 extends SourceBase {
final String url;
final boolean flushOnUpdate;
public MjpegSource2(String name, String url) {
this(name, url, false);
}
public MjpegSource2(String name, String url, boolean flushOnUpdate) {
super(name, new SourceConfig());
this.url = url;
this.flushOnUpdate = flushOnUpdate;
}
InputStream stream;
@Override
protected void doInitialize() throws IOException, InterruptedException {
super.doInitialize();
URL aux = new URL(url);
stream = aux.openStream();
if (!stream.markSupported()) {
stream = new BufferedInputStream(stream);
}
}
Thread monitoredThread;
@Override
protected void doSetMonitored(boolean value) {
if (value && (monitoredThread == null)) {
monitoredThread = new Thread(() -> {
try {
while (true) {
try {
doUpdate();
Thread.sleep(1);
} catch (IOException ex) {
getLogger().log(Level.FINE, null, ex);
}
}
} catch (InterruptedException ex) {
return;
}
});
monitoredThread.setDaemon(true);
monitoredThread.start();
} else if (!value && (monitoredThread != null)) {
monitoredThread.interrupt();
monitoredThread = null;
}
}
final byte[] START_OF_FRAME = {(byte) 0xFF, (byte) 0xD8};
final byte[] END_OF_FRAME = {(byte) 0xFF, (byte) 0xD9};
final int MAX_FRAME_SIZE = 512 * 1024;
@Override
protected void doUpdate() throws IOException, InterruptedException {
byte[] data = null;
if (stream != null) {
if (flushOnUpdate) {
flush();
}
try {
data = readData();
} catch (EOFException ex) {
//Try to reopen stream
doInitialize();
data = readData();
}
}
if (data == null) {
pushImage(null);
} else {
BufferedImage img = Utils.newImage(data);
pushImage(img);
}
}
byte[] readData() throws IOException {
if (stream != null) {
stream.mark(MAX_FRAME_SIZE);
int startOfFrame = waitBytes(START_OF_FRAME) - START_OF_FRAME.length;
if (startOfFrame >= 0) {
int endOfFrame = waitBytes(END_OF_FRAME);
if (endOfFrame >= 0) {
stream.reset();
stream.skip(startOfFrame);
int length = endOfFrame ;//- END_OF_FRAME.length ;
byte[] data = new byte[length];
stream.read(data, 0, length);
return data;
}
}
}
return null;
}
int waitBytes(byte[] data) throws IOException {
int index = 0;
int dataPos = 0;
while (true) {
int ret = stream.read();
if (ret < 0) {
throw new EOFException();
}
byte value = (byte) ret;
if (value == data[dataPos]) {
dataPos++;
if (dataPos == data.length) {
return (index + 1);
}
} else {
dataPos = 0;
}
index++;
if (index >= MAX_FRAME_SIZE) {
return -1;
}
}
}
public void flush() throws IOException {
//stream.skip(stream.available());
//TODO: Skipping won't make the current image to be displayed
stream.close();
stream = new URL(url).openStream();
if (!stream.markSupported()) {
stream = new BufferedInputStream(stream);
}
}
}

View File

@@ -0,0 +1,184 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel3" max="32767" attributes="0"/>
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="deviceStatePanel1" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="deviceStatePanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel3">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Raspberry Pi "/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonPuckDetCheck" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="107" max="32767" attributes="0"/>
<Component id="buttonPuckDetStop" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="108" max="32767" attributes="0"/>
<Component id="buttonPuckDetStart" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonPuckDetCheck" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonPuckDetStop" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonPuckDetStart" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonPuckDetCheck">
<Properties>
<Property name="text" type="java.lang.String" value="Ckeck"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPuckDetCheckActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonPuckDetStop">
<Properties>
<Property name="text" type="java.lang.String" value="Stop"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPuckDetStopActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonPuckDetStart">
<Properties>
<Property name="text" type="java.lang.String" value="Start"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPuckDetStartActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Detection"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="0" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jScrollPane1" pref="274" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="table">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="6" rowCount="30">
<Column editable="false" title="Puck" type="java.lang.String"/>
<Column editable="false" title="Online" type="java.lang.Boolean"/>
<Column editable="false" title="Mechanical" type="java.lang.String"/>
<Column editable="false" title="Inductive" type="java.lang.String"/>
<Column editable="false" title="Detection" type="java.lang.String"/>
<Column editable="false" title="Image" type="java.lang.String"/>
</Table>
</Property>
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
<TableColumnModel selectionModel="0">
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
</TableColumnModel>
</Property>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Component class="ch.psi.pshell.swing.DeviceStatePanel" name="deviceStatePanel1">
<Properties>
<Property name="deviceName" type="java.lang.String" value="puck_detection"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@@ -0,0 +1,251 @@
import ch.psi.mxsc.Puck;
import ch.psi.mxsc.PuckDetection;
import ch.psi.mxsc.PuckState;
import ch.psi.mxsc.PuckState.SwitchState;
import ch.psi.pshell.core.Context;
import ch.psi.pshell.swing.DevicePanel;
import ch.psi.utils.swing.SwingUtils;
/**
*
*/
public class PuckDetectionPanel extends DevicePanel {
public PuckDetectionPanel() {
initComponents();
int row = 0;
for (String segment : new String[]{"A", "B", "C", "D", "E", "F"}){
for (int puck=1; puck<=5; puck++){
table.getModel().setValueAt(segment+puck, row++, 0);
}
}
}
@Override
public PuckDetection getDevice(){
return (PuckDetection) super.getDevice();
}
@Override
protected void onDeviceCacheChanged(Object value, Object former, long timestamp, boolean arg3) {
for (int row=0; row< 30; row++){
String name = table.getModel().getValueAt(row, 0).toString();
//int id = row+1;
try {
Puck puck = getDevice().getPuck(name);
int id = puck.getIndex() + 1;
PuckState state = getDevice().getPuckState(id);
table.getModel().setValueAt(state.online, row, 1);
table.getModel().setValueAt((SwitchState.Off == state.mecSwitch) ? "" : String.valueOf(state.mecSwitch), row, 2);
table.getModel().setValueAt((SwitchState.Off == state.indSwitch) ? "" : String.valueOf(state.indSwitch), row, 3);
table.getModel().setValueAt(puck.getDetection() == null ? "" : puck.getDetection(), row, 4);
table.getModel().setValueAt(puck.getPuckType() == null ? "" : puck.getPuckType(), row, 5);
} catch (Exception ex) {
ex.printStackTrace();
table.getModel().setValueAt(false, row, 1);
table.getModel().setValueAt(false, row, 2);
table.getModel().setValueAt(false, row, 3);
table.getModel().setValueAt("", row, 4);
table.getModel().setValueAt("", row, 5);
}
}
}
void execute(String statement, boolean showReturn){
try {
Context.getInstance().evalLineBackgroundAsync(statement).handle((ret, ex) -> {
if (ex != null){
showException((Exception)ex);
} else if (showReturn){
SwingUtils.showMessage(this, "Return", String.valueOf(ret));
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel3 = new javax.swing.JPanel();
buttonPuckDetCheck = new javax.swing.JButton();
buttonPuckDetStop = new javax.swing.JButton();
buttonPuckDetStart = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
table = new javax.swing.JTable();
deviceStatePanel1 = new ch.psi.pshell.swing.DeviceStatePanel();
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Raspberry Pi "));
buttonPuckDetCheck.setText("Ckeck");
buttonPuckDetCheck.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPuckDetCheckActionPerformed(evt);
}
});
buttonPuckDetStop.setText("Stop");
buttonPuckDetStop.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPuckDetStopActionPerformed(evt);
}
});
buttonPuckDetStart.setText("Start");
buttonPuckDetStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPuckDetStartActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(buttonPuckDetCheck)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 107, Short.MAX_VALUE)
.addComponent(buttonPuckDetStop)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 108, Short.MAX_VALUE)
.addComponent(buttonPuckDetStart)
.addContainerGap())
);
jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonPuckDetCheck, buttonPuckDetStart, buttonPuckDetStop});
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonPuckDetCheck)
.addComponent(buttonPuckDetStop)
.addComponent(buttonPuckDetStart))
.addContainerGap())
);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Detection"));
table.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null}
},
new String [] {
"Puck", "Online", "Mechanical", "Inductive", "Detection", "Image"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.Boolean.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, false, false, false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane1.setViewportView(table);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE)
.addContainerGap())
);
deviceStatePanel1.setDeviceName("puck_detection");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(deviceStatePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(0, 0, 0)
.addComponent(deviceStatePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0))
);
}// </editor-fold>//GEN-END:initComponents
private void buttonPuckDetCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPuckDetCheckActionPerformed
execute("check_puck_detection()", true);
}//GEN-LAST:event_buttonPuckDetCheckActionPerformed
private void buttonPuckDetStopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPuckDetStopActionPerformed
execute("stop_puck_detection()", false);
}//GEN-LAST:event_buttonPuckDetStopActionPerformed
private void buttonPuckDetStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPuckDetStartActionPerformed
execute("start_puck_detection()", false);
}//GEN-LAST:event_buttonPuckDetStartActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonPuckDetCheck;
private javax.swing.JButton buttonPuckDetStart;
private javax.swing.JButton buttonPuckDetStop;
private ch.psi.pshell.swing.DeviceStatePanel deviceStatePanel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable table;
// End of variables declaration//GEN-END:variables
}

140
plugins/Recovery.form Normal file
View File

@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="ledKnownPosition" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="textPosition" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="ledValidSegment" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textDistance" min="-2" pref="86" max="-2" attributes="0"/>
</Group>
<Component id="textSegment" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace pref="136" max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="buttonAbort" linkSize="1" min="-2" pref="73" max="-2" attributes="0"/>
<Component id="buttonRecover" linkSize="1" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="144" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="ledKnownPosition" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textPosition" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="ledValidSegment" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textSegment" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textDistance" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="81" max="32767" attributes="0"/>
<Component id="buttonRecover" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.Led" name="ledKnownPosition">
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" value="Known position"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.Led" name="ledValidSegment">
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="text" type="java.lang.String" value="Valid segment"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonRecover">
<Properties>
<Property name="text" type="java.lang.String" value="Recover"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonRecoverActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonAbort">
<Properties>
<Property name="text" type="java.lang.String" value="Abort"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAbortActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="textPosition">
<Properties>
<Property name="editable" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textSegment">
<Properties>
<Property name="editable" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textDistance">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="11"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="text" type="java.lang.String" value="Distance:"/>
</Properties>
</Component>
</SubComponents>
</Form>

255
plugins/Recovery.java Normal file
View File

@@ -0,0 +1,255 @@
/*
* Copyright (c) 2014-2017 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.device.Device;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Color;
import java.util.List;
import javax.swing.SwingUtilities;
/**
*
*/
public class Recovery extends Panel {
public Recovery() {
initComponents();
startTimer(5000, 200);
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
}
@Override
public void onStateChange(State state, State former) {
if (state==State.Ready){
SwingUtilities.invokeLater(()->{onTimer();});
}
textSegment.setEnabled(state == State.Ready);
textDistance.setEnabled(state == State.Ready);
textPosition.setEnabled(state == State.Ready);
updateButton();
}
void updateButton(){
buttonRecover.setEnabled((getContext().getState() == State.Ready) &&
(!textSegment.getText().trim().isEmpty()) &&
(textPosition.getText().trim().isEmpty()) );
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
@Override
protected void onTimer() {
Device robot = getContext().getDevicePool().getByName("robot", Device.class);
if ((robot==null) || (!robot.getState().isNormal())){
ledValidSegment.setColor(Color.BLACK);
textSegment.setText("");
ledKnownPosition.setColor(Color.BLACK);
textPosition.setText("");
} else {
if (getState()==State.Ready){
String point = null;
try{
point = (String) eval("robot.get_current_point()", true);
ledKnownPosition.setColor((point == null) ? Color.RED : Color.GREEN);
textPosition.setText((point == null) ? "": point);
} catch (Exception ex) {
System.out.println(ex);
ledKnownPosition.setColor(Color.BLACK);
textPosition.setText("");
}
try{
List segment = (List) eval("get_current_segment()", true);
ledValidSegment.setColor((segment == null) ? Color.RED : Color.GREEN);
textSegment.setText((segment == null) ? "": segment.get(0) + "->" + segment.get(1) + " [" + segment.get(2) + "mm]");
if ((segment == null)||(point!=null)){
textDistance.setText("");
} else {
try{
Object distance = eval("get_current_distance()", true);
textDistance.setText((distance == null) ? "" : String.format("%1.2f",((Number)distance).doubleValue()));
} catch (Exception ex) {
textDistance.setText("");
}
}
} catch (Exception ex) {
System.out.println(ex);
ledValidSegment.setColor(Color.BLACK);
textSegment.setText("");
textDistance.setText("");
}
}
}
updateButton();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
ledKnownPosition = new ch.psi.pshell.swing.Led();
jLabel6 = new javax.swing.JLabel();
ledValidSegment = new ch.psi.pshell.swing.Led();
jLabel7 = new javax.swing.JLabel();
buttonRecover = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
textPosition = new javax.swing.JTextField();
textSegment = new javax.swing.JTextField();
textDistance = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
jLabel6.setText("Known position");
jLabel7.setText("Valid segment");
buttonRecover.setText("Recover");
buttonRecover.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonRecoverActionPerformed(evt);
}
});
buttonAbort.setText("Abort");
buttonAbort.setEnabled(false);
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAbortActionPerformed(evt);
}
});
textPosition.setEditable(false);
textSegment.setEditable(false);
textDistance.setEditable(false);
textDistance.setHorizontalAlignment(javax.swing.JTextField.TRAILING);
jLabel8.setText("Distance:");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(ledKnownPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(textPosition))
.addGroup(layout.createSequentialGroup()
.addComponent(ledValidSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel7)
.addGap(16, 16, 16)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textDistance, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(textSegment))))
.addGap(8, 8, 8))
.addGroup(layout.createSequentialGroup()
.addContainerGap(136, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(buttonAbort, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonRecover))
.addContainerGap(144, Short.MAX_VALUE))
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAbort, buttonRecover});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ledKnownPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6)
.addComponent(textPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ledValidSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7)
.addComponent(textSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(textDistance, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 81, Short.MAX_VALUE)
.addComponent(buttonRecover)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonAbort)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void buttonRecoverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRecoverActionPerformed
try{
buttonAbort.setEnabled(true);
evalAsync("recover()", false).handle((ret, ex) -> {
if (ex != null){
showException((Exception)ex);
} else {
SwingUtils.showMessage(getTopLevel(), "Return", String.valueOf(ret));
}
buttonAbort.setEnabled(false);
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonRecoverActionPerformed
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
try {
abort();
try{
eval("robot.disable()", true);
} catch (Exception ex){
this.showException(ex);
}
try{
eval("stop_task()", true);
} catch (Exception ex){
this.showException(ex);
}
try{
eval("robot.reset_motion()", true);
} catch (Exception ex){
this.showException(ex);
}
} catch (InterruptedException ex) {
showException(ex);
}
}//GEN-LAST:event_buttonAbortActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonRecover;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private ch.psi.pshell.swing.Led ledKnownPosition;
private ch.psi.pshell.swing.Led ledValidSegment;
private javax.swing.JTextField textDistance;
private javax.swing.JTextField textPosition;
private javax.swing.JTextField textSegment;
// End of variables declaration//GEN-END:variables
}

21
plugins/RobotModbus.java Normal file
View File

@@ -0,0 +1,21 @@
/*
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.device.*;
import ch.psi.pshell.modbus.*;
/**
*/
public class RobotModbus extends ModbusTCP {
public RobotModbus(String name, String server) {
super(name, server);
}
public Object run() throws Exception{
Thread.sleep(1000);
return ("Done run");
}
}

587
plugins/RobotPanel.form Normal file
View File

@@ -0,0 +1,587 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel1" max="32767" attributes="0"/>
<Component id="jPanel2" alignment="0" max="32767" attributes="0"/>
<Component id="jPanel3" alignment="0" max="32767" attributes="0"/>
<Component id="panelState" alignment="0" max="32767" attributes="0"/>
<Component id="jPanel4" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="jPanel4" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="panelState" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Power"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" pref="52" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="ledPowered" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="panelPowerCtr" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel1" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="ledPowered" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="panelPowerCtr" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.Led" name="ledPowered">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="18" style="0"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Powered:"/>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="panelPowerCtr">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="buttonEnable" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="18" max="32767" attributes="0"/>
<Component id="buttonDisable" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" alignment="2" groupAlignment="1" max="-2" attributes="0">
<Component id="buttonDisable" alignment="1" max="32767" attributes="0"/>
<Component id="buttonEnable" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonDisable">
<Properties>
<Property name="text" type="java.lang.String" value="Disable"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDisableActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonEnable">
<Properties>
<Property name="text" type="java.lang.String" value="Enable"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonEnableActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Motion"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel7" min="-2" pref="52" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="ledMoving" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jLabel2" alignment="0" min="-2" pref="52" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="panelMotionCtr" max="32767" attributes="0"/>
<Component id="spinnerSpeed" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel7" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="ledMoving" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="panelMotionCtr" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSpeed" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Speed:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerSpeed">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="10" maximum="100" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerSpeedStateChanged"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ch.psi.utils.swing.HorizontalSpinner()"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Moving:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.Led" name="ledMoving">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="18" style="0"/>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="panelMotionCtr">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="butonStop" pref="45" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="buttonPause" pref="46" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="buttonResume" pref="47" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="butonStop" alignment="2" max="32767" attributes="0"/>
<Component id="buttonPause" alignment="2" max="32767" attributes="0"/>
<Component id="buttonResume" alignment="2" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="butonStop">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new javax.swing.ImageIcon(App.class.getResource(&quot;/ch/psi/pshell/ui/Stop.png&quot;))" type="code"/>
</Property>
<Property name="text" type="java.lang.String" value=" "/>
<Property name="horizontalTextPosition" type="int" value="0"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="butonStopActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonResume">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new javax.swing.ImageIcon(App.class.getResource(&quot;/ch/psi/pshell/ui/Play.png&quot;))" type="code"/>
</Property>
<Property name="text" type="java.lang.String" value=" "/>
<Property name="horizontalTextPosition" type="int" value="0"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonResumeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonPause">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new javax.swing.ImageIcon(App.class.getResource(&quot;/ch/psi/pshell/ui/Pause.png&quot;))" type="code"/>
</Property>
<Property name="text" type="java.lang.String" value=" "/>
<Property name="horizontalTextPosition" type="int" value="0"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPauseActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel3">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Status"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel8" linkSize="2" min="-2" pref="52" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="ledTask" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" alignment="0" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel4" linkSize="2" min="-2" pref="52" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="ledEmpty" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel3" linkSize="2" min="-2" pref="52" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="ledSettled" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel9" linkSize="2" min="-2" pref="52" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="ledPosition" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="textTask" max="32767" attributes="0"/>
<Component id="textPosition" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel6" linkSize="2" min="-2" pref="52" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="ledMode" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="textMode" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel3" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="ledSettled" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel4" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="ledEmpty" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="textMode" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="ledMode" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="buttonAbort" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="ledTask" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="textTask" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel9" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="ledPosition" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="textPosition" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Settled:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.Led" name="ledSettled">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="18" style="0"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Empty:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.Led" name="ledEmpty">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="18" style="0"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textTask">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Mode:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textMode">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonAbort">
<Properties>
<Property name="text" type="java.lang.String" value="Abort"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAbortActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Task:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.Led" name="ledTask">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="18" style="0"/>
</Property>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.Led" name="ledMode">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="18" style="0"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textPosition">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.Led" name="ledPosition">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="18" style="0"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel9">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Position:"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="ch.psi.pshell.swing.DeviceStatePanel" name="panelState">
</Component>
<Container class="javax.swing.JPanel" name="jPanel4">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Tool"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" pref="52" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="ledOpen" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="panelPowerCtr1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel5" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="ledOpen" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="panelPowerCtr1" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.Led" name="ledOpen">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="18" style="0"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Open:"/>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="panelPowerCtr1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="buttonOpen" linkSize="3" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="18" max="32767" attributes="0"/>
<Component id="buttonClose" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" alignment="2" groupAlignment="1" max="-2" attributes="0">
<Component id="buttonClose" alignment="1" max="32767" attributes="0"/>
<Component id="buttonOpen" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonClose">
<Properties>
<Property name="text" type="java.lang.String" value=" Close "/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonCloseActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonOpen">
<Properties>
<Property name="text" type="java.lang.String" value=" Open "/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonOpenActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

685
plugins/RobotPanel.java Normal file
View File

@@ -0,0 +1,685 @@
import ch.psi.pshell.device.Device;
import ch.psi.pshell.ui.App;
import ch.psi.pshell.swing.DevicePanel;
import ch.psi.pshell.core.Context;
import ch.psi.utils.State;
import java.awt.Color;
import java.util.Map;
import javax.swing.JSpinner;
import javax.swing.JTextField;
/**
*
*/
public class RobotPanel extends DevicePanel {
/**
* Creates new form RobotPanel
*/
public RobotPanel() {
initComponents();
((JSpinner.DefaultEditor)spinnerSpeed.getEditor()).getTextField().setHorizontalAlignment(JTextField.CENTER);
}
@Override
public void setDevice(Device device) {
super.setDevice(device);
if (device == null) {
}
panelState.setDevice(device);
}
@Override
protected void onDeviceStateChanged(State state, State former) {
boolean enabled = state.isNormal();
spinnerSpeed.setEnabled(enabled);
buttonAbort.setEnabled(enabled);
if (!enabled){
buttonEnable.setEnabled(enabled);
buttonDisable.setEnabled(enabled);
butonStop.setEnabled(enabled);
buttonPause.setEnabled(enabled);
buttonResume.setEnabled(enabled);
}
}
boolean updating;
@Override
protected void onDeviceCacheChanged(Object value, Object former, long timestamp, boolean valueChange) {
updating = true;
try{
Boolean powered = null;
Boolean empty = null;
Boolean settled = null;
Boolean moving = null;
Boolean open = null;
Integer speed = null;
String task = null;
String mode = null;
String position = null;
if ((value != null) && (value instanceof Map)) {
Map status = (Map) value;
try {
powered = (Boolean) status.get("powered");
} catch (Exception ex) {
}
try {
empty = (Boolean) status.get("empty");
} catch (Exception ex) {
}
try {
settled = (Boolean) status.get("settled");
} catch (Exception ex) {
}
try {
open = (Boolean) status.get("open");
} catch (Exception ex) {
}
try {
speed = (Integer) status.get("speed");
} catch (Exception ex) {
}
try {
position = (String) status.get("pos");
if (position==null){
position = "";
}
} catch (Exception ex) {
}
try {
task = ((status.containsKey("task")) && (status.get("task") == null)) ? "" : ((String) status.get("task")).trim();
} catch (Exception ex) {
System.out.println(ex);
ex.printStackTrace();
}
try {
mode = ((String) status.get("mode")).trim();
//mode = (String) Context.getInstance().evalLineBackground(getDevice().getName() + ".working_mode");
} catch (Exception ex) {
}
try {
//if (status.get("status").equals("hold")){
// moving = false;
//} else if (status.get("status").equals("move")){
// moving = true;
//}
moving = Boolean.FALSE.equals(settled) || Boolean.FALSE.equals(empty);
} catch (Exception ex) {
}
}
boolean remote = mode.equals("remote");
boolean enabled = Boolean.TRUE.equals(powered);
buttonEnable.setEnabled((powered != null) && (powered == false));
buttonDisable.setEnabled(enabled);
butonStop.setEnabled(remote && Boolean.TRUE.equals(moving));
buttonPause.setEnabled(remote && enabled && Boolean.TRUE.equals(moving) && Boolean.FALSE.equals(settled));
buttonResume.setEnabled(remote && enabled && Boolean.TRUE.equals(moving) && Boolean.TRUE.equals(settled));
ledPowered.setColor((powered == null) ? Color.GRAY : (powered ? Color.YELLOW : Color.DARK_GRAY));
ledEmpty.setColor((empty == null) ? Color.GRAY : (empty ? Color.GREEN : Color.YELLOW));
ledSettled.setColor((settled == null) ? Color.GRAY : (settled ? Color.GREEN : Color.YELLOW));
ledOpen.setColor((open == null) ? Color.GRAY : (open ? Color.GREEN : Color.DARK_GRAY));
ledMoving.setColor((moving == null) ? Color.GRAY : (moving ? Color.YELLOW : Color.DARK_GRAY));
textTask.setText((task == null) ? "" : task);
ledTask.setColor((task == null) ? Color.GRAY : (task.isEmpty() ? Color.DARK_GRAY : Color.YELLOW));
textPosition.setText((position == null) ? "" : position);
ledPosition.setColor((position == null) ? Color.GRAY : (position.isEmpty() ? Color.DARK_GRAY : Color.GREEN));
//buttonAbort.setEnabled(!textTask.getText().isEmpty());
spinnerSpeed.setEnabled(speed != null);
if (speed == null) {
spinnerSpeed.setValue(0);
} else {
spinnerSpeed.setValue(speed);
}
ledMode.setColor((mode == null) ? Color.BLACK : (remote ? Color.GREEN : Color.YELLOW));
textMode.setText((mode == null) ? "" : mode);
} finally{
updating = false;
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
ledPowered = new ch.psi.pshell.swing.Led();
jLabel1 = new javax.swing.JLabel();
panelPowerCtr = new javax.swing.JPanel();
buttonDisable = new javax.swing.JButton();
buttonEnable = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
spinnerSpeed = new ch.psi.utils.swing.HorizontalSpinner();
jLabel7 = new javax.swing.JLabel();
ledMoving = new ch.psi.pshell.swing.Led();
panelMotionCtr = new javax.swing.JPanel();
butonStop = new javax.swing.JButton();
buttonResume = new javax.swing.JButton();
buttonPause = new javax.swing.JButton();
jPanel3 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
ledSettled = new ch.psi.pshell.swing.Led();
jLabel4 = new javax.swing.JLabel();
ledEmpty = new ch.psi.pshell.swing.Led();
textTask = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
textMode = new javax.swing.JTextField();
buttonAbort = new javax.swing.JButton();
jLabel8 = new javax.swing.JLabel();
ledTask = new ch.psi.pshell.swing.Led();
ledMode = new ch.psi.pshell.swing.Led();
textPosition = new javax.swing.JTextField();
ledPosition = new ch.psi.pshell.swing.Led();
jLabel9 = new javax.swing.JLabel();
panelState = new ch.psi.pshell.swing.DeviceStatePanel();
jPanel4 = new javax.swing.JPanel();
ledOpen = new ch.psi.pshell.swing.Led();
jLabel5 = new javax.swing.JLabel();
panelPowerCtr1 = new javax.swing.JPanel();
buttonClose = new javax.swing.JButton();
buttonOpen = new javax.swing.JButton();
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Power"));
ledPowered.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("Powered:");
buttonDisable.setText("Disable");
buttonDisable.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonDisableActionPerformed(evt);
}
});
buttonEnable.setText("Enable");
buttonEnable.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonEnableActionPerformed(evt);
}
});
javax.swing.GroupLayout panelPowerCtrLayout = new javax.swing.GroupLayout(panelPowerCtr);
panelPowerCtr.setLayout(panelPowerCtrLayout);
panelPowerCtrLayout.setHorizontalGroup(
panelPowerCtrLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelPowerCtrLayout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(buttonEnable)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
.addComponent(buttonDisable))
);
panelPowerCtrLayout.setVerticalGroup(
panelPowerCtrLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelPowerCtrLayout.createSequentialGroup()
.addGap(0, 0, 0)
.addGroup(panelPowerCtrLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(buttonDisable, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonEnable))
.addGap(0, 0, 0))
);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledPowered, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelPowerCtr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(4, 4, 4)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel1)
.addComponent(ledPowered, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelPowerCtr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(2, 2, 2))
);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Motion"));
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel2.setText("Speed:");
spinnerSpeed.setModel(new javax.swing.SpinnerNumberModel(10, null, 100, 1));
spinnerSpeed.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerSpeedStateChanged(evt);
}
});
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel7.setText("Moving:");
ledMoving.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
butonStop.setIcon(new javax.swing.ImageIcon(App.class.getResource("/ch/psi/pshell/ui/Stop.png")));
butonStop.setText(" ");
butonStop.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
butonStop.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
butonStopActionPerformed(evt);
}
});
buttonResume.setIcon(new javax.swing.ImageIcon(App.class.getResource("/ch/psi/pshell/ui/Play.png")));
buttonResume.setText(" ");
buttonResume.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
buttonResume.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonResumeActionPerformed(evt);
}
});
buttonPause.setIcon(new javax.swing.ImageIcon(App.class.getResource("/ch/psi/pshell/ui/Pause.png")));
buttonPause.setText(" ");
buttonPause.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
buttonPause.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPauseActionPerformed(evt);
}
});
javax.swing.GroupLayout panelMotionCtrLayout = new javax.swing.GroupLayout(panelMotionCtr);
panelMotionCtr.setLayout(panelMotionCtrLayout);
panelMotionCtrLayout.setHorizontalGroup(
panelMotionCtrLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelMotionCtrLayout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(butonStop, javax.swing.GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonPause, javax.swing.GroupLayout.DEFAULT_SIZE, 46, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonResume, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE)
.addGap(0, 0, 0))
);
panelMotionCtrLayout.setVerticalGroup(
panelMotionCtrLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelMotionCtrLayout.createSequentialGroup()
.addGap(0, 0, 0)
.addGroup(panelMotionCtrLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(butonStop, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonPause, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonResume, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(0, 0, 0))
);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledMoving, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(14, 14, 14)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(panelMotionCtr, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(spinnerSpeed))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(4, 4, 4)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel7)
.addComponent(ledMoving, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelMotionCtr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(spinnerSpeed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(2, 2, 2))
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Status"));
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel3.setText("Settled:");
ledSettled.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel4.setText("Empty:");
ledEmpty.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
textTask.setEditable(false);
textTask.setHorizontalAlignment(javax.swing.JTextField.CENTER);
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel6.setText("Mode:");
textMode.setEditable(false);
textMode.setHorizontalAlignment(javax.swing.JTextField.CENTER);
buttonAbort.setText("Abort");
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAbortActionPerformed(evt);
}
});
jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel8.setText("Task:");
ledTask.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
ledMode.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
textPosition.setEditable(false);
textPosition.setHorizontalAlignment(javax.swing.JTextField.CENTER);
ledPosition.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel9.setText("Position:");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledTask, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledEmpty, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledSettled, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textTask)
.addComponent(textPosition)))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(textMode)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonAbort)
.addContainerGap())
);
jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel3, jLabel4, jLabel6, jLabel8, jLabel9});
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGap(4, 4, 4)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel3)
.addComponent(ledSettled, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(2, 2, 2)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel4)
.addComponent(ledEmpty, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(2, 2, 2)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(textMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ledMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6))
.addGap(2, 2, 2)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(buttonAbort)
.addComponent(jLabel8)
.addComponent(ledTask, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textTask, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(2, 2, 2)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel9)
.addComponent(ledPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(2, 2, 2))
);
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Tool"));
ledOpen.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel5.setText("Open:");
buttonClose.setText(" Close ");
buttonClose.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonCloseActionPerformed(evt);
}
});
buttonOpen.setText(" Open ");
buttonOpen.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonOpenActionPerformed(evt);
}
});
javax.swing.GroupLayout panelPowerCtr1Layout = new javax.swing.GroupLayout(panelPowerCtr1);
panelPowerCtr1.setLayout(panelPowerCtr1Layout);
panelPowerCtr1Layout.setHorizontalGroup(
panelPowerCtr1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelPowerCtr1Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(buttonOpen)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
.addComponent(buttonClose))
);
panelPowerCtr1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonClose, buttonOpen});
panelPowerCtr1Layout.setVerticalGroup(
panelPowerCtr1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelPowerCtr1Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addGroup(panelPowerCtr1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(buttonClose, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonOpen))
.addGap(0, 0, 0))
);
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledOpen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelPowerCtr1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(4, 4, 4)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel5)
.addComponent(ledOpen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelPowerCtr1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(2, 2, 2))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelState, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(panelState, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
}// </editor-fold>//GEN-END:initComponents
private void buttonEnableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonEnableActionPerformed
try{
Context.getInstance().evalLineBackground(getDevice().getName() + ".enable()");
} catch (Exception ex){
this.showException(ex);
}
}//GEN-LAST:event_buttonEnableActionPerformed
private void buttonDisableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDisableActionPerformed
try{
Context.getInstance().evalLineBackground(getDevice().getName() + ".disable()");
} catch (Exception ex){
this.showException(ex);
}
}//GEN-LAST:event_buttonDisableActionPerformed
private void spinnerSpeedStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerSpeedStateChanged
try{
if (!updating){
Context.getInstance().evalLineBackground(getDevice().getName() + ".set_monitor_speed(" + spinnerSpeed.getValue() + ")");
}
} catch (Exception ex){
this.showException(ex);
}
}//GEN-LAST:event_spinnerSpeedStateChanged
private void butonStopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butonStopActionPerformed
try{
Context.getInstance().evalLineBackground(getDevice().getName() + ".reset_motion()");
} catch (Exception ex){
this.showException(ex);
}
}//GEN-LAST:event_butonStopActionPerformed
private void buttonPauseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPauseActionPerformed
try{
Context.getInstance().evalLineBackground(getDevice().getName() + ".stop()");
} catch (Exception ex){
this.showException(ex);
}
}//GEN-LAST:event_buttonPauseActionPerformed
private void buttonResumeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonResumeActionPerformed
try{
Context.getInstance().evalLineBackground(getDevice().getName() + ".resume()");
} catch (Exception ex){
this.showException(ex);
}
}//GEN-LAST:event_buttonResumeActionPerformed
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
try{
Context.getInstance().evalLineBackground(getDevice().getName() + ".stop_task()");
//Context.getInstance().evalLineBackground(getDevice().getName() + ".task_kill('" + textTask.getText() + "')");
} catch (Exception ex){
this.showException(ex);
}
}//GEN-LAST:event_buttonAbortActionPerformed
private void buttonCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCloseActionPerformed
try{
Context.getInstance().evalLineBackground(getDevice().getName() + ".close_tool()");
} catch (Exception ex){
this.showException(ex);
}
}//GEN-LAST:event_buttonCloseActionPerformed
private void buttonOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonOpenActionPerformed
try{
Context.getInstance().evalLineBackground(getDevice().getName() + ".open_tool()");
} catch (Exception ex){
this.showException(ex);
}
}//GEN-LAST:event_buttonOpenActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton butonStop;
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonClose;
private javax.swing.JButton buttonDisable;
private javax.swing.JButton buttonEnable;
private javax.swing.JButton buttonOpen;
private javax.swing.JButton buttonPause;
private javax.swing.JButton buttonResume;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private ch.psi.pshell.swing.Led ledEmpty;
private ch.psi.pshell.swing.Led ledMode;
private ch.psi.pshell.swing.Led ledMoving;
private ch.psi.pshell.swing.Led ledOpen;
private ch.psi.pshell.swing.Led ledPosition;
private ch.psi.pshell.swing.Led ledPowered;
private ch.psi.pshell.swing.Led ledSettled;
private ch.psi.pshell.swing.Led ledTask;
private javax.swing.JPanel panelMotionCtr;
private javax.swing.JPanel panelPowerCtr;
private javax.swing.JPanel panelPowerCtr1;
private ch.psi.pshell.swing.DeviceStatePanel panelState;
private javax.swing.JSpinner spinnerSpeed;
private javax.swing.JTextField textMode;
private javax.swing.JTextField textPosition;
private javax.swing.JTextField textTask;
// End of variables declaration//GEN-END:variables
}

21
plugins/RobotTcp.java Normal file
View File

@@ -0,0 +1,21 @@
/*
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.device.*;
import ch.psi.pshell.serial.*;
/**
*/
public class RobotTcp extends TcpDevice {
public RobotTcp(String name, String server) {
super(name, server);
}
public Object run() throws Exception{
Thread.sleep(1000);
return ("Done");
}
}

View File

@@ -0,0 +1,14 @@
import ch.psi.pshell.device.DeviceConfig;
/**
*
*/
public class SmartMagnetConfig extends DeviceConfig{
public double holdingCurrent;
public double restingCurrent;
public double mountCurrent;
public double unmountCurrent;
public double remanenceCurrent;
}

View File

@@ -0,0 +1,221 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel1" max="32767" attributes="0"/>
<Component id="panelState" alignment="0" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="panelCurrent" max="32767" attributes="0"/>
<Component id="jPanel2" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="panelCurrent" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="panelState" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Status"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" min="-2" pref="52" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="ledStatus" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="panelPowerCtr" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel5" min="-2" pref="52" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="ledMounted" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel10" min="-2" pref="52" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="panelCurrentRb" min="-2" pref="173" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel1" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="ledStatus" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="panelPowerCtr" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel5" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="ledMounted" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel10" min="-2" max="-2" attributes="0"/>
<Component id="panelCurrentRb" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.Led" name="ledStatus">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="18" style="0"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Status:"/>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="panelPowerCtr">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="150" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="23" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Mounted:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.Led" name="ledMounted">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="18" style="0"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel10">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Current:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.DeviceValuePanel" name="panelCurrentRb">
<Properties>
<Property name="deviceName" type="java.lang.String" value="smc_current_rb"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="ch.psi.pshell.swing.DeviceStatePanel" name="panelState">
</Component>
<Component class="ch.psi.pshell.swing.ProcessVariablePanel" name="panelCurrent">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Current"/>
</Border>
</Property>
<Property name="deviceName" type="java.lang.String" value="smc_current"/>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="jPanel2">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Gonio"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="ledMountPosition" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel2" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="ledMountPosition" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Mount Position:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.Led" name="ledMountPosition">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="18" style="0"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@@ -0,0 +1,234 @@
import ch.psi.pshell.device.Device;
import ch.psi.pshell.ui.App;
import ch.psi.pshell.swing.DevicePanel;
import ch.psi.pshell.core.Context;
import ch.psi.utils.State;
import java.awt.Color;
import java.lang.reflect.Method;
import java.util.Map;
/**
*
*/
public class SmartMagnetPanel extends DevicePanel {
/**
* Creates new form RobotPanel
*/
public SmartMagnetPanel() {
initComponents();
}
@Override
public void setDevice(Device device) {
super.setDevice(device);
if (device == null) {
}
panelState.setDevice(device);
this.startTimer(1000, 100);
}
@Override
protected void onTimer(){
Color color = Color.RED;
try{
if (Context.getInstance().evalLineBackground("in_mount_position").equals(Boolean.TRUE)){
color = Color.GREEN;
}
} catch (Exception ex){
}
ledMountPosition.setColor(color);
}
@Override
protected void onDeviceStateChanged(State state, State former) {
switch(state){
case Ready:
ledStatus.setColor(Color.GREEN);
ledMounted.setColor(Color.BLACK);
break;
case Busy:
ledStatus.setColor(Color.GREEN);
ledMounted.setColor(Color.GREEN);
break;
case Fault:
ledStatus.setColor(Color.RED);
ledMounted.setColor(Color.RED);
break;
default:
ledStatus.setColor(Color.BLACK);
ledMounted.setColor(Color.BLACK);
break;
}
}
@Override
protected void onDeviceCacheChanged(Object value, Object former, long timestamp, boolean valueChange) {
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
ledStatus = new ch.psi.pshell.swing.Led();
jLabel1 = new javax.swing.JLabel();
panelPowerCtr = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
ledMounted = new ch.psi.pshell.swing.Led();
jLabel10 = new javax.swing.JLabel();
panelCurrentRb = new ch.psi.pshell.swing.DeviceValuePanel();
panelState = new ch.psi.pshell.swing.DeviceStatePanel();
panelCurrent = new ch.psi.pshell.swing.ProcessVariablePanel();
jPanel2 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
ledMountPosition = new ch.psi.pshell.swing.Led();
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Status"));
ledStatus.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("Status:");
javax.swing.GroupLayout panelPowerCtrLayout = new javax.swing.GroupLayout(panelPowerCtr);
panelPowerCtr.setLayout(panelPowerCtrLayout);
panelPowerCtrLayout.setHorizontalGroup(
panelPowerCtrLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 150, Short.MAX_VALUE)
);
panelPowerCtrLayout.setVerticalGroup(
panelPowerCtrLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 23, Short.MAX_VALUE)
);
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel5.setText("Mounted:");
ledMounted.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel10.setText("Current:");
panelCurrentRb.setDeviceName("smc_current_rb");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelPowerCtr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledMounted, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelCurrentRb, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(4, 4, 4)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel1)
.addComponent(ledStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelPowerCtr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel5)
.addComponent(ledMounted, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel10)
.addComponent(panelCurrentRb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
panelCurrent.setBorder(javax.swing.BorderFactory.createTitledBorder("Current"));
panelCurrent.setDeviceName("smc_current");
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Gonio"));
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel2.setText("Mount Position:");
ledMountPosition.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledMountPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel2)
.addComponent(ledMountPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelState, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(panelCurrent, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(panelCurrent, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(panelState, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private ch.psi.pshell.swing.Led ledMountPosition;
private ch.psi.pshell.swing.Led ledMounted;
private ch.psi.pshell.swing.Led ledStatus;
private ch.psi.pshell.swing.ProcessVariablePanel panelCurrent;
private ch.psi.pshell.swing.DeviceValuePanel panelCurrentRb;
private javax.swing.JPanel panelPowerCtr;
private ch.psi.pshell.swing.DeviceStatePanel panelState;
// End of variables declaration//GEN-END:variables
}

26
plugins/TestZMQ.java Normal file
View File

@@ -0,0 +1,26 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author gac-S_Changer
*/
public class TestZMQ {
public static void main(String[] args) {
String server = "raspberrypi:5556";
org.zeromq.ZMQ.Context context = org.zeromq.ZMQ.context(1);
org.zeromq.ZMQ.Socket subscriber = context.socket(org.zeromq.ZMQ.SUB);
subscriber.connect("tcp://" + server);
subscriber.subscribe("Status".getBytes());
while (!Thread.currentThread().isInterrupted()) {
String type = subscriber.recvStr();
String contents = subscriber.recvStr();
System.out.println(type + " : " + contents);
}
subscriber.close();
context.term();
}
}

167
plugins/WagoPanel.form Normal file
View File

@@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="deviceStatePanel1" max="32767" attributes="0"/>
<Component id="panelSafety" max="32767" attributes="0"/>
<Component id="panelRobot1" max="32767" attributes="0"/>
<Component id="panelDewar" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="panelSafety" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="panelDewar" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="panelRobot1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="deviceStatePanel1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.DeviceStatePanel" name="deviceStatePanel1">
<Properties>
<Property name="deviceName" type="java.lang.String" value="wago"/>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="panelSafety">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Safety"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonReleasePsys" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonReleaseLocal" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonReleaseLocal" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonReleasePsys" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonReleasePsys">
<Properties>
<Property name="text" type="java.lang.String" value="Release PSYS"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonReleasePsysActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonReleaseLocal">
<Properties>
<Property name="text" type="java.lang.String" value="Release Local"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonReleaseLocalActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="panelRobot1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Dryer"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonHeater" linkSize="3" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonStream" linkSize="3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonHeater" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonStream" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JToggleButton" name="buttonHeater">
<Properties>
<Property name="text" type="java.lang.String" value="Heater"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonHeaterActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToggleButton" name="buttonStream">
<Properties>
<Property name="text" type="java.lang.String" value="Air Stream"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonStreamActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="ch.psi.pshell.swing.ProcessVariablePanel" name="panelDewar">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder justification="1" title="Dewar Light"/>
</Border>
</Property>
<Property name="deviceName" type="java.lang.String" value="led_level"/>
<Property name="showAdvanced" type="boolean" value="false"/>
<Property name="showButtons" type="boolean" value="false"/>
<Property name="showLimitButtons" type="boolean" value="false"/>
<Property name="showSlider" type="boolean" value="true"/>
<Property name="showStop" type="boolean" value="false"/>
</Properties>
</Component>
</SubComponents>
</Form>

207
plugins/WagoPanel.java Normal file
View File

@@ -0,0 +1,207 @@
import ch.psi.mxsc.Controller;
import ch.psi.pshell.core.Context;
import ch.psi.pshell.swing.DevicePanel;
import java.util.concurrent.CompletableFuture;
import javax.swing.border.TitledBorder;
/**
*
*/
public class WagoPanel extends DevicePanel {
public WagoPanel() {
initComponents();
this.startTimer(10000);
}
CompletableFuture future;
@Override
public void onTimer(){
if ((getDevice()!=null)){
updateTitle();
}
}
void updateTitle(){
Boolean roomTemp = (Controller.getInstance().isLedRoomTemp());
if (roomTemp==null){
((TitledBorder)panelDewar.getBorder()).setTitle("Dewar Light");
} else if (roomTemp==true){
((TitledBorder)panelDewar.getBorder()).setTitle("Dewar Light (room temperature)");
} else {
((TitledBorder)panelDewar.getBorder()).setTitle("Dewar Light (LN2)");
}
}
void execute(String statement){
try {
Context.getInstance().evalLineBackgroundAsync(statement).handle((ret, ex) -> {
if (WagoPanel.this.isShowing()){
if (ex != null){
showException((Exception)ex);
}
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
deviceStatePanel1 = new ch.psi.pshell.swing.DeviceStatePanel();
panelSafety = new javax.swing.JPanel();
buttonReleasePsys = new javax.swing.JButton();
buttonReleaseLocal = new javax.swing.JButton();
panelRobot1 = new javax.swing.JPanel();
buttonHeater = new javax.swing.JToggleButton();
buttonStream = new javax.swing.JToggleButton();
panelDewar = new ch.psi.pshell.swing.ProcessVariablePanel();
deviceStatePanel1.setDeviceName("wago");
panelSafety.setBorder(javax.swing.BorderFactory.createTitledBorder("Safety"));
buttonReleasePsys.setText("Release PSYS");
buttonReleasePsys.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonReleasePsysActionPerformed(evt);
}
});
buttonReleaseLocal.setText("Release Local");
buttonReleaseLocal.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonReleaseLocalActionPerformed(evt);
}
});
javax.swing.GroupLayout panelSafetyLayout = new javax.swing.GroupLayout(panelSafety);
panelSafety.setLayout(panelSafetyLayout);
panelSafetyLayout.setHorizontalGroup(
panelSafetyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelSafetyLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonReleasePsys)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonReleaseLocal)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panelSafetyLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonReleaseLocal, buttonReleasePsys});
panelSafetyLayout.setVerticalGroup(
panelSafetyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelSafetyLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelSafetyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonReleaseLocal)
.addComponent(buttonReleasePsys))
.addContainerGap())
);
panelRobot1.setBorder(javax.swing.BorderFactory.createTitledBorder("Dryer"));
buttonHeater.setText("Heater");
buttonHeater.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonHeaterActionPerformed(evt);
}
});
buttonStream.setText("Air Stream");
buttonStream.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonStreamActionPerformed(evt);
}
});
javax.swing.GroupLayout panelRobot1Layout = new javax.swing.GroupLayout(panelRobot1);
panelRobot1.setLayout(panelRobot1Layout);
panelRobot1Layout.setHorizontalGroup(
panelRobot1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelRobot1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonHeater)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonStream)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panelRobot1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonHeater, buttonStream});
panelRobot1Layout.setVerticalGroup(
panelRobot1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelRobot1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(panelRobot1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonHeater)
.addComponent(buttonStream))
.addContainerGap())
);
panelDewar.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Dewar Light", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.DEFAULT_POSITION));
panelDewar.setDeviceName("led_level");
panelDewar.setShowAdvanced(false);
panelDewar.setShowButtons(false);
panelDewar.setShowLimitButtons(false);
panelDewar.setShowSlider(true);
panelDewar.setShowStop(false);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(deviceStatePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelSafety, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelRobot1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelDewar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(panelSafety, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(panelDewar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(panelRobot1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(deviceStatePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
}// </editor-fold>//GEN-END:initComponents
private void buttonReleasePsysActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonReleasePsysActionPerformed
execute("release_psys()");
}//GEN-LAST:event_buttonReleasePsysActionPerformed
private void buttonReleaseLocalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonReleaseLocalActionPerformed
execute("release_local()");
}//GEN-LAST:event_buttonReleaseLocalActionPerformed
private void buttonHeaterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonHeaterActionPerformed
execute("set_heater(" + (buttonHeater.isSelected() ? "True": "False") + ")");
}//GEN-LAST:event_buttonHeaterActionPerformed
private void buttonStreamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStreamActionPerformed
execute("set_air_stream(" + (buttonStream.isSelected()? "True": "False")+ ")");
}//GEN-LAST:event_buttonStreamActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JToggleButton buttonHeater;
private javax.swing.JButton buttonReleaseLocal;
private javax.swing.JButton buttonReleasePsys;
private javax.swing.JToggleButton buttonStream;
private ch.psi.pshell.swing.DeviceStatePanel deviceStatePanel1;
private ch.psi.pshell.swing.ProcessVariablePanel panelDewar;
private javax.swing.JPanel panelRobot1;
private javax.swing.JPanel panelSafety;
// End of variables declaration//GEN-END:variables
}

62
plugins/gui.form Normal file
View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="renderer1" min="-2" pref="154" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="82" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="51" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
<Component id="linePlotJFree1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="250" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="renderer1" min="-2" pref="102" max="-2" attributes="0"/>
<EmptySpace pref="20" max="32767" attributes="0"/>
<Component id="linePlotJFree1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="Abort"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
<Component class="ch.psi.pshell.imaging.Renderer" name="renderer1">
</Component>
<Component class="ch.psi.pshell.plot.LinePlotJFree" name="linePlotJFree1">
</Component>
</SubComponents>
</Form>

96
plugins/gui.java Normal file
View File

@@ -0,0 +1,96 @@
/*
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
*/
public class gui extends Panel {
public gui() {
initComponents();
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
}
@Override
public void onStateChange(State state, State former) {
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
//Callback to perform update - in event thread
@Override
protected void doUpdate() {
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
renderer1 = new ch.psi.pshell.imaging.Renderer();
linePlotJFree1 = new ch.psi.pshell.plot.LinePlotJFree();
jButton1.setText("Abort");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(renderer1, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(82, 82, 82))
.addGroup(layout.createSequentialGroup()
.addGap(51, 51, 51)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton1)
.addComponent(linePlotJFree1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(250, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(renderer1, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE)
.addComponent(linePlotJFree1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try {
abort();
} catch (InterruptedException ex) {
Logger.getLogger(gui.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton1ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private ch.psi.pshell.plot.LinePlotJFree linePlotJFree1;
private ch.psi.pshell.imaging.Renderer renderer1;
// End of variables declaration//GEN-END:variables
}

15
script/LN2_Monitoring.scd Normal file
View File

@@ -0,0 +1,15 @@
[
[ [ true, "phase_separator_level", "Device", 1, 1, "102,204,255" ],
[ true, "filling_phase_separator", "Device", 1, 1, "51,255,255" ],
[ true, "filling_dewar", "Device", 1, 1, "0,0,102" ],
[ true, "dewar_level", "Device", 1, 1, "0,51,153" ],
[ true, "rim_heater_temp", "Device", 1, 1, "255,0,51" ] ],
[ [ "1", 0.0, 100.0, null, null, 1000000.0, false, null ],
[ "2", null, null, null, null, null, null, null ],
[ "3", null, null, null, null, null, null, null ],
[ "4", null, null, null, null, null, null, null ],
[ "5", null, null, null, null, null, null, null ] ],
[ [ ] ],
[ [ "", 20000, 100 ],
[ "", "" ] ]
]

View File

@@ -0,0 +1,12 @@
[
[ [ true, "phase_separator_level", "Device", 1, 1, "255,0,0" ],
[ true, "dewar_level", "Device", 1, 1, "0,0,255" ] ],
[ [ "1", 0.0, 100.0, null, null, 100000.0, false, null ],
[ "2", null, null, null, null, null, null, null ],
[ "3", null, null, null, null, null, null, null ],
[ "4", null, null, null, null, null, null, null ],
[ "5", null, null, null, null, null, null, null ] ],
[ [ ] ],
[ [ "", 20000, 100 ],
[ "", "" ] ]
]

View File

@@ -0,0 +1,29 @@
import plotutils
import math
#STRATEGY = "Normal"
#STRATEGY = "Boundary"
#STRATEGY = "FullNeighborhood"
RANGE = [-5.0, 5.0]
STEP_SIZE = 0.1
LATENCY = 0.05
robot.enable()
move_to_laser()
robot.set_motors_enabled(True)
current_y = robot_y.getPosition()
current_z = robot_z.getPosition()
r = bsearch([robot_y, robot_z], laser_distance,[RANGE[0], RANGE[0]], [RANGE[1], RANGE[1]], [STEP_SIZE,STEP_SIZE], relative = True, maximum=True, strategy = STRATEGY, latency = LATENCY, title = "Binary Search YZ")
print r.print()
opt_y, opt_z= r.getOptimalPosition()
offset_y, offset_z = opt_y - current_y, opt_z - current_z
print "offset_y: ", offset_y, " offset_z: ", offset_z

View File

@@ -0,0 +1,45 @@
import plotutils
import math
#STRATEGY = "Normal"
STRATEGY = "Boundary"
#STRATEGY = "FullNeighborhood"
RANGE = [-5.0, 5.0]
INITIAL_STEP = 1.0
STEP_SIZE = 0.05
LATENCY = 0.05
NOISE_FILTER = 1
robot.enable()
move_to_laser()
robot.set_motors_enabled(True)
current_x = robot_x.getPosition()
current_z = robot_z.getPosition()
class Distance(Readable):
def read(self):
ret = ue.readable.read()
ret = 0.0 if math.isnan(ret) else ret
return ret
laser_distance=Distance()
start = time.time()
r = hsearch([robot_x, robot_z],laser_distance, [RANGE[0], RANGE[0]], [RANGE[1], RANGE[1]], [INITIAL_STEP,INITIAL_STEP], [STEP_SIZE,STEP_SIZE], NOISE_FILTER, relative = True, maximum=True, latency = LATENCY, title = "Hill Climbing XZ")
print r.print()
opt_x, opt_z= r.getOptimalPosition()
offset_x, offset_z = opt_x - current_x, opt_z - current_z
print "offset_x: ", offset_x, " offset_z: ", offset_z

View File

@@ -0,0 +1,31 @@
#Imports
import plotutils
from mathutils import fit_gaussian, Gaussian
#Parameters
RANGE = [-120.0,120.0]
STEP = 5.0
LATENCY = 0.005
RELATIVE = False
#Enabling and checking
#enable_motion()
#system_check()
robot.enable()
#Body
robot.set_tool(TOOL_DEFAULT)
move_to_laser()
#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

View File

@@ -0,0 +1,81 @@
import plotutils
from mathutils import fit_gaussian, Gaussian
d = robot.get_distance_to_pnt("pLaser")
if d<0:
raise Exception ("Error calculating distance to laser: " + str(d))
if d>20:
raise Exception ("Should be near the laser position to perform the scan")
RANGE = [-2.0, 2.0] #[-1.5, 1.5]
STEP = 0.02
Z_OFFSET = 0 #-1.0
LATENCY = 0.025
BORDER_SIZE = 0.15
robot.enable()
robot.set_motors_enabled(True)
current_positon = robot_x.getPosition()
robot_z.moveRel(Z_OFFSET)
robot.setPolling(25)
try:
ret = lscan(robot_x, ue.readable, RANGE[0], RANGE[1], STEP, latency = LATENCY, relative = True)
finally:
robot.setPolling(DEFAULT_ROBOT_POLLING)
d = ret.getReadable(0)
first_index = -1
last_index = -1
for i in range(len(d)):
if not math.isnan(d[i]):
if first_index<0:
first_index = i
last_index = i
if first_index == -1 or last_index < first_index:
raise Exception("Invalid range")
remove = int(max(BORDER_SIZE, STEP) / STEP)
_range = [first_index+remove, last_index-remove]
if _range[1] <= _range[0]:
raise Exception("Invalid range: " + str(_range))
center_index = int((_range[0] + _range[1])/2)
center_positon = ret.getPositions(0)[center_index]
y = ret.getReadable(0)[_range[0] : _range[1]]
x = ret.getPositions(0)[_range[0]: _range[1]]
#x = enforce_monotonic(x)
#(normalization, mean_val, sigma) = fit_gaussian([-v for v in y], x)
closest_x = x[y.indexOf(min(y))]
closest_y = y[y.indexOf(min(y))]
if closest_x is None or closest_x <= ret.getPositions(0)[first_index] or closest_x >= ret.getPositions(0)[last_index]:
raise Exception("Invalid Fit")
center_offset = center_positon-closest_y
#center_offset = current_positon-closest_y
p=get_plots()[0]
p.addMarker(closest_y, p.AxisId.X, str(closest_y), Color.GREEN)
robot.set_motors_enabled(True)
robot_x.move(closest_x)

View File

@@ -0,0 +1,81 @@
import plotutils
from mathutils import fit_gaussian, Gaussian
d = robot.get_distance_to_pnt("pLaser")
if d<0:
raise Exception ("Error calculating distance to laser: " + str(d))
if d>20:
raise Exception ("Should be near the laser position to perform the scan")
RANGE = [-2.0, 2.0] #[-1.5, 1.5]
STEP = 0.02
Z_OFFSET = 0 #-1.0
LATENCY = 0.025
BORDER_SIZE = 0.15
robot.enable()
robot.set_motors_enabled(True)
current_positon = robot_y.getPosition()
robot_z.moveRel(Z_OFFSET)
robot.setPolling(25)
try:
ret = lscan(robot_y, ue.readable, RANGE[0], RANGE[1], STEP, latency = LATENCY, relative = True)
finally:
robot.setPolling(DEFAULT_ROBOT_POLLING)
d = ret.getReadable(0)
first_index = -1
last_index = -1
for i in range(len(d)):
if not math.isnan(d[i]):
if first_index<0:
first_index = i
last_index = i
if first_index == -1 or last_index < first_index:
raise Exception("Invalid range")
remove = int(max(BORDER_SIZE, STEP) / STEP)
_range = [first_index+remove, last_index-remove]
if _range[1] <= _range[0]:
raise Exception("Invalid range: " + str(_range))
center_index = int((_range[0] + _range[1])/2)
center_positon = ret.getPositions(0)[center_index]
y = ret.getReadable(0)[_range[0] : _range[1]]
x = ret.getPositions(0)[_range[0]: _range[1]]
#x = enforce_monotonic(x)
#(normalization, mean_val, sigma) = fit_gaussian([-v for v in y], x)
closest_y = x[y.indexOf(min(y))]
closest_x = y[y.indexOf(min(y))]
if closest_y is None or closest_y <= ret.getPositions(0)[first_index] or closest_y >= ret.getPositions(0)[last_index]:
raise Exception("Invalid Fit")
center_offset = center_positon-closest_y
#center_offset = current_positon-closest_y
p=get_plots()[0]
p.addMarker(closest_y, p.AxisId.X, str(closest_y), Color.GREEN)
robot.set_motors_enabled(True)
robot_y.move(closest_y)

Some files were not shown because too many files have changed in this diff Show More