├── .gitignore
├── .gitmodules
├── .travis.yml
├── BowlerBoard_BootloadRev3_2015-06-06.xml
├── BowlerBoard_BootloadRev4_2015-06-06.xml
├── LICENSE
├── README.md
├── build.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── libs
└── .gitignore
├── resources
└── img
│ ├── screenshot-01.png
│ ├── screenshot-02.png
│ ├── screenshot-03.png
│ ├── screenshot-04.png
│ └── screenshot-05.png
├── rover.xml
└── src
└── main
├── java
└── com
│ └── neuronrobotics
│ ├── bowlerstudio
│ ├── BowlerStudio.java
│ ├── BowlerStudioController.java
│ ├── ConnectionManager.java
│ ├── DeviceSupportPluginMap.java
│ ├── MainController.java
│ ├── OutputFilter.java
│ ├── PluginFactory.java
│ ├── PluginManager.java
│ ├── PluginManagerWidget.java
│ ├── RedirectableStream.java
│ ├── RpcCommandPanel.java
│ ├── StudioBuildInfo.java
│ ├── TestServer.java
│ ├── VirtualCameraMobileBase.java
│ ├── creature
│ │ ├── AbstractGameController.java
│ │ ├── AdvancedKinematicsController.java
│ │ ├── CartesianPanel.java
│ │ ├── CreatureLab.java
│ │ ├── DHLinkWidget.java
│ │ ├── DeviceSettingsBase.java
│ │ ├── DhChainWidget.java
│ │ ├── DhLab.java
│ │ ├── DhSettingsWidget.java
│ │ ├── EngineeringUnitsSliderWidget.java
│ │ ├── IGameControllerUpdateListener.java
│ │ ├── IGistPromptCompletionListener.java
│ │ ├── IOnEngineeringUnitsChange.java
│ │ ├── IOnTransformChange.java
│ │ ├── JogKinematicsDevice.java
│ │ ├── JogWidget.java
│ │ ├── LinkConfigurationWidget.java
│ │ ├── LinkSliderWidget.java
│ │ ├── MobleBaseFactory.java
│ │ ├── PrinterConfiguration.java
│ │ └── TransformWidget.java
│ ├── robots
│ │ ├── FormacarumRover.java
│ │ ├── ObjectDetectionDataTableElement.java
│ │ └── RoverDataTable.java
│ ├── scripting
│ │ ├── CommandLineWidget.java
│ │ ├── GithubLoginFX.java
│ │ ├── ScriptingFileWidget.java
│ │ ├── ScriptingWebWidget.java
│ │ └── ScriptingWidgetType.java
│ ├── tabs
│ │ ├── AbstractBowlerStudioTab.java
│ │ ├── CameraTab.java
│ │ ├── DyIOControl.java
│ │ ├── DyIOPanel.java
│ │ ├── DyIOchannelWidget.java
│ │ ├── LocalFileScriptTab.java
│ │ ├── SalientTab.java
│ │ └── ScriptingGistTab.java
│ ├── threed
│ │ ├── Axis.java
│ │ ├── BowlerStudio3dEngine.java
│ │ ├── VirtualCameraDevice.java
│ │ └── Xform.java
│ └── utils
│ │ └── BowlerStudioResourceFactory.java
│ ├── graphing
│ ├── CSVWriter.java
│ ├── DataChannel.java
│ ├── DataWriter.java
│ ├── ExcelWriter.java
│ ├── GraphDataElement.java
│ ├── GraphingOptionsDialog.java
│ └── GraphingWindow.java
│ ├── nrconsole
│ ├── plugin
│ │ ├── BowlerCam
│ │ │ ├── BowlerCamController.java
│ │ │ ├── BowlerCamPanel.java
│ │ │ └── RGBSlider.java
│ │ ├── DeviceConfig
│ │ │ ├── AxisPanel.java
│ │ │ ├── DeviceConfigPanel.java
│ │ │ ├── LocalSettingsPanel.java
│ │ │ ├── MachineSetting.java
│ │ │ ├── PrinterConiguration.java
│ │ │ ├── SettingsChangeListener.java
│ │ │ ├── SettingsListItem.java
│ │ │ ├── SettingsPanel.java
│ │ │ ├── Slic3rAll.java
│ │ │ ├── Slic3rMasterPanel.java
│ │ │ ├── Slic3rPrinter.java
│ │ │ └── Slic3rPrints.java
│ │ ├── DyIO
│ │ │ ├── AdvancedAsyncWidget.java
│ │ │ ├── ChannelManager.java
│ │ │ ├── ChannelPanel.java
│ │ │ ├── ChannelPanelStatus.java
│ │ │ ├── ControlPanel.java
│ │ │ ├── DyIOConsole.java
│ │ │ ├── DyIOControlsPanel.java
│ │ │ ├── DyIOPanel.java
│ │ │ ├── GettingStartedPanel.java
│ │ │ ├── IChannelPanelListener.java
│ │ │ ├── Secheduler
│ │ │ │ ├── AnamationSequencer.java
│ │ │ │ ├── SchedulerControlBar.java
│ │ │ │ ├── SchedulerGui.java
│ │ │ │ └── ServoOutputScheduleChannelUI.java
│ │ │ └── channelwidgets
│ │ │ │ ├── AnalogChannelUI.java
│ │ │ │ ├── ControlWidget.java
│ │ │ │ ├── CounterInputWidget.java
│ │ │ │ ├── CounterOutputWidget.java
│ │ │ │ ├── DigitalInputWidget.java
│ │ │ │ ├── DigitalOutputWidget.java
│ │ │ │ ├── LabelChannelUI.java
│ │ │ │ ├── PPMReaderWidget.java
│ │ │ │ ├── SPIChannelWidget.java
│ │ │ │ ├── ServoWidget.java
│ │ │ │ ├── SliderChannelUI.java
│ │ │ │ └── UARTChannelUI.java
│ │ ├── PID
│ │ │ ├── AdvancedPIDWidget.java
│ │ │ ├── DyPIDControlWidget.java
│ │ │ ├── PIDControl.java
│ │ │ ├── PIDControlWidget.java
│ │ │ ├── PIDGraph.java
│ │ │ └── PIDVelocityWidget.java
│ │ └── bootloader
│ │ │ ├── BootloaderPanel.java
│ │ │ └── gui
│ │ │ ├── BootloaderParams.java
│ │ │ ├── NRBootLoaderApp.java
│ │ │ ├── NR_Bootloader_GUI.java
│ │ │ └── StatusLabel.java
│ └── util
│ │ ├── CommitWidget.java
│ │ ├── CompoundSlider.java
│ │ ├── DirectoryFilter.java
│ │ ├── FileSelectionFactory.java
│ │ ├── GCodeFilter.java
│ │ ├── GroovyFilter.java
│ │ ├── IntegerComboBox.java
│ │ ├── Mp3Filter.java
│ │ ├── NRConsoleDocumentationFactory.java
│ │ ├── PrefsLoader.java
│ │ ├── PromptForGist.java
│ │ ├── Slic3rFilter.java
│ │ ├── StlFilter.java
│ │ └── XmlFilter.java
│ └── pidsim
│ ├── CSVWriter.java
│ ├── DataPanel.java
│ ├── ExcelWriter.java
│ ├── GraphingPanel.java
│ ├── LinearPhysicsEngine.java
│ ├── PIDConstantsDialog.java
│ ├── PIDSim.java
│ ├── PIDSimFullTest.java
│ ├── PidLab.java
│ └── SettingsDialog.java
└── resources
├── com
└── neuronrobotics
│ ├── bowlerstudio
│ ├── CreatureLabControls.fxml
│ ├── DyIOChannelContorol.fxml
│ ├── DyIOPanel.fxml
│ ├── Main.fxml
│ ├── build.properties
│ ├── flyingCamera.xml
│ ├── githublogin.fxml
│ ├── java-keywords.css
│ └── newCreaturLab.fxml
│ └── nrconsole
│ ├── images
│ ├── hat.png
│ └── logo.png
│ └── plugin
│ ├── DyIO
│ └── images
│ │ ├── channel-default.png
│ │ ├── channel-highlight.png
│ │ ├── channel-panel-background.png
│ │ ├── channel-selected.png
│ │ ├── channel-update.png
│ │ ├── dyio-red.png
│ │ ├── dyio-red.svg
│ │ ├── dyio-red2.png
│ │ ├── dyio.png
│ │ ├── dyio.svg
│ │ ├── dyio2.png
│ │ ├── icon-analog-in.png
│ │ ├── icon-big-digital-in.png
│ │ ├── icon-big-digital-out.png
│ │ ├── icon-big-off.png
│ │ ├── icon-counter-in-dir.png
│ │ ├── icon-counter-in-home.png
│ │ ├── icon-counter-in-int.png
│ │ ├── icon-counter-out-dir.png
│ │ ├── icon-counter-out-home.png
│ │ ├── icon-counter-out-int.png
│ │ ├── icon-dc-motor-direction.png
│ │ ├── icon-dc-motor-velocity.png
│ │ ├── icon-digital-in.png
│ │ ├── icon-digital-out.png
│ │ ├── icon-off.png
│ │ ├── icon-ppm-reader.png
│ │ ├── icon-pwm-out.png
│ │ ├── icon-servo-out.png
│ │ ├── icon-spi-clock.png
│ │ ├── icon-spi-miso.png
│ │ ├── icon-spi-mosi.png
│ │ ├── icon-uart-rx.png
│ │ ├── icon-uart-tx.png
│ │ ├── icon-usart-rx.png
│ │ └── icon-usart-tx.png
│ └── bootloader
│ └── images
│ ├── blank.png
│ ├── error.png
│ └── ok.png
├── javax.usb.properties
└── speech.properties
/.gitignore:
--------------------------------------------------------------------------------
1 | /build/
2 | /.nb-gradle/private/
3 | /bin/
4 | /JFXScad.jar
5 | /servoTest.jfxscad
6 | /wheel.stl
7 | /.gradle*
8 | /.gradle*
9 | /.project
10 | /.classpath
11 | /.settings*
12 |
13 | /build/
14 | /whitecylinder/
15 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/.gitmodules
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 | jdk:
3 | - oraclejdk8
4 |
5 | before_install:
6 | - "export DISPLAY=:99.0"
7 | - "export TERM=dumb"
8 | - "sh -e /etc/init.d/xvfb start"
9 |
10 | install:
11 | - TERM=dumb ./gradlew --refresh-dependencies --stacktrace
12 |
13 | script:
14 | - TERM=dumb ./gradlew build --stacktrace
15 |
16 | after_failure:
17 | - "cat ./build/test-results/*.xml"
18 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 by Michael Hoffer
2 |
3 | This program is free software: you can redistribute it and/or modify
4 | it under the terms of the GNU Lesser General Public License as published by
5 | the Free Software Foundation, either version 3 of the License, or
6 | (at your option) any later version.
7 |
8 | This program is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU Lesser General Public License for more details.
12 |
13 | You should have received a copy of the GNU Lesser General Public License
14 | along with this program. If not, see .
15 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Mar 29 21:40:51 CET 2014
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-bin.zip
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/libs/.gitignore:
--------------------------------------------------------------------------------
1 | /nrsdk-3.11.3-jar-with-dependencies.jar
2 | /BowlerScriptingKernel.jar
3 |
--------------------------------------------------------------------------------
/resources/img/screenshot-01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/resources/img/screenshot-01.png
--------------------------------------------------------------------------------
/resources/img/screenshot-02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/resources/img/screenshot-02.png
--------------------------------------------------------------------------------
/resources/img/screenshot-03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/resources/img/screenshot-03.png
--------------------------------------------------------------------------------
/resources/img/screenshot-04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/resources/img/screenshot-04.png
--------------------------------------------------------------------------------
/resources/img/screenshot-05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/resources/img/screenshot-05.png
--------------------------------------------------------------------------------
/rover.xml:
--------------------------------------------------------------------------------
1 | [
2 |
3 |
4 | RotationTurretPlate
5 | pid
6 | 0
7 | .088
8 | 4096
9 | -4096
10 | true
11 | 0
12 | false
13 | 500
14 |
15 | 106.5
16 | 0
17 | -12.7
18 | -90
19 |
20 |
21 |
22 | firstTilt
23 | pid
24 | 1
25 | .088
26 | 4096
27 | -4096
28 | true
29 | 0
30 | false
31 | 500
32 |
33 | 0
34 | -90
35 | 476.25
36 | 0
37 |
38 |
39 |
40 |
41 | secondTilt
42 | pid
43 | 2
44 | .088
45 | 4096
46 | -4096
47 | true
48 | 0
49 | false
50 | 500
51 |
52 | 0
53 | 90
54 | 419
55 | 90
56 |
57 |
58 |
59 |
60 | wristTwist
61 | pid
62 | 3
63 | .756
64 | 4096
65 | -4096
66 | true
67 | 0
68 | false
69 | 500
70 |
71 | -168.25
72 | 0
73 | 0
74 | -90
75 |
76 |
77 |
78 |
79 | cameraFrame
80 | pid
81 | 4
82 | .756
83 | 4096
84 | -4096
85 | true
86 | 0
87 | false
88 | 500
89 |
90 | -168.25
91 | 0
92 | 0
93 | -90
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 | 0
102 | 0
103 | 0
104 | 1
105 | 0
106 | 0
107 | 0
108 |
109 |
110 | , rover.xml]
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/DeviceSupportPluginMap.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio;
2 |
3 | import com.neuronrobotics.bowlerstudio.tabs.AbstractBowlerStudioTab;
4 | import com.neuronrobotics.sdk.common.BowlerAbstractDevice;
5 | import com.neuronrobotics.sdk.namespace.bcs.pid.IPidControlNamespace;
6 |
7 | public class DeviceSupportPluginMap implements PluginFactory{
8 |
9 | private Class> device;
10 | private Class> plugin;
11 | private PluginFactory factory=null;
12 |
13 |
14 | DeviceSupportPluginMap(Class> device,Class> plugin){
15 | this.setDevice(device);
16 | this.setPlugin(plugin);
17 |
18 | }
19 | public DeviceSupportPluginMap(Class> device,Class> plugin, PluginFactory factory){
20 | this.factory = factory;
21 | this.setDevice(device);
22 | this.setPlugin(plugin);
23 |
24 | }
25 |
26 | public boolean isFactoryProvided(){
27 | return factory!=null;
28 | }
29 |
30 | public Class> getDevice() {
31 | return device;
32 | }
33 |
34 | private void setDevice(Class> device) {
35 | if(BowlerAbstractDevice.class.isAssignableFrom(device) || IPidControlNamespace.class.isAssignableFrom(device) )
36 | this.device = device;
37 | else
38 | throw new RuntimeException("Devices must subclass BowlerAbstractDevice or NonBowlerDevice");
39 | }
40 |
41 | public Class> getPlugin() {
42 | return plugin;
43 | }
44 |
45 | private void setPlugin(Class> plugin) {
46 | if(AbstractBowlerStudioTab.class.isAssignableFrom(plugin) )
47 | this.plugin = plugin;
48 | else
49 | throw new RuntimeException("Plugins must subclass AbstractBowlerStudioTab");
50 | }
51 |
52 | @Override
53 | public String toString(){
54 | return "Device: "+device.getCanonicalName()+" Plugin: "+plugin.getCanonicalName();
55 | }
56 |
57 | @Override
58 | public AbstractBowlerStudioTab generateNewPlugin() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
59 | if(factory!=null)
60 | return factory.generateNewPlugin();
61 | return (AbstractBowlerStudioTab) Class.forName(
62 | plugin.getName()
63 | ).cast(plugin.newInstance()// This is where the new tab allocation is called
64 | )
65 | ;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/OutputFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 |
7 | package com.neuronrobotics.bowlerstudio;
8 |
9 | /**
10 | *
11 | * @author Michael Hoffer <info@michaelhoffer.de>
12 | */
13 | @FunctionalInterface
14 | public interface OutputFilter {
15 | public boolean onMatch(String s);
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/PluginFactory.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio;
2 |
3 | import com.neuronrobotics.bowlerstudio.tabs.AbstractBowlerStudioTab;
4 |
5 | public interface PluginFactory {
6 | AbstractBowlerStudioTab generateNewPlugin() throws ClassNotFoundException, InstantiationException, IllegalAccessException ;
7 | }
8 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/PluginManagerWidget.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio;
2 |
3 | import java.util.ArrayList;
4 |
5 | import com.neuronrobotics.sdk.common.DeviceManager;
6 | import com.neuronrobotics.sdk.common.Log;
7 |
8 | import javafx.application.Platform;
9 | import javafx.event.ActionEvent;
10 | import javafx.event.EventHandler;
11 | import javafx.geometry.Insets;
12 | import javafx.scene.Node;
13 | import javafx.scene.control.Accordion;
14 | import javafx.scene.control.Button;
15 | import javafx.scene.control.TextField;
16 | import javafx.scene.control.TitledPane;
17 | import javafx.scene.layout.HBox;
18 | import javafx.scene.layout.Priority;
19 |
20 | public class PluginManagerWidget extends TitledPane {
21 | private PluginManager manager;
22 | private TextField deviceName = new TextField();
23 | private Button disconnectTHis;
24 | final Accordion accordion = new Accordion ();
25 |
26 | public PluginManagerWidget(PluginManager m, Node graphic){
27 | HBox content = new HBox(20);
28 |
29 | content.setPadding(new Insets(0, 20, 10, 20));
30 | this.manager = m;
31 | ArrayList plugins = manager.getPlugins();
32 | accordion.getPanes().addAll(plugins);
33 | disconnectTHis = new Button("Disconnect "+manager.getName());
34 |
35 | disconnectTHis.setOnMousePressed( event -> {
36 | new Thread(){
37 | public void run(){
38 | setName("disconnect plugins");
39 | Log.warning("Disconnect button for "+manager.getName()+" pressed");
40 | getManager().getDevice().disconnect();
41 |
42 | }
43 | }.start();
44 |
45 | });
46 | deviceName.setOnAction(event -> {
47 | getManager().setName(deviceName.getText());
48 | setText("Scripting name: "+manager.getName());
49 | disconnectTHis.setText("Disconnect "+manager.getName());
50 | });
51 | Platform.runLater(()->deviceName.setText(manager.getName()));
52 | content.setHgrow(accordion, Priority.ALWAYS);
53 | content.getChildren().addAll(graphic,disconnectTHis,deviceName,accordion);
54 | setContent(content);
55 | setText("Scripting name: "+manager.getName());
56 | }
57 |
58 | public PluginManager getManager() {
59 | return manager;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/RpcCommandPanel.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio;
2 |
3 | import java.awt.event.ActionEvent;
4 | import java.awt.event.ActionListener;
5 | import java.util.ArrayList;
6 |
7 | import javafx.scene.control.CheckBoxTreeItem;
8 |
9 | import javax.swing.JButton;
10 | import javax.swing.JLabel;
11 | import javax.swing.JPanel;
12 | import javax.swing.JTextField;
13 | import javax.swing.tree.DefaultMutableTreeNode;
14 |
15 | import net.miginfocom.swing.MigLayout;
16 |
17 | import com.neuronrobotics.sdk.common.BowlerAbstractDevice;
18 | import com.neuronrobotics.sdk.common.BowlerDataType;
19 | import com.neuronrobotics.sdk.common.BowlerDatagram;
20 | import com.neuronrobotics.sdk.common.RpcEncapsulation;
21 | import com.neuronrobotics.sdk.genericdevice.GenericDevice;
22 |
23 |
24 | public class RpcCommandPanel extends JPanel implements ActionListener {
25 |
26 | /**
27 | *
28 | */
29 | private static final long serialVersionUID = -9199252749669892888L;
30 | private BowlerAbstractDevice device;
31 | private RpcEncapsulation rpc;
32 | private CheckBoxTreeItem> rpcDhild;
33 | private boolean commandsEnabled=false;
34 | private ArrayList tx = new ArrayList();
35 | private ArrayList rx = new ArrayList();
36 | private JButton send = new JButton("Send");
37 | private JLabel txRpc = new JLabel("****");
38 | private JLabel rxRpc = new JLabel("****");
39 |
40 | public RpcCommandPanel(RpcEncapsulation rpc,BowlerAbstractDevice device, CheckBoxTreeItem> rpcDhild){
41 | this.setRpcDhild(rpcDhild);
42 | this.setRpc(rpc);
43 | this.setDevice(device);
44 | setLayout(new MigLayout());
45 | add(new JLabel("Namespace"), "cell 0 0,alignx leading");
46 | add(new JLabel(rpc.getNamespace().split(";")[0]), "cell 1 0,alignx leading");
47 |
48 | add(new JLabel("Method"), "cell 0 1,alignx leading");
49 | add(new JLabel(rpc.getDownstreamMethod().toString()), "cell 1 1,alignx leading");
50 |
51 | add(new JLabel("RPC"), "cell 0 2,alignx leading");
52 | add(new JLabel(rpc.getRpc()), "cell 1 2,alignx leading");
53 |
54 | add(new JLabel("Tx>>"), "cell 0 3,alignx leading");
55 | txRpc.setText(rpc.getRpc());
56 | add(txRpc, "cell 0 3,alignx leading");
57 | add(new JLabel("Rx<<"), "cell 0 4,alignx leading");
58 | add(rxRpc, "cell 0 4,alignx leading");
59 | add(send,"cell 2 3,alignx leading");
60 |
61 | JPanel txPanel = new JPanel(new MigLayout());
62 | JPanel rxPanel = new JPanel(new MigLayout());
63 |
64 | int i=0;
65 | for (BowlerDataType s:rpc.getDownstreamArguments()){
66 | JTextField tmp= new JTextField(5);
67 | tmp.setText("0");
68 | txPanel.add(new JLabel(s.toString()), "cell "+i+" 0,alignx leading");
69 | tx.add(tmp);
70 | i++;
71 | }
72 | i=0;
73 | for (BowlerDataType s:rpc.getUpstreamArguments()){
74 | JLabel tmp= new JLabel();
75 | tmp.setText("0");
76 | rxPanel.add(new JLabel(s.toString()), "cell "+i+" 0,alignx leading");
77 | rx.add(tmp);
78 | i++;
79 | }
80 | i=0;
81 | for(JTextField t:tx){
82 | txPanel.add(t, "cell "+i+" 1,alignx leading");
83 | i++;
84 | }
85 | i=0;
86 | for(JLabel t:rx){
87 | rxPanel.add(t, "cell "+i+" 1,alignx leading");
88 | i++;
89 | }
90 |
91 | add(txPanel, "cell 1 3,alignx leading");
92 | add(rxPanel, "cell 1 4,alignx leading");
93 |
94 | send.addActionListener(this);
95 | }
96 |
97 | public RpcEncapsulation getRpc() {
98 | return rpc;
99 | }
100 |
101 | private void setRpc(RpcEncapsulation rpc) {
102 | this.rpc = rpc;
103 | }
104 |
105 | public BowlerAbstractDevice getDevice() {
106 | return device;
107 | }
108 |
109 | private void setDevice(BowlerAbstractDevice device) {
110 | this.device = device;
111 | }
112 |
113 | public CheckBoxTreeItem> getRpcDhild() {
114 | return rpcDhild;
115 | }
116 |
117 | public void setRpcDhild(CheckBoxTreeItem> rpcDhild) {
118 | this.rpcDhild = rpcDhild;
119 | }
120 |
121 | public void enableCommands() {
122 | if(commandsEnabled)
123 | return;
124 |
125 | commandsEnabled = true;
126 | }
127 |
128 | @Override
129 | public void actionPerformed(ActionEvent arg0) {
130 | Object[] values = new Object[tx.size()];
131 | for (int i=0;i listeners = new ArrayList();
7 |
8 | public void addIGameControllerUpdateListener(IGameControllerUpdateListener l){
9 | if(!listeners.contains(l))
10 | listeners.add(l);
11 | }
12 | public void removeIGameControllerUpdateListener(IGameControllerUpdateListener l){
13 | if(listeners.contains(l))
14 | listeners.remove(l);
15 | }
16 | public void clearIGameControllerUpdateListener(){
17 | listeners.clear();
18 | }
19 |
20 | protected void fireGameControllerUpdate(){
21 |
22 | }
23 |
24 | public abstract double getControls0Plus();
25 | public abstract double getControls0Minus();
26 |
27 | public abstract double getControls1Plus();
28 | public abstract double getControls1Minus();
29 |
30 | public abstract double getControls2Plus();
31 | public abstract double getControls2Minus();
32 |
33 | public abstract double getControls3Plus();
34 | public abstract double getControls3Minus();
35 |
36 | public abstract double getNavUp();
37 | public abstract double getNavDown();
38 |
39 | public abstract double getNavLeft();
40 | public abstract double getNavRight();
41 |
42 |
43 | public abstract double getActionLeft();
44 | public abstract double getActionRight();
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/creature/AdvancedKinematicsController.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.creature;
2 |
3 | import javafx.embed.swing.SwingNode;
4 | import javafx.scene.control.ScrollPane;
5 |
6 | import com.neuronrobotics.bowlerstudio.tabs.AbstractBowlerStudioTab;
7 | import com.neuronrobotics.sdk.addons.kinematics.AbstractKinematicsNR;
8 | import com.neuronrobotics.sdk.common.BowlerAbstractDevice;
9 |
10 | public class AdvancedKinematicsController extends AbstractBowlerStudioTab {
11 |
12 | private PrinterConfiguration gui = new PrinterConfiguration();
13 |
14 | @Override
15 | public void onTabClosing() {
16 | // TODO Auto-generated method stub
17 |
18 | }
19 |
20 | @Override
21 | public String[] getMyNameSpaces() {
22 | // TODO Auto-generated method stub
23 | return new String[]{"bcs.cartesian.*"};
24 | }
25 |
26 | @Override
27 | public void initializeUI(BowlerAbstractDevice pm) {
28 | // TODO Auto-generated method stub
29 | AbstractKinematicsNR kin = (AbstractKinematicsNR)pm;
30 | gui.setKinematicsModel(kin);
31 | SwingNode sn = new SwingNode();
32 | sn.setContent(gui);
33 | ScrollPane s1 = new ScrollPane();
34 |
35 | s1.setContent(sn);
36 | setContent(s1);
37 | setText("Advanced Kinematics");
38 | onTabReOpening();
39 | }
40 |
41 | @Override
42 | public void onTabReOpening() {
43 | // TODO Auto-generated method stub
44 |
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/creature/DeviceSettingsBase.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.creature;
2 |
3 | import javax.swing.JPanel;
4 |
5 | import com.neuronrobotics.replicator.driver.NRPrinter;
6 | import com.neuronrobotics.replicator.driver.StateBasedControllerConfiguration;
7 |
8 | public abstract class DeviceSettingsBase extends JPanel {
9 |
10 | private NRPrinter printer;
11 | public DeviceSettingsBase(NRPrinter _printer){
12 | printer = _printer;
13 |
14 | }
15 | public abstract StateBasedControllerConfiguration getStateBasedControllerSettings();
16 |
17 | public abstract void setStateBasedControllerSettings(StateBasedControllerConfiguration _state);
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/creature/DhLab.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.creature;
2 |
3 |
4 | import javafx.scene.control.Button;
5 | import javafx.scene.control.ScrollPane;
6 | import javafx.scene.layout.GridPane;
7 |
8 | import com.neuronrobotics.bowlerstudio.tabs.AbstractBowlerStudioTab;
9 | import com.neuronrobotics.sdk.addons.kinematics.AbstractKinematicsNR;
10 | import com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics;
11 | import com.neuronrobotics.sdk.addons.kinematics.MobileBase;
12 | import com.neuronrobotics.sdk.common.BowlerAbstractDevice;
13 | import com.neuronrobotics.sdk.common.Log;
14 |
15 | public class DhLab extends CreatureLab {
16 |
17 | @Override
18 | public void initializeUI(BowlerAbstractDevice pm) {
19 | super.initializeUI(pm);
20 | setText("DH Lab");
21 | }
22 |
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/creature/DhSettingsWidget.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.creature;
2 |
3 | import javafx.application.Platform;
4 | import javafx.scene.control.Accordion;
5 | import javafx.scene.control.TextField;
6 | import javafx.scene.control.TitledPane;
7 | import javafx.scene.layout.ColumnConstraints;
8 | import javafx.scene.layout.GridPane;
9 | import javafx.scene.layout.RowConstraints;
10 | import javafx.scene.text.Text;
11 |
12 | import com.neuronrobotics.sdk.addons.kinematics.AbstractKinematicsNR;
13 | import com.neuronrobotics.sdk.addons.kinematics.DHLink;
14 | import com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics;
15 |
16 |
17 | public class DhSettingsWidget extends javafx.scene.Group implements IOnEngineeringUnitsChange {
18 |
19 | private DHLink dhLink;
20 | private EngineeringUnitsSliderWidget delta;
21 | private EngineeringUnitsSliderWidget theta;
22 | private EngineeringUnitsSliderWidget alpha;
23 | private EngineeringUnitsSliderWidget radius;
24 | private DHParameterKinematics device2;
25 | private IOnEngineeringUnitsChange externalListener;
26 |
27 | public DhSettingsWidget(DHLink dhLink,DHParameterKinematics device2,IOnEngineeringUnitsChange externalListener ){
28 | this.dhLink = dhLink;
29 | this.device2 = device2;
30 |
31 | this.externalListener = externalListener;
32 |
33 | delta= new EngineeringUnitsSliderWidget(this,
34 | 0,
35 | 200,
36 | dhLink.getDelta(),
37 | 180," mm ");
38 |
39 | theta = new EngineeringUnitsSliderWidget(this,
40 | -180,
41 | 180,
42 | Math.toDegrees(dhLink.getTheta()),
43 | 180,"degrees");
44 |
45 |
46 |
47 | radius= new EngineeringUnitsSliderWidget(this,
48 | 60,
49 | 200,
50 | dhLink.getRadius(),
51 | 180," mm ");
52 |
53 | alpha = new EngineeringUnitsSliderWidget(this,
54 | -180,
55 | 180,
56 | Math.toDegrees(dhLink.getAlpha()),
57 | 180,"degrees");
58 |
59 | GridPane gridpane = new GridPane();
60 | gridpane.getColumnConstraints().add(new ColumnConstraints(120)); // column 1 is 75 wide
61 | gridpane.getColumnConstraints().add(new ColumnConstraints(320)); // column 2 is 300 wide
62 | gridpane.getColumnConstraints().add(new ColumnConstraints(100)); // column 2 is 100 wide
63 | gridpane.getRowConstraints().add(new RowConstraints(50)); //
64 | gridpane.getRowConstraints().add(new RowConstraints(50)); //
65 | gridpane.getRowConstraints().add(new RowConstraints(50)); //
66 | gridpane.getRowConstraints().add(new RowConstraints(50)); //
67 | gridpane.add(new Text("Delta (Height)"), 0, 0);
68 | gridpane.add(delta, 1, 0);
69 | gridpane.add(new Text("Radius (Length)"), 0, 1);
70 | gridpane.add(radius, 1, 1);
71 | Accordion advancedPanel = new Accordion();
72 | GridPane agridpane = new GridPane();
73 | agridpane.getColumnConstraints().add(new ColumnConstraints(120)); // column 1 is 75 wide
74 | agridpane.getColumnConstraints().add(new ColumnConstraints(320)); // column 2 is 300 wide
75 | agridpane.getColumnConstraints().add(new ColumnConstraints(100)); // column 2 is 100 wide
76 | agridpane.getRowConstraints().add(new RowConstraints(50)); //
77 | agridpane.getRowConstraints().add(new RowConstraints(50)); //
78 | agridpane.add(new Text("Theta"), 0, 0);
79 | agridpane.add(theta, 1, 0);
80 | agridpane.add(new Text("Alpha"), 0, 1);
81 | agridpane.add(alpha, 1, 1);
82 |
83 | TitledPane rp =new TitledPane("Advance D-H ", agridpane);
84 | advancedPanel.getPanes().add(rp);
85 |
86 | gridpane.add(advancedPanel, 1, 2);
87 |
88 | getChildren().add(gridpane);
89 | }
90 |
91 |
92 | @Override
93 | public void onSliderMoving(EngineeringUnitsSliderWidget source, double newAngleDegrees) {
94 | dhLink.setTheta(Math.toRadians(theta.getValue()));
95 | dhLink.setAlpha(Math.toRadians(alpha.getValue()));
96 | dhLink.setRadius(radius.getValue());
97 | dhLink.setDelta(delta.getValue());
98 |
99 | if(externalListener!=null)
100 | externalListener.onSliderMoving(source, newAngleDegrees);
101 | //this calls the render update function attachec as the on jointspace update
102 | double[] joint=device2.getCurrentJointSpaceVector();
103 | device2.getChain().getChain(joint);
104 | Platform.runLater(()->device2.onJointSpaceUpdate(device2, joint));
105 | }
106 |
107 | @Override
108 | public void onSliderDoneMoving(EngineeringUnitsSliderWidget source,
109 | double newAngleDegrees) {
110 | // TODO Auto-generated method stub
111 | if(externalListener!=null)
112 | externalListener.onSliderDoneMoving(source, newAngleDegrees);
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/creature/IGameControllerUpdateListener.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.creature;
2 |
3 | public interface IGameControllerUpdateListener {
4 | public void onControllerUpdate(AbstractGameController source);
5 | }
6 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/creature/IGistPromptCompletionListener.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.creature;
2 |
3 | public interface IGistPromptCompletionListener {
4 | public void done(String gitsId, String file);
5 | }
6 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/creature/IOnEngineeringUnitsChange.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.creature;
2 |
3 | public interface IOnEngineeringUnitsChange {
4 | public void onSliderMoving(EngineeringUnitsSliderWidget source,double newAngleDegrees);
5 | public void onSliderDoneMoving(EngineeringUnitsSliderWidget source,double newAngleDegrees);
6 | }
7 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/creature/IOnTransformChange.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.creature;
2 |
3 | import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR;
4 |
5 | public interface IOnTransformChange {
6 | public abstract void onTransformChaging(TransformNR newTrans);
7 | public abstract void onTransformFinished(TransformNR newTrans);
8 | }
9 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/creature/JogKinematicsDevice.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.creature;
2 |
3 | import javafx.application.Platform;
4 | import javafx.embed.swing.SwingNode;
5 | import javafx.event.ActionEvent;
6 | import javafx.event.EventHandler;
7 | import javafx.scene.control.Button;
8 | import javafx.scene.control.Label;
9 | import javafx.scene.control.ScrollPane;
10 | import javafx.scene.control.TextField;
11 | import javafx.scene.layout.HBox;
12 | import javafx.scene.layout.VBox;
13 |
14 | import com.neuronrobotics.bowlerstudio.tabs.AbstractBowlerStudioTab;
15 | import com.neuronrobotics.sdk.addons.kinematics.AbstractKinematicsNR;
16 | import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR;
17 | import com.neuronrobotics.sdk.common.BowlerAbstractDevice;
18 |
19 | public class JogKinematicsDevice extends AbstractBowlerStudioTab{
20 |
21 |
22 |
23 |
24 |
25 | @Override
26 | public void onTabClosing() {
27 | // TODO Auto-generated method stub
28 |
29 | }
30 |
31 | @Override
32 | public String[] getMyNameSpaces() {
33 | // TODO Auto-generated method stub
34 | return new String[]{"bcs.cartesian.*"};
35 | }
36 |
37 | @Override
38 | public void initializeUI(BowlerAbstractDevice pm) {
39 |
40 | setContent(new JogWidget((AbstractKinematicsNR) pm));
41 | setText("Jog Kinematics Devices");
42 | onTabReOpening();
43 | }
44 |
45 | @Override
46 | public void onTabReOpening() {
47 | // TODO Auto-generated method stub
48 |
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/creature/LinkSliderWidget.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.creature;
2 |
3 | import java.time.Duration;
4 |
5 | import org.reactfx.util.FxTimer;
6 |
7 | import com.neuronrobotics.sdk.addons.kinematics.AbstractKinematicsNR;
8 | import com.neuronrobotics.sdk.addons.kinematics.AbstractLink;
9 | import com.neuronrobotics.sdk.addons.kinematics.DHLink;
10 | import com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics;
11 | import com.neuronrobotics.sdk.addons.kinematics.DhLinkType;
12 | import com.neuronrobotics.sdk.addons.kinematics.IJointSpaceUpdateListenerNR;
13 | import com.neuronrobotics.sdk.addons.kinematics.JointLimit;
14 | import com.neuronrobotics.sdk.common.Log;
15 |
16 | import javafx.application.Platform;
17 | import javafx.beans.value.ChangeListener;
18 | import javafx.beans.value.ObservableValue;
19 | import javafx.scene.Group;
20 | import javafx.scene.control.Accordion;
21 | import javafx.scene.control.Button;
22 | import javafx.scene.control.Label;
23 | import javafx.scene.control.Slider;
24 | import javafx.scene.control.TextField;
25 | import javafx.scene.control.TitledPane;
26 | import javafx.scene.layout.ColumnConstraints;
27 | import javafx.scene.layout.GridPane;
28 | import javafx.scene.layout.RowConstraints;
29 | import javafx.scene.text.Text;
30 |
31 | public class LinkSliderWidget extends Group implements IJointSpaceUpdateListenerNR {
32 | private AbstractKinematicsNR device;
33 | private DHParameterKinematics dhdevice;
34 |
35 | private int linkIndex;
36 | private EngineeringUnitsSliderWidget setpoint;
37 |
38 |
39 |
40 |
41 | public LinkSliderWidget(int linkIndex, DHLink dhlink, AbstractKinematicsNR device2) {
42 |
43 | this.linkIndex = linkIndex;
44 | this.device = device2;
45 | if(DHParameterKinematics.class.isInstance(device2)){
46 | dhdevice=(DHParameterKinematics)device2;
47 | }
48 |
49 | AbstractLink abstractLink = device2.getAbstractLink(linkIndex);
50 |
51 |
52 |
53 | TextField name = new TextField(abstractLink.getLinkConfiguration().getName());
54 | name.setMaxWidth(100.0);
55 | name.setOnAction(event -> {
56 | abstractLink.getLinkConfiguration().setName(name.getText());
57 | });
58 |
59 | setpoint = new EngineeringUnitsSliderWidget(new IOnEngineeringUnitsChange() {
60 |
61 | @Override
62 | public void onSliderMoving(EngineeringUnitsSliderWidget source, double newAngleDegrees) {
63 | // TODO Auto-generated method stub
64 |
65 | }
66 |
67 | @Override
68 | public void onSliderDoneMoving(EngineeringUnitsSliderWidget source,
69 | double newAngleDegrees) {
70 | try {
71 | device2.setDesiredJointAxisValue(linkIndex, setpoint.getValue(), 2);
72 |
73 | } catch (Exception e) {
74 | // TODO Auto-generated catch block
75 | e.printStackTrace();
76 | };
77 | }
78 | },
79 | abstractLink.getMinEngineeringUnits(),
80 | abstractLink.getMaxEngineeringUnits(),
81 | device2.getCurrentJointSpaceVector()[linkIndex],
82 | 180,dhlink.getLinkType()==DhLinkType.ROTORY?"degrees":"mm");
83 |
84 |
85 | GridPane panel = new GridPane();
86 |
87 | panel.getColumnConstraints().add(new ColumnConstraints(30)); // column 1 is 75 wide
88 | panel.getColumnConstraints().add(new ColumnConstraints(120)); // column 1 is 75 wide
89 | panel.getColumnConstraints().add(new ColumnConstraints(120)); // column 2 is 300 wide
90 |
91 |
92 |
93 | panel.add( new Text("#"+linkIndex),
94 | 0,
95 | 0);
96 | panel.add( name,
97 | 1,
98 | 0);
99 | panel.add( setpoint,
100 | 2,
101 | 0);
102 |
103 | getChildren().add(panel);
104 | }
105 |
106 |
107 | public void changed(ObservableValue extends Boolean> observableValue,
108 | Boolean wasChanging,
109 | Boolean changing) {
110 |
111 | }
112 |
113 | @Override
114 | public void onJointSpaceUpdate(AbstractKinematicsNR source, double[] joints) {
115 | Platform.runLater(()->{
116 | try{
117 | setpoint.setValue(joints[linkIndex]);
118 | }catch(ArrayIndexOutOfBoundsException ex){
119 | return;
120 | }
121 | });
122 |
123 |
124 | }
125 |
126 | @Override
127 | public void onJointSpaceTargetUpdate(AbstractKinematicsNR source,
128 | double[] joints) {
129 | // TODO Auto-generated method stub
130 |
131 | }
132 |
133 | @Override
134 | public void onJointSpaceLimit(AbstractKinematicsNR source, int axis,
135 | JointLimit event) {
136 | // TODO Auto-generated method stub
137 |
138 | }
139 |
140 |
141 | }
142 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/robots/ObjectDetectionDataTableElement.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.robots;
2 |
3 | import java.util.ArrayList;
4 |
5 | import com.neuronrobotics.imageprovider.Detection;
6 | import com.neuronrobotics.imageprovider.IObjectDetector;
7 |
8 | public class ObjectDetectionDataTableElement {
9 |
10 | private IObjectDetector detector;
11 | private String name;
12 | private ArrayList detections = new ArrayList();
13 | private int storeTime=10;
14 |
15 | public ObjectDetectionDataTableElement(IObjectDetector detector, String Name){
16 | this.setDetector(detector);
17 | setName(Name);
18 | }
19 |
20 | public void addDetection(Detection d){
21 | if(d!=null){
22 | detections.add(d);
23 | }
24 | //pop out old elements
25 | if(detections.size()>storeTime)
26 | detections.remove(detections.size()-1);
27 | }
28 |
29 | public String getName() {
30 | return name;
31 | }
32 |
33 | public void setName(String name) {
34 | this.name = name;
35 | }
36 |
37 | public IObjectDetector getDetector() {
38 | return detector;
39 | }
40 |
41 | public void setDetector(IObjectDetector detector) {
42 | this.detector = detector;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/robots/RoverDataTable.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.robots;
2 |
3 | import java.util.ArrayList;
4 |
5 | import com.neuronrobotics.sdk.common.NonBowlerDevice;
6 |
7 | public class RoverDataTable extends NonBowlerDevice {
8 |
9 | private ArrayList detections = new ArrayList<>();
10 |
11 | private long startOfApp = System.currentTimeMillis();
12 | private double hungry=0;
13 |
14 | @Override
15 | public void disconnectDeviceImp() {
16 | // TODO Auto-generated method stub
17 |
18 | }
19 |
20 | @Override
21 | public boolean connectDeviceImp() {
22 | // TODO Auto-generated method stub
23 | return false;
24 | }
25 |
26 | @Override
27 | public ArrayList getNamespacesImp() {
28 | // TODO Auto-generated method stub
29 | return new ArrayList();
30 | }
31 |
32 | public ArrayList getDetections() {
33 | return detections;
34 | }
35 |
36 | public void addDetector(ObjectDetectionDataTableElement el){
37 | if(!detections.contains(el))
38 | detections.add(el);
39 | }
40 |
41 | public ObjectDetectionDataTableElement getSpecificDetection(String name ) {
42 | for (ObjectDetectionDataTableElement o:detections){
43 | if(o.getName().contains(name)){
44 | return o;
45 | }
46 | }
47 | return null;
48 | }
49 |
50 |
51 |
52 | public double getHungry() {
53 | return hungry;
54 | }
55 |
56 | public void setHungry(double hungry) {
57 | this.hungry = hungry;
58 | }
59 |
60 | public long getStartOfApp() {
61 | return startOfApp;
62 | }
63 |
64 | public void setStartOfApp(long startOfApp) {
65 | this.startOfApp = startOfApp;
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/scripting/GithubLoginFX.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.scripting;
2 |
3 | import java.net.URL;
4 | import java.util.ResourceBundle;
5 |
6 | import javafx.fxml.FXML;
7 | import javafx.scene.Parent;
8 | import javafx.scene.Scene;
9 | import javafx.scene.control.TextField;
10 | import javafx.scene.control.PasswordField;
11 | import javafx.stage.Stage;
12 |
13 |
14 |
15 | public class GithubLoginFX implements javafx.fxml.Initializable {
16 |
17 | @FXML
18 | private TextField username;
19 | @FXML PasswordField password;
20 |
21 | private boolean done=false;
22 |
23 | private String [] creds = new String[]{"",""};
24 | private Stage stage;
25 | private Parent root;
26 | private Scene scene;
27 |
28 | @Override
29 | public void initialize(URL location, ResourceBundle resources) {
30 |
31 | reset();
32 | }
33 |
34 | public void reset(){
35 | done=false;
36 | setCreds(new String[]{"",""});
37 | password.clear();
38 | getUsername().clear();
39 |
40 |
41 | }
42 |
43 | @FXML public void anonMode() {
44 | setCreds(null);
45 |
46 | finish();
47 | }
48 | private void finish(){
49 | stage.close();
50 | stage.hide();
51 | done=true;
52 | }
53 |
54 | @FXML public void login() {
55 | getCreds()[0]= getUsername().getText();
56 | getCreds()[1]= password.getText();
57 | if(getCreds()[0]==null||getCreds()[1]==null){
58 | setCreds(null);
59 | }else if(getCreds()[0].equals("")||getCreds()[1].equals("")){
60 | setCreds(null);
61 | }
62 |
63 | finish();
64 | }
65 |
66 | @FXML public void focusOnPw() {
67 | password.requestFocus();
68 | }
69 |
70 | public boolean isDone() {
71 | return done;
72 | }
73 |
74 | public void setDone(boolean done) {
75 | this.done = done;
76 | }
77 |
78 | public String [] getCreds() {
79 | return creds;
80 | }
81 |
82 | public void setCreds(String [] creds) {
83 | this.creds = creds;
84 | }
85 |
86 | public void setStage(Stage stage, Parent root) {
87 | this.stage = stage;
88 | if(this.root==null){
89 | this.root = root;
90 | scene= new Scene(root);
91 | }
92 | stage.setScene(scene);
93 | }
94 |
95 | public TextField getUsername() {
96 | return username;
97 | }
98 |
99 | public void setUsername(TextField username) {
100 | this.username = username;
101 | }
102 |
103 |
104 | }
105 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/scripting/ScriptingWidgetType.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.scripting;
2 |
3 | public enum ScriptingWidgetType {
4 | FILE,
5 | WEB,
6 | GIST,
7 | CREATURE
8 | }
9 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/tabs/AbstractBowlerStudioTab.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.tabs;
2 |
3 | import java.util.ArrayList;
4 |
5 | import com.neuronrobotics.sdk.common.BowlerAbstractConnection;
6 | import com.neuronrobotics.sdk.common.BowlerAbstractDevice;
7 | import com.neuronrobotics.sdk.common.IConnectionEventListener;
8 | import com.neuronrobotics.sdk.common.IDeviceConnectionEventListener;
9 | import com.sun.javafx.scene.control.behavior.TabPaneBehavior;
10 | import com.sun.javafx.scene.control.skin.TabPaneSkin;
11 |
12 | import javafx.application.Platform;
13 | import javafx.event.Event;
14 | import javafx.event.EventHandler;
15 | import javafx.scene.control.Tab;
16 |
17 | public abstract class AbstractBowlerStudioTab extends Tab implements EventHandler {
18 |
19 | private boolean active = false;
20 | ArrayList myNames =null;
21 |
22 | public abstract void onTabClosing();
23 | public abstract String[] getMyNameSpaces();
24 | public abstract void initializeUI(BowlerAbstractDevice pm);
25 | public abstract void onTabReOpening();
26 |
27 |
28 | public void setDevice(BowlerAbstractDevice pm){
29 | myNames = new ArrayList ();
30 | if(getMyNameSpaces().length>0){
31 | for(int i=0;i names) {
59 | if (names == null)
60 | return false;
61 | for(String s:names){
62 | for(String m:myNames){
63 | if(s.contains(m)){
64 | setActive(true);
65 | }
66 | }
67 | }
68 |
69 | return isAcvive();
70 | }
71 |
72 | public void requestClose() {
73 | Platform.runLater(()->{
74 | try{
75 | TabPaneBehavior behavior = getBehavior();
76 | if(behavior.canCloseTab(this)) {
77 | behavior.closeTab(this);
78 | }
79 | }catch (NullPointerException e){
80 | //e.printStackTrace();
81 | }
82 | });
83 | }
84 |
85 | private TabPaneBehavior getBehavior() {
86 | return ((TabPaneSkin) getTabPane().getSkin()).getBehavior();
87 | }
88 |
89 | public void setActive(boolean a){
90 | active=a;
91 | }
92 |
93 | public boolean isAcvive() {
94 | return active;
95 | }
96 |
97 | @Override
98 | public void handle(Event event){
99 | System.out.println("Closing "+getText());
100 | onTabClosing();
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/tabs/DyIOControl.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.tabs;
2 |
3 | import java.io.IOException;
4 | import java.util.logging.Level;
5 | import java.util.logging.Logger;
6 |
7 | import javafx.fxml.FXMLLoader;
8 | import javafx.scene.Group;
9 | import javafx.scene.Parent;
10 | import javafx.scene.Scene;
11 |
12 | import com.neuronrobotics.bowlerstudio.BowlerStudio;
13 | import com.neuronrobotics.bowlerstudio.utils.BowlerStudioResourceFactory;
14 | import com.neuronrobotics.sdk.common.BowlerAbstractDevice;
15 | import com.neuronrobotics.sdk.dyio.DyIO;
16 |
17 | public class DyIOControl extends AbstractBowlerStudioTab {
18 |
19 | private DyIO dyio;
20 | DyIOPanel controller ;
21 | @Override
22 | public void onTabClosing() {
23 | // TODO Auto-generated method stub
24 |
25 | }
26 |
27 | @Override
28 | public String[] getMyNameSpaces() {
29 | // TODO Auto-generated method stub
30 | return new String[]{"neuronrobotics.dyio.*"};
31 | }
32 |
33 | @Override
34 | public void initializeUI(BowlerAbstractDevice pm) {
35 | this.dyio = (DyIO)pm;
36 |
37 |
38 | setText(dyio.getScriptingName());
39 | FXMLLoader fxmlLoader = BowlerStudioResourceFactory.getMainPanel();
40 | Parent root = fxmlLoader.getRoot();
41 | controller = fxmlLoader.getController();
42 | controller.setDyIO(dyio);
43 | setContent(root);
44 | }
45 |
46 |
47 | @Override
48 | public void onTabReOpening() {
49 | // TODO Auto-generated method stub
50 |
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/threed/Axis.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.threed;
2 |
3 | /*
4 | * Axis.java 1.0 98/11/25
5 | *
6 | * Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved.
7 | *
8 | * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
9 | * modify and redistribute this software in source and binary code form,
10 | * provided that i) this copyright notice and license appear on all copies of
11 | * the software; and ii) Licensee does not utilize the software in a manner
12 | * which is disparaging to Sun.
13 | *
14 | * This software is provided "AS IS," without a warranty of any kind. ALL
15 | * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
16 | * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
17 | * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
18 | * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
19 | * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
20 | * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
21 | * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
22 | * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
23 | * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
24 | * POSSIBILITY OF SUCH DAMAGES.
25 | *
26 | * This software is not designed or intended for use in on-line control of
27 | * aircraft, air traffic, aircraft navigation or aircraft communications; or in
28 | * the design, construction, operation or maintenance of any nuclear
29 | * facility. Licensee represents and warrants that it will not use or
30 | * redistribute the Software for such purposes.
31 | */
32 |
33 | /*
34 | * Getting Started with the Java 3D API
35 | * written in Java 3D
36 | *
37 | * This program demonstrates:
38 | * 1. writing a visual object class
39 | * In this program, Axis class defines a visual object
40 | * This particular class extends Shape3D
41 | * See the text for a discussion.
42 | * 2. Using LineArray to draw 3D lines.
43 | */
44 |
45 | import javafx.scene.Group;
46 | import javafx.scene.control.Label;
47 | import javafx.scene.paint.Color;
48 | import javafx.scene.paint.PhongMaterial;
49 | import javafx.scene.shape.Box;
50 | import javafx.scene.shape.Sphere;
51 | import javafx.scene.transform.Affine;
52 |
53 | // TODO: Auto-generated Javadoc
54 | /**
55 | * The Class Axis.
56 | */
57 | public class Axis extends Group {
58 |
59 | /**
60 | * Instantiates a new axis.
61 | */
62 | public Axis() {
63 | this(50);
64 | }
65 | // //////////////////////////////////////////
66 | //
67 | // create axis visual object
68 | /**
69 | * Instantiates a new axis.
70 | *
71 | * @param i the i
72 | */
73 | //
74 | public Axis(int i) {
75 | final PhongMaterial redMaterial = new PhongMaterial();
76 | redMaterial.setDiffuseColor(Color.DARKRED);
77 | redMaterial.setSpecularColor(Color.RED);
78 |
79 | final PhongMaterial greenMaterial = new PhongMaterial();
80 | greenMaterial.setDiffuseColor(Color.DARKGREEN);
81 | greenMaterial.setSpecularColor(Color.GREEN);
82 |
83 | final PhongMaterial blueMaterial = new PhongMaterial();
84 | blueMaterial.setDiffuseColor(Color.DARKBLUE);
85 | blueMaterial.setSpecularColor(Color.BLUE);
86 |
87 | final Box xAxis = new Box(i, 2, 2);
88 | final Box yAxis = new Box(2, i, 2);
89 | final Box zAxis = new Box(2, 2, i);
90 |
91 |
92 | Affine xp = new Affine();
93 | xp.setTx(i/2);
94 | xAxis.getTransforms().add(xp);
95 | Label xText = new Label("+X");
96 | xText.getTransforms().add(xp);
97 |
98 | Affine yp = new Affine();
99 | yp.setTy(i/2);
100 | yAxis.getTransforms().add(yp);
101 | Label yText = new Label("+Y");
102 | yText.getTransforms().add(yp);
103 |
104 | Affine zp = new Affine();
105 | zp.setTz(i/2);
106 | zAxis.getTransforms().add(zp);
107 | Label zText = new Label("+Z");
108 | zText.getTransforms().add(zp);
109 |
110 |
111 | xAxis.setMaterial(redMaterial);
112 | yAxis.setMaterial(greenMaterial);
113 | zAxis.setMaterial(blueMaterial);
114 |
115 | getChildren().addAll(xAxis,yAxis,zAxis,xText,yText,zText);
116 | }
117 |
118 | } // end of class Axis
119 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/threed/VirtualCameraDevice.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.threed;
2 |
3 | import java.awt.image.BufferedImage;
4 | import java.util.ArrayList;
5 |
6 | import com.neuronrobotics.imageprovider.AbstractImageProvider;
7 | import com.neuronrobotics.sdk.addons.kinematics.TransformFactory;
8 | import com.neuronrobotics.sdk.addons.kinematics.math.RotationNR;
9 | import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR;
10 |
11 | import javafx.scene.Group;
12 | import javafx.scene.PerspectiveCamera;
13 | import javafx.scene.transform.Affine;
14 | import javafx.scene.transform.Translate;
15 |
16 | public class VirtualCameraDevice extends AbstractImageProvider {
17 |
18 | private PerspectiveCamera camera;
19 | private Group hand;
20 | private Group cameraFrame = new Group();
21 |
22 | private double zoomDepth = -1000;
23 | private Affine zoomAffine = new Affine();
24 |
25 | public VirtualCameraDevice(PerspectiveCamera camera, Group hand){
26 | this.hand = hand;
27 | this.setCamera(camera);
28 | setScriptingName("virtualCameraDevice");
29 |
30 | }
31 | @Override
32 | public void setGlobalPositionListener(Affine affine) {
33 | super.setGlobalPositionListener(affine);
34 | //System.out.println("Setting camera frame transform");
35 | Group manipulationFrame = new Group();
36 | camera.getTransforms().add(zoomAffine);
37 | zoomAffine.setTz(getZoomDepth());
38 |
39 | getCameraFrame().getTransforms().add(TransformFactory.getTransform(
40 | BowlerStudio3dEngine.getOffsetforvisualization()
41 | ));
42 | manipulationFrame.getTransforms().add(affine);
43 |
44 |
45 | manipulationFrame.getChildren().addAll(camera, hand);
46 | getCameraFrame().getChildren().add(manipulationFrame);
47 |
48 | }
49 |
50 | @Override
51 | protected boolean captureNewImage(BufferedImage imageData) {
52 | // TODO Auto-generated method stub
53 | return false;
54 | }
55 |
56 | @Override
57 | public void disconnectDeviceImp() { }
58 |
59 | @Override
60 | public boolean connectDeviceImp() {
61 | return true;
62 | }
63 |
64 | @Override
65 | public ArrayList getNamespacesImp() {
66 | return new ArrayList();
67 | }
68 |
69 | public PerspectiveCamera getCamera() {
70 | return camera;
71 | }
72 | public Group getCameraGroup() {
73 | return getCameraFrame();
74 | }
75 |
76 | private void setCamera(PerspectiveCamera camera) {
77 | this.camera = camera;
78 | }
79 | public Group getCameraFrame() {
80 | return cameraFrame;
81 | }
82 | public void setCameraFrame(Group cameraFrame) {
83 | this.cameraFrame = cameraFrame;
84 | }
85 | public double getZoomDepth() {
86 | return zoomDepth;
87 | }
88 | public void setZoomDepth(double zoomDepth) {
89 | if(zoomDepth>-2)
90 | zoomDepth=-2;
91 | if(zoomDepth<-3000)
92 | zoomDepth=-3000;
93 | this.zoomDepth = zoomDepth;
94 | zoomAffine.setTz(getZoomDepth());
95 | }
96 |
97 | }
98 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/bowlerstudio/utils/BowlerStudioResourceFactory.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.bowlerstudio.utils;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 | import java.util.EnumSet;
6 | import java.util.HashMap;
7 | import java.util.Map;
8 | import java.util.logging.Level;
9 | import java.util.logging.Logger;
10 |
11 | import com.neuronrobotics.bowlerstudio.BowlerStudio;
12 | import com.neuronrobotics.nrconsole.plugin.DyIO.DyIOConsole;
13 | import com.neuronrobotics.sdk.dyio.DyIOChannelMode;
14 | import com.neuronrobotics.sdk.util.ThreadUtil;
15 |
16 | import javafx.fxml.FXMLLoader;
17 | import javafx.scene.image.Image;
18 |
19 | public class BowlerStudioResourceFactory {
20 | private static final Map lookup = new HashMap();
21 | private static Image chanHighlight;
22 | private static Image chanUpdate;
23 | private static Image chanDefault;
24 | private static final ArrayListfxmlLoaders=new ArrayList();
25 | private static FXMLLoader mainPanel = new FXMLLoader(
26 | BowlerStudio.class.getResource("DyIOPanel.fxml"));
27 | private static FXMLLoader githubLogin = new FXMLLoader(
28 | BowlerStudio.class.getResource("githublogin.fxml"));
29 | static {
30 |
31 |
32 |
33 | }
34 |
35 | public static FXMLLoader getLoader(int channelIndex){
36 | return fxmlLoaders.get(channelIndex);
37 | }
38 |
39 | public static void load(){
40 |
41 | for(DyIOChannelMode cm : EnumSet.allOf(DyIOChannelMode.class)) {
42 | Image image;
43 | //
44 | try {
45 | image = new Image(
46 | DyIOConsole.class
47 | .getResourceAsStream("images/icon-"
48 | + cm.toSlug()+ ".png"));
49 | } catch (NullPointerException e) {
50 | image = new Image(
51 | DyIOConsole.class
52 | .getResourceAsStream("images/icon-off.png"));
53 | }
54 | lookup.put( cm, image);
55 | }
56 | setChanHighlight(new Image(
57 | DyIOConsole.class
58 | .getResourceAsStream("images/channel-highlight.png")));
59 | setChanDefault(new Image(
60 | DyIOConsole.class
61 | .getResourceAsStream("images/channel-default.png")));
62 | setChanUpdate(new Image(
63 | DyIOConsole.class
64 | .getResourceAsStream("images/channel-update.png")));
65 |
66 | for(int i=0;i<24;i++){
67 | // generate the control widgets
68 | FXMLLoader fxmlLoader = new FXMLLoader(
69 | BowlerStudio.class.getResource("DyIOChannelContorol.fxml"));
70 | try {
71 | fxmlLoader.load();
72 | } catch (IOException ex) {
73 | throw new RuntimeException(ex);
74 | }
75 | fxmlLoaders.add(fxmlLoader);
76 | }
77 | try {
78 | mainPanel.load();
79 | } catch (IOException ex) {
80 | Logger.getLogger(BowlerStudio.class.getName()).
81 | log(Level.SEVERE, null, ex);
82 | }
83 |
84 | try {
85 | githubLogin.load();
86 | } catch (IOException e) {
87 | Logger.getLogger(BowlerStudio.class.getName()).
88 | log(Level.SEVERE, null, e);
89 | }
90 |
91 | }//stub to force a load from the static in a specific thread
92 |
93 | public static Image getModeImage(DyIOChannelMode mode){
94 | return lookup.get(mode);
95 | }
96 |
97 | public static Image getChanHighlight() {
98 | return chanHighlight;
99 | }
100 |
101 | public static void setChanHighlight(Image chanHighlight) {
102 | BowlerStudioResourceFactory.chanHighlight = chanHighlight;
103 | }
104 |
105 | public static Image getChanUpdate() {
106 | return chanUpdate;
107 | }
108 |
109 | public static void setChanUpdate(Image chanUpdate) {
110 | BowlerStudioResourceFactory.chanUpdate = chanUpdate;
111 | }
112 |
113 | public static Image getChanDefault() {
114 | return chanDefault;
115 | }
116 |
117 | public static void setChanDefault(Image chanDefault) {
118 | BowlerStudioResourceFactory.chanDefault = chanDefault;
119 | }
120 |
121 | public static FXMLLoader getMainPanel() {
122 | return mainPanel;
123 | }
124 |
125 | public static void setMainPanel(FXMLLoader mainPanel) {
126 | BowlerStudioResourceFactory.mainPanel = mainPanel;
127 | }
128 |
129 | public static FXMLLoader getGithubLogin() {
130 | return githubLogin;
131 | }
132 |
133 | public static void setGithubLogin(FXMLLoader githubLogin) {
134 | BowlerStudioResourceFactory.githubLogin = githubLogin;
135 | }
136 |
137 | }
138 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/graphing/CSVWriter.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.graphing;
2 |
3 | import java.io.BufferedWriter;
4 | import java.io.File;
5 | import java.io.FileWriter;
6 | import java.io.IOException;
7 | import java.util.ArrayList;
8 |
9 | import javax.swing.JOptionPane;
10 |
11 | import com.neuronrobotics.sdk.common.SDKInfo;
12 |
13 | public class CSVWriter {
14 | public static void WriteToCSV(ArrayList dataTable,String filename) {
15 | String out = "";
16 | synchronized(dataTable){
17 | for(int j =0;j< dataTable.size();j++) {
18 | out+=dataTable.get(j).getTimestamp();
19 | for (int i=0;iSystem.currentTimeMillis())
24 | return;
25 | lastTime= System.currentTimeMillis();
26 | // try{
27 | // Platform.runLater(()-> {
28 | // long time = System.currentTimeMillis() - startTime ;
29 | // if(series != null)
30 | // series.add((double) time/1000, value);
31 | // while(series.getItemCount()>3000){
32 | // Platform.runLater(()-> {
33 | // series.remove(0);
34 | // });
35 | // }
36 | // });
37 | // }catch(IllegalStateException ex){
38 | // //application not yet loaded
39 | // }
40 | }
41 |
42 | public XYSeries getSeries() {
43 | return series;
44 | }
45 |
46 | public static void restart() {
47 | startTime = System.currentTimeMillis();
48 | }
49 |
50 | public void clear() {
51 | series.clear();
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/graphing/DataWriter.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.graphing;
2 |
3 | import java.io.File;
4 |
5 | public interface DataWriter {
6 | public void setFile(File f);
7 | public void addData(DataChannel c);
8 | public void cleanup();
9 | }
10 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/graphing/ExcelWriter.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.graphing;
2 |
3 | import java.io.File;
4 | import java.io.IOException;
5 | import java.util.Locale;
6 |
7 | import jxl.Workbook;
8 | import jxl.WorkbookSettings;
9 | import jxl.write.Label;
10 | import jxl.write.Number;
11 | import jxl.write.WritableSheet;
12 | import jxl.write.WritableWorkbook;
13 | import jxl.write.WriteException;
14 | import jxl.write.biff.RowsExceededException;
15 |
16 | import org.jfree.data.xy.XYDataItem;
17 |
18 | public class ExcelWriter implements DataWriter {
19 |
20 | private WorkbookSettings wbSettings = new WorkbookSettings();
21 | private WritableWorkbook workbook;
22 | private WritableSheet excelSheet;
23 | private int lineOffset = 0;
24 | public ExcelWriter() {
25 | wbSettings.setLocale(new Locale("en", "EN"));
26 | }
27 |
28 | private void addNumber(int column, int row, double d) throws WriteException, RowsExceededException {
29 | Number number;
30 | number = new Number(column, row, d);
31 | excelSheet.addCell(number);
32 | }
33 |
34 | private void addLabel(int column, int row, String s) throws WriteException, RowsExceededException {
35 | Label label;
36 | label = new Label(column, row, s);
37 | excelSheet.addCell(label);
38 | }
39 |
40 |
41 | public void setFile(File f) {
42 | try {
43 | workbook = Workbook.createWorkbook(f, wbSettings);
44 | workbook.createSheet("Data", 0);
45 | excelSheet = workbook.getSheet(0);
46 | } catch (IOException e) {
47 | // TODO Auto-generated catch block
48 | e.printStackTrace();
49 | }
50 | }
51 |
52 |
53 | public void addData(DataChannel c) {
54 | try {
55 | int col = 1;
56 | addLabel(lineOffset, 0, c.toString() + " Time (ms)");
57 | addLabel(lineOffset+1, 0, c.toString() + " Value");
58 |
59 | for(Object o : c.getSeries().getItems()) {
60 | XYDataItem i = (XYDataItem) o;
61 | addNumber(lineOffset, col, i.getXValue());
62 | addNumber(lineOffset+1, col, i.getYValue());
63 | col++;
64 | }
65 | } catch (RowsExceededException e) {
66 | // TODO Auto-generated catch block
67 | e.printStackTrace();
68 | } catch (WriteException e) {
69 | // TODO Auto-generated catch block
70 | e.printStackTrace();
71 | }
72 | lineOffset+=2;
73 | }
74 |
75 |
76 | public void cleanup() {
77 | try {
78 | workbook.write();
79 | workbook.close();
80 | } catch (Exception e) {
81 | // TODO Auto-generated catch block
82 | e.printStackTrace();
83 | }
84 | }
85 |
86 | }
87 |
88 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/graphing/GraphDataElement.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.graphing;
2 |
3 | public class GraphDataElement {
4 | private long ms;
5 | private double [] data;
6 | public GraphDataElement(long currentTimeMillis, double [] data) {
7 | setTimestamp(currentTimeMillis);
8 | this.setData(data);
9 | }
10 | public void setData(double [] data) {
11 | this.data = data;
12 | }
13 | public double [] getData() {
14 | return data;
15 | }
16 | public void setTimestamp(long ms) {
17 | this.ms = ms;
18 | }
19 | public long getTimestamp() {
20 | return ms;
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/graphing/GraphingOptionsDialog.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.graphing;
2 |
3 | import javax.swing.JFrame;
4 | import javax.swing.JLabel;
5 |
6 | import net.miginfocom.swing.MigLayout;
7 |
8 | public class GraphingOptionsDialog extends JFrame {
9 | /**
10 | *
11 | */
12 | private static final long serialVersionUID = 1L;
13 | @SuppressWarnings("unused")
14 | private GraphingWindow window;
15 |
16 | public GraphingOptionsDialog(GraphingWindow window) {
17 | this.window = window;
18 | setLayout(new MigLayout());
19 | setTitle("Graphing Options");
20 |
21 | add(new JLabel("Graphing Options"));
22 |
23 | pack();
24 | setLocationRelativeTo(null);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/BowlerCam/BowlerCamController.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.BowlerCam;
2 |
3 | import javafx.embed.swing.SwingNode;
4 | import javafx.scene.control.ScrollPane;
5 |
6 | import com.neuronrobotics.bowlerstudio.tabs.AbstractBowlerStudioTab;
7 | import com.neuronrobotics.sdk.bowlercam.device.BowlerCamDevice;
8 | import com.neuronrobotics.sdk.common.BowlerAbstractDevice;
9 |
10 | public class BowlerCamController extends AbstractBowlerStudioTab{
11 |
12 | private BowlerCamPanel bcp = new BowlerCamPanel();
13 |
14 | @Override
15 | public void onTabClosing() {
16 | // TODO Auto-generated method stub
17 |
18 | }
19 |
20 | @Override
21 | public String[] getMyNameSpaces() {
22 | // TODO Auto-generated method stub
23 | return new String[] {"neuronrobotics.bowlercam.*"};
24 | }
25 |
26 | @Override
27 | public void initializeUI(BowlerAbstractDevice pm) {
28 |
29 | bcp.setConnection((BowlerCamDevice)pm);
30 |
31 | SwingNode sn = new SwingNode();
32 | sn.setContent(bcp);
33 | ScrollPane s1 = new ScrollPane();
34 |
35 | s1.setContent(sn);
36 | setContent(s1);
37 | setText("BowlerCam Control");
38 | onTabReOpening();
39 | }
40 |
41 | @Override
42 | public void onTabReOpening() {
43 | // TODO Auto-generated method stub
44 |
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/BowlerCam/RGBSlider.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.BowlerCam;
2 |
3 | import java.awt.Color;
4 | import java.awt.Graphics;
5 |
6 | import javax.swing.JLabel;
7 | import javax.swing.JPanel;
8 | import javax.swing.JSlider;
9 | import javax.swing.SwingConstants;
10 |
11 | import net.miginfocom.swing.MigLayout;
12 |
13 | public class RGBSlider extends JPanel {
14 | JSlider r = new JSlider(SwingConstants.VERTICAL, 0, 255, 128);
15 | JSlider g = new JSlider(SwingConstants.VERTICAL, 0, 255, 128);
16 | JSlider b = new JSlider(SwingConstants.VERTICAL, 0, 255, 128);
17 |
18 | JLabel rl = new JLabel("128");
19 | JLabel gl = new JLabel("128");
20 | JLabel bl = new JLabel("128");
21 | ColorBox c = new ColorBox(Color.gray);
22 | /**
23 | *
24 | */
25 | private static final long serialVersionUID = 1L;
26 |
27 | public RGBSlider(String name){
28 | setLayout(new MigLayout());
29 | r.setMajorTickSpacing(15);
30 | g.setMajorTickSpacing(15);
31 | b.setMajorTickSpacing(15);
32 |
33 | r.setPaintTicks(true);
34 | g.setPaintTicks(true);
35 | b.setPaintTicks(true);
36 |
37 | JPanel rc = new JPanel(new MigLayout());
38 | JPanel gc = new JPanel(new MigLayout());
39 | JPanel bc = new JPanel(new MigLayout());
40 |
41 | rc.add(new JLabel("R"));
42 | rc.add(rl,"wrap");
43 | rc.add(r);
44 |
45 | gc.add(new JLabel("G"));
46 | gc.add(gl,"wrap");
47 | gc.add(g);
48 |
49 | bc.add(new JLabel("B"));
50 | bc.add(bl,"wrap");
51 | bc.add(b);
52 |
53 | JPanel slides = new JPanel(new MigLayout());
54 | slides.add(new JLabel(name),"wrap");
55 | slides.add(rc);
56 | slides.add(gc);
57 | slides.add(bc);
58 |
59 | add(slides,"wrap");
60 | add(c,"wrap");
61 |
62 | }
63 | public void setColor(int r,int g,int b){
64 | this.r.setValue(r);
65 | this.g.setValue(g);
66 | this.b.setValue(b);
67 | getColor();
68 | }
69 | public void setColor(Color c){
70 | this.r.setValue(c.getRed());
71 | this.g.setValue(c.getGreen());
72 | this.b.setValue(c.getBlue());
73 | getColor();
74 | }
75 | public Color getColor(){
76 | rl.setText(new Integer(r.getValue()).toString());
77 | gl.setText(new Integer(g.getValue()).toString());
78 | bl.setText(new Integer(b.getValue()).toString());
79 | Color now =new Color(r.getValue(),g.getValue(),b.getValue());
80 | c.setColor(now);
81 | setBackground(now);
82 | return now;
83 | }
84 | private class ColorBox extends JPanel
85 | {
86 | /**
87 | * long
88 | */
89 | private static final long serialVersionUID = 1L;
90 | public ColorBox(Color backColor){
91 | setSize(400, 400);
92 | setColor(backColor);
93 | }
94 | public void setColor(Color c) {
95 | setBackground(c);
96 | }
97 | public void paintComponent(Graphics g){
98 | super.paintComponent(g);
99 | }
100 |
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DeviceConfig/MachineSetting.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DeviceConfig;
2 |
3 | public class MachineSetting {
4 |
5 | private final String name;
6 | private V value;
7 |
8 | public MachineSetting(String _name,V v) {
9 | name = _name;
10 | value = v;
11 | }
12 | public MachineSetting(String _name) {
13 | name = _name;
14 |
15 | }
16 | public String getName() {
17 | return name;
18 | }
19 |
20 | public V getValue() {
21 | return value;
22 | }
23 | public void setValue(V _value) {
24 | value = _value;
25 | }
26 |
27 | public String toString() {
28 | return "(" + name + ", " + value + ")";
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DeviceConfig/PrinterConiguration.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DeviceConfig;
2 |
3 | import javafx.embed.swing.SwingNode;
4 | import javafx.scene.control.ScrollPane;
5 |
6 | import com.neuronrobotics.bowlerstudio.tabs.AbstractBowlerStudioTab;
7 | import com.neuronrobotics.replicator.driver.BowlerBoardDevice;
8 | import com.neuronrobotics.replicator.driver.NRPrinter;
9 | import com.neuronrobotics.sdk.common.BowlerAbstractDevice;
10 |
11 | public class PrinterConiguration extends AbstractBowlerStudioTab{
12 |
13 | private DeviceConfigPanel gui = new DeviceConfigPanel();
14 |
15 | @Override
16 | public void onTabClosing() {
17 | // TODO Auto-generated method stub
18 |
19 | }
20 |
21 | @Override
22 | public String[] getMyNameSpaces() {
23 | return new String[]{"bcs.cartesian.*"};
24 | }
25 |
26 | @Override
27 | public void initializeUI(BowlerAbstractDevice pm) {
28 | NRPrinter printer = (NRPrinter)pm;
29 | BowlerBoardDevice delt = printer.getDeltaDevice();
30 |
31 | if (delt.isAvailable()){
32 | gui.setDevices(delt,printer);
33 | }
34 | if (delt.isAvailable()){
35 | gui.updateSettings();
36 | }
37 |
38 | SwingNode sn = new SwingNode();
39 | sn.setContent(gui);
40 | ScrollPane s1 = new ScrollPane();
41 |
42 | s1.setContent(sn);
43 | setContent(s1);
44 | setText("Printer Config");
45 | onTabReOpening();
46 | }
47 |
48 | @Override
49 | public void onTabReOpening() {
50 | // TODO Auto-generated method stub
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DeviceConfig/SettingsChangeListener.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DeviceConfig;
2 |
3 | public interface SettingsChangeListener {
4 | public void settingsChanged();
5 | public void settingsRequest();
6 | }
7 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DeviceConfig/SettingsListItem.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DeviceConfig;
2 |
3 | import java.awt.List;
4 |
5 | import javax.swing.JPanel;
6 | import javax.swing.JLabel;
7 | import javax.swing.JTextField;
8 |
9 | import java.beans.PropertyChangeListener;
10 | import java.beans.PropertyChangeEvent;
11 | import java.awt.event.ActionListener;
12 | import java.awt.event.ActionEvent;
13 | import java.awt.event.FocusEvent;
14 | import java.awt.event.FocusListener;
15 | import java.beans.VetoableChangeListener;
16 | import java.awt.event.KeyAdapter;
17 | import java.awt.event.KeyEvent;
18 | import java.awt.Color;
19 |
20 | import javax.swing.JFormattedTextField;
21 | import javax.swing.event.CaretEvent;
22 | import javax.swing.event.CaretListener;
23 | import javax.swing.event.DocumentEvent;
24 | import javax.swing.event.DocumentListener;
25 |
26 | import java.awt.event.InputMethodListener;
27 | import java.awt.event.InputMethodEvent;
28 |
29 | public class SettingsListItem extends JPanel {
30 | private JLabel lblNewLabel;
31 | private JTextField txtSetVal;
32 | private String labelTxt;
33 | private String currentValue;
34 | public SettingsListItem() {
35 | add(getLblNewLabel());
36 | add(getTxtSetVal());
37 |
38 | }
39 | public SettingsListItem(String _lblText, String _value) {
40 | add(getLblNewLabel());
41 | add(getTxtSetVal());
42 | loadValues( _lblText, _value);
43 |
44 | }
45 | public SettingsListItem(String _lblText, int _value) {
46 | add(getLblNewLabel());
47 | add(getTxtSetVal());
48 | loadValues( _lblText, _value);
49 |
50 | }
51 | public SettingsListItem(String _lblText, double _value) {
52 | add(getLblNewLabel());
53 | add(getTxtSetVal());
54 | loadValues( _lblText, _value);
55 |
56 | }
57 |
58 | public void loadValues(String _lblTxt, String _value){
59 | currentValue = _value;
60 | labelTxt =_lblTxt;
61 | getLblNewLabel().setText(_lblTxt);
62 | getTxtSetVal().setText(_value);
63 | }
64 | public void loadValues(String _lblTxt, int _value){
65 | currentValue = Integer.toString(_value);
66 | labelTxt =_lblTxt;
67 | getLblNewLabel().setText(_lblTxt);
68 | getTxtSetVal().setText(Integer.toString(_value));
69 | }
70 | public void loadValues(String _lblTxt, double _value){
71 | currentValue = Double.toString(_value);
72 | labelTxt =_lblTxt;
73 | getLblNewLabel().setText(_lblTxt);
74 | getTxtSetVal().setText(Double.toString(_value));
75 | }
76 |
77 | private JLabel getLblNewLabel() {
78 | if (lblNewLabel == null) {
79 | lblNewLabel = new JLabel("New label");
80 | }
81 | return lblNewLabel;
82 | }
83 | public int getIntValue(){
84 | try {
85 | return Integer.valueOf(getTxtSetVal().getText());
86 | } catch (Exception e) {
87 | return 1;
88 | }
89 |
90 | }
91 | public double getDoubleValue(){
92 | try {
93 |
94 | return Double.valueOf(getTxtSetVal().getText());
95 | } catch (Exception e) {
96 | return 1;
97 | }
98 |
99 | }
100 | public String getStringValue(){
101 | return getTxtSetVal().getText();
102 | }
103 | private JTextField getTxtSetVal() {
104 | if (txtSetVal == null) {
105 | txtSetVal = new JTextField();
106 | txtSetVal.setText("Setting");
107 |
108 | txtSetVal.addCaretListener(new CaretListener() {
109 |
110 | @Override
111 | public void caretUpdate(CaretEvent e) {
112 | if (txtSetVal.getText().equals(currentValue)){
113 | txtSetVal.setBackground(Color.WHITE);
114 | }
115 | else{
116 | txtSetVal.setBackground(Color.ORANGE);
117 | }
118 |
119 | }
120 | });
121 |
122 |
123 | txtSetVal.setColumns(10);
124 | }
125 | return txtSetVal;
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DeviceConfig/SettingsPanel.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DeviceConfig;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import javax.swing.JPanel;
7 |
8 | public abstract class SettingsPanel extends JPanel {
9 | private ArrayList settings = new ArrayList();
10 | private List listeners = new ArrayList();
11 |
12 |
13 |
14 | public abstract String getPanelName();
15 |
16 | public abstract void initComponents();
17 | public void addListener(SettingsChangeListener toAdd) {
18 | listeners.add(toAdd);
19 | }
20 | public void removeListeners() {
21 | listeners.clear();
22 | }
23 | public void notifySettingsChanged(){
24 | for (SettingsChangeListener ptl : listeners) {
25 | ptl.settingsChanged();
26 | }
27 | }
28 | public void notifySettingsRequest(){
29 | for (SettingsChangeListener ptl : listeners) {
30 | ptl.settingsRequest();
31 | }
32 | }
33 |
34 | public void checkNewSettings(){
35 | notifySettingsRequest();
36 | }
37 |
38 | public ArrayList getValues(){
39 |
40 | return settings;
41 | }
42 |
43 | public void setValues(ArrayList values) {
44 | settings = values;
45 | notifySettingsChanged();
46 | }
47 |
48 | public boolean settingExists(String _name){
49 | for (MachineSetting machineSetting : settings) {
50 | if (machineSetting.getName() == _name){
51 | return true;
52 | }
53 | }
54 | return false;
55 | }
56 |
57 | public MachineSetting getSetting(String _name){
58 |
59 | for (MachineSetting machineSetting : settings) {
60 | if (machineSetting.getName() == _name){
61 | return machineSetting;
62 | }
63 | }
64 | return null;
65 | }
66 | public int numSettings(){
67 | return settings.size();
68 | }
69 |
70 | public MachineSetting getSetting(int index){
71 |
72 | return settings.get(index);
73 | }
74 | public void setValue(int index, MachineSetting item){
75 |
76 | if (settings.size() <= index){
77 | settings.add(index, item);
78 | }
79 | else{
80 | settings.set(index, item);
81 | }
82 | notifySettingsChanged();
83 | }
84 |
85 | public Object getSetValue(String _name){
86 |
87 | for (MachineSetting machineSetting : settings) {
88 | if (machineSetting.getName() == _name){
89 | return machineSetting.getValue();
90 | }
91 | }
92 | return null;
93 | }
94 | public Object getSetValue(int index){
95 |
96 | return settings.get(index).getValue();
97 | }
98 | public int getIntValue(String _name){
99 |
100 | for (MachineSetting machineSetting : settings) {
101 | if (machineSetting.getName() == _name){
102 | return (Integer) machineSetting.getValue();
103 | }
104 | }
105 | return -1;
106 | }
107 | public boolean getBooleanValue(String _name){
108 |
109 | for (MachineSetting machineSetting : settings) {
110 | if (machineSetting.getName() == _name){
111 | return (Boolean) machineSetting.getValue();
112 | }
113 | }
114 | return false;
115 | }
116 | public double getDoubleValue(String _name){
117 |
118 | for (MachineSetting machineSetting : settings) {
119 | if (machineSetting.getName() == _name){
120 | return (Double) machineSetting.getValue();
121 | }
122 | }
123 | return -1;
124 | }
125 | public double getDoubleValue(int index){
126 |
127 | return (Double) settings.get(index).getValue();
128 | }
129 |
130 | public int getIntegerValue(int index){
131 |
132 | return (Integer) settings.get(index).getValue();
133 | }
134 |
135 | public boolean getBooleanValue(int index){
136 |
137 | return (Boolean) settings.get(index).getValue();
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DeviceConfig/Slic3rMasterPanel.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DeviceConfig;
2 |
3 | import java.awt.event.ActionEvent;
4 | import java.awt.event.ActionListener;
5 |
6 | import javax.swing.ButtonGroup;
7 | import javax.swing.JPanel;
8 | import javax.swing.JRadioButton;
9 | import javax.swing.JScrollPane;
10 |
11 | import net.miginfocom.swing.MigLayout;
12 |
13 | import com.neuronrobotics.nrconsole.util.PrefsLoader;
14 |
15 | public class Slic3rMasterPanel extends SettingsPanel {
16 | private JScrollPane scrollPane;
17 | private JPanel panel;
18 | private JRadioButton rdbtnShowAllSettings;
19 | private JPanel panel_1;
20 | PrefsLoader prefs = new PrefsLoader();
21 | private Slic3rAll pnlAll = new Slic3rAll(this);
22 | private Slic3rPrinter pnlPrinter = new Slic3rPrinter(this);
23 | private Slic3rPrints pnlPrints = new Slic3rPrints(this);
24 | private JRadioButton rdbtnShowOnlyPrinter;
25 | private JRadioButton rdbtnShowOnlyPrint;
26 | private final ButtonGroup buttonGroup = new ButtonGroup();
27 |
28 | /**
29 | * Create the panel.
30 | */
31 | public Slic3rMasterPanel() {
32 |
33 | initComponents();
34 |
35 |
36 | }
37 |
38 |
39 |
40 |
41 | private SettingsPanel whichPanel(){
42 | if (rdbtnShowAllSettings.isSelected()){
43 | removeListeners();
44 | addListener(pnlAll);
45 | notifySettingsChanged();
46 | return pnlAll;
47 | }
48 | else if (rdbtnShowOnlyPrinter.isSelected()){
49 | removeListeners();
50 | addListener(pnlPrinter);
51 | notifySettingsChanged();
52 | return pnlPrinter;
53 | }
54 | else if(rdbtnShowOnlyPrint.isSelected()){
55 | removeListeners();
56 | addListener(pnlPrints);
57 | notifySettingsChanged();
58 | return pnlPrints;
59 | }
60 | removeListeners();
61 | addListener(pnlAll);
62 | notifySettingsChanged();
63 | return pnlAll;
64 |
65 |
66 | }
67 | private void changePanels(){
68 | scrollPane.setViewportView(whichPanel());
69 | }
70 |
71 |
72 | private JScrollPane getScrollPane() {
73 | if (scrollPane == null) {
74 | scrollPane = new JScrollPane();
75 | scrollPane.setColumnHeaderView(getPanel());
76 |
77 | }
78 | return scrollPane;
79 | }
80 | private JPanel getPanel() {
81 | if (panel == null) {
82 | panel = new JPanel();
83 | panel.add(getRdbtnShowOnlyPrinter());
84 | panel.add(getRdbtnShowOnlyPrint());
85 | panel.add(getRdbtnShowAllSettings());
86 | }
87 | return panel;
88 | }
89 | private JRadioButton getRdbtnShowAllSettings() {
90 | if (rdbtnShowAllSettings == null) {
91 | rdbtnShowAllSettings = new JRadioButton("Show All Settings");
92 | rdbtnShowAllSettings.addActionListener(new ActionListener() {
93 | public void actionPerformed(ActionEvent e) {
94 | if (rdbtnShowAllSettings.isSelected()){
95 | prefs.setSlic3rRDBTNLast(0);
96 | }
97 | changePanels();
98 | }
99 | });
100 |
101 | buttonGroup.add(rdbtnShowAllSettings);
102 | }
103 | return rdbtnShowAllSettings;
104 | }
105 |
106 |
107 | @Override
108 | public String getPanelName() {
109 |
110 | return "Slic3r Settings";
111 | }
112 |
113 | @Override
114 | public void initComponents() {
115 | setLayout(new MigLayout("", "[grow]", "[grow]"));
116 | add(getScrollPane(), "cell 0 0,grow");
117 | switch (prefs.getSlic3rRDBTNLast()) {
118 | case 0:
119 | getRdbtnShowAllSettings().setSelected(true);
120 | break;
121 | case 1:
122 | getRdbtnShowOnlyPrinter().setSelected(true);
123 | break;
124 | case 2:
125 | getRdbtnShowOnlyPrint().setSelected(true);
126 | break;
127 | default:
128 | getRdbtnShowAllSettings().setSelected(true);
129 | break;
130 | }
131 | changePanels();
132 |
133 | }
134 | private JRadioButton getRdbtnShowOnlyPrinter() {
135 | if (rdbtnShowOnlyPrinter == null) {
136 | rdbtnShowOnlyPrinter = new JRadioButton("Show Only Printer Settings");
137 | rdbtnShowOnlyPrinter.addActionListener(new ActionListener() {
138 | public void actionPerformed(ActionEvent arg0) {
139 | if (rdbtnShowOnlyPrinter.isSelected()){
140 | prefs.setSlic3rRDBTNLast(1);
141 | }
142 | changePanels();
143 | }
144 | });
145 |
146 | buttonGroup.add(rdbtnShowOnlyPrinter);
147 |
148 | }
149 | return rdbtnShowOnlyPrinter;
150 | }
151 |
152 | private JRadioButton getRdbtnShowOnlyPrint() {
153 | if (rdbtnShowOnlyPrint == null) {
154 | rdbtnShowOnlyPrint = new JRadioButton("Show Only Print Job Settings");
155 | rdbtnShowOnlyPrint.addActionListener(new ActionListener() {
156 | public void actionPerformed(ActionEvent e) {
157 | if (rdbtnShowOnlyPrint.isSelected()){
158 | prefs.setSlic3rRDBTNLast(2);
159 | }
160 | changePanels();
161 | }
162 | });
163 |
164 | buttonGroup.add(rdbtnShowOnlyPrint);
165 | }
166 | return rdbtnShowOnlyPrint;
167 | }
168 | }
169 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DyIO/ChannelManager.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DyIO;
2 |
3 | import java.awt.event.MouseEvent;
4 | import java.util.ArrayList;
5 |
6 | import javax.swing.JOptionPane;
7 |
8 | import com.neuronrobotics.sdk.common.Log;
9 | import com.neuronrobotics.sdk.dyio.DyIOChannel;
10 | import com.neuronrobotics.sdk.dyio.DyIOChannelMode;
11 | import com.neuronrobotics.sdk.dyio.IDyIOChannelModeChangeListener;
12 |
13 | public class ChannelManager implements IDyIOChannelModeChangeListener {
14 | public static final int ALIGNED_LEFT = 0;
15 | public static final int ALIGNED_RIGHT = 1;
16 |
17 | private DyIOChannel channel;
18 | private ControlPanel controlPanel;
19 | private ChannelPanel channelPanel;
20 | //private ChannelRecorder channelRecorder;
21 | private ArrayList listeners = new ArrayList();
22 |
23 | public ChannelManager(DyIOChannel c){
24 | channel = c;
25 |
26 | //channelRecorder = new ChannelRecorder(this);
27 | controlPanel = new ControlPanel(this);
28 | channelPanel = new ChannelPanel(this);
29 |
30 |
31 | channel.addChannelEventListener(controlPanel);
32 | channel.addChannelEventListener(channelPanel);
33 |
34 | onModeChange(channel.getMode());
35 |
36 | channel.addChannelModeChangeListener(this);
37 | }
38 |
39 | public void refresh() {
40 | //System.out.println(this.getClass()+" Refresh");
41 | //TODO this does not change the actual channel control planel type
42 | setMode(channel.getMode());
43 | }
44 |
45 | public void setActive(boolean active) {
46 | channelPanel.setSelected(active);
47 | }
48 |
49 | public ControlPanel getControlPanel() {
50 | return controlPanel;
51 | }
52 |
53 | public ChannelPanel getChannelPanel() {
54 | return channelPanel;
55 | }
56 |
57 | // public ChannelRecorder getChannelRecorder() {
58 | // return channelRecorder;
59 | // }
60 |
61 | public void displayError(String msg) {
62 | JOptionPane.showMessageDialog(null, msg, "Channel Error", JOptionPane.ERROR_MESSAGE);
63 | }
64 |
65 | public void fireOnClick(MouseEvent e) {
66 | int type = IChannelPanelListener.SINGLE_CLICK;
67 |
68 | if(e.isControlDown()) {
69 | type = IChannelPanelListener.CTRL_CLICK;
70 | }
71 |
72 | if(e.isShiftDown()) {
73 | type = IChannelPanelListener.SHIFT_CLICK;
74 | }
75 |
76 | for(IChannelPanelListener l : listeners) {
77 | l.onClick(this, type);
78 | }
79 | }
80 |
81 | public void fireOnModeChange() {
82 | for(IChannelPanelListener l : listeners) {
83 | l.onModeChange();
84 | }
85 | }
86 |
87 | public void fireOnRecordingEvent() {
88 | for(IChannelPanelListener l : listeners) {
89 | l.onRecordingEvent(this, controlPanel.isRecordingEnabled());
90 | }
91 | }
92 |
93 | public void addListener(IChannelPanelListener l) {
94 | if(listeners.contains(l)) {
95 | return;
96 | }
97 |
98 | listeners.add(l);
99 | }
100 |
101 | public DyIOChannel getChannel() {
102 | return channel;
103 | }
104 |
105 | public void setMode(DyIOChannelMode mode) {
106 | try{
107 | channel.setMode(mode);
108 | }catch(Exception ex){
109 | ex.printStackTrace();
110 | }
111 | }
112 |
113 | @Override
114 | public void onModeChange(DyIOChannelMode newMode) {
115 | Log.debug("Updating mode on channel: "+channel.getChannelNumber()+" mode: "+newMode);
116 | channelPanel.setMode(newMode);
117 | controlPanel.setUpModeUI(newMode);
118 | }
119 |
120 |
121 | public void onDyIOPowerEvent() {
122 | controlPanel.setupModesComboBox();
123 | }
124 |
125 | public void removeListener(IChannelPanelListener l) {
126 | if(listeners.contains(l)) {
127 | listeners.remove(l);
128 | }
129 | }
130 |
131 | }
132 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DyIO/ChannelPanel.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DyIO;
2 |
3 | import java.awt.Dimension;
4 | import java.awt.Graphics;
5 | import java.awt.event.ActionEvent;
6 | import java.awt.event.ActionListener;
7 | import java.awt.event.MouseEvent;
8 | import java.awt.event.MouseListener;
9 |
10 | import javax.swing.ImageIcon;
11 | import javax.swing.JLabel;
12 | import javax.swing.JPanel;
13 | import javax.swing.Timer;
14 |
15 | import net.miginfocom.swing.MigLayout;
16 |
17 | import com.neuronrobotics.sdk.dyio.DyIOChannelEvent;
18 | import com.neuronrobotics.sdk.dyio.DyIOChannelMode;
19 | import com.neuronrobotics.sdk.dyio.IChannelEventListener;
20 |
21 | public class ChannelPanel extends JPanel implements IChannelEventListener, MouseListener, ActionListener {
22 |
23 |
24 | private static final long serialVersionUID = 1L;
25 |
26 | private boolean selected;
27 | private ImageIcon image;
28 | private DyIOChannelMode mode = DyIOChannelMode.OFF;
29 | private ChannelPanelStatus status = ChannelPanelStatus.DEFAULT;
30 | private Timer timer = new Timer(150, this);
31 | private ChannelManager manager;
32 | private boolean leftAligned = true;
33 |
34 | public ChannelPanel(ChannelManager m) {
35 | setManager(m);
36 | initPanel();
37 | }
38 |
39 | private void initPanel() {
40 | setLayout(new MigLayout());
41 |
42 | setStatus(ChannelPanelStatus.DEFAULT);
43 |
44 | addMouseListener(this);
45 |
46 | Dimension size = new Dimension(image.getIconWidth(), image.getIconHeight());
47 | setSize(size);
48 | setMaximumSize(size);
49 | setMinimumSize(size);
50 | setPreferredSize(size);
51 |
52 | timer.stop();
53 | }
54 |
55 | public boolean isSelected() {
56 | return selected;
57 | }
58 |
59 | public void setSelected(boolean isSelected) {
60 | selected = isSelected;
61 | setStatus(selected?ChannelPanelStatus.SELECTED:ChannelPanelStatus.DEFAULT);
62 | }
63 |
64 | public ChannelPanelStatus getStatus() {
65 | return status;
66 | }
67 |
68 | public void setStatus(ChannelPanelStatus mode) {
69 | image = new ImageIcon(DyIOPanel.class.getResource(mode.getPath()));
70 |
71 | revalidate();
72 | repaint();
73 | }
74 |
75 | public DyIOChannelMode getMode() {
76 | return mode;
77 | }
78 |
79 | public void setMode(DyIOChannelMode mode) {
80 | removeAll();
81 | ImageIcon image;
82 | try {
83 | image = new ImageIcon(DyIOPanel.class.getResource("images/icon-" + mode.toSlug() + ".png"));
84 | }catch (NullPointerException e) {
85 | image = new ImageIcon(DyIOPanel.class.getResource("images/icon-off.png"));
86 | }
87 | add(new JLabel(image), leftAligned ? "pos 52 2" : "pos 3 2");
88 | revalidate();
89 | repaint();
90 | }
91 |
92 | public void setAlignedLeft(boolean leftAligned) {
93 | this.leftAligned = leftAligned;
94 | setMode(manager.getChannel().getCurrentMode());
95 | }
96 |
97 |
98 | public void paintComponent (Graphics g) {
99 | super.paintComponent(g);
100 |
101 | try {
102 | g.drawImage(image.getImage(), 0,0,this.getWidth(),this.getHeight(),this);
103 | } catch (Exception e) {
104 |
105 | }
106 | }
107 |
108 |
109 | public void onChannelEvent(DyIOChannelEvent e) {
110 | setStatus(ChannelPanelStatus.UPDATE);
111 | timer.restart();
112 | }
113 |
114 |
115 | public void mouseClicked(MouseEvent e) {
116 | selected=true;
117 | setStatus(ChannelPanelStatus.HIGHLIGHT);
118 | getManager().fireOnClick(e);
119 | }
120 |
121 |
122 | public void mouseEntered(MouseEvent e) {
123 | if(!selected) {
124 | setStatus(ChannelPanelStatus.HIGHLIGHT);
125 | }
126 | }
127 |
128 |
129 | public void mouseExited(MouseEvent e) {
130 | if(!selected) {
131 | setStatus(ChannelPanelStatus.DEFAULT);
132 | }
133 | }
134 |
135 |
136 | public void mousePressed(MouseEvent e) {
137 | // TODO Auto-generated method stub
138 |
139 | }
140 |
141 |
142 | public void mouseReleased(MouseEvent e) {
143 | // TODO Auto-generated method stub
144 |
145 | }
146 |
147 |
148 | public void actionPerformed(ActionEvent e) {
149 | if(getStatus() != ChannelPanelStatus.UPDATE) {
150 | if(selected)
151 | setStatus(ChannelPanelStatus.SELECTED);
152 | else
153 | setStatus(ChannelPanelStatus.DEFAULT);
154 | }
155 | timer.stop();
156 | }
157 |
158 | public void setManager(ChannelManager manager) {
159 | setMode(manager.getChannel().getCurrentMode());
160 | this.manager = manager;
161 | }
162 |
163 | public ChannelManager getManager() {
164 | return manager;
165 | }
166 | }
167 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DyIO/ChannelPanelStatus.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DyIO;
2 |
3 |
4 | public enum ChannelPanelStatus {
5 | DEFAULT("images/channel-default.png"),
6 | SELECTED("images/channel-selected.png"),
7 | HIGHLIGHT("images/channel-highlight.png"),
8 | UPDATE("images/channel-update.png");
9 | private String imagePath;
10 |
11 | private ChannelPanelStatus(String path) {
12 | imagePath = path;
13 | }
14 |
15 | public String getPath() {
16 | return imagePath;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DyIO/DyIOControlsPanel.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DyIO;
2 |
3 | import java.awt.Dimension;
4 | import java.awt.Rectangle;
5 | import java.util.ArrayList;
6 |
7 | import javax.swing.JPanel;
8 | import javax.swing.JScrollPane;
9 | import javax.swing.Scrollable;
10 |
11 | import net.miginfocom.swing.MigLayout;
12 |
13 | //import com.neuronrobotics.nrconsole.NRConsoleWindow;
14 |
15 | public class DyIOControlsPanel extends JPanel {
16 | private static final long serialVersionUID = 1L;
17 | private ArrayList controls = new ArrayList();
18 | private ControlPanelScroller components = new ControlPanelScroller();
19 | private JScrollPane scroller;
20 |
21 | public DyIOControlsPanel() {
22 | //setBorder(BorderFactory.createRaisedBevelBorder());
23 | components.setLayout(new MigLayout());
24 |
25 | scroller = new JScrollPane(components);
26 | add(scroller);
27 | fix();
28 | }
29 |
30 | public void setChannel(ControlPanel channel) {
31 | components.removeAll();
32 | controls.add(channel);
33 | components.add(channel, "wrap");
34 |
35 | fix();
36 | }
37 |
38 | public void addChannel(ControlPanel channel) {
39 | controls.add(channel);
40 | components.add(channel, "wrap");
41 | fix();
42 | }
43 |
44 |
45 | public void removeChannel(ControlPanel channel) {
46 | controls.remove(channel);
47 | components.remove(channel);
48 | fix();
49 | }
50 |
51 | private void fix(){
52 | repaint();
53 | }
54 |
55 | public void repaint(){
56 | super.repaint();
57 | if(components != null){
58 | components.revalidate();
59 | components.repaint();
60 | }
61 |
62 | }
63 |
64 | private class ControlPanelScroller extends JPanel implements Scrollable{
65 | private int maxUnitIncrement = 50;
66 |
67 | /**
68 | *
69 | */
70 | private static final long serialVersionUID = 1L;
71 |
72 | public ControlPanelScroller() {
73 | setOpaque(false);
74 | }
75 |
76 |
77 |
78 | public Dimension getPreferredScrollableViewportSize() {
79 | // TODO Auto-generated method stub
80 | //return new Dimension(ControlPanel.panelWidth+52,NRConsoleWindow.panelHight-110);
81 | //Dimension d=NRConsoleWindow.getNRWindowSize();
82 | return new Dimension(ControlPanel.panelWidth+52,768) ;
83 | }
84 |
85 |
86 | public int getScrollableBlockIncrement(Rectangle visibleRect, int arg1,int arg2) {
87 | // TODO Auto-generated method stub
88 | return maxUnitIncrement;
89 | }
90 |
91 |
92 | public boolean getScrollableTracksViewportHeight() {
93 | // TODO Auto-generated method stub
94 | return false;
95 | }
96 |
97 |
98 | public boolean getScrollableTracksViewportWidth() {
99 | // TODO Auto-generated method stub
100 | return false;
101 | }
102 |
103 |
104 | public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
105 |
106 | return maxUnitIncrement;
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DyIO/GettingStartedPanel.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DyIO;
2 |
3 | import java.awt.Desktop;
4 | import java.awt.event.ActionEvent;
5 | import java.awt.event.ActionListener;
6 | import java.net.URI;
7 | import java.net.URISyntaxException;
8 |
9 | import javax.swing.JButton;
10 | import javax.swing.JLabel;
11 | import javax.swing.JPanel;
12 |
13 | import net.miginfocom.swing.MigLayout;
14 |
15 | import com.neuronrobotics.sdk.config.SDKBuildInfo;
16 |
17 | public class GettingStartedPanel extends JPanel {
18 |
19 | /**
20 | *
21 | */
22 | private static final long serialVersionUID = -7822822213729180361L;
23 | private JButton onLineDocs = new JButton("Open");
24 | private JButton javaDocs = new JButton("Open");
25 |
26 | private String wiki = "http://wiki.neuronrobotics.com/Getting_started_main_page";
27 | private String jDoc1 = "http://downloads.neuronrobotics.com/nrdk/";
28 | private String jDoc2 = "/java/docs/api/index.html";
29 | private String jDoc;
30 | private static Desktop desktop = null;
31 | public GettingStartedPanel (){
32 | setName("Getting Started");
33 | setLayout(new MigLayout());
34 |
35 | jDoc = jDoc1+SDKBuildInfo.getVersion()+jDoc2;
36 | if (Desktop.isDesktopSupported()) {
37 | setDesktop(Desktop.getDesktop());
38 | }else{
39 | System.err.println("Desktop not supported");
40 | }
41 |
42 | add(new JLabel("Getting Started Documents:"),"wrap");
43 | add(new DocWidget("Online Getting Started Overview", wiki),"wrap");
44 | add(new DocWidget("Online DyIO Details", "http://wiki.neuronrobotics.com/DyIO"),"wrap");
45 | add(new DocWidget("Online 'JavaDoc' Programming guide", jDoc),"wrap");
46 |
47 | }
48 |
49 | //Method to launch a page in a browser
50 | //used to allow object "helpButton" to function
51 | public static void openPage(URI uri) throws Exception {
52 | getDesktop().browse(uri);
53 | }
54 |
55 | public static Desktop getDesktop() throws Exception {
56 | if(desktop == null) {
57 | if (Desktop.isDesktopSupported()) {
58 | setDesktop(Desktop.getDesktop());
59 | }else{
60 | throw new Exception("Desktop not supported for documentation");
61 | }
62 | }
63 | return desktop;
64 | }
65 | public static void setDesktop(Desktop d) {
66 | desktop = d;
67 | }
68 | private class DocWidget extends JPanel{
69 | /**
70 | *
71 | */
72 | private static final long serialVersionUID = -174323483559948677L;
73 | URI uri;
74 | private JButton button = new JButton("Open");
75 | public DocWidget(String description, String location){
76 | setLayout(new MigLayout());
77 | try {
78 | uri = new URI(location);
79 | } catch (URISyntaxException e) {
80 | // TODO Auto-generated catch block
81 | e.printStackTrace();
82 | }
83 |
84 | add(button );
85 | add(new JLabel(description),"wrap");
86 |
87 | button.addActionListener(new ActionListener() {
88 |
89 | @Override
90 | public void actionPerformed(ActionEvent arg0) {
91 | try {
92 | getDesktop().browse(uri);
93 | } catch (Exception e) {
94 | // TODO Auto-generated catch block
95 | e.printStackTrace();
96 | }
97 |
98 | }
99 | });
100 | }
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DyIO/IChannelPanelListener.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DyIO;
2 |
3 |
4 | public interface IChannelPanelListener {
5 | public static final int SINGLE_CLICK = 0;
6 | public static final int SHIFT_CLICK = 1;
7 | public static final int CTRL_CLICK = 2;
8 | public void onClick(ChannelManager source, int type);
9 | public void onModeChange();
10 | public void onRecordingEvent(ChannelManager source, boolean enabled);
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DyIO/Secheduler/AnamationSequencer.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DyIO.Secheduler;
2 |
3 | import javafx.embed.swing.SwingNode;
4 | import javafx.scene.control.ScrollPane;
5 |
6 | import com.neuronrobotics.bowlerstudio.tabs.AbstractBowlerStudioTab;
7 | import com.neuronrobotics.sdk.common.BowlerAbstractDevice;
8 |
9 | public class AnamationSequencer extends AbstractBowlerStudioTab {
10 | public static final String[] myNames ={"neuronrobotics.dyio.*"};
11 | private SchedulerGui gui=new SchedulerGui();;
12 |
13 |
14 | @Override
15 | public void onTabClosing() {
16 | // TODO Auto-generated method stub
17 |
18 | }
19 |
20 | @Override
21 | public String[] getMyNameSpaces() {
22 | return new String[] {"neuronrobotics.dyio.*"};
23 | }
24 |
25 | @Override
26 | public void initializeUI(BowlerAbstractDevice pm) {
27 | // TODO Auto-generated method stub
28 | gui.setConnection(pm);
29 | SwingNode sn = new SwingNode();
30 | sn.setContent(gui);
31 | ScrollPane s1 = new ScrollPane();
32 |
33 | s1.setContent(sn);
34 | setContent(s1);
35 | setText("Anamation Sequencer");
36 | onTabReOpening();
37 | }
38 |
39 | @Override
40 | public void onTabReOpening() {
41 | // TODO Auto-generated method stub
42 |
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DyIO/channelwidgets/AnalogChannelUI.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DyIO.channelwidgets;
2 |
3 | import java.awt.Color;
4 | import java.awt.event.ActionEvent;
5 | import java.awt.event.ActionListener;
6 | import java.text.DecimalFormat;
7 |
8 | import javax.swing.JButton;
9 | import javax.swing.JCheckBox;
10 | import javax.swing.JLabel;
11 | import javax.swing.JPanel;
12 | import javax.swing.JSlider;
13 |
14 | import net.miginfocom.swing.MigLayout;
15 |
16 | import com.neuronrobotics.nrconsole.plugin.DyIO.ChannelManager;
17 | import com.neuronrobotics.nrconsole.plugin.DyIO.GettingStartedPanel;
18 | import com.neuronrobotics.sdk.common.BowlerDocumentationFactory;
19 | import com.neuronrobotics.sdk.dyio.peripherals.AnalogInputChannel;
20 | import com.neuronrobotics.sdk.dyio.peripherals.DyIOAbstractPeripheral;
21 | import com.neuronrobotics.sdk.dyio.peripherals.IAnalogInputListener;
22 |
23 | public class AnalogChannelUI extends ControlWidget implements IAnalogInputListener, ActionListener {
24 | private static final long serialVersionUID = 1L;
25 |
26 | private JSlider sliderUI = new JSlider();
27 | private JPanel vals = new JPanel(new MigLayout());
28 | private JLabel valueUI = new JLabel();
29 | private JLabel valueUIADC = new JLabel();
30 | private JButton refresh = new JButton("Update");
31 | private JCheckBox async = new JCheckBox("Async");
32 |
33 | private AnalogInputChannel aic;
34 |
35 | public AnalogChannelUI(ChannelManager channel) {
36 | super(channel);
37 | setRecordable(true);
38 |
39 | aic = new AnalogInputChannel(getChannel(), true);
40 |
41 | sliderUI.setMaximum(0);
42 | sliderUI.setMaximum(1024);
43 | sliderUI.setMajorTickSpacing(100);
44 | sliderUI.setPaintTicks(true);
45 | sliderUI.setEnabled(false);
46 |
47 | //Button to launch info page for Digital Input panel
48 | JButton helpButton = new JButton("Help");
49 |
50 | //Label for Digital Input Panel
51 | JLabel helpLabel = new JLabel("Analog Input Panel");
52 | add(helpLabel, "split 2, span 2, align left");
53 | add(helpButton, "gapleft 200, wrap, align right");
54 | helpButton.addActionListener(new ActionListener() {
55 | @Override
56 | public void actionPerformed(ActionEvent arg0) {
57 | try {
58 | GettingStartedPanel.openPage(BowlerDocumentationFactory.getDocumentationURL(aic));
59 | } catch (Exception exceptE) {}
60 | }
61 | });
62 |
63 | //Help button formating
64 | helpButton.setFont((helpButton.getFont()).deriveFont(8f));
65 | helpButton.setBackground(Color.green);
66 |
67 | //Digital Input Panel label formating
68 | helpLabel.setHorizontalTextPosition(JLabel.LEFT);
69 | helpLabel.setForeground(Color.GRAY);
70 |
71 | JPanel pan = new JPanel(new MigLayout());
72 |
73 | pan.add(sliderUI);
74 | vals.add(valueUI,"wrap");
75 | vals.add(valueUIADC,"wrap");
76 | pan.add(vals);
77 | pan.add(refresh);
78 | add(pan);
79 |
80 | aic.addAnalogInputListener(this);
81 | refresh.addActionListener(this);
82 | async.addActionListener(this);
83 |
84 | pollValue();
85 |
86 | aic.addAnalogInputListener(this);
87 | }
88 |
89 | private String formatValue(double value) {
90 | return new DecimalFormat("00.00").format(value)+" V";
91 | }
92 |
93 | private void setValue(double value) {
94 | sliderUI.setValue((int) (value));
95 | valueUI.setText(formatValue( value/1024*4.9));
96 | valueUIADC.setText(new Integer((int) value).toString()+" ADC");
97 | recordValue(value );
98 | }
99 |
100 | public void onAnalogValueChange(AnalogInputChannel channel,double value) {
101 | setValue(value);
102 | async.setSelected(true);
103 | }
104 |
105 | public void actionPerformed(ActionEvent e) {
106 | setValue(aic.getScaledValue());
107 | if(e.getSource() == refresh) {
108 | setValue(aic.getValue());
109 | }else if(e.getSource() == async) {
110 | if(!async.isSelected()) {
111 | aic.setAsync(false);
112 | aic.removeAnalogInputListener(this);
113 | } else {
114 | aic.setAsync(true);
115 | aic.addAnalogInputListener(this);
116 | }
117 | }
118 | }
119 |
120 | public void pollValue() {
121 | if(!async.isSelected())
122 | setValue(aic.getValue());
123 | }
124 |
125 | public DyIOAbstractPeripheral getPerpheral() {
126 | return aic;
127 | }
128 |
129 | }
130 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DyIO/channelwidgets/ControlWidget.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DyIO.channelwidgets;
2 |
3 | import java.awt.Dimension;
4 |
5 | import javax.swing.JPanel;
6 | import javax.swing.SwingUtilities;
7 |
8 | import net.miginfocom.swing.MigLayout;
9 |
10 | import com.neuronrobotics.nrconsole.plugin.DyIO.ChannelManager;
11 | import com.neuronrobotics.sdk.dyio.DyIOChannel;
12 | import com.neuronrobotics.sdk.dyio.peripherals.DyIOAbstractPeripheral;
13 |
14 | public abstract class ControlWidget extends JPanel {
15 |
16 | private static final long serialVersionUID = 1L;
17 |
18 | private Dimension size = new Dimension(300, 50);
19 | private ChannelManager manager;
20 | private boolean isRecordable = false;
21 |
22 | public ControlWidget(ChannelManager c) {
23 | manager = c;
24 |
25 | setLayout(new MigLayout());
26 | setPreferredSize(size);
27 | }
28 |
29 | public DyIOChannel getChannel() {
30 | return manager.getChannel();
31 | }
32 |
33 | public void pollValue() { }
34 |
35 | public void recordValue(int value) {
36 | // SwingUtilities.invokeLater(() -> {
37 | // manager.getChannelRecorder().recordValue(value);
38 | // });
39 |
40 | }
41 |
42 | public void recordValue(double value) {
43 | // SwingUtilities.invokeLater(() -> {
44 | // manager.getChannelRecorder().recordValue(value);
45 | // });
46 | }
47 |
48 | public void setRecordable(boolean enable) {
49 | isRecordable = enable;
50 | }
51 |
52 | public boolean isRecordable() {
53 | return isRecordable;
54 | }
55 |
56 | abstract public DyIOAbstractPeripheral getPerpheral();
57 |
58 | }
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DyIO/channelwidgets/CounterInputWidget.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DyIO.channelwidgets;
2 |
3 | import java.awt.Color;
4 | import java.awt.event.ActionEvent;
5 | import java.awt.event.ActionListener;
6 |
7 | import javax.swing.JButton;
8 | import javax.swing.JCheckBox;
9 | import javax.swing.JLabel;
10 | import javax.swing.JPanel;
11 | import javax.swing.JTextField;
12 |
13 | import net.miginfocom.swing.MigLayout;
14 |
15 | import com.neuronrobotics.nrconsole.plugin.DyIO.ChannelManager;
16 | import com.neuronrobotics.nrconsole.plugin.DyIO.GettingStartedPanel;
17 | import com.neuronrobotics.sdk.common.BowlerDocumentationFactory;
18 | import com.neuronrobotics.sdk.dyio.DyIOChannelMode;
19 | import com.neuronrobotics.sdk.dyio.peripherals.CounterInputChannel;
20 | import com.neuronrobotics.sdk.dyio.peripherals.DyIOAbstractPeripheral;
21 | import com.neuronrobotics.sdk.dyio.peripherals.ICounterInputListener;
22 |
23 | public class CounterInputWidget extends ControlWidget implements ICounterInputListener,ActionListener{
24 |
25 | private static final long serialVersionUID = 1L;
26 | CounterInputChannel ci;
27 | private JTextField field = new JTextField();
28 | private JButton refresh = new JButton("Refresh");
29 | private JCheckBox async = new JCheckBox("Async");
30 |
31 | public CounterInputWidget(ChannelManager c, DyIOChannelMode mode) {
32 | super(c);
33 | setRecordable(true);
34 | ci = new CounterInputChannel(getChannel(),true);
35 | field.setColumns(10);
36 | field.setEnabled(false);
37 |
38 | //Button to launch info page for Counter Input panel
39 | JButton helpButton = new JButton("Help");
40 |
41 | //Label for Counter Input Panel
42 | JLabel helpLabel = new JLabel("Encoder/Counter input Panel");
43 | JPanel pan1 = new JPanel(new MigLayout());
44 | pan1.add(helpLabel, "split 2, span 2, align left");
45 | pan1.add(helpButton, "gapleft 150, wrap, align right");
46 | add(pan1,"wrap");
47 | helpButton.addActionListener(new ActionListener() {
48 | @Override
49 | public void actionPerformed(ActionEvent arg0) {
50 | try {
51 | GettingStartedPanel.openPage(BowlerDocumentationFactory.getDocumentationURL(ci));
52 | } catch (Exception exceptE) {}
53 | }
54 | });
55 |
56 | //Help button formating
57 | helpButton.setFont((helpButton.getFont()).deriveFont(8f));
58 | helpButton.setBackground(Color.green);
59 |
60 | //Digital Input Panel label formating
61 | helpLabel.setHorizontalTextPosition(JLabel.LEFT);
62 | helpLabel.setForeground(Color.GRAY);
63 |
64 | add(field);
65 | add(refresh);
66 |
67 | ci.addCounterInputListener(this);
68 | refresh.addActionListener(this);
69 | async.addActionListener(this);
70 |
71 | setValue(0);
72 | ci.addCounterInputListener(this);
73 | }
74 | private void setValue(int value) {
75 | recordValue(value);
76 | field.setText(new Integer(value).toString());
77 | }
78 |
79 | public void onCounterValueChange(CounterInputChannel source, int value) {
80 | setValue(value);
81 | async.setSelected(true);
82 | }
83 |
84 | public void actionPerformed(ActionEvent e) {
85 | if(e.getSource() == field) {
86 |
87 | }else if(e.getSource() == refresh) {
88 | setValue(ci.getValue());
89 | }else if(e.getSource() == async) {
90 | if(!async.isSelected()) {
91 | ci.setAsync(false);
92 | ci.removeCounterInputListener(this);
93 | } else {
94 | ci.addCounterInputListener(this);
95 | ci.setAsync(true);
96 | }
97 | }
98 |
99 | }
100 |
101 | public DyIOAbstractPeripheral getPerpheral() {
102 | // TODO Auto-generated method stub
103 | return ci;
104 | }
105 |
106 | }
107 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DyIO/channelwidgets/CounterOutputWidget.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DyIO.channelwidgets;
2 |
3 | import java.awt.Color;
4 | import java.awt.event.ActionEvent;
5 | import java.awt.event.ActionListener;
6 |
7 | import javax.swing.JButton;
8 | import javax.swing.JLabel;
9 | import javax.swing.JPanel;
10 | import javax.swing.JTextField;
11 |
12 | import net.miginfocom.swing.MigLayout;
13 |
14 | import com.neuronrobotics.nrconsole.plugin.DyIO.ChannelManager;
15 | import com.neuronrobotics.nrconsole.plugin.DyIO.GettingStartedPanel;
16 | import com.neuronrobotics.sdk.common.BowlerDocumentationFactory;
17 | import com.neuronrobotics.sdk.dyio.DyIOChannelMode;
18 | import com.neuronrobotics.sdk.dyio.peripherals.CounterOutputChannel;
19 | import com.neuronrobotics.sdk.dyio.peripherals.DyIOAbstractPeripheral;
20 | import com.neuronrobotics.sdk.dyio.peripherals.ICounterOutputListener;
21 |
22 | public class CounterOutputWidget extends ControlWidget implements ActionListener,ICounterOutputListener{
23 |
24 | private static final long serialVersionUID = 1L;
25 | CounterOutputChannel outChannel;
26 | private JTextField field = new JTextField();
27 | private JButton set = new JButton("Set");
28 | private JButton refresh = new JButton("Refresh");
29 |
30 | public CounterOutputWidget(ChannelManager c, DyIOChannelMode mode){
31 | super(c);
32 | setRecordable(true);
33 | outChannel = new CounterOutputChannel(getChannel());
34 | field.setColumns(10);
35 |
36 | //Button to launch info page for Counter Output panel
37 | JButton helpButton = new JButton("Help");
38 |
39 | //Label for Counter Output Panel
40 | JLabel helpLabel = new JLabel("Stepper/Counter Panel");
41 | JPanel pan1 = new JPanel(new MigLayout());
42 | pan1.add(helpLabel, "split 2, span 2, align left");
43 | pan1.add(helpButton, "gapleft 150, wrap, align right");
44 | add(pan1,"wrap");
45 | helpButton.addActionListener(new ActionListener() {
46 | @Override
47 | public void actionPerformed(ActionEvent arg0) {
48 | try {
49 | GettingStartedPanel.openPage(BowlerDocumentationFactory.getDocumentationURL(outChannel));
50 | } catch (Exception exceptE) {}
51 | }
52 | });
53 |
54 | //Help button formating
55 | helpButton.setFont((helpButton.getFont()).deriveFont(8f));
56 | helpButton.setBackground(Color.green);
57 |
58 | //Counter Output Panel label formating
59 | helpLabel.setHorizontalTextPosition(JLabel.LEFT);
60 | helpLabel.setForeground(Color.GRAY);
61 | JPanel pan = new JPanel(new MigLayout());
62 |
63 | pan.add(field);
64 | pan.add(set);
65 | add(pan);
66 |
67 | field.setEnabled(true);
68 | set.addActionListener(this);
69 | setValue(outChannel.getValue());
70 | outChannel.addCounterOutputListener(this);
71 | }
72 | private void setValue(int value) {
73 |
74 | recordValue(value);
75 | field.setText(new Integer(value).toString());
76 | }
77 |
78 | public void actionPerformed(ActionEvent e) {
79 | if(e.getSource() == field) {
80 |
81 | }else if(e.getSource()==set){
82 | try{
83 | int out = new Integer(field.getText()).intValue();
84 | if(outChannel.getChannel().getDevice().getCachedMode()){
85 | outChannel.getChannel().getDevice().setCachedMode(false);
86 | }
87 | outChannel.SetPosition(out);
88 | }catch(Exception e1){
89 | field.setText("0");
90 | }
91 | }else if(e.getSource() == refresh) {
92 | setValue(outChannel.getValue());
93 | }
94 |
95 | }
96 |
97 | public void pollValue() {
98 |
99 | }
100 |
101 | public void onCounterValueChange(CounterOutputChannel source, int value) {
102 | setValue(value);
103 | }
104 |
105 | public DyIOAbstractPeripheral getPerpheral() {
106 | // TODO Auto-generated method stub
107 | return outChannel;
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DyIO/channelwidgets/DigitalInputWidget.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DyIO.channelwidgets;
2 |
3 | import java.awt.Color;
4 | import java.awt.event.ActionEvent;
5 | import java.awt.event.ActionListener;
6 |
7 | import javax.swing.JButton;
8 | import javax.swing.JCheckBox;
9 | import javax.swing.JLabel;
10 |
11 | import com.neuronrobotics.nrconsole.plugin.DyIO.ChannelManager;
12 | import com.neuronrobotics.nrconsole.plugin.DyIO.GettingStartedPanel;
13 | import com.neuronrobotics.sdk.common.BowlerDocumentationFactory;
14 | import com.neuronrobotics.sdk.common.Log;
15 | import com.neuronrobotics.sdk.dyio.peripherals.DigitalInputChannel;
16 | import com.neuronrobotics.sdk.dyio.peripherals.DyIOAbstractPeripheral;
17 | import com.neuronrobotics.sdk.dyio.peripherals.IDigitalInputListener;
18 |
19 | public class DigitalInputWidget extends ControlWidget implements IDigitalInputListener, ActionListener {
20 |
21 | private static final long serialVersionUID = 1L;
22 |
23 | private JButton button = new JButton();
24 | private JButton refresh = new JButton("Refresh");
25 | private JCheckBox async = new JCheckBox("Async");
26 |
27 | //Button to launch info page for Digital Input panel
28 | private JButton helpButton = new JButton("Help");
29 |
30 | //Label for Digital Input Panel
31 | private JLabel helpLabel = new JLabel("Digital Input Panel");
32 |
33 | private DigitalInputChannel dic;
34 |
35 | public DigitalInputWidget(ChannelManager c) {
36 | super(c);
37 | Log.debug("BEGIN Setting up: "+this.getClass());
38 | setRecordable(true);
39 |
40 | dic = new DigitalInputChannel(getChannel(),true);
41 |
42 |
43 |
44 | add(helpLabel, "split 2, span 2, align left");
45 | add(helpButton, "gapleft 200, wrap, align right");
46 |
47 | button.setEnabled(false);
48 |
49 | add(button);
50 | add(refresh);
51 |
52 |
53 |
54 | setValue(true);
55 | dic.addDigitalInputListener(this);
56 | refresh.addActionListener(this);
57 | async.addActionListener(this);
58 | helpButton.addActionListener(new ActionListener() {
59 |
60 | @Override
61 | public void actionPerformed(ActionEvent arg0) {
62 | try {
63 | GettingStartedPanel.openPage(BowlerDocumentationFactory.getDocumentationURL(dic));
64 | } catch (Exception exceptE) {
65 | //TODO: launch error message window
66 |
67 | }
68 | }
69 | });
70 |
71 | //Help button formating
72 | helpButton.setFont((helpButton.getFont()).deriveFont(8f));
73 | helpButton.setBackground(Color.green);
74 |
75 | //Digital Input Panel label formating
76 | helpLabel.setHorizontalTextPosition(JLabel.LEFT);
77 | helpLabel.setForeground(Color.GRAY);
78 |
79 | Log.debug("END Setting up: "+this.getClass());
80 |
81 | }
82 |
83 | private void setValue(boolean value) {
84 | if(value) {
85 | button.setText("High");
86 | recordValue(255);
87 | } else {
88 | button.setText("Low");
89 | recordValue(0);
90 | }
91 | }
92 |
93 |
94 | public void actionPerformed(ActionEvent e) {
95 | if(e.getSource() == refresh) {
96 | pollValue();
97 | }else if(e.getSource() == async) {
98 | if(!async.isSelected()) {
99 | dic.setAsync(false);
100 | dic.removeDigitalInputListener(this);
101 | } else {
102 | dic.setAsync(true);
103 | dic.addDigitalInputListener(this);
104 | }
105 | }
106 | }
107 |
108 |
109 |
110 | public void onDigitalValueChange(DigitalInputChannel source, boolean isHigh) {
111 | setValue(isHigh);
112 | }
113 |
114 |
115 | public void pollValue() {
116 |
117 | if(!async.isSelected())
118 | setValue(dic.isHigh());
119 |
120 | }
121 |
122 |
123 | public DyIOAbstractPeripheral getPerpheral() {
124 | // TODO Auto-generated method stub
125 | return dic;
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DyIO/channelwidgets/DigitalOutputWidget.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DyIO.channelwidgets;
2 |
3 | import java.awt.Color;
4 | import java.awt.event.ActionEvent;
5 | import java.awt.event.ActionListener;
6 |
7 | import javax.swing.JButton;
8 | import javax.swing.JLabel;
9 |
10 | import com.neuronrobotics.nrconsole.plugin.DyIO.ChannelManager;
11 | import com.neuronrobotics.nrconsole.plugin.DyIO.GettingStartedPanel;
12 | import com.neuronrobotics.sdk.common.BowlerDocumentationFactory;
13 | import com.neuronrobotics.sdk.dyio.peripherals.DigitalOutputChannel;
14 | import com.neuronrobotics.sdk.dyio.peripherals.DyIOAbstractPeripheral;
15 |
16 | public class DigitalOutputWidget extends ControlWidget implements ActionListener {
17 |
18 | private static final long serialVersionUID = 1L;
19 |
20 | private boolean state;
21 |
22 | private JButton button = new JButton();
23 |
24 | private DigitalOutputChannel doc;
25 |
26 | public DigitalOutputWidget(ChannelManager channel) {
27 | super(channel);
28 | setRecordable(true);
29 |
30 | doc = new DigitalOutputChannel(getChannel());
31 |
32 | //Button to launch info page for Digital Output panel
33 | JButton helpButton = new JButton("Help");
34 |
35 | //Label for Digital Output Panel
36 | JLabel helpLabel = new JLabel("Digital Output Panel");
37 | add(helpLabel, "split 2, span 2, align left");
38 | add(helpButton, "gapleft 200, wrap, align right");
39 | helpButton.addActionListener(new ActionListener() {
40 | @Override
41 | public void actionPerformed(ActionEvent arg0) {
42 | try {
43 | GettingStartedPanel.openPage(BowlerDocumentationFactory.getDocumentationURL(doc));
44 | } catch (Exception exceptE) {}
45 | }
46 | });
47 |
48 | //Help button formating
49 | helpButton.setFont((helpButton.getFont()).deriveFont(8f));
50 | helpButton.setBackground(Color.green);
51 |
52 | //Digital Output Panel label formating
53 | helpLabel.setHorizontalTextPosition(JLabel.LEFT);
54 | helpLabel.setForeground(Color.GRAY);
55 |
56 | add(button);
57 |
58 | button.addActionListener(this);
59 |
60 | setValue(doc.isHigh());
61 | }
62 |
63 | private void setValue(boolean value) {
64 | state=value;
65 | if(value) {
66 | button.setText("High");
67 | recordValue(255);
68 | } else {
69 | button.setText("Low");
70 | recordValue(0);
71 | }
72 | }
73 |
74 | public void actionPerformed(ActionEvent e) {
75 | if(doc.getChannel().getDevice().getCachedMode()){
76 | doc.getChannel().getDevice().setCachedMode(false);
77 | }
78 |
79 | if(doc.setHigh(!state)) {
80 | setValue(!state);
81 | }
82 | }
83 |
84 | public void pollValue() {
85 | setValue(doc.isHigh());
86 | }
87 |
88 | public DyIOAbstractPeripheral getPerpheral() {
89 | // TODO Auto-generated method stub
90 | return null;
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DyIO/channelwidgets/LabelChannelUI.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DyIO.channelwidgets;
2 |
3 | import javax.swing.JLabel;
4 |
5 | import com.neuronrobotics.nrconsole.plugin.DyIO.ChannelManager;
6 | import com.neuronrobotics.sdk.dyio.peripherals.DyIOAbstractPeripheral;
7 |
8 | public class LabelChannelUI extends ControlWidget {
9 |
10 | private static final long serialVersionUID = 1L;
11 |
12 | public LabelChannelUI(ChannelManager channel, String text) {
13 | super(channel);
14 | add(new JLabel(text));
15 | }
16 |
17 | @Override
18 | public DyIOAbstractPeripheral getPerpheral() {
19 | // TODO Auto-generated method stub
20 | return null;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DyIO/channelwidgets/PPMReaderWidget.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DyIO.channelwidgets;
2 |
3 | import java.awt.Color;
4 | import java.awt.event.ActionEvent;
5 | import java.awt.event.ActionListener;
6 |
7 | import javax.swing.JButton;
8 | import javax.swing.JComboBox;
9 | import javax.swing.JLabel;
10 | import javax.swing.JPanel;
11 |
12 | import net.miginfocom.swing.MigLayout;
13 |
14 | import com.neuronrobotics.nrconsole.plugin.DyIO.ChannelManager;
15 | import com.neuronrobotics.nrconsole.plugin.DyIO.GettingStartedPanel;
16 | import com.neuronrobotics.sdk.common.BowlerDocumentationFactory;
17 | import com.neuronrobotics.sdk.dyio.peripherals.DyIOAbstractPeripheral;
18 | import com.neuronrobotics.sdk.dyio.peripherals.IPPMReaderListener;
19 | import com.neuronrobotics.sdk.dyio.peripherals.PPMReaderChannel;
20 |
21 | public class PPMReaderWidget extends ControlWidget implements IPPMReaderListener{
22 |
23 | private static final long serialVersionUID = 1L;
24 | private PPMReaderChannel ppmr;
25 | private JLabel [] ppmLabels = new JLabel[6] ;
26 | private JComboBox [] ppmLinks = new JComboBox [6] ;
27 | private int [] cross;
28 | private JPanel values = new JPanel(new MigLayout());
29 | public PPMReaderWidget(ChannelManager c) {
30 | super(c);
31 |
32 | try {
33 | ppmr = new PPMReaderChannel(getChannel());
34 | cross = ppmr.getCrossLink();
35 | int [] vals = ppmr.getValues();
36 | for(int i=0;i255 || toAdd<0) {
52 | return;
53 | }
54 | dataStream.add(toAdd);
55 | tx.setText(dataStream.toString());
56 | }catch (NumberFormatException e) {
57 |
58 | }
59 |
60 | }
61 | });
62 |
63 | clear.addActionListener(new ActionListener() {
64 |
65 | public void actionPerformed(ActionEvent arg0) {
66 | dataStream.clear();
67 | tx.setText("");
68 | }
69 | });
70 |
71 | send.addActionListener(new ActionListener() {
72 |
73 | public void actionPerformed(ActionEvent arg0) {
74 | Integer s = (Integer)ss.getSelectedItem();
75 | if(s == null) {
76 | JOptionPane.showMessageDialog(null, "Please select Chip Select pin", "Chip Select error", JOptionPane.ERROR_MESSAGE);
77 | return;
78 | }
79 |
80 | byte [] back = spi.write(s.intValue(), dataStream.getBytes());
81 |
82 | rx.setText(new ByteList(back).toString());
83 | }
84 | });
85 |
86 | //Button to launch info page for SPIChannel panel
87 | JButton helpButton = new JButton("Help");
88 |
89 | //Label for SPIChannel Panel
90 | JLabel helpLabel = new JLabel("SPI Panel");
91 | JPanel pan1 = new JPanel(new MigLayout());
92 | pan1.add(helpLabel, "split 2, span 2, align left");
93 | pan1.add(helpButton, "gapleft 150, wrap, align right");
94 | add(pan1,"wrap");
95 | helpButton.addActionListener(new ActionListener() {
96 | @Override
97 | public void actionPerformed(ActionEvent arg0) {
98 | try {
99 | GettingStartedPanel.openPage(BowlerDocumentationFactory.getDocumentationURL(spi));
100 | } catch (Exception exceptE) {}
101 | }
102 | });
103 |
104 | //Help button formating
105 | helpButton.setFont((helpButton.getFont()).deriveFont(8f));
106 | helpButton.setBackground(Color.green);
107 |
108 | //SPIChannel Panel label formating
109 | helpLabel.setHorizontalTextPosition(JLabel.LEFT);
110 | helpLabel.setForeground(Color.GRAY);
111 | JPanel pan = new JPanel(new MigLayout());
112 |
113 | pan.add(new JLabel("Tx: "));
114 | pan.add(tx);
115 | pan.add(send);
116 | pan.add(clear,"wrap");
117 | pan.add(new JLabel("Rx: "));
118 | pan.add(rx,"wrap");
119 | pan.add(new JLabel("Chip Select: "));
120 | pan.add(ss);
121 | pan.add(new JLabel("Add a byte: "));
122 | pan.add(addByte);
123 | pan.add(addByteButton);
124 |
125 | add(pan);
126 | }
127 |
128 | public DyIOAbstractPeripheral getPerpheral() {
129 | // TODO Auto-generated method stub
130 | return null;
131 | }
132 |
133 | }
134 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/DyIO/channelwidgets/SliderChannelUI.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.DyIO.channelwidgets;
2 |
3 | import java.awt.event.ActionEvent;
4 | import java.awt.event.ActionListener;
5 |
6 | import javax.swing.JButton;
7 | import javax.swing.JCheckBox;
8 | import javax.swing.JLabel;
9 | import javax.swing.JSlider;
10 | import javax.swing.event.ChangeEvent;
11 | import javax.swing.event.ChangeListener;
12 |
13 | import net.miginfocom.swing.MigLayout;
14 |
15 | import com.neuronrobotics.nrconsole.plugin.DyIO.ChannelManager;
16 | import com.neuronrobotics.sdk.common.Log;
17 | import com.neuronrobotics.sdk.dyio.DyIOChannelMode;
18 | import com.neuronrobotics.sdk.dyio.peripherals.DCMotorOutputChannel;
19 | import com.neuronrobotics.sdk.dyio.peripherals.DyIOAbstractPeripheral;
20 | import com.neuronrobotics.sdk.dyio.peripherals.PWMOutputChannel;
21 |
22 | public class SliderChannelUI extends ControlWidget implements ChangeListener, ActionListener {
23 | private static final long serialVersionUID = 1L;
24 |
25 | private JSlider sliderUI = new JSlider();
26 | private JLabel valueUI = new JLabel();
27 | private JCheckBox liveUpdate = new JCheckBox("Live");
28 | private JButton save = new JButton("Set Default");
29 | private int saveValue = 256;
30 | private DyIOAbstractPeripheral dap;
31 | private boolean startup = true;
32 | public SliderChannelUI(ChannelManager channel, DyIOChannelMode mode) {
33 | super(channel);
34 | setRecordable(true);
35 |
36 | if(mode == DyIOChannelMode.PWM_OUT){
37 | dap = new PWMOutputChannel(getChannel());
38 | }else if((mode == DyIOChannelMode.DC_MOTOR_VEL)||(mode == DyIOChannelMode.DC_MOTOR_DIR)){
39 | dap = new DCMotorOutputChannel(getChannel());
40 | }
41 |
42 | setLayout(new MigLayout());
43 |
44 | sliderUI.setMaximum(0);
45 | sliderUI.setMaximum(255);
46 | sliderUI.setMajorTickSpacing(15);
47 | sliderUI.setPaintTicks(true);
48 | liveUpdate.setSelected(true);
49 |
50 | add(sliderUI);
51 | add(valueUI);
52 | add(liveUpdate, "wrap");
53 | add(save);
54 |
55 | Log.debug(this.getClass()+"Getting value");
56 | int v =getChannel().getValue();
57 | Log.debug(this.getClass()+"Setting UI value");
58 | setValue(v);
59 |
60 | save.addActionListener(this);
61 | sliderUI.addChangeListener(this);
62 | startup = false;
63 | }
64 |
65 | private String formatValue(int value) {
66 | return String.format("%03d", value);
67 | }
68 |
69 | private void setValue(int value) {
70 | if(value < 0) {
71 | value = 0;
72 | }
73 |
74 | if(value > 255) {
75 | value = 255;
76 | }
77 |
78 | recordValue(value);
79 |
80 | sliderUI.setValue(value);
81 | valueUI.setText(formatValue(value));
82 | }
83 |
84 |
85 | public void stateChanged(ChangeEvent e) {
86 | valueUI.setText(formatValue(sliderUI.getValue()));
87 |
88 | if(!liveUpdate.isSelected() && sliderUI.getValueIsAdjusting()) {
89 | return;
90 | }
91 | if(sliderUI.getValue() !=saveValue )
92 | save.setEnabled(true);
93 | else
94 | save.setEnabled(false);
95 | if( startup == false ) {
96 | Log.debug(this.getClass()+"Setting Device value");
97 | if(dap.getChannel().getDevice().getCachedMode()){
98 | dap.getChannel().getDevice().setCachedMode(false);
99 | }
100 | dap.setValue(sliderUI.getValue());
101 | pollValue();
102 | }
103 | }
104 |
105 |
106 | public void actionPerformed(ActionEvent e) {
107 | if (e.getSource() == save){
108 | saveValue = sliderUI.getValue();
109 | dap.SavePosition(saveValue);
110 | save.setEnabled(false);
111 | }
112 | }
113 |
114 |
115 | public void pollValue() {
116 |
117 | recordValue(dap.getValue());
118 | }
119 |
120 |
121 | public DyIOAbstractPeripheral getPerpheral() {
122 | return dap;
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/PID/PIDGraph.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.PID;
2 |
3 | import java.awt.Dimension;
4 | import java.awt.event.ActionEvent;
5 | import java.awt.event.ActionListener;
6 | import java.util.ArrayList;
7 |
8 | import javax.swing.BorderFactory;
9 | import javax.swing.JButton;
10 | import javax.swing.JPanel;
11 | import javax.swing.border.EtchedBorder;
12 |
13 | import net.miginfocom.swing.MigLayout;
14 |
15 | import org.jfree.chart.ChartFactory;
16 | import org.jfree.chart.ChartPanel;
17 | import org.jfree.chart.JFreeChart;
18 | import org.jfree.chart.axis.NumberAxis;
19 | import org.jfree.chart.plot.PlotOrientation;
20 | import org.jfree.data.xy.XYDataItem;
21 | import org.jfree.data.xy.XYSeries;
22 | import org.jfree.data.xy.XYSeriesCollection;
23 | import org.jfree.util.Log;
24 |
25 | import com.neuronrobotics.graphing.CSVWriter;
26 | import com.neuronrobotics.graphing.GraphDataElement;
27 | import com.neuronrobotics.sdk.util.ThreadUtil;
28 |
29 | public class PIDGraph extends JPanel {
30 | private ArrayList dataTable = new ArrayList();
31 | private XYSeries setpoints;
32 | private XYSeries positions;
33 | private XYSeriesCollection xyDataset=new XYSeriesCollection();
34 | private JButton save = new JButton("Export Data");
35 | private JButton clear = new JButton("Clear graph");
36 | private int channel;
37 |
38 | private double startTime=System.currentTimeMillis();
39 |
40 | double[] data = {0,0};
41 |
42 | public PIDGraph(int channel){
43 | this.channel=channel;
44 | setLayout(new MigLayout());
45 | setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
46 | JFreeChart chart = ChartFactory.createXYLineChart(
47 | "Live Data",
48 | "Time",
49 | "Value",
50 | xyDataset,
51 | PlotOrientation.VERTICAL,
52 | true,
53 | false,
54 | false);
55 |
56 | ChartPanel cp = new ChartPanel(chart);
57 |
58 | // set the graph to zoom around the values and not include zero
59 | NumberAxis rangeAxis = (NumberAxis) chart.getXYPlot().getRangeAxis();
60 | rangeAxis.setAutoRangeIncludesZero(false);
61 |
62 | JPanel buttons = new JPanel();
63 | buttons.add(save);
64 | buttons.add(clear);
65 | add(buttons,"wrap");
66 | add(cp,"wrap");
67 | //add(save);
68 | //add(clear,"wrap");
69 | save.addActionListener(new ActionListener() {
70 |
71 | public void actionPerformed(ActionEvent arg0) {
72 | String name ="Graph_Of_Group_"+getChannel()+"_"+System.currentTimeMillis()+".csv";
73 | CSVWriter.WriteToCSV(dataTable,name);
74 | dataTable.clear();
75 | setpoints.clear();
76 | positions.clear();
77 | }
78 | });
79 | clear.addActionListener(new ActionListener() {
80 |
81 | public void actionPerformed(ActionEvent arg0) {
82 | dataTable.clear();
83 | setpoints.clear();
84 | positions.clear();
85 | }
86 | });
87 |
88 | setSize(new Dimension(150,100));
89 | init();
90 | }
91 | /**
92 | * long
93 | */
94 | private static final long serialVersionUID = 1L;
95 | public void addEvent(double setpoint, double position) {
96 | data[0] = setpoint;
97 | data[1] = position;
98 | }
99 | private void init(){
100 | xyDataset.removeAllSeries();
101 | setpoints = new XYSeries("Set Point");
102 | positions = new XYSeries("Position");
103 | xyDataset.addSeries(setpoints);
104 | xyDataset.addSeries(positions);
105 | new updaterThread().start();
106 | }
107 | private int getChannel() {
108 | return channel;
109 | }
110 |
111 | private class updaterThread extends Thread{
112 | double[] lastData= {0,0};
113 | public void run(){
114 | while (true){
115 | ThreadUtil.wait(50);
116 | if(lastData[0] != data[0] || lastData[1]!=data[1]){
117 | lastData[0]=data[0];
118 | lastData[1]=data[1];
119 | try{
120 |
121 |
122 | double time = (System.currentTimeMillis()-startTime);
123 |
124 | dataTable.add(new GraphDataElement((long) time,data));
125 | XYDataItem s = new XYDataItem(time,data[0]);
126 | XYDataItem p = new XYDataItem(time,data[1]);
127 |
128 | if(setpoints.getItemCount()>99){
129 | setpoints.remove(0);
130 | }
131 | setpoints.add(s);
132 |
133 | if(positions.getItemCount()>99){
134 | positions.remove(0);
135 | }
136 | positions.add(p);
137 |
138 | }catch(Exception e){
139 | System.err.println("Failed to set a data point");
140 | e.printStackTrace();
141 | Log.error(e);
142 | Log.error(e.getStackTrace());
143 | init();
144 | }
145 | }
146 | }
147 | }
148 |
149 | }
150 |
151 | }
152 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/PID/PIDVelocityWidget.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.PID;
2 |
3 | import java.awt.event.ActionEvent;
4 | import java.awt.event.ActionListener;
5 |
6 | import javax.swing.JButton;
7 | import javax.swing.JLabel;
8 | import javax.swing.JPanel;
9 | import javax.swing.JTextField;
10 |
11 | import net.miginfocom.swing.MigLayout;
12 |
13 | public class PIDVelocityWidget extends JPanel implements ActionListener {
14 |
15 | /**
16 | *
17 | */
18 | private static final long serialVersionUID = -5325751144652371482L;
19 | PIDControlWidget widget;
20 | private JTextField vel=new JTextField(5);
21 | private JTextField time=new JTextField(5);
22 | JButton go = new JButton("Run Velocity");
23 |
24 | public PIDVelocityWidget(PIDControlWidget w){
25 | widget=w;
26 | setLayout(new MigLayout());
27 | go.addActionListener(this);
28 | vel.addActionListener(this);
29 | time.addActionListener(this);
30 | vel.setText("100");
31 | time.setText("0");
32 | add(new JLabel("Velocity Control"),"wrap");
33 | JPanel p = new JPanel(new MigLayout());
34 | p.add(vel);p.add(new JLabel("ticks per second"),"wrap");
35 | p.add(time);p.add(new JLabel("seconds"),"wrap");
36 | add(p,"wrap");
37 | add(go,"wrap");
38 | }
39 |
40 | @Override
41 | public void actionPerformed(ActionEvent arg0) {
42 | System.err.println("Go button pressed");
43 | try{
44 | double t = Double.parseDouble(time.getText());
45 | int v = Integer.parseInt(vel.getText());
46 | widget.SetPIDVel(v, t);
47 | }catch (Exception ex){
48 | vel.setText("100");
49 | time.setText("0");
50 | ex.printStackTrace();
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/bootloader/gui/BootloaderParams.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.bootloader.gui;
2 |
3 | import com.neuronrobotics.sdk.bootloader.NRBootCoreType;
4 |
5 |
6 | public class BootloaderParams {
7 | private int core;
8 | private String hexFilePath;
9 | private NRBootCoreType type;
10 | public String toString(){
11 | String s;
12 | s="Core #"+getCore()+" of type:"+getType().getReadableName()+" Using file:"+getHexFilePath();
13 | return s;
14 | }
15 | public void setCore(int core) {
16 | this.core = core;
17 | }
18 | public int getCore() {
19 | return core;
20 | }
21 | public void setHexFilePath(String hexFilePath) {
22 | this.hexFilePath = hexFilePath;
23 | }
24 | public String getHexFilePath() {
25 | return hexFilePath;
26 | }
27 | public void setType(NRBootCoreType type) {
28 | this.type = type;
29 | }
30 | public NRBootCoreType getType() {
31 | return type;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/bootloader/gui/NRBootLoaderApp.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.bootloader.gui;
2 |
3 | import java.io.File;
4 | import java.io.FileInputStream;
5 | import java.io.FileNotFoundException;
6 | import java.util.ArrayList;
7 |
8 | import javax.swing.JOptionPane;
9 |
10 | import com.neuronrobotics.sdk.bootloader.Core;
11 | import com.neuronrobotics.sdk.bootloader.Hexml;
12 | import com.neuronrobotics.sdk.bootloader.NRBoot;
13 | import com.neuronrobotics.sdk.bootloader.NRBootCoreType;
14 | import com.neuronrobotics.sdk.ui.ConnectionDialog;
15 |
16 | public class NRBootLoaderApp {
17 | public NRBootLoaderApp(String[] args){
18 | String port = null;
19 | Hexml hex=null;
20 | ArrayList cores = new ArrayList();
21 | for (int i=0;i \n--xml ");
102 | System.exit(1);
103 | }
104 |
105 | }
106 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/plugin/bootloader/gui/StatusLabel.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.plugin.bootloader.gui;
2 |
3 | import javax.swing.ImageIcon;
4 | import javax.swing.JLabel;
5 |
6 | import com.neuronrobotics.nrconsole.plugin.bootloader.BootloaderPanel;
7 |
8 | public class StatusLabel extends JLabel {
9 | private static final long serialVersionUID = 1L;
10 | public static final int OK = 1;
11 | public static final int ERROR = 2;
12 |
13 |
14 | public StatusLabel() {
15 | setStatus(0);
16 | }
17 |
18 | public void setStatus(int status) {
19 | switch (status) {
20 | case OK:
21 | setIcon(createImageIcon("images/ok.png"));
22 | break;
23 | case ERROR:
24 | setIcon(createImageIcon("images/error.png"));
25 | break;
26 | default:
27 | setIcon(createImageIcon("images/blank.png"));
28 | break;
29 | }
30 |
31 | invalidate();
32 | //repaint();
33 | }
34 |
35 | protected ImageIcon createImageIcon(String path) {
36 | java.net.URL imgURL = BootloaderPanel.class.getResource(path);
37 | if (imgURL != null) {
38 | return new ImageIcon(imgURL);
39 | } else {
40 | System.err.println("Couldn't find file: " + path);
41 | return null;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/util/CommitWidget.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.util;
2 |
3 | import java.io.File;
4 | import java.util.Optional;
5 |
6 | import org.eclipse.jgit.api.Git;
7 |
8 | import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine;
9 |
10 | import javafx.application.Platform;
11 | import javafx.geometry.Insets;
12 | import javafx.scene.Node;
13 | import javafx.scene.control.ButtonType;
14 | import javafx.scene.control.Dialog;
15 | import javafx.scene.control.Label;
16 | import javafx.scene.control.TextArea;
17 | import javafx.scene.control.TextField;
18 | import javafx.scene.control.ButtonBar.ButtonData;
19 | import javafx.scene.layout.GridPane;
20 | import javafx.util.Pair;
21 |
22 | public class CommitWidget {
23 | public static void commit(File currentFile, String code){
24 | Platform.runLater(() ->{
25 | // Create the custom dialog.
26 | Dialog> dialog = new Dialog<>();
27 | dialog.setTitle("Commit message Dialog");
28 | dialog.setHeaderText("Enter a commit message to publish changes");
29 |
30 |
31 | // Set the button types.
32 | ButtonType loginButtonType = new ButtonType("Publish", ButtonData.OK_DONE);
33 | dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);
34 |
35 | // Create the username and password labels and fields.
36 | GridPane grid = new GridPane();
37 | grid.setHgap(10);
38 | grid.setVgap(10);
39 | grid.setPadding(new Insets(20, 150, 10, 10));
40 |
41 | TextField username = new TextField();
42 | username.setPromptText("60 character description");
43 | TextArea password = new TextArea();
44 | password.setPrefRowCount(5);
45 | password.setPrefColumnCount(40);
46 | password.setPromptText("Full Sentences describing explanation");
47 |
48 | grid.add(new Label("What did you change?"), 0, 0);
49 | grid.add(username, 1, 0);
50 | grid.add(new Label("Why did you change it?"), 0, 1);
51 | grid.add(password, 1, 1);
52 |
53 | // Enable/Disable login button depending on whether a username was entered.
54 | Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType);
55 | loginButton.setDisable(true);
56 |
57 | // Do some validation (using the Java 8 lambda syntax).
58 | username.textProperty().addListener((observable, oldValue, newValue) -> {
59 | loginButton.setDisable(newValue.trim().length()<5);
60 | });
61 |
62 | dialog.getDialogPane().setContent(grid);
63 |
64 | // Request focus on the username field by default.
65 | Platform.runLater(() -> username.requestFocus());
66 |
67 | // Convert the result to a username-password-pair when the login button is clicked.
68 | dialog.setResultConverter(dialogButton -> {
69 | if (dialogButton == loginButtonType) {
70 | return new Pair<>(username.getText(), password.getText());
71 | }
72 | return null;
73 | });
74 |
75 | Optional> result = dialog.showAndWait();
76 |
77 | result.ifPresent(commitBody -> {
78 | new Thread(){
79 | public void run(){
80 | String message = commitBody.getKey()+"/n/n"+commitBody.getValue();
81 |
82 | Git git;
83 | try {
84 | git = ScriptingEngine.locateGit(currentFile);
85 | String remote= git.getRepository().getConfig().getString("remote", "origin", "url");
86 | String relativePath = ScriptingEngine.findLocalPath(currentFile,git);
87 | ScriptingEngine.pushCodeToGit(remote,"master", relativePath, code, message);
88 | git.close();
89 | } catch (Exception e1) {
90 | // TODO Auto-generated catch block
91 | e1.printStackTrace();
92 | }
93 | }
94 | }.start();
95 | });
96 | });
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/util/CompoundSlider.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.util;
2 |
3 | import javax.swing.JPanel;
4 |
5 | public class CompoundSlider extends JPanel {
6 |
7 | /**
8 | * long
9 | */
10 | private static final long serialVersionUID = 6803306324376497720L;
11 | private int lb,ub;
12 | public CompoundSlider(int lowerBound, int upperBound,int center, double scale) {
13 | lb=lowerBound;
14 | ub=upperBound;
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/util/DirectoryFilter.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.util;
2 |
3 | import java.io.File;
4 |
5 | import javax.swing.filechooser.FileFilter;
6 |
7 | public class DirectoryFilter extends FileFilter {
8 |
9 | public String getDescription() {
10 | return "Select Directory";
11 | }
12 | public boolean accept(File f) {
13 | if(f.isDirectory()) {
14 | return true;
15 | }
16 | return false;
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/util/FileSelectionFactory.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.util;
2 |
3 | import java.io.File;
4 |
5 | import javafx.application.Platform;
6 | import javafx.stage.FileChooser;
7 | import javafx.stage.FileChooser.ExtensionFilter;
8 |
9 | import javax.swing.JFileChooser;
10 | import javax.swing.filechooser.FileFilter;
11 |
12 | import com.neuronrobotics.bowlerstudio.BowlerStudio;
13 | import com.neuronrobotics.imageprovider.StaticFileProvider;
14 | import com.neuronrobotics.sdk.util.ThreadUtil;
15 |
16 |
17 | public class FileSelectionFactory {
18 |
19 | public static File GetFile(File start, ExtensionFilter... filter) {
20 | class fileHolder{
21 | private boolean done=false;
22 | private File file=null;
23 | public boolean isDone() {
24 | return done;
25 | }
26 | public void setDone(boolean done) {
27 | this.done = done;
28 | }
29 | public File getFile() {
30 | return file;
31 | }
32 | public void setFile(File file) {
33 | this.file = file;
34 | }
35 | }
36 | final fileHolder file=new fileHolder();
37 | Platform.runLater(() -> {
38 | FileChooser fileChooser = new FileChooser();
39 | fileChooser.setInitialDirectory(start.isDirectory()?start:start.getParentFile());
40 |
41 | fileChooser.getExtensionFilters().addAll(filter);
42 | fileChooser.setTitle("Bowler File Chooser");
43 | file.setFile(fileChooser.showOpenDialog(BowlerStudio.getPrimaryStage()));
44 | file.setDone(true);
45 |
46 | });
47 | while(!file.isDone()){
48 | ThreadUtil.wait(16);
49 | }
50 |
51 | return file.getFile();
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/util/GCodeFilter.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.util;
2 |
3 | import java.io.File;
4 |
5 | import javax.swing.filechooser.FileFilter;
6 |
7 | public class GCodeFilter extends FileFilter {
8 |
9 | public String getDescription() {
10 | return "GCode File";
11 | }
12 | public boolean accept(File f) {
13 | if(f.isDirectory()) {
14 | return true;
15 | }
16 | String path = f.getAbsolutePath().toLowerCase();
17 | if ((path.endsWith("gcode") && (path.charAt(path.length() - 5)) == '.')) {
18 | return true;
19 | }
20 | if ((path.endsWith("ngc") && (path.charAt(path.length() - 3)) == '.')) {
21 | return true;
22 | }
23 | return f.getName().matches(".+\\.gcode$") || f.getName().matches(".+\\.ngc$");
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/util/GroovyFilter.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.util;
2 |
3 | import java.io.File;
4 |
5 | import javax.swing.filechooser.FileFilter;
6 |
7 | public class GroovyFilter extends FileFilter {
8 |
9 | public String getDescription() {
10 | return "Script (.groovy .java)";
11 | }
12 |
13 | public boolean accept(File f) {
14 | return true;
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/util/IntegerComboBox.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.util;
2 |
3 | import javax.swing.JComboBox;
4 |
5 | public class IntegerComboBox extends JComboBox{
6 |
7 | /**
8 | *
9 | */
10 | private static final long serialVersionUID = 2439771311089831575L;
11 |
12 | private final String noneString = "None";
13 | private int noneValue=0xff;
14 |
15 | public IntegerComboBox(){}
16 |
17 | public IntegerComboBox(boolean withNoneOption, int noneVal){
18 | if(withNoneOption){
19 | addItem(noneString);
20 | noneValue=noneVal;
21 | }
22 | }
23 |
24 | public void removeInteger(int in){
25 | for(int i=0;i {
16 | TextInputDialog dialog = new TextInputDialog("https://gist.github.com/"+defaultID);
17 | dialog.setTitle(purpose);
18 | dialog.setHeaderText("Enter the URL (Link from the browser)");
19 | dialog.setContentText("Link to Gist: ");
20 |
21 | // Traditional way to get the response value.
22 | Optional result = dialog.showAndWait();
23 | if (result.isPresent()){
24 |
25 | String gistcode = ScriptingEngine.urlToGist(result.get());
26 | System.out.println("Creature Gist " + gistcode);
27 | ArrayList choices =ScriptingEngine.filesInGist(gistcode,null);
28 | String suggestedChoice="";
29 | int numXml=0;
30 | for(int i=0;i d = new ChoiceDialog<>(suggestedChoice, choices);
45 | d.setTitle("Choose a file in the gist");
46 | d.setHeaderText("Select from the files in the gist to pick the Creature File");
47 | d.setContentText("Choose A Creature:");
48 |
49 | // Traditional way to get the response value.
50 | Optional r = d.showAndWait();
51 | if (r.isPresent()){
52 | System.out.println("Your choice: " + r.get());
53 | listener.done(gistcode,r.get());
54 | }
55 | }
56 |
57 | });
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/util/Slic3rFilter.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.util;
2 |
3 | import java.io.File;
4 |
5 | import javax.swing.filechooser.FileFilter;
6 |
7 | public class Slic3rFilter extends FileFilter {
8 |
9 | public String getDescription() {
10 | return "Slic3r Executable";
11 | }
12 | public boolean accept(File f) {
13 | if(f.isDirectory()) {
14 | return true;
15 | }
16 | String path = f.getAbsolutePath().toLowerCase();
17 | if (f.getName().toLowerCase().contains("slic3r")) {
18 | return true;
19 | }
20 |
21 | return f.getName().toLowerCase().matches("slic3r");
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/util/StlFilter.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.util;
2 |
3 | import java.io.File;
4 |
5 | import javax.swing.filechooser.FileFilter;
6 |
7 | public class StlFilter extends FileFilter {
8 |
9 | public String getDescription() {
10 | return "STL File";
11 | }
12 | public boolean accept(File f) {
13 | if(f.isDirectory()) {
14 | return true;
15 | }
16 | String path = f.getAbsolutePath().toLowerCase();
17 | if ((path.toLowerCase().endsWith("stl") && (path.charAt(path.length() - 3)) == '.')) {
18 | return true;
19 | }
20 |
21 | return f.getName().matches(".+\\.stl$");
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/nrconsole/util/XmlFilter.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.nrconsole.util;
2 |
3 | import java.io.File;
4 |
5 | import javax.swing.filechooser.FileFilter;
6 |
7 | public class XmlFilter extends FileFilter {
8 |
9 | public String getDescription() {
10 | return "Configuration (xml)";
11 | }
12 |
13 | public boolean accept(File f) {
14 | if(f.isDirectory()) {
15 | return true;
16 | }
17 | String path = f.getAbsolutePath().toLowerCase();
18 | if ((path.endsWith("xml") && (path.charAt(path.length() - 3)) == '.')) {
19 | return true;
20 | }
21 | return f.getName().matches(".+\\.xml$");
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/pidsim/CSVWriter.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.pidsim;
2 |
3 | import java.io.BufferedWriter;
4 | import java.io.File;
5 | import java.io.FileWriter;
6 | import java.io.IOException;
7 |
8 | import org.jfree.data.xy.XYDataItem;
9 | import org.jfree.data.xy.XYSeries;
10 |
11 | public class CSVWriter {
12 |
13 | private BufferedWriter writer;
14 |
15 | public void setFile(File f) {
16 | if (!f.getName().endsWith(".csv")){
17 | f = new File(f.getAbsolutePath()+".csv");
18 | }
19 |
20 | FileWriter fstream;
21 | try {
22 | fstream = new FileWriter(f.getAbsolutePath());
23 | } catch (IOException e) {
24 | // TODO Auto-generated catch block
25 | e.printStackTrace();
26 | return;
27 | }
28 |
29 | writer = new BufferedWriter(fstream);
30 | }
31 |
32 | public void addData(XYSeries data) {
33 |
34 | XYSeries cache;
35 | try {
36 | cache = data.createCopy(0, data.getItemCount() - 1);
37 | } catch (CloneNotSupportedException e) {
38 | // TODO Auto-generated catch block
39 | e.printStackTrace();
40 | return;
41 | }
42 |
43 | try {
44 | writer.write("Time (s),Position (degrees)\n");
45 | for(Object o : cache.getItems()) {
46 | XYDataItem i = (XYDataItem) o;
47 | writer.write(i.getXValue() + "," + i.getYValue() + "\n");
48 | }
49 | } catch (IOException e) {
50 |
51 | }
52 |
53 | }
54 |
55 | public void cleanup() {
56 | try {
57 | writer.close();
58 | } catch (IOException e) {
59 | // TODO Auto-generated catch block
60 | e.printStackTrace();
61 | }
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/pidsim/DataPanel.java:
--------------------------------------------------------------------------------
1 | /* ---------------------
2 | * DynamicDataDemo2.java
3 | * ---------------------
4 | * (C) Copyright 2003-2009, by Object Refinery Limited.
5 | *
6 | */
7 |
8 | package com.neuronrobotics.pidsim;
9 |
10 | import java.awt.BasicStroke;
11 | import java.awt.BorderLayout;
12 | import java.awt.Color;
13 | import java.awt.Font;
14 | import java.awt.event.ActionEvent;
15 | import java.awt.event.ActionListener;
16 | import java.io.File;
17 |
18 | import javax.swing.JButton;
19 | import javax.swing.JFileChooser;
20 | import javax.swing.JPanel;
21 |
22 | import org.jfree.chart.ChartFactory;
23 | import org.jfree.chart.ChartPanel;
24 | import org.jfree.chart.ChartUtilities;
25 | import org.jfree.chart.JFreeChart;
26 | import org.jfree.chart.axis.ValueAxis;
27 | import org.jfree.chart.plot.Marker;
28 | import org.jfree.chart.plot.ValueMarker;
29 | import org.jfree.chart.plot.XYPlot;
30 | import org.jfree.chart.renderer.xy.DefaultXYItemRenderer;
31 | import org.jfree.data.xy.XYSeries;
32 | import org.jfree.data.xy.XYSeriesCollection;
33 | import org.jfree.ui.LengthAdjustmentType;
34 | import org.jfree.ui.RectangleAnchor;
35 | import org.jfree.ui.TextAnchor;
36 |
37 | public class DataPanel extends JPanel implements ActionListener {
38 |
39 | private static final long serialVersionUID = 1L;
40 |
41 | private XYPlot plot;
42 |
43 | private XYSeries positionSer;
44 | private Marker setpoint = new ValueMarker(0);
45 | private JButton exportXlsBtn = new JButton("Export Excel");
46 | private JButton exportCsvBtn = new JButton("Export CSV");
47 |
48 | /**
49 | * Creates a new self-contained demo panel.
50 | */
51 | public DataPanel(String title) {
52 | //setTitle(title);
53 | setLayout(new BorderLayout());
54 |
55 | positionSer = new XYSeries("True Position");
56 |
57 | XYSeriesCollection dataset1 = new XYSeriesCollection(positionSer);
58 |
59 | JFreeChart chart = ChartFactory.createTimeSeriesChart("Position", "Time (seconds)", "Angle (degrees)", dataset1,true, true, false);
60 |
61 | plot = (XYPlot) chart.getPlot();
62 | plot.setRenderer(1, new DefaultXYItemRenderer());
63 | plot.mapDatasetToRangeAxis(1, 1);
64 |
65 | ValueAxis axis = plot.getDomainAxis();
66 | axis.setAutoRange(true);
67 | axis.setFixedAutoRange(20000.0); // 20 seconds
68 |
69 | ChartUtilities.applyCurrentTheme(chart);
70 |
71 | ChartPanel chartPanel = new ChartPanel(chart);
72 | chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
73 |
74 | exportXlsBtn.setActionCommand("EXPORT_XLS");
75 | exportCsvBtn.setActionCommand("EXPORT_CSV");
76 |
77 | exportXlsBtn.addActionListener(this);
78 | exportCsvBtn.addActionListener(this);
79 |
80 | JPanel exportPanel = new JPanel();
81 | exportPanel.add(exportXlsBtn);
82 | exportPanel.add(exportCsvBtn);
83 |
84 | JPanel mainPanel = new JPanel(new BorderLayout());
85 | mainPanel.add(chartPanel);
86 | mainPanel.add(exportPanel, BorderLayout.SOUTH);
87 |
88 | add(mainPanel);
89 | }
90 |
91 | public void addPosition(double position, long time) {
92 | positionSer.add(time, position);
93 | }
94 |
95 | public void setSetpoint(double sp) {
96 | plot.removeRangeMarker(setpoint);
97 | setpoint = new ValueMarker(sp);
98 | setpoint.setLabelOffsetType(LengthAdjustmentType.EXPAND);
99 | setpoint.setPaint(Color.red);
100 | setpoint.setStroke(new BasicStroke(2.0f));
101 | setpoint.setLabel("Setpoint");
102 | setpoint.setLabelFont(new Font("SansSerif", Font.PLAIN, 11));
103 | setpoint.setLabelPaint(Color.red);
104 | setpoint.setLabelAnchor(RectangleAnchor.TOP_LEFT);
105 | setpoint.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT);
106 | plot.addRangeMarker(setpoint);
107 | }
108 |
109 | @Override
110 | public void actionPerformed(ActionEvent e) {
111 | JFileChooser fc = new JFileChooser();
112 | int fcRtn = fc.showSaveDialog(this);
113 |
114 | if(fcRtn != JFileChooser.APPROVE_OPTION) {
115 | return;
116 | }
117 |
118 | File f = fc.getSelectedFile();
119 |
120 | if(e.getActionCommand().equalsIgnoreCase("EXPORT_XLS")) {
121 | ExcelWriter ew = new ExcelWriter();
122 | ew.setFile(f);
123 | ew.addData(positionSer);
124 | ew.cleanup();
125 | } else {
126 | if (!f.getName().endsWith(".csv")){
127 | f = new File(f.getAbsolutePath()+".csv");
128 | }
129 | CSVWriter cw = new CSVWriter();
130 | cw.setFile(f);
131 | cw.addData(positionSer);
132 | cw.cleanup();
133 | }
134 |
135 | }
136 | }
137 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/pidsim/ExcelWriter.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.pidsim;
2 |
3 | import java.io.File;
4 | import java.io.IOException;
5 | import java.util.Locale;
6 |
7 | import jxl.Workbook;
8 | import jxl.WorkbookSettings;
9 | import jxl.write.Label;
10 | import jxl.write.Number;
11 | import jxl.write.WritableSheet;
12 | import jxl.write.WritableWorkbook;
13 | import jxl.write.WriteException;
14 | import jxl.write.biff.RowsExceededException;
15 |
16 | import org.jfree.data.xy.XYDataItem;
17 | import org.jfree.data.xy.XYSeries;
18 |
19 | public class ExcelWriter {
20 | private WorkbookSettings wbSettings = new WorkbookSettings();
21 | private WritableWorkbook workbook;
22 | private WritableSheet excelSheet;
23 | private int lineOffset = 0;
24 |
25 | public ExcelWriter() {
26 | wbSettings.setLocale(new Locale("en", "EN"));
27 | }
28 |
29 | private void addNumber(int column, int row, double d) throws WriteException, RowsExceededException {
30 | Number number;
31 | number = new Number(column, row, d);
32 | excelSheet.addCell(number);
33 | }
34 |
35 | private void addLabel(int column, int row, String s) throws WriteException, RowsExceededException {
36 | Label label;
37 | label = new Label(column, row, s);
38 | excelSheet.addCell(label);
39 | }
40 |
41 | public void setFile(File f) {
42 | if (!f.getName().endsWith(".xls")){
43 | f = new File(f.getAbsolutePath()+".xls");
44 | }
45 |
46 | try {
47 | workbook = Workbook.createWorkbook(f, wbSettings);
48 | workbook.createSheet("Data", 0);
49 | excelSheet = workbook.getSheet(0);
50 | } catch (IOException e) {
51 | // TODO Auto-generated catch block
52 | e.printStackTrace();
53 | }
54 | }
55 |
56 | public void addData(XYSeries data) {
57 | try {
58 | int col = 1;
59 | addLabel(lineOffset, 0, "Time (s)");
60 | addLabel(lineOffset+1, 0, "Position (degrees)");
61 |
62 | XYSeries cache;
63 | try {
64 | cache = data.createCopy(0, data.getItemCount() - 1);
65 | } catch (CloneNotSupportedException e) {
66 | // TODO Auto-generated catch block
67 | e.printStackTrace();
68 | return;
69 | }
70 |
71 | for(Object o : cache.getItems()) {
72 | XYDataItem i = (XYDataItem) o;
73 | addNumber(lineOffset, col, i.getXValue());
74 | addNumber(lineOffset+1, col, i.getYValue());
75 | col++;
76 | }
77 | } catch (RowsExceededException e) {
78 | // TODO Auto-generated catch block
79 | e.printStackTrace();
80 | } catch (WriteException e) {
81 | // TODO Auto-generated catch block
82 | e.printStackTrace();
83 | }
84 | lineOffset+=2;
85 | }
86 |
87 | public void cleanup() {
88 | try {
89 | workbook.write();
90 | workbook.close();
91 | } catch (IOException e) {
92 | // TODO Auto-generated catch block
93 | e.printStackTrace();
94 | }
95 | }
96 |
97 | }
98 |
99 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/pidsim/PIDConstantsDialog.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.pidsim;
2 |
3 | import java.awt.event.ActionEvent;
4 | import java.awt.event.ActionListener;
5 | import javax.swing.JButton;
6 | import javax.swing.JFrame;
7 | import javax.swing.JLabel;
8 | import javax.swing.JPanel;
9 | import javax.swing.JTextField;
10 |
11 | import net.miginfocom.swing.MigLayout;
12 |
13 | public class PIDConstantsDialog extends JPanel {
14 | private double kp=1;
15 | private double ki=0;
16 | private double kd=0;
17 |
18 | private JTextField pData=new JTextField(5);
19 | private JTextField iData=new JTextField(5);
20 | private JTextField dData=new JTextField(5);
21 | private JButton set=new JButton("Set");
22 | /**
23 | *
24 | */
25 | private static final long serialVersionUID = 1L;
26 | public PIDConstantsDialog(double p,double i,double d){
27 | setLayout(new MigLayout());
28 | setKp(p);
29 | setKi(i);
30 | setKd(d);
31 | add(new JLabel("Kp"));
32 | add(pData,"wrap");
33 | add(new JLabel("Ki"));
34 | add(iData,"wrap");
35 | add(new JLabel("Kd"));
36 | add(dData,"wrap");
37 | pData.setText(new Double(getKp()).toString());
38 | iData.setText(new Double(getKi()).toString());
39 | dData.setText(new Double(getKd()).toString());
40 | set.addActionListener(new ActionListener() {
41 | @Override
42 | public void actionPerformed(ActionEvent e) {
43 | try{
44 | setKp(Double.parseDouble(pData.getText()));
45 | }catch (NumberFormatException ex){}
46 | try{
47 | setKi(Double.parseDouble(iData.getText()));
48 | }catch (NumberFormatException ex){}
49 | try{
50 | setKd(Double.parseDouble(dData.getText()));
51 | }catch (NumberFormatException ex){}
52 | }
53 | });
54 | add(set);
55 | }
56 | public void setKp(double kp) {
57 | this.kp = kp;
58 | }
59 | public double getKp() {
60 | return kp;
61 | }
62 | public void setKi(double ki) {
63 | this.ki = ki;
64 | }
65 | public double getKi() {
66 | return ki;
67 | }
68 | public void setKd(double kd) {
69 | this.kd = kd;
70 | }
71 | public double getKd() {
72 | return kd;
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/pidsim/PIDSim.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.pidsim;
2 |
3 |
4 | public class PIDSim {
5 |
6 | private GraphingPanel graphingPanel;
7 | private LinearPhysicsEngine phy;
8 |
9 | private double sp;
10 | private double position;
11 | private double mass = .01;
12 | private double length = 1;
13 | private double stFriction = .5;
14 | private double dyFriction = .3;
15 | private long time = 0;
16 | private double maxTorque = 20;// Newton meters
17 | private PIDConstantsDialog constants = new PIDConstantsDialog( .1,//kp
18 | 0,//ki
19 | 0);//kd
20 |
21 | public PIDSim(LinearPhysicsEngine eng) {
22 | graphingPanel = new GraphingPanel(this,constants, "Neuron Robotics PIDSim");
23 | phy=eng;
24 | }
25 |
26 | public double getSetPoint() {
27 |
28 | return sp;
29 | }
30 |
31 | public void setSetPoint(double value) {
32 | sp = value;
33 | getGraphingPanel().setSetPoint(sp);
34 | }
35 | /**
36 | * setting a torque in kg/m
37 | * @param value
38 | * @throws Exception if max torque is exceded
39 | */
40 | public void setTorque(double value) throws Exception {
41 | phy.setTorque(value);
42 | }
43 |
44 | public long getTime() {
45 | return time;
46 | }
47 |
48 | protected void setTime(long t) {
49 | time = t;
50 | }
51 |
52 | protected void setPosition(double value) {
53 | position = value;
54 | getGraphingPanel().setPosition(position);
55 | }
56 |
57 | public double getPosition() {
58 | return position;
59 | }
60 |
61 | public double getMass() {
62 | return mass;
63 | }
64 |
65 | public void setMass(double value) {
66 | phy.setMass(mass);
67 | mass = value;
68 | }
69 |
70 | public double getLength() {
71 | return length;
72 | }
73 |
74 | public void setLength(double value) {
75 | phy.setLinkLen(value);
76 | length = value;
77 | }
78 |
79 | public double getStaticFriction() {
80 | return stFriction;
81 | }
82 |
83 | public void setStaticFriction(double value) {
84 | phy.setMuStatic(value);
85 | stFriction = value;
86 | }
87 |
88 | public double getDynamicFriction() {
89 | return dyFriction;
90 | }
91 |
92 | public void setDynamicFriction(double value) {
93 | phy.setMuDynamic(value);
94 | dyFriction = value;
95 | }
96 |
97 | public double getMaxTorque() {
98 | return maxTorque;
99 | }
100 |
101 | public void setMaxTorque(double maxTorque) {
102 | this.maxTorque = maxTorque;
103 | }
104 |
105 | public GraphingPanel getGraphingPanel() {
106 | return graphingPanel;
107 | }
108 |
109 |
110 |
111 | public PIDConstantsDialog getConstants() {
112 | return constants;
113 | }
114 |
115 | public void setConstants(PIDConstantsDialog constants) {
116 | this.constants = constants;
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/src/main/java/com/neuronrobotics/pidsim/PIDSimFullTest.java:
--------------------------------------------------------------------------------
1 | package com.neuronrobotics.pidsim;
2 |
3 |
4 | public class PIDSimFullTest {
5 | public static void main(String[] args) throws InterruptedException {
6 | // PIDSim pid = new PIDSim( .01, // mass
7 | // .5, //link length
8 | // 5, //torque from static friction
9 | // 4.5); //torque from dynamic friction
10 | // pid.initialize();
11 | // pid.setSetPoint(45);
12 | // PIDConstantsDialog d = new PIDConstantsDialog( 2,//kp
13 | // .5,//ki
14 | // 15);//kd
15 | //
16 | //
17 | // double IntegralCircularBuffer[] = new double[100];
18 | // double iTotal=0;
19 | // int index=0;
20 | // double previousState = 0;
21 | // for(int i =0;i
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/bowlerstudio/build.properties:
--------------------------------------------------------------------------------
1 | app.name=BowlerStudio
2 | app.version=0.6.9
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/bowlerstudio/flyingCamera.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | none
4 | FlyingCamera
5 |
6 | BoomArm
7 |
8 | boom
9 | virtualCameraDevice
10 | camera
11 | 0
12 |
13 | 1
14 | 255.0
15 | 0.0
16 | 1.0E8
17 | -1.0E8
18 | 0
19 | false
20 | 0
21 | false
22 | 10000000
23 |
24 |
25 | 0
26 | 0.0
27 | 0
28 | 0
29 |
30 |
31 |
32 |
33 |
34 | 0.0
35 | 0.0
36 | 0.0
37 | 1.0
38 | 0.0
39 | 0.0
40 | 0.0
41 |
42 |
43 |
44 | 0.0
45 | 0.0
46 | 0.0
47 | 1.0
48 | 0.0
49 | 0.0
50 | 0.0
51 |
52 |
53 |
54 |
55 |
56 | 0.0
57 | 0.0
58 | 0.0
59 | 1.0
60 | 0.0
61 | 0.0
62 | 0.0
63 |
64 |
65 |
66 | 0.0
67 | 0.0
68 | 0.0
69 | 1.0
70 | 0.0
71 | 0.0
72 | 0.0
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/bowlerstudio/githublogin.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/bowlerstudio/java-keywords.css:
--------------------------------------------------------------------------------
1 | /*
2 | To change this license header, choose License Headers in Project Properties.
3 | To change this template file, choose Tools | Templates
4 | and open the template in the editor.
5 | */
6 | /*
7 | Created on : 28.03.2014, 23:11:29
8 | Author : Michael Hoffer <info@michaelhoffer.de>
9 | */
10 |
11 | .keyword {
12 | -fx-fill: brown;
13 | -fx-font-weight: bold;
14 | }
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/bowlerstudio/newCreaturLab.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/images/hat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/images/hat.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/images/logo.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/channel-default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/channel-default.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/channel-highlight.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/channel-highlight.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/channel-panel-background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/channel-panel-background.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/channel-selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/channel-selected.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/channel-update.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/channel-update.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/dyio-red.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/dyio-red.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/dyio-red2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/dyio-red2.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/dyio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/dyio.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/dyio2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/dyio2.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-analog-in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-analog-in.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-big-digital-in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-big-digital-in.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-big-digital-out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-big-digital-out.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-big-off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-big-off.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-counter-in-dir.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-counter-in-dir.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-counter-in-home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-counter-in-home.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-counter-in-int.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-counter-in-int.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-counter-out-dir.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-counter-out-dir.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-counter-out-home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-counter-out-home.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-counter-out-int.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-counter-out-int.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-dc-motor-direction.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-dc-motor-direction.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-dc-motor-velocity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-dc-motor-velocity.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-digital-in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-digital-in.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-digital-out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-digital-out.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-off.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-ppm-reader.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-ppm-reader.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-pwm-out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-pwm-out.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-servo-out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-servo-out.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-spi-clock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-spi-clock.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-spi-miso.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-spi-miso.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-spi-mosi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-spi-mosi.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-uart-rx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-uart-rx.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-uart-tx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-uart-tx.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-usart-rx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-usart-rx.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-usart-tx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/DyIO/images/icon-usart-tx.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/bootloader/images/blank.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/bootloader/images/blank.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/bootloader/images/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/bootloader/images/error.png
--------------------------------------------------------------------------------
/src/main/resources/com/neuronrobotics/nrconsole/plugin/bootloader/images/ok.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuronRobotics/BowlerStudio_legacy/1133aecd191a839a3e910b3a47b685a5cb187865/src/main/resources/com/neuronrobotics/nrconsole/plugin/bootloader/images/ok.png
--------------------------------------------------------------------------------
/src/main/resources/javax.usb.properties:
--------------------------------------------------------------------------------
1 | javax.usb.services = org.usb4java.javax.Services
--------------------------------------------------------------------------------
/src/main/resources/speech.properties:
--------------------------------------------------------------------------------
1 | # Copyright 2001 Sun Microsystems, Inc.
2 | # All Rights Reserved. Use is subject to license terms.
3 | #
4 | # See the file "license.terms" for information on usage and
5 | # redistribution of this file, and for a DISCLAIMER OF ALL
6 | # WARRANTIES.
7 | #
8 |
9 | # Modify this accordingly...
10 | #
11 | #TextSynthEngineCentral=com.sun.speech.engine.synthesis.text.TextEngineCentral
12 | #
13 | FreeTTSSynthEngineCentral=com.sun.speech.freetts.jsapi.FreeTTSEngineCentral
14 |
--------------------------------------------------------------------------------