├── .gitattributes ├── .github ├── FUNDING.yml └── workflows │ ├── release.yml │ └── verify.yml ├── .gitignore ├── .gitmodules ├── .travis.yml ├── COC.md ├── DEPENDENCIES.md ├── DEPENDENCIES_shallow.md ├── DEPENDENCIES_unknown.md ├── Depenancies.pdf ├── ISSUE_TEMPLATE.md ├── LICENSE ├── README.md ├── alllibs.txt ├── build.gradle ├── debian ├── .gitignore ├── README.Debian ├── README.source ├── bowlerstudio-docs.docs ├── bowlerstudio.doc-base.EX ├── changelog ├── changelog.gz ├── compat ├── control ├── copyright ├── install ├── outfile └── rules ├── genDeps.sh ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jvm.json ├── libraries └── .gitignore ├── log └── .gitignore ├── makeJar.sh ├── runMac.sh ├── searchLicense.sh ├── settings.gradle ├── src └── main │ ├── java │ └── com │ │ └── neuronrobotics │ │ ├── bowlerstudio │ │ ├── AddFileToGistController.java │ │ ├── BowlerStudio.java │ │ ├── BowlerStudioController.java │ │ ├── BowlerStudioFXMLController.java │ │ ├── BowlerStudioMenu.java │ │ ├── BowlerStudioMenuWorkspace.java │ │ ├── BowlerStudioModularFrame.java │ │ ├── ChangeAssetRepoController.java │ │ ├── ConnectionManager.java │ │ ├── CreatureLab3dController.java │ │ ├── DeviceSupportPluginMap.java │ │ ├── GistHelper.java │ │ ├── INewVitaminCallback.java │ │ ├── Main.java │ │ ├── MakeReleaseController.java │ │ ├── MeasurmentConfig.java │ │ ├── MenuRefreshEvent.java │ │ ├── MenuResettingEventHandler.java │ │ ├── NameGetter.java │ │ ├── NewCreatureWizard.java │ │ ├── NewVitaminWizardController.java │ │ ├── OutputFilter.java │ │ ├── PluginFactory.java │ │ ├── PluginManager.java │ │ ├── PluginManagerWidget.java │ │ ├── PsudoSplash.java │ │ ├── RedirectableStream.java │ │ ├── RpcCommandPanel.java │ │ ├── SplashManager.java │ │ ├── Terminal.java │ │ ├── TestServer.java │ │ ├── Tutorial.java │ │ ├── assets │ │ │ └── BowlerStudioResourceFactory.java │ │ ├── creature │ │ │ ├── AbstractGameController.java │ │ │ ├── AdjustbodyMassWidget.java │ │ │ ├── CreatureLab.java │ │ │ ├── CreatureLabControlsTab.java │ │ │ ├── DhLab.java │ │ │ ├── DhSettingsWidget.java │ │ │ ├── EngineeringUnitsSliderWidget.java │ │ │ ├── GameControlThreadManager.java │ │ │ ├── IAmControlled.java │ │ │ ├── IGameControllerUpdateListener.java │ │ │ ├── IGistPromptCompletionListener.java │ │ │ ├── IJogProvider.java │ │ │ ├── IOnEngineeringUnitsChange.java │ │ │ ├── IOnTransformChange.java │ │ │ ├── ITransformProvider.java │ │ │ ├── ITrimControl.java │ │ │ ├── JogMobileBase.java │ │ │ ├── JogThread.java │ │ │ ├── JogWidget.java │ │ │ ├── LinkConfigurationWidget.java │ │ │ ├── LinkGaugeController.java │ │ │ ├── LinkSliderWidget.java │ │ │ ├── MobleBaseMenueFactory.java │ │ │ ├── ParallelWidget.java │ │ │ ├── PhysicsWidget.java │ │ │ ├── TransformWidget.java │ │ │ ├── TransformWidgetTest.java │ │ │ ├── VitaminWidgetTest.java │ │ │ └── VitatminWidget.java │ │ ├── scripting │ │ │ ├── AskToDeleteWidget.java │ │ │ ├── GithubLoginFX.java │ │ │ ├── IExternalEditor.java │ │ │ ├── IScriptEventListener.java │ │ │ ├── ScriptingFileWidget.java │ │ │ ├── ScriptingWebWidget.java │ │ │ ├── ScriptingWidgetType.java │ │ │ └── external │ │ │ │ ├── ArduinoExternalEditor.java │ │ │ │ ├── BlenderExternalEditor.java │ │ │ │ ├── CaDoodleExternalEditor.java │ │ │ │ ├── EclipseExternalEditor.java │ │ │ │ ├── ExternalEditorController.java │ │ │ │ ├── FreeCADExternalEditor.java │ │ │ │ ├── GroovyEclipseExternalEditor.java │ │ │ │ ├── OpenSCADExternalEditor.java │ │ │ │ ├── SVGExternalEditor.java │ │ │ │ └── SceneBuilderExternalEditor.java │ │ ├── tabs │ │ │ ├── AbstractBowlerStudioTab.java │ │ │ ├── CalibrateGameControl.java │ │ │ ├── FirmataTab.java │ │ │ ├── LocalFileScriptTab.java │ │ │ ├── WebTab.java │ │ │ ├── WebTabController.java │ │ │ ├── WebTabFactory.java │ │ │ └── WebTabTest.java │ │ ├── threed │ │ │ ├── AssemblySlider.java │ │ │ ├── Axis.java │ │ │ ├── BowlerStudio3dEngine.java │ │ │ ├── CreaturelLabController.java │ │ │ ├── ICameraChangeListener.java │ │ │ ├── IControlsMap.java │ │ │ ├── Jbullet.java │ │ │ ├── MakeRuler.java │ │ │ ├── VirtualCameraMobileBase.java │ │ │ └── Xform.java │ │ └── utils │ │ │ ├── BowlerConnectionMenu.java │ │ │ ├── FindTextWidget.java │ │ │ ├── ImageTracer.java │ │ │ └── SVGFactory.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 │ │ │ ├── DyIO │ │ │ │ └── Secheduler │ │ │ │ │ ├── AnamationSequencer.java │ │ │ │ │ ├── SchedulerControlBar.java │ │ │ │ │ ├── SchedulerGui.java │ │ │ │ │ └── ServoOutputScheduleChannelUI.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 │ │ │ ├── PromptForGit.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 │ │ └── sdk │ │ └── addons │ │ └── kinematics │ │ ├── FirmataBowler.java │ │ └── FirmataLink.java │ └── resources │ ├── NeuronRobotics.ico │ ├── com │ └── neuronrobotics │ │ ├── bowlerstudio │ │ ├── applicationImageBackground-965x482.png │ │ ├── build.properties │ │ ├── ruler.png │ │ ├── splash-with-boarder.png │ │ └── splash.png │ │ └── nrconsole │ │ ├── images │ │ └── splash.png │ │ └── plugin │ │ └── bootloader │ │ └── images │ │ ├── blank.png │ │ ├── error.png │ │ └── ok.png │ ├── javax.usb.properties │ └── speech.properties ├── test.dxf └── wrappers ├── JavaVersionCheck.jar ├── linux ├── BowlerStudio.desktop ├── NeuronRobotics.png ├── bowlerstudio └── control └── osx ├── BowlerStudio └── bowler-scripting-kernel.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | src/main/java/com/neuronrobotics/bowlerstudio/NameGetter.java filter=unchanged 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | # github: madhephaestus 3 | github: CommonWealthRobotics 4 | patreon: madhephaestus 5 | #community_bridge: BowlerStudio 6 | issuehunt: CommonWealthRobotics/BowlerStudio 7 | #ko-fi: bowlerstudio 8 | #open_collective: kevin-harrington 9 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: "Release" 2 | on: 3 | push: 4 | tags: 5 | - '*' 6 | 7 | jobs: 8 | release: 9 | 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout repository and submodules 14 | uses: actions/checkout@v2 15 | with: 16 | submodules: recursive 17 | - name: Get the version 18 | id: get_version 19 | run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} 20 | 21 | - name: Configure GIt 22 | run: | 23 | git config --global user.email "mad.hephaestus@gmail.com" 24 | git config --global user.name "Kevin Harrington" 25 | git config --global pull.rebase false 26 | git config --global core.mergeoptions --no-edit 27 | git fetch --depth=1 28 | 29 | 30 | - name: Set Release Number Studio 31 | run: | 32 | echo $'app.name=BowlerStudio' > src/main/resources/com/neuronrobotics/bowlerstudio/build.properties 33 | echo "app.version=${{ steps.get_version.outputs.VERSION }}" >> src/main/resources/com/neuronrobotics/bowlerstudio/build.properties 34 | 35 | - name: Set OAuth Key 36 | env: # Or as an environment variable 37 | OAUTH_SECRET: ${{ secrets.OAUTH_SECRET }} 38 | run: | 39 | sed -i "s/REPLACE_ME/$OAUTH_SECRET/g" src/main/java/com/neuronrobotics/bowlerstudio/NameGetter.java 40 | 41 | 42 | - name: start xvfb 43 | run: 44 | Xvfb :99 & 45 | 46 | - name: initialize the X11 DISPLAY variable 47 | run: 48 | export DISPLAY=:99 49 | 50 | - name: Pull a JavaFX JDK 51 | run: wget http://static.azul.com/zulu/bin/zulu8.44.0.13-ca-fx-jdk8.0.242-linux_x64.tar.gz 52 | 53 | - name: After JDK download, list directory contnts 54 | run: pwd; ls -la 55 | 56 | - name: Build with Gradle 57 | run: bash makeJar.sh 58 | 59 | - name: release 60 | uses: actions/create-release@v1 61 | id: create_release 62 | with: 63 | draft: false 64 | prerelease: false 65 | release_name: ${{ steps.version.outputs.version }} 66 | tag_name: ${{ github.ref }} 67 | env: 68 | GITHUB_TOKEN: ${{ github.token }} 69 | - name: upload JVM Configuration 70 | uses: actions/upload-release-asset@v1 71 | env: 72 | GITHUB_TOKEN: ${{ github.token }} 73 | with: 74 | upload_url: ${{ steps.create_release.outputs.upload_url }} 75 | asset_path: jvm.json 76 | asset_name: jvm.json 77 | asset_content_type: application/json 78 | - name: upload BowlerStudio artifact 79 | uses: actions/upload-release-asset@v1 80 | env: 81 | GITHUB_TOKEN: ${{ github.token }} 82 | with: 83 | upload_url: ${{ steps.create_release.outputs.upload_url }} 84 | asset_path: ./build/libs/BowlerStudio.jar 85 | asset_name: BowlerStudio.jar 86 | asset_content_type: application/jar 87 | -------------------------------------------------------------------------------- /.github/workflows/verify.yml: -------------------------------------------------------------------------------- 1 | # test 2 | name: Test package 3 | on: 4 | push: 5 | branches: 6 | - '*' 7 | tags-ignore: 8 | - '*' 9 | pull_request: 10 | branches: 11 | - '*' 12 | 13 | jobs: 14 | build: 15 | 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - name: Checkout repository and submodules 20 | uses: actions/checkout@v2 21 | with: 22 | submodules: recursive 23 | 24 | - name: List directory contents 25 | run: pwd; ls -la 26 | 27 | - name: start xvfb 28 | run: 29 | Xvfb :0 & 30 | 31 | - name: initialize the X11 DISPLAY variable 32 | run: 33 | export DISPLAY=:0 34 | 35 | - name: After checkout, list directory contnts 36 | run: pwd; ls -la 37 | 38 | - name: Build with Gradle 39 | run: bash makeJar.sh 40 | -------------------------------------------------------------------------------- /.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 | /.idea* 13 | 14 | /build/ 15 | /whitecylinder/ 16 | *.iml 17 | /CSGdatabase.json 18 | /jbullet-20101010/ 19 | /.DS_Store 20 | *hs_err_pid*.log* 21 | *.debuggerDefaults* 22 | /*.svg 23 | /*.svg.png 24 | /.combined.png-autosave.kra 25 | /combined.png 26 | /Oracle_VM_VirtualBox_Extension_Pack-5.2.20.vbox-extpack 27 | /chdk-ptp-java.log 28 | /deps.txt 29 | /MUJOCO_LOG.TXT 30 | /physicsTest/ 31 | /zulu*.tar.gz 32 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libraries/bowler-script-kernel"] 2 | path = libraries/bowler-script-kernel 3 | url = https://github.com/CommonWealthRobotics/bowler-script-kernel.git 4 | [submodule "libraries/dockfx"] 5 | path = libraries/dockfx 6 | url = https://github.com/CommonWealthRobotics/dockfx.git 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | before_install: 3 | - "export DISPLAY=:99.0" 4 | - "export TERM=dumb" 5 | - "sh -e /etc/init.d/xvfb start" 6 | 7 | 8 | script: 9 | - TERM=dumb ./gradlew compileJava javadoc 10 | cache: 11 | directories: 12 | - $HOME/.m2 13 | 14 | jdk: 15 | - oraclejdk8 16 | 17 | # for running tests on Travis CI container infrastructure for faster builds 18 | sudo: true 19 | dist: trusty 20 | 21 | -------------------------------------------------------------------------------- /COC.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies within all project spaces, and it also applies when 49 | an individual is representing the project or its community in public spaces. 50 | Examples of representing a project or community include using an official 51 | project e-mail address, posting via an official social media account, or acting 52 | as an appointed representative at an online or offline event. Representation of 53 | a project may be further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at [INSERT EMAIL ADDRESS]. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /DEPENDENCIES.md: -------------------------------------------------------------------------------- 1 | 2 | batik-all.jar , Apache 3 | batik-awt-util-1.7.jar , Apache 4 | batik-svggen-1.7.jar , Apache 5 | batik-util-1.7.jar , Apache 6 | bowler-kernel.jar , Apache 7 | commons-beanutils-1.8.0.jar , Apache 8 | commons-codec-1.13.jar , Apache 9 | commons-collections-3.2.2.jar , Apache 10 | commons-discovery-0.4.jar , Apache 11 | commons-fileupload-1.2.1.jar , Apache 12 | commons-io-2.6.jar , Apache 13 | commons-lang-2.6.jar , Apache 14 | commons-lang3-3.11.jar , Apache 15 | commons-logging-1.2.jar , Apache 16 | commons-math3-3.6.1.jar , Apache 17 | commons-net-3.3.jar , Apache 18 | controlsfx-8.0.6.jar , Unknown 19 | groovy-2.3.7.jar , Apache 20 | groovy-all-2.4.5.jar , Apache 21 | hamcrest-core-1.1.jar , BSD 22 | httpclient-4.5.1.jar , Apache 23 | httpcore-4.4.3.jar , Apache 24 | httpcore-nio-4.1.jar , Apache 25 | icu4j-54.1.1.jar , BSD 26 | ivy-2.2.0.jar , Apache 27 | jackson-annotations-2.10.1.jar , Apache 28 | jackson-core-2.10.1.jar , Apache 29 | jackson-databind-2.10.1.jar , Apache 30 | jakarta.activation-api-1.2.1.jar , Unknown 31 | jakarta.xml.bind-api-2.3.2.jar , Unknown 32 | javax.annotation-api-1.2.jar , CDDL 33 | javax.servlet-api-3.1.0.jar , CDDL 34 | jetty-continuation-9.4.36.v20210114.jar , Apache 35 | jetty-http-9.4.36.v20210114.jar , Apache 36 | jetty-io-9.4.36.v20210114.jar , Apache 37 | jetty-security-9.4.36.v20210114.jar , Apache 38 | jetty-server-9.4.36.v20210114.jar , Apache 39 | jetty-servlet-9.4.36.v20210114.jar , Apache 40 | jetty-servlets-9.4.36.v20210114.jar , Apache 41 | jetty-util-9.4.36.v20210114.jar , Apache 42 | jetty-util-ajax-9.4.36.v20210114.jar , Apache 43 | jetty-webapp-9.4.36.v20210114.jar , Apache 44 | jetty-xml-9.4.36.v20210114.jar , Apache 45 | jtok-core-1.9.3.jar , Apache 46 | junit-4.10.jar , BSD 47 | jython-2.5.3.jar , Apache 48 | jython-standalone-2.5.2.jar , Apache 49 | log4j-1.2.16.jar , Apache 50 | mockito-all-1.9.5.jar , MIT License 51 | opennlp-maxent-3.0.3.jar , Apache 52 | opennlp-tools-1.5.3.jar , Apache 53 | pdf-transcoder.jar , Apache 54 | svg-dom-java-1.1.jar , W3C 55 | xml-apis-1.3.04.jar , Apache 56 | xml-apis-ext.jar , Apache 57 | xml-apis.jar , W3C 58 | xmlrpc-client-3.1.3.jar , Apache 59 | xmlrpc-common-3.1.3.jar , Apache 60 | -------------------------------------------------------------------------------- /DEPENDENCIES_unknown.md: -------------------------------------------------------------------------------- 1 | 2 | annotation-indexer-1.4.jar 3 | asm5-5.0.1.jar 4 | asm-all-3.1.jar 5 | asm-debug-all-4.2.jar 6 | bcpg-jdk15on-1.64.jar 7 | bcpkix-jdk15on-1.64.jar 8 | bcprov-jdk15on-1.64.jar 9 | bluecove-2.1.1.jar 10 | bluecove-gpl-2.1.1.jar 11 | bridge-method-annotation-1.14.jar 12 | bridge-method-injector-1.14.jar 13 | CHDK-PTP-Java-0.5.3-SNAPSHOT.jar 14 | clojure-1.8.0.jar 15 | de.huxhorn.sulky.3rdparty.jlayer-1.0.jar 16 | dockfx.jar 17 | easybind-1.0.4-SNAPSHOT.jar 18 | emotionml-checker-java-1.1.jar 19 | ezmorph-1.0.6.jar 20 | fast-md5-2.7.1.jar 21 | firmata4j-2.3.4.1.jar 22 | flowless-0.4.jar 23 | github-api-1.101.jar 24 | GithubPasswordManager-0.6.1.jar 25 | gson-2.5.jar 26 | guava-14.0.1.jar 27 | hsqldb-2.0.0.jar 28 | ihmc-native-library-loader-1.3.1.jar 29 | jama-1.0.3.jar 30 | Jampack-1.0.jar 31 | JavaCad-0.27.0.jar 32 | javacpp-1.5.7.jar 33 | JavaEWAH-1.1.6.jar 34 | jbullet-2.72.2.4.jar 35 | jbullet-2.72.2.4-sources.jar 36 | jcommon-1.0.15.jar 37 | jfreechart-1.0.12.jar 38 | jinput-2.0.6-ihmc2.jar 39 | jinput-platform-2.0.6-natives-linux.jar 40 | jinput-platform-2.0.6-natives-osx.jar 41 | jinput-platform-2.0.6-natives-windows.jar 42 | jl1.0.jar 43 | jmf-2.1.1e.jar 44 | jsapi.jar 45 | jsch-0.1.55.jar 46 | js.jar 47 | json-20180813.jar 48 | json-lib-2.4-jenkins-2.jar 49 | json-simple-1.1.jar 50 | jsoup-1.8.3.jar 51 | jsr305-2.0.1.jar 52 | jssc-2.8.0.jar 53 | junit-4.0.jar 54 | jutils-1.0.0.jar 55 | jwnl-1.3.3.jar 56 | jxl-2.4.2.jar 57 | jzlib-1.1.3.jar 58 | kabeja-0.4.jar 59 | kabeja-svg-0.4.jar 60 | kabeja-xslt.jar 61 | libusb4java-1.2.0-linux-arm.jar 62 | libusb4java-1.2.0-linux-x86_64.jar 63 | libusb4java-1.2.0-linux-x86.jar 64 | libusb4java-1.2.0-osx-x86_64.jar 65 | libusb4java-1.2.0-osx-x86.jar 66 | libusb4java-1.2.0-windows-x86_64.jar 67 | libusb4java-1.2.0-windows-x86.jar 68 | localizer-1.7.jar 69 | marytts-common-5.2.jar 70 | marytts-lang-en-5.2.jar 71 | marytts-runtime-5.2.jar 72 | marytts-signalproc-5.2.jar 73 | maven-plugin-api-2.0.1.jar 74 | mbrola.jar 75 | Medusa-7.1.jar 76 | miethxml-toolkit.jar 77 | miethxml-ui.jar 78 | miglayout-core-4.2.jar 79 | miglayout-swing-4.2.jar 80 | motej.0.9.jar 81 | mujoco-java-2.2.0-pre.5.jar 82 | nrjavaserial-5.1.1.jar 83 | nrsdk-3.33.0-jar-with-dependencies.jar 84 | nrV4J-3.8.1.jar 85 | okhttp-2.0.0.jar 86 | okhttp-urlconnection-2.0.0.jar 87 | okio-1.0.0.jar 88 | org.eclipse.jgit-5.6.0.201912101111-r.jar 89 | protobuf-java-3.8.0.jar 90 | reactfx-2.0-M5.jar 91 | richtextfx-0.6.jar 92 | rosjava-0.1.6.jar 93 | rsyntaxtextarea-2.6.0.jar 94 | slf4j-api-1.7.7.jar 95 | slf4j-simple-1.6.1.jar 96 | smack-3.2.1.jar 97 | smackx-3.2.1.jar 98 | smil-boston-dom-java-2000-02-25.jar 99 | stack-alloc.jar 100 | stapler-1.237.jar 101 | swing-layout-1.0.3.jar 102 | tiger-types-1.3.jar 103 | tink-1.3.0-rc1.jar 104 | trove4j-2.0.2.jar 105 | undofx-2.1.1.jar 106 | usb4java-1.2.0.jar 107 | usb4java-javax-1.2.0.jar 108 | usb-api-1.0.2.jar 109 | vecmath-1.3.1.jar 110 | voice-cmu-slt-hsmm-5.2.jar 111 | voice-dfki-poppy-hsmm-5.2.jar 112 | voice-dfki-prudence-hsmm-5.2.jar 113 | voice-dfki-spike-hsmm-5.2.jar 114 | vvecmath-0.3.2.jar 115 | WalnutiQ-2.3.3.jar 116 | wellbehavedfx-0.1.1.jar 117 | wordnet-random-name-1.2.jar 118 | ws-commons-util-1.0.2.jar 119 | -------------------------------------------------------------------------------- /Depenancies.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CommonWealthRobotics/BowlerStudio/c6a15352f19793e7ec6a812db4f6ceaab28b9af1/Depenancies.pdf -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Installed Version 2 | 3 | ### OS type and version number 4 | 5 | ### Expected behavior 6 | 7 | ### Actual Behavior 8 | 9 | ### Steps to reproduce the behavior 10 | -------------------------------------------------------------------------------- /debian/.gitignore: -------------------------------------------------------------------------------- 1 | /changelog.bak 2 | /.changelog.swp 3 | -------------------------------------------------------------------------------- /debian/README.Debian: -------------------------------------------------------------------------------- 1 | bowlerstudio for Debian 2 | ---------------------- 3 | 4 | 5 | 6 | -- Kevin Harrington Sun, 26 Jun 2016 11:43:09 -0400 7 | -------------------------------------------------------------------------------- /debian/README.source: -------------------------------------------------------------------------------- 1 | bowlerstudio for Debian 2 | ---------------------- 3 | 4 | 6 | 7 | 8 | 9 | -- Kevin Harrington Sun, 26 Jun 2016 11:43:09 -0400 10 | 11 | -------------------------------------------------------------------------------- /debian/bowlerstudio-docs.docs: -------------------------------------------------------------------------------- 1 | README.source 2 | README.Debian 3 | -------------------------------------------------------------------------------- /debian/bowlerstudio.doc-base.EX: -------------------------------------------------------------------------------- 1 | Document: bowlerstudio 2 | Title: Debian bowlerstudio Manual 3 | Author: 4 | Abstract: This manual describes what bowlerstudio is 5 | and how it can be used to 6 | manage online manuals on Debian systems. 7 | Section: unknown 8 | 9 | Format: debiandoc-sgml 10 | Files: /usr/share/doc/bowlerstudio/bowlerstudio.sgml.gz 11 | 12 | Format: postscript 13 | Files: /usr/share/doc/bowlerstudio/bowlerstudio.ps.gz 14 | 15 | Format: text 16 | Files: /usr/share/doc/bowlerstudio/bowlerstudio.text.gz 17 | 18 | Format: HTML 19 | Index: /usr/share/doc/bowlerstudio/html/index.html 20 | Files: /usr/share/doc/bowlerstudio/html/*.html 21 | -------------------------------------------------------------------------------- /debian/changelog.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CommonWealthRobotics/BowlerStudio/c6a15352f19793e7ec6a812db4f6ceaab28b9af1/debian/changelog.gz -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: bowlerstudio 2 | Package: bowlerstudio 3 | Priority: extra 4 | Maintainer: Customer Support 5 | Architecture: all 6 | Version: 0.18.6 7 | Depends: oracle-java8-set-default,libopencv2.4-java,libopencv2.4-jni,slic3r,jarwrapper,arduino 8 | Provides: bowlerstudio 9 | Conflicts: modemmanager,nr-rdk-java 10 | Replaces: modemmanager,nr-rdk-java 11 | Description: Robotics Development Engironment and runtime. 12 | A scripting platform for writing, designing, simulating 13 | and manufacturing robots. 14 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: bowlerstudio 3 | Source: 4 | 5 | Files: * 6 | Copyright: 7 | 8 | License: 9 | 10 | 11 | . 12 | 13 | 14 | # If you want to use GPL v2 or later for the /debian/* files use 15 | # the following clauses, or change it to suit. Delete these two lines 16 | Files: debian/* 17 | Copyright: 2016 Kevin Harrington 18 | License: GPL-2+ 19 | This package is free software; you can redistribute it and/or modify 20 | it under the terms of the GNU General Public License as published by 21 | the Free Software Foundation; either version 2 of the License, or 22 | (at your option) any later version. 23 | . 24 | This package is distributed in the hope that it will be useful, 25 | but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | GNU General Public License for more details. 28 | . 29 | You should have received a copy of the GNU General Public License 30 | along with this program. If not, see 31 | . 32 | On Debian systems, the complete text of the GNU General 33 | Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". 34 | 35 | # Please also look if there are files or directories which have a 36 | # different copyright/license attached and list them here. 37 | # Please avoid picking licenses with terms that are more restrictive than the 38 | # packaged work, as it may make Debian's contributions unacceptable upstream. 39 | -------------------------------------------------------------------------------- /debian/install: -------------------------------------------------------------------------------- 1 | usr/share/bowlerstudio/BowlerStudio.jar /usr/share/bowlerstudio/ 2 | usr/share/bowlerstudio/NeuronRobotics.ico /usr/share/bowlerstudio/ 3 | usr/share/bowlerstudio/NeuronRobotics.png /usr/share/bowlerstudio/ 4 | usr/share/bowlerstudio/dyio-3.14.6.xml /usr/share/bowlerstudio/ 5 | usr/bin/bowlerstudio /usr/bin/ 6 | usr/share/bowlerstudio/NeuronRobotics.png /usr/share/themes/base/neuronrobotics/icons/ 7 | usr/share/bowlerstudio/BowlerStudio.desktop /usr/share/applications/ 8 | usr/share/bowlerstudio/81-neuronrobotics.rules /etc/udev/rules.d/ 9 | usr/share/doc/bowlerstudio/copyright /usr/share/doc/bowlerstudio/ 10 | usr/share/doc/bowlerstudio/changelog.gz /usr/share/doc/bowlerstudio/ 11 | -------------------------------------------------------------------------------- /debian/outfile: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | JAVA_HOME=/usr/lib/jvm/default-java 2 | 3 | %: 4 | dh $@ --with javahelper 5 | 6 | override_dh_auto_build: 7 | dh_auto_build -- dist 8 | 9 | override_dh_install: 10 | dh_auto_build -- package-debian 11 | dh_install 12 | 13 | override_jh_exec: 14 | exit 0 15 | -------------------------------------------------------------------------------- /genDeps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #./gradlew showAll>alllibs.txt 4 | 5 | sort alllibs.txt |grep .jar|uniq >DEPENDENCIES_shallow.md 6 | 7 | echo "" > DEPENDENCIES.md 8 | echo "" > DEPENDENCIES_unknown.md 9 | for VARIABLE in $(cat DEPENDENCIES_shallow.md) 10 | do 11 | LOCATION=$(locate -l 1 $VARIABLE) 12 | FILE=$(unzip -l $LOCATION | grep LICENSE|grep -v "LICENSE.") 13 | stringarray=($FILE) 14 | LOCENSELOC=$(echo ${stringarray[3]}) 15 | if [ -z "$LOCENSELOC" ] 16 | then 17 | FILE=$(unzip -l $LOCATION | grep LICENSE|grep ".txt"|grep -v "documentation") 18 | stringarray=($FILE) 19 | LOCENSELOC=$(echo ${stringarray[3]}) 20 | 21 | fi 22 | if [ -z "$LOCENSELOC" ] 23 | then 24 | FILE=$(unzip -l $LOCATION | grep license|grep ".txt"|grep -v "documentation") 25 | stringarray=($FILE) 26 | LOCENSELOC=$(echo ${stringarray[3]}) 27 | fi 28 | if [ -z "$LOCENSELOC" ] 29 | then 30 | FILE=$(unzip -l $LOCATION | grep LICENSE.md) 31 | stringarray=($FILE) 32 | LOCENSELOC=$(echo ${stringarray[3]}) 33 | fi 34 | if [ -z "$LOCENSELOC" ] 35 | then 36 | FILE=$(unzip -l $LOCATION | grep license.html) 37 | stringarray=($FILE) 38 | LOCENSELOC=$(echo ${stringarray[3]}) 39 | fi 40 | if [ -z "$LOCENSELOC" ] 41 | then 42 | echo "$VARIABLE No license file" 43 | TYPE="No License " 44 | echo "$VARIABLE">> DEPENDENCIES_unknown.md 45 | else 46 | echo "Licance file to be used: $VARIABLE $LOCENSELOC" 47 | #echo "Searching $VARIABLE for $LOCENSELOC" 48 | 49 | LICENSE=$(unzip -p $LOCATION $LOCENSELOC) 50 | 51 | TYPE=$LICENSE 52 | if [ -z "$TYPE" ] 53 | then 54 | echo "$VARIABLE No license file" 55 | TYPE="No License $LOCATION" 56 | else 57 | shopt -s nocasematch; 58 | if [[ "$LICENSE" =~ "apache" ]]; then 59 | TYPE="Apache" 60 | #echo "Apache license found" 61 | elif [[ "$LICENSE" =~ "MIT License" ]]; then 62 | TYPE="MIT License" 63 | elif [[ "$LICENSE" =~ "BSD" ]]; then 64 | TYPE="BSD" 65 | elif [[ "$LICENSE" =~ "W3C" ]]; then 66 | TYPE="W3C" 67 | elif [[ "$LICENSE" =~ "CDDL" ]]; then 68 | TYPE="CDDL" 69 | else 70 | echo " $LOCATION Unknown $LICENSE" 71 | TYPE="Unknown" 72 | #exit 1 73 | fi 74 | fi 75 | echo "$VARIABLE , $TYPE">> DEPENDENCIES.md 76 | fi 77 | 78 | 79 | done 80 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | rg.gradle.jvmargs=-Dprism.forceGPU=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CommonWealthRobotics/BowlerStudio/c6a15352f19793e7ec6a812db4f6ceaab28b9af1/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /jvm.json: -------------------------------------------------------------------------------- 1 | { 2 | "Linux-x64":{ 3 | "url":"https://cdn.azul.com/zulu/bin/" 4 | , 5 | "type":"tar.gz", 6 | "name":"zulu17.50.19-ca-fx-jdk17.0.11-linux_x64", 7 | "jvmargs":["-Dprism.forceGPU=true","-XX:MaxRAMPercentage=90.0", "--add-exports", 8 | "javafx.graphics/com.sun.javafx.css=ALL-UNNAMED", 9 | "--add-exports", 10 | "javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED", 11 | "--add-exports", 12 | "javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED", 13 | "--add-exports", 14 | "javafx.base/com.sun.javafx.event=ALL-UNNAMED", 15 | "--add-exports", 16 | "javafx.controls/com.sun.javafx.scene.control.skin.resources=ALL-UNNAMED", 17 | "--add-exports", 18 | "javafx.graphics/com.sun.javafx.util=ALL-UNNAMED", 19 | "--add-exports", 20 | "javafx.graphics/com.sun.javafx.scene.input=ALL-UNNAMED", 21 | "--add-opens", 22 | "javafx.graphics/javafx.scene=ALL-UNNAMED"] 23 | }, 24 | "Linux-aarch64":{ 25 | "url":"https://cdn.azul.com/zulu/bin/" 26 | , 27 | "type":"tar.gz", 28 | "name":"zulu17.52.17-ca-fx-jdk17.0.12-linux_aarch64", 29 | "jvmargs":["-Dprism.forceGPU=true","-XX:MaxRAMPercentage=90.0", "--add-exports", 30 | "javafx.graphics/com.sun.javafx.css=ALL-UNNAMED", 31 | "--add-exports", 32 | "javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED", 33 | "--add-exports", 34 | "javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED", 35 | "--add-exports", 36 | "javafx.base/com.sun.javafx.event=ALL-UNNAMED", 37 | "--add-exports", 38 | "javafx.controls/com.sun.javafx.scene.control.skin.resources=ALL-UNNAMED", 39 | "--add-exports", 40 | "javafx.graphics/com.sun.javafx.util=ALL-UNNAMED", 41 | "--add-exports", 42 | "javafx.graphics/com.sun.javafx.scene.input=ALL-UNNAMED", 43 | "--add-opens", 44 | "javafx.graphics/javafx.scene=ALL-UNNAMED"] 45 | }, 46 | "Windows-x64":{ 47 | "url":"https://cdn.azul.com/zulu/bin/" 48 | , 49 | "type":"zip", 50 | "name":"zulu17.50.19-ca-fx-jdk17.0.11-win_x64", 51 | "jvmargs":["-XX:MaxRAMPercentage=90.0", "--add-exports", 52 | "javafx.graphics/com.sun.javafx.css=ALL-UNNAMED", 53 | "--add-exports", 54 | "javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED", 55 | "--add-exports", 56 | "javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED", 57 | "--add-exports", 58 | "javafx.base/com.sun.javafx.event=ALL-UNNAMED", 59 | "--add-exports", 60 | "javafx.controls/com.sun.javafx.scene.control.skin.resources=ALL-UNNAMED", 61 | "--add-exports", 62 | "javafx.graphics/com.sun.javafx.util=ALL-UNNAMED", 63 | "--add-exports", 64 | "javafx.graphics/com.sun.javafx.scene.input=ALL-UNNAMED", 65 | "--add-opens", 66 | "javafx.graphics/javafx.scene=ALL-UNNAMED"] 67 | }, 68 | "Mac-x64":{ 69 | "url":"https://cdn.azul.com/zulu/bin/" 70 | , 71 | "type":"zip", 72 | "name":"zulu17.50.19-ca-fx-jdk17.0.11-macosx_x64", 73 | "jvmargs":["-Dprism.forceGPU=true","-XX:MaxRAMPercentage=90.0", "--add-exports", 74 | "javafx.graphics/com.sun.javafx.css=ALL-UNNAMED", 75 | "--add-exports", 76 | "javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED", 77 | "--add-exports", 78 | "javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED", 79 | "--add-exports", 80 | "javafx.base/com.sun.javafx.event=ALL-UNNAMED", 81 | "--add-exports", 82 | "javafx.controls/com.sun.javafx.scene.control.skin.resources=ALL-UNNAMED", 83 | "--add-exports", 84 | "javafx.graphics/com.sun.javafx.util=ALL-UNNAMED", 85 | "--add-exports", 86 | "javafx.graphics/com.sun.javafx.scene.input=ALL-UNNAMED", 87 | "--add-opens", 88 | "javafx.graphics/javafx.scene=ALL-UNNAMED"] 89 | }, 90 | "Mac-aarch64":{ 91 | "url":"https://cdn.azul.com/zulu/bin/" 92 | , 93 | "type":"zip", 94 | "name":"zulu17.50.19-ca-fx-jdk17.0.11-macosx_aarch64", 95 | "jvmargs":["-Dprism.forceGPU=true","-XX:MaxRAMPercentage=90.0", "--add-exports", 96 | "javafx.graphics/com.sun.javafx.css=ALL-UNNAMED", 97 | "--add-exports", 98 | "javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED", 99 | "--add-exports", 100 | "javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED", 101 | "--add-exports", 102 | "javafx.base/com.sun.javafx.event=ALL-UNNAMED", 103 | "--add-exports", 104 | "javafx.controls/com.sun.javafx.scene.control.skin.resources=ALL-UNNAMED", 105 | "--add-exports", 106 | "javafx.graphics/com.sun.javafx.util=ALL-UNNAMED", 107 | "--add-exports", 108 | "javafx.graphics/com.sun.javafx.scene.input=ALL-UNNAMED", 109 | "--add-opens", 110 | "javafx.graphics/javafx.scene=ALL-UNNAMED"] 111 | } 112 | 113 | } -------------------------------------------------------------------------------- /libraries/.gitignore: -------------------------------------------------------------------------------- 1 | /.project 2 | /.settings/ 3 | /.classpath 4 | -------------------------------------------------------------------------------- /log/.gitignore: -------------------------------------------------------------------------------- 1 | /server.log 2 | -------------------------------------------------------------------------------- /makeJar.sh: -------------------------------------------------------------------------------- 1 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 2 | 3 | export ARCH=x86_64 4 | JVM=zulu8.78.0.19-ca-fx-jdk8.0.412-linux_x64 5 | set -e 6 | ZIP=$JVM.tar.gz 7 | export JAVA_HOME=$HOME/bin/java8/ 8 | if test -d $JAVA_HOME/$JVM/; then 9 | echo "$JAVA_HOME exists." 10 | else 11 | rm -rf $JAVA_HOME 12 | mkdir -p $JAVA_HOME 13 | wget https://cdn.azul.com/zulu/bin/$ZIP 14 | tar -xvzf $ZIP -C $JAVA_HOME 15 | mv $JAVA_HOME/$JVM/* $JAVA_HOME/ 16 | fi 17 | echo "Java home set to $JAVA_HOME" 18 | 19 | ./gradlew clean shadowJar -------------------------------------------------------------------------------- /runMac.sh: -------------------------------------------------------------------------------- 1 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 2 | 3 | export ARCH=x86_64 4 | JVM=zulu17.50.19-ca-fx-jdk17.0.11-macosx_x64 5 | set -e 6 | ZIP=$JVM.tar.gz 7 | export JAVA_HOME=$HOME/bin/java17/ 8 | if test -d $JAVA_HOME/$JVM/; then 9 | echo "$JAVA_HOME exists." 10 | else 11 | rm -rf $JAVA_HOME 12 | mkdir -p $JAVA_HOME 13 | curl -L https://cdn.azul.com/zulu/bin/$ZIP -o $ZIP 14 | tar -xvzf $ZIP -C $JAVA_HOME 15 | mv $JAVA_HOME/$JVM/* $JAVA_HOME/ 16 | fi 17 | echo "Java home set to $JAVA_HOME" 18 | ./gradlew --stop 19 | #rm -rf ~/.gradle/caches/ 20 | #rm -rf ~/.gradle/daemon/ 21 | ./gradlew clean build --refresh-dependencies 22 | ./gradlew shadowJar 23 | 24 | $JAVA_HOME/bin/java -Dprism.forceGPU=true --add-exports \ 25 | javafx.graphics/com.sun.javafx.css=ALL-UNNAMED \ 26 | --add-exports \ 27 | javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED \ 28 | --add-exports \ 29 | javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED \ 30 | --add-exports \ 31 | javafx.base/com.sun.javafx.event=ALL-UNNAMED \ 32 | --add-exports \ 33 | javafx.controls/com.sun.javafx.scene.control.skin.resources=ALL-UNNAMED \ 34 | --add-exports \ 35 | javafx.graphics/com.sun.javafx.util=ALL-UNNAMED \ 36 | --add-exports \ 37 | javafx.graphics/com.sun.javafx.scene.input=ALL-UNNAMED \ 38 | --add-opens \ 39 | javafx.graphics/javafx.scene=ALL-UNNAMED \ 40 | -jar build/libs/BowlerStudio.jar -------------------------------------------------------------------------------- /searchLicense.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for VARIABLE in $(cat DEPENDENCIES_unknown.md) 3 | do 4 | LOCATION=$(locate -l 1 $VARIABLE) 5 | echo $VARIABLE 6 | unzip -l $LOCATION | grep -i "license" 7 | done -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':libraries:bowler-script-kernel' 2 | include ':libraries:bowler-script-kernel:java-bowler' 3 | include ':libraries:dockfx' 4 | include ':libraries:bowler-script-kernel:GithubPasswordManager:GithubPasswordManager' 5 | rootProject.name = 'BowlerStudio' 6 | 7 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/ChangeAssetRepoController.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio; 2 | 3 | import com.neuronrobotics.bowlerstudio.assets.AssetFactory; 4 | import com.neuronrobotics.bowlerstudio.assets.ConfigurationDatabase; 5 | import com.neuronrobotics.bowlerstudio.assets.FontSizeManager; 6 | 7 | import javafx.application.Application; 8 | import javafx.application.Platform; 9 | import javafx.event.ActionEvent; 10 | import javafx.fxml.FXML; 11 | import javafx.fxml.FXMLLoader; 12 | import javafx.scene.Parent; 13 | import javafx.scene.Scene; 14 | import javafx.scene.control.Button; 15 | import javafx.scene.control.TextField; 16 | import javafx.stage.Modality; 17 | import javafx.stage.Stage; 18 | 19 | /** 20 | * Created by Ryan Benasutti on 2/6/2016. 21 | */ 22 | 23 | public class ChangeAssetRepoController extends Application { 24 | @FXML 25 | private TextField repoField; 26 | 27 | @FXML 28 | private Button changeRepoButton, cancelButton; 29 | 30 | public ChangeAssetRepoController() {} 31 | 32 | @SuppressWarnings("restriction") 33 | @Override 34 | public void start(Stage primaryStage) throws Exception { 35 | FXMLLoader loader = AssetFactory.loadLayout("layout/changeAssetRepo.fxml", true); 36 | Parent root; 37 | loader.setController(this); 38 | // This is needed when loading on MAC 39 | loader.setClassLoader(getClass().getClassLoader()); 40 | root = loader.load(); 41 | FontSizeManager.addListener(fontNum->{ 42 | int tmp = fontNum-10; 43 | if(tmp<12) 44 | tmp=12; 45 | root.setStyle("-fx-font-size: "+tmp+"pt"); 46 | }); 47 | BowlerStudio.runLater(() -> { 48 | primaryStage.setTitle("Change Asset Repository"); 49 | 50 | Scene scene = new Scene(root); 51 | primaryStage.setScene(scene); 52 | primaryStage.initModality(Modality.WINDOW_MODAL); 53 | primaryStage.setResizable(true); 54 | primaryStage.show(); 55 | }); 56 | } 57 | 58 | @FXML 59 | public void onChangeRepo(ActionEvent event) 60 | { 61 | String repo = repoField.getText() 62 | .replaceAll("git://", "https://"); 63 | new Thread(()->{ 64 | ConfigurationDatabase.setObject("BowlerStudioConfigs", "skinRepo", 65 | repo); 66 | ConfigurationDatabase.save(); 67 | 68 | }).start(); 69 | 70 | Stage stage = (Stage) changeRepoButton.getScene().getWindow(); 71 | stage.close(); 72 | 73 | } 74 | 75 | @FXML 76 | public void onCancel(ActionEvent event) { 77 | BowlerStudio.runLater(() -> { 78 | Stage stage = (Stage) cancelButton.getScene().getWindow(); 79 | stage.close(); 80 | }); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /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/GistHelper.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio; 2 | 3 | import com.neuronrobotics.bowlerstudio.scripting.PasswordManager; 4 | import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine; 5 | import com.neuronrobotics.sdk.common.Log; 6 | import com.neuronrobotics.sdk.util.ThreadUtil; 7 | import org.eclipse.jgit.api.errors.GitAPIException; 8 | //import org.jfree.util.Log; 9 | import org.kohsuke.github.GHGist; 10 | import org.kohsuke.github.GHGistBuilder; 11 | import org.kohsuke.github.GHGistFile; 12 | import org.kohsuke.github.GitHub; 13 | 14 | import java.io.IOException; 15 | import java.net.URL; 16 | 17 | /** 18 | * Created by Ryan Benasutti on 2/5/2016. 19 | */ 20 | 21 | public class GistHelper 22 | { 23 | private GistHelper() {} 24 | 25 | public static String createNewGist(String filename, String description, boolean isPublic) 26 | { 27 | //TODO: Perhaps this method should throw GitAPIException and IOException 28 | //Setup gist 29 | String defaultContents = "";//; 30 | GitHub gitHub = PasswordManager.getGithub(); 31 | GHGistBuilder builder = gitHub.createGist(); 32 | builder.file(filename, defaultContents); 33 | builder.description(description); 34 | builder.public_(isPublic); 35 | 36 | //Make gist 37 | return createGistFromBuilder(builder, filename); 38 | } 39 | 40 | public static String addFileToGist(String filename, String content, GHGist gistID) 41 | { 42 | GitHub gitHub = PasswordManager.getGithub(); 43 | try 44 | { 45 | //Copy from old gist 46 | GHGist oldGist = gistID; 47 | GHGistBuilder builder = gitHub.createGist(); 48 | 49 | builder.description(oldGist.getDescription()); 50 | builder.public_(oldGist.isPublic()); 51 | 52 | for (String key : oldGist.getFiles().keySet()) 53 | builder.file(key, oldGist.getFiles().get(key).getContent()); 54 | 55 | //Add new file 56 | builder.file(filename, content); 57 | 58 | //Make new gist with old filename 59 | return createGistFromBuilder(builder, oldGist.getFiles().values().iterator().next().getFileName()); 60 | 61 | 62 | } 63 | catch (Exception e) 64 | { 65 | e.printStackTrace(); 66 | } 67 | return null; 68 | } 69 | 70 | private static String createGistFromBuilder(GHGistBuilder builder, String filename) 71 | { 72 | GHGist gist; 73 | try 74 | { 75 | gist = builder.create(); 76 | //String gistID = ScriptingEngine.urlToGist(gist.getHtmlUrl()); 77 | 78 | //BowlerStudio.openUrlInNewTab(new URL(gist.getHtmlUrl())); 79 | com.neuronrobotics.sdk.common.Log.error("Creating repo"); 80 | while (true) 81 | { 82 | try 83 | { 84 | ScriptingEngine.fileFromGit(gist.getGitPullUrl(), filename); 85 | break; 86 | } 87 | catch (GitAPIException e) 88 | { 89 | e.printStackTrace(); 90 | } 91 | 92 | ThreadUtil.wait(500); 93 | //Log.warn(filename + " not built yet"); 94 | } 95 | 96 | com.neuronrobotics.sdk.common.Log.error("Creating gist at " + filename); 97 | ScriptingEngine.getLangaugeByExtention(filename).getDefaultContents(gist.getGitPullUrl(), filename); 98 | return gist.getGitPullUrl(); 99 | } 100 | catch (IOException e) 101 | { 102 | e.printStackTrace(); 103 | } 104 | return null; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/INewVitaminCallback.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio; 2 | 3 | import javafx.scene.control.Menu; 4 | 5 | public interface INewVitaminCallback { 6 | void addVitaminType(String s); 7 | 8 | Menu getTypeMenu(String type); 9 | 10 | void addSizesToMenu(String size,String type); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/Main.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio; 2 | 3 | public class Main { 4 | 5 | public static void main(String[] args) throws Exception { 6 | BowlerStudio.main(args); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/MeasurmentConfig.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import com.neuronrobotics.bowlerstudio.vitamins.Vitamins; 7 | 8 | public class MeasurmentConfig { 9 | private String key; 10 | private String type; 11 | private String id; 12 | 13 | public MeasurmentConfig(String key, String type, String id) { 14 | this.type = type; 15 | this.id = id; 16 | this.setKey(key); 17 | com.neuronrobotics.sdk.common.Log.error("Adding Measurment " + key + " " + getMeasurment()); 18 | getMeasurment(); 19 | } 20 | 21 | public String getKey() { 22 | return key; 23 | } 24 | 25 | public void setKey(String key) { 26 | this.key = key; 27 | } 28 | 29 | 30 | public String getMeasurment() { 31 | // if(configs.get(key)==null) 32 | // configs.put(key, ""); 33 | 34 | try { 35 | return Vitamins.getMeasurement(type, id,key).toString(); 36 | } catch (Exception ex) { 37 | System.out.print("\n\tGetting measurement of " + key); 38 | ex.printStackTrace(System.out); 39 | return ""; 40 | } 41 | } 42 | 43 | public void setMeasurment(String measurment) { 44 | com.neuronrobotics.sdk.common.Log.error("Setting field "+type+", "+ id +", "+ key + " to " + measurment); 45 | Vitamins.putMeasurment(type, id,key, measurment); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/MenuRefreshEvent.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio; 2 | 3 | public interface MenuRefreshEvent { 4 | void setToLoggedIn(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/MenuResettingEventHandler.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio; 2 | 3 | import javafx.event.Event; 4 | import javafx.event.EventHandler; 5 | 6 | public abstract class MenuResettingEventHandler implements EventHandler { 7 | private Runnable menuReset = null; 8 | 9 | public Runnable getMenuReset() { 10 | if(menuReset==null) 11 | menuReset=new Runnable() { 12 | 13 | @Override 14 | public void run() { 15 | // Auto-generated method stub 16 | 17 | } 18 | }; 19 | return menuReset; 20 | } 21 | 22 | public void setMenuReset(Runnable menuReset) { 23 | this.menuReset = menuReset; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/NameGetter.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio; 2 | 3 | import java.util.function.Supplier; 4 | 5 | import javax.swing.JFrame; 6 | import javax.swing.JOptionPane; 7 | 8 | public class NameGetter implements Supplier{ 9 | 10 | @Override 11 | public String get() { 12 | String sec = "REPLACE_ME"; 13 | if(sec.contains("REPLACE")) { 14 | String line = System.getProperty("API-SECRET"); 15 | if(line!=null) 16 | return line; 17 | JFrame jframe = new JFrame(); 18 | String answer = JOptionPane.showInputDialog(jframe, "Enter API secret"); 19 | jframe.dispose(); 20 | return answer; 21 | } 22 | return sec; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/NewCreatureWizard.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio; 2 | 3 | import com.neuronrobotics.bowlerstudio.scripting.IScriptingLanguage; 4 | import com.neuronrobotics.bowlerstudio.scripting.RobotHelper; 5 | 6 | import javafx.stage.Stage; 7 | 8 | public class NewCreatureWizard { 9 | 10 | public static void run() { 11 | BowlerStudio.runLater(()->{ 12 | Stage s = new Stage(); 13 | new Thread(()->{ 14 | Thread.setDefaultUncaughtExceptionHandler(new IssueReportingExceptionHandler()); 15 | AddFileToGistController controller = new AddFileToGistController(null, BowlerStudioMenu.getSelfRef()); 16 | try { 17 | controller.start(s,(IScriptingLanguage)new RobotHelper()); 18 | } catch (Exception e) { 19 | e.printStackTrace(); 20 | } 21 | 22 | }).start(); 23 | }); 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /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 com.neuronrobotics.bowlerstudio.assets.AssetFactory; 4 | import com.neuronrobotics.sdk.common.Log; 5 | import javafx.application.Platform; 6 | import javafx.geometry.Insets; 7 | import javafx.scene.Node; 8 | import javafx.scene.control.Accordion; 9 | import javafx.scene.control.Button; 10 | import javafx.scene.control.TextField; 11 | import javafx.scene.control.TitledPane; 12 | import javafx.scene.layout.HBox; 13 | import javafx.scene.layout.Priority; 14 | 15 | import java.util.ArrayList; 16 | 17 | public class PluginManagerWidget extends TitledPane { 18 | private PluginManager manager; 19 | private TextField deviceName = new TextField(); 20 | private Button disconnectTHis; 21 | final Accordion accordion = new Accordion (); 22 | 23 | public PluginManagerWidget(PluginManager m, Node graphic){ 24 | HBox content = new HBox(20); 25 | 26 | content.setPadding(new Insets(0, 20, 10, 20)); 27 | this.manager = m; 28 | ArrayList plugins = manager.getPlugins(); 29 | accordion.getPanes().addAll(plugins); 30 | disconnectTHis = new Button("Disconnect "+manager.getName(), AssetFactory.loadIcon("Disconnect-Device.png")); 31 | 32 | disconnectTHis.setOnMousePressed( event -> { 33 | new Thread(){ 34 | public void run(){ 35 | Thread.currentThread().setUncaughtExceptionHandler(new IssueReportingExceptionHandler()); 36 | 37 | setName("disconnect plugins"); 38 | Log.warning("Disconnect button for "+manager.getName()+" pressed"); 39 | getManager().getDevice().disconnect(); 40 | 41 | } 42 | }.start(); 43 | 44 | }); 45 | setGraphic(AssetFactory.loadIcon("Bowler-Device-In-Manager.png")); 46 | deviceName.setOnAction(event -> { 47 | getManager().setName(deviceName.getText()); 48 | setText(manager.getName()); 49 | disconnectTHis.setText("Disconnect "+manager.getName()); 50 | }); 51 | BowlerStudio.runLater(()->deviceName.setText(manager.getName())); 52 | content.setHgrow(accordion, Priority.ALWAYS); 53 | content.getChildren().addAll(graphic,disconnectTHis,deviceName,accordion); 54 | setContent(content); 55 | setText(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 false; 18 | public static void closeSplash() { 19 | if (isVisableSplash()) 20 | closeSplashLocal(); 21 | 22 | } 23 | 24 | private static void closeSplashLocal() { 25 | if (BowlerStudio.splash != null) { 26 | BowlerStudio.splash.close(); 27 | splashGraphics = null; 28 | return; 29 | } 30 | if(closePreventer.getAsBoolean()) 31 | return; 32 | PsudoSplash.close(); 33 | } 34 | 35 | public static boolean isVisableSplash() { 36 | if (BowlerStudio.splash != null) 37 | return BowlerStudio.splash.isVisible(); 38 | if(!PsudoSplash.isInitialized()) 39 | return false; 40 | return PsudoSplash.isVisableSplash(); 41 | } 42 | 43 | private static void updateSplash() { 44 | PsudoSplash.get().updateSplash(); 45 | } 46 | 47 | public static void renderSplashFrame(int percent, String message) { 48 | if (loadFirst) { 49 | 50 | initialize(); 51 | } 52 | String string = percent + "% " + message; 53 | System.out.println(" Splash Rendering " + percent + " " + message); 54 | PsudoSplash.get().setMessage(string); 55 | updateSplash(); 56 | 57 | // if (Platform.isFxApplicationThread()) 58 | // throw new RuntimeException("Splash manager can not be opened from a javafx thread!"); 59 | int index=0; 60 | while(!SplashManager.isVisableSplash()) { 61 | System.out.println("Waiting for splash to open before moving on"); 62 | try { 63 | Thread.sleep(100); 64 | index++; 65 | } catch (InterruptedException e) { 66 | return; 67 | } 68 | if(index>10) 69 | return; 70 | } 71 | } 72 | 73 | private static void initialize() { 74 | com.neuronrobotics.sdk.common.Log.error("No splash screen availible!"); 75 | 76 | loadFirst = false; 77 | } 78 | 79 | public static BooleanSupplier getClosePreventer() { 80 | return closePreventer; 81 | } 82 | 83 | public static void setClosePreventer(BooleanSupplier cp) { 84 | closePreventer = cp; 85 | } 86 | 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/TestServer.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio; 2 | 3 | import java.io.IOException; 4 | import java.net.InetAddress; 5 | import java.net.UnknownHostException; 6 | 7 | import com.neuronrobotics.sdk.common.BowlerAbstractDevice; 8 | import com.neuronrobotics.sdk.common.BowlerDataType; 9 | import com.neuronrobotics.sdk.common.BowlerDatagram; 10 | import com.neuronrobotics.sdk.common.BowlerMethod; 11 | import com.neuronrobotics.sdk.common.DeviceManager; 12 | import com.neuronrobotics.sdk.common.Log; 13 | import com.neuronrobotics.sdk.common.MACAddress; 14 | import com.neuronrobotics.sdk.common.RpcEncapsulation; 15 | import com.neuronrobotics.sdk.common.device.server.BowlerAbstractDeviceServerNamespace; 16 | import com.neuronrobotics.sdk.common.device.server.BowlerAbstractServer; 17 | import com.neuronrobotics.sdk.common.device.server.IBowlerCommandProcessor; 18 | import com.neuronrobotics.sdk.network.BowlerTCPClient; 19 | import com.neuronrobotics.sdk.network.UDPBowlerConnection; 20 | 21 | public class TestServer { 22 | 23 | private TestServer() { 24 | } 25 | 26 | public static void main(String[] args) throws Exception { 27 | class SampleBowlerServer extends BowlerAbstractServer { 28 | BowlerAbstractDeviceServerNamespace ns = new BowlerAbstractDeviceServerNamespace( 29 | getMacAddress(), "test.thingy.*;0.3;;") { 30 | }; 31 | 32 | public SampleBowlerServer() { 33 | super(new MACAddress()); 34 | 35 | ns.addRpc(new RpcEncapsulation(ns.getNamespaceIndex(), ns 36 | .getNamespace(), "test", BowlerMethod.GET, 37 | new BowlerDataType[] { BowlerDataType.I32, 38 | BowlerDataType.I32, BowlerDataType.I32 },// send 3 39 | // integers 40 | BowlerMethod.POST, new BowlerDataType[] { 41 | BowlerDataType.I32, BowlerDataType.I32, 42 | BowlerDataType.I32 }, // get 3 integers back 43 | new IBowlerCommandProcessor() { 44 | public Object[] process(Object[] data) { 45 | for (int i = 0; i < data.length; i++) { 46 | com.neuronrobotics.sdk.common.Log.error("Server Got # " + data[i]); 47 | } 48 | return new Object[] { 37,42, 999999}; 49 | } 50 | })); 51 | addBowlerDeviceServerNamespace(ns); 52 | 53 | Log.info("Starting UDP"); 54 | try { 55 | startNetworkServer(1865); 56 | } catch (IOException e) { 57 | // Auto-generated catch block 58 | e.printStackTrace(); 59 | }// starts the UDP server 60 | // this also starts tcp server on port+1, in this case 1866 61 | 62 | } 63 | } 64 | 65 | class SampleBowlerClient extends BowlerAbstractDevice { 66 | 67 | public void runCommand() { 68 | Object[] args = send("test.thingy.*;0.3;;", BowlerMethod.GET, "test", 69 | new Object[] { 36, 83, 13 });// send some numbers 70 | for (int i = 0; i < args.length; i++) { 71 | com.neuronrobotics.sdk.common.Log.error("Client Received # " + args[i]); 72 | } 73 | } 74 | 75 | @Override 76 | public void onAsyncResponse(BowlerDatagram data) { 77 | }// no async in this demo 78 | } 79 | 80 | SampleBowlerClient client = new SampleBowlerClient(); 81 | 82 | //client.setConnection(new UDPBowlerConnection(InetAddress.getByName("127.0.0.1"), 1865)); 83 | // Alternately you can use the tcp connection 84 | client.setConnection( new BowlerTCPClient("127.0.0.1",1866)); 85 | DeviceManager.addConnection(client, "sampleClient"); 86 | 87 | client.runCommand();// runs our test command from client to server and 88 | // back 89 | 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/Tutorial.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio; 2 | 3 | import java.io.File; 4 | import org.eclipse.jetty.server.Connector; 5 | import org.eclipse.jetty.server.Handler; 6 | import org.eclipse.jetty.server.Server; 7 | import org.eclipse.jetty.server.ServerConnector; 8 | import org.eclipse.jetty.server.handler.DefaultHandler; 9 | import org.eclipse.jetty.server.handler.HandlerList; 10 | import org.eclipse.jetty.server.handler.ResourceHandler; 11 | import com.neuronrobotics.bowlerstudio.assets.ConfigurationDatabase; 12 | import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine; 13 | import com.neuronrobotics.sdk.util.ThreadUtil; 14 | import com.neuronrobotics.video.OSUtil; 15 | 16 | public class Tutorial { 17 | private static int WEBSERVER_PORT = 37037; 18 | private static final String HOME_Local_URL_ROOT = "/BowlerStudio/Welcome-To-BowlerStudio/"; 19 | private static final String weburl = "http://CommonWealthRobotics.com"+HOME_Local_URL_ROOT; 20 | private static String HOME_URL =null; 21 | private static String HOME_Local_URL = null; 22 | private static boolean doneLoadingTutorials; 23 | private static Boolean startedLoadingTutorials = false; 24 | public static String getHomeUrl() throws Exception{ 25 | ConfigurationDatabase.setObject("BowlerStudioConfigs", "tutorialBranch", 26 | "deploy"); 27 | if(OSUtil.isOSX()) { 28 | ConfigurationDatabase.setObject("BowlerStudioConfigs", "tutorialSource", 29 | weburl); 30 | return weburl; 31 | } 32 | File i=null; 33 | String remoteURI = (String)ConfigurationDatabase.getObject("BowlerStudioConfigs", "tutorialSource", 34 | "https://github.com/CommonWealthRobotics/CommonWealthRobotics.github.io.git"); 35 | do{ 36 | 37 | i= ScriptingEngine.fileFromGit( 38 | remoteURI, 39 | (String)ConfigurationDatabase.getObject("BowlerStudioConfigs", "tutorialBranch", 40 | "deploy"), // the default branch is source, so this needs to 41 | // be specified 42 | "docs/index.html"); 43 | }while(!i.exists()); 44 | ScriptingEngine.pull(remoteURI); 45 | File indexOfTutorial=i; 46 | if(!doneLoadingTutorials ){ 47 | if(!startedLoadingTutorials){ 48 | //synchronized(startedLoadingTutorials){ 49 | startedLoadingTutorials = true; 50 | //} 51 | new Thread(){ 52 | public void run(){ 53 | Thread.currentThread().setUncaughtExceptionHandler(new IssueReportingExceptionHandler()); 54 | 55 | //HOME_Local_URL = indexOfTutorial.toURI().toString().replace("file:/", "file:///"); 56 | Server server = new Server(WEBSERVER_PORT); 57 | ServerConnector connector = new ServerConnector(server); 58 | server.setConnectors(new Connector[] { connector }); 59 | ResourceHandler resource_handler = new ResourceHandler(); 60 | resource_handler.setDirectoriesListed(true); 61 | resource_handler.setWelcomeFiles(new String[] { "index.html" }); 62 | com.neuronrobotics.sdk.common.Log.error("Serving "+ indexOfTutorial.getParent()); 63 | resource_handler.setResourceBase(indexOfTutorial.getParent()); 64 | 65 | HandlerList handlers = new HandlerList(); 66 | handlers.setHandlers(new Handler[] { resource_handler, new DefaultHandler() }); 67 | server.setHandler(handlers); 68 | 69 | try { 70 | server.start(); 71 | WEBSERVER_PORT= connector.getLocalPort(); 72 | HOME_Local_URL = "http://localhost:"+WEBSERVER_PORT+HOME_Local_URL_ROOT; 73 | doneLoadingTutorials = true; 74 | server.join(); 75 | } catch (Exception e) { 76 | throw new RuntimeException(e); 77 | } 78 | 79 | 80 | } 81 | }.start(); 82 | } 83 | long start = System.currentTimeMillis(); 84 | // wait up to 30 seconds for menue to load, then fail over to the web version 85 | while(! doneLoadingTutorials && (System.currentTimeMillis()-start<3000)){ 86 | ThreadUtil.wait(100); 87 | } 88 | 89 | if(doneLoadingTutorials ) 90 | HOME_URL = HOME_Local_URL; 91 | else 92 | HOME_URL= weburl; 93 | } 94 | return HOME_URL; 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/assets/BowlerStudioResourceFactory.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.assets; 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 org.eclipse.jgit.api.errors.GitAPIException; 12 | import org.eclipse.jgit.api.errors.InvalidRemoteException; 13 | import org.eclipse.jgit.api.errors.TransportException; 14 | 15 | import com.neuronrobotics.bowlerstudio.BowlerStudio; 16 | import com.neuronrobotics.bowlerstudio.scripting.GithubLoginFX; 17 | //import com.neuronrobotics.nrconsole.plugin.DyIO.DyIOConsole; 18 | import com.neuronrobotics.sdk.dyio.DyIOChannelMode; 19 | 20 | import javafx.fxml.FXMLLoader; 21 | import javafx.scene.image.Image; 22 | 23 | public class BowlerStudioResourceFactory { 24 | private static final Map lookup = new HashMap<>(); 25 | private static Image chanHighlight; 26 | private static Image chanUpdate; 27 | private static Image chanDefault; 28 | private static final ArrayList fxmlLoaders = new ArrayList<>(); 29 | private static FXMLLoader githubLogin; 30 | private static FXMLLoader mainControllerPanel; 31 | private static boolean loaded=false; 32 | private BowlerStudioResourceFactory() { 33 | } 34 | 35 | public static FXMLLoader getLoader(int channelIndex) { 36 | return fxmlLoaders.get(channelIndex); 37 | } 38 | 39 | @SuppressWarnings("restriction") 40 | public static void load() throws Exception { 41 | if(loaded) 42 | return; 43 | loaded=true; 44 | try { 45 | //mainPanel.setController(new DyIOPanel()); 46 | BowlerStudio.renderSplashFrame( 95,"Loading GitHub"); 47 | 48 | githubLogin = AssetFactory.loadLayout("layout/githublogin.fxml"); 49 | //githubLogin.setController(new GithubLoginFX()); 50 | githubLogin.setClassLoader(GithubLoginFX.class.getClassLoader()); 51 | } catch (InvalidRemoteException e1) { 52 | // Auto-generated catch block 53 | e1.printStackTrace(); 54 | } catch (TransportException e1) { 55 | // Auto-generated catch block 56 | e1.printStackTrace(); 57 | } catch (GitAPIException e1) { 58 | // Auto-generated catch block 59 | e1.printStackTrace(); 60 | } catch (IOException e1) { 61 | // Auto-generated catch block 62 | e1.printStackTrace(); 63 | } catch (Exception e1) { 64 | // Auto-generated catch block 65 | e1.printStackTrace(); 66 | } 67 | 68 | 69 | 70 | 71 | try { 72 | githubLogin.load(); 73 | javafx.scene.Parent root = githubLogin.getRoot(); 74 | FontSizeManager.addListener(fontNum->{ 75 | int tmp = fontNum-10; 76 | if(tmp<12) 77 | tmp=12; 78 | root.setStyle("-fx-font-size: "+tmp+"pt"); 79 | }); 80 | } catch (IOException e) { 81 | Logger.getLogger(BowlerStudio.class.getName()).log(Level.SEVERE, null, e); 82 | } 83 | 84 | }// stub to force a load from the static in a specific thread 85 | 86 | public static Image getModeImage(DyIOChannelMode mode) { 87 | return lookup.get(mode); 88 | } 89 | 90 | public static Image getChanHighlight() { 91 | return chanHighlight; 92 | } 93 | 94 | public static void setChanHighlight(Image chanHighlight) { 95 | BowlerStudioResourceFactory.chanHighlight = chanHighlight; 96 | } 97 | 98 | public static Image getChanUpdate() { 99 | return chanUpdate; 100 | } 101 | 102 | public static void setChanUpdate(Image chanUpdate) { 103 | BowlerStudioResourceFactory.chanUpdate = chanUpdate; 104 | } 105 | 106 | public static Image getChanDefault() { 107 | return chanDefault; 108 | } 109 | 110 | public static void setChanDefault(Image chanDefault) { 111 | BowlerStudioResourceFactory.chanDefault = chanDefault; 112 | } 113 | 114 | 115 | public static FXMLLoader getGithubLogin() { 116 | return githubLogin; 117 | } 118 | 119 | public static void setGithubLogin(FXMLLoader githubLogin) { 120 | BowlerStudioResourceFactory.githubLogin = githubLogin; 121 | } 122 | 123 | public static FXMLLoader getMainControllerPanel() { 124 | return mainControllerPanel; 125 | } 126 | 127 | public static void setMainControllerPanel(FXMLLoader mainControllerPanel) { 128 | BowlerStudioResourceFactory.mainControllerPanel = mainControllerPanel; 129 | } 130 | 131 | } 132 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/creature/AbstractGameController.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.creature; 2 | 3 | import java.util.ArrayList; 4 | 5 | public abstract class AbstractGameController { 6 | private ArrayList 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/AdjustbodyMassWidget.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.creature; 2 | 3 | import com.neuronrobotics.sdk.addons.kinematics.MobileBase; 4 | import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; 5 | 6 | import javafx.scene.Group; 7 | import javafx.scene.control.TextField; 8 | import javafx.scene.layout.GridPane; 9 | import javafx.scene.text.Text; 10 | 11 | public class AdjustbodyMassWidget extends Group { 12 | 13 | 14 | private MobileBase device; 15 | private MobileBaseCadManager manager; 16 | double textToNum(TextField mass) { 17 | try { 18 | return Double.parseDouble(mass.getText().trim()); 19 | }catch(Throwable t) { 20 | mass.setText("0"); 21 | return 0; 22 | } 23 | } 24 | 25 | public AdjustbodyMassWidget(MobileBase device) { 26 | this.device = device; 27 | manager = MobileBaseCadManager.get(device); 28 | GridPane pane = new GridPane(); 29 | 30 | TextField mass = new TextField(CreatureLab.getFormatted(device.getMassKg())); 31 | mass.setOnAction(event -> { 32 | device.setMassKg(textToNum(mass)); 33 | if(manager!=null)manager.generateCad(); 34 | }); 35 | TransformNR currentCentroid = device.getCenterOfMassFromCentroid(); 36 | TextField massx = new TextField(CreatureLab.getFormatted(currentCentroid.getX())); 37 | massx.setOnAction(event -> { 38 | currentCentroid.setX(textToNum(massx)); 39 | device.setCenterOfMassFromCentroid(currentCentroid); 40 | ; 41 | if(manager!=null)manager.generateCad(); 42 | 43 | }); 44 | 45 | TextField massy = new TextField(CreatureLab.getFormatted(currentCentroid.getY())); 46 | massy.setOnAction(event -> { 47 | currentCentroid.setY(textToNum(massy)); 48 | device.setCenterOfMassFromCentroid(currentCentroid); 49 | ; 50 | if(manager!=null)manager.generateCad(); 51 | 52 | }); 53 | 54 | TextField massz = new TextField(CreatureLab.getFormatted(currentCentroid.getZ())); 55 | massz.setOnAction(event -> { 56 | currentCentroid.setZ(textToNum(massz)); 57 | device.setCenterOfMassFromCentroid(currentCentroid); 58 | ; 59 | if(manager!=null)manager.generateCad(); 60 | 61 | }); 62 | 63 | 64 | 65 | pane.add(new Text("Mass"), 0, 0); 66 | pane.add(mass, 1, 0); 67 | 68 | pane.add(new Text("Mass Centroid x"), 0, 1); 69 | pane.add(massx, 1, 1); 70 | 71 | pane.add(new Text("Mass Centroid y"), 0, 2); 72 | pane.add(massy, 1, 2); 73 | pane.add(new Text("Mass Centroid z"), 0, 3); 74 | pane.add(massz, 1,3); 75 | getChildren().add(pane); 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/creature/CreatureLabControlsTab.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.creature; 2 | import com.neuronrobotics.bowlerstudio.BowlerStudio; 3 | 4 | import javafx.fxml.FXML; 5 | import javafx.scene.control.TreeView; 6 | import javafx.scene.layout.AnchorPane; 7 | import javafx.scene.layout.GridPane; 8 | import javafx.scene.layout.HBox; 9 | import javafx.scene.layout.VBox; 10 | 11 | public class CreatureLabControlsTab { 12 | @FXML 13 | private AnchorPane walkingBox; 14 | 15 | @FXML 16 | private AnchorPane controlsBox; 17 | 18 | @FXML 19 | private AnchorPane progressBar; 20 | 21 | @FXML 22 | private AnchorPane treeBox; 23 | 24 | 25 | public AnchorPane getWalkingBox() { 26 | return walkingBox; 27 | } 28 | 29 | // public void setWalkingBox(AnchorPane walkingBox) { 30 | // this.walkingBox = walkingBox; 31 | // } 32 | 33 | public AnchorPane getControlsBox() { 34 | return walkingBox; 35 | } 36 | 37 | // public void setControlsBox(AnchorPane controlsBox) { 38 | // this.controlsBox = controlsBox; 39 | // } 40 | 41 | // public AnchorPane getProgressBar() { 42 | // return progressBar; 43 | // } 44 | 45 | public void setProgressBar(AnchorPane progressBar) { 46 | this.progressBar = progressBar; 47 | } 48 | 49 | public AnchorPane getTreeBox() { 50 | return treeBox; 51 | } 52 | 53 | public void setTreeBox(AnchorPane treeBox) { 54 | this.treeBox = treeBox; 55 | } 56 | 57 | 58 | public void setOverlayTop(GridPane radioOptions) { 59 | // Auto-generated method stub 60 | BowlerStudio.runLater(()->{ 61 | progressBar.getChildren().clear(); 62 | progressBar.getChildren().add(radioOptions); 63 | AnchorPane.setTopAnchor(radioOptions, 0.0); 64 | AnchorPane.setLeftAnchor(radioOptions, 0.0); 65 | AnchorPane.setRightAnchor(radioOptions, 0.0); 66 | AnchorPane.setBottomAnchor(radioOptions, 0.0); 67 | }); 68 | } 69 | 70 | public void setOverlayTopRight(JogMobileBase walkWidget) { 71 | // Auto-generated method stub 72 | // @JansenSmith - placed contents in llambda runnable - 20220915 73 | BowlerStudio.runLater(()->{ 74 | walkingBox.getChildren().clear(); 75 | walkingBox.getChildren().add(walkWidget); 76 | AnchorPane.setTopAnchor(walkWidget, 0.0); 77 | AnchorPane.setLeftAnchor(walkWidget, 0.0); 78 | AnchorPane.setRightAnchor(walkWidget, 0.0); 79 | AnchorPane.setBottomAnchor(walkWidget, 0.0); 80 | }); 81 | } 82 | 83 | 84 | 85 | } 86 | -------------------------------------------------------------------------------- /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/GameControlThreadManager.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.creature; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.util.ArrayList; 6 | 7 | import org.eclipse.jgit.api.errors.GitAPIException; 8 | import org.eclipse.jgit.api.errors.InvalidRemoteException; 9 | import org.eclipse.jgit.api.errors.TransportException; 10 | 11 | import com.neuronrobotics.bowlerstudio.BowlerStudio; 12 | import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine; 13 | import com.neuronrobotics.sdk.common.Log; 14 | import com.neuronrobotics.sdk.util.ThreadUtil; 15 | 16 | public class GameControlThreadManager { 17 | private static Thread scriptRunner=null; 18 | private static IAmControlled currentController=null; 19 | private static boolean running = false; 20 | public static void stop() { 21 | if(!isRunning()) 22 | return; 23 | //new RuntimeException().printStackTrace(); 24 | 25 | reset(); 26 | Thread tmp = scriptRunner; 27 | if (tmp != null) 28 | while (tmp.isAlive()) { 29 | 30 | com.neuronrobotics.sdk.common.Log.error("Interrupting "+currentController.getName()); 31 | ThreadUtil.wait(10); 32 | try { 33 | tmp.interrupt(); 34 | tmp.join(); 35 | } catch (InterruptedException e) { 36 | // Auto-generated catch block 37 | //e.printStackTrace(); 38 | } 39 | } 40 | 41 | scriptRunner = null; 42 | } 43 | /** 44 | * @return the currentController 45 | */ 46 | public static IAmControlled getCurrentController() { 47 | return currentController; 48 | } 49 | /** 50 | * @param currentController the currentController to set 51 | */ 52 | public static void setCurrentController(IAmControlled c) { 53 | boolean was=isRunning(); 54 | boolean b =false; 55 | if(currentController!=null) { 56 | b = c!=currentController; 57 | if(b) 58 | stop(); 59 | } 60 | currentController = c; 61 | if(was && b) { 62 | start(); 63 | } 64 | } 65 | public static void startStopAction() { 66 | //new RuntimeException().printStackTrace(); 67 | currentController.getRunStopButton().setDisable(true); 68 | if (isRunning()) 69 | stop(); 70 | else 71 | try { 72 | start(); 73 | } catch (Exception e) { 74 | // Auto-generated catch block 75 | e.printStackTrace(); 76 | } 77 | currentController.getRunStopButton().setDisable(false); 78 | } 79 | public static void start() { 80 | File currentFile = currentController.getScriptFile(); 81 | 82 | 83 | setRunning(true); 84 | BowlerStudio.runLater(() -> { 85 | BowlerStudio.setToStopButton(currentController.getRunStopButton()); 86 | }); 87 | //new RuntimeException().printStackTrace(); 88 | scriptRunner = new Thread() { 89 | 90 | public void run() { 91 | try { 92 | 93 | ScriptingEngine.inlineFileScriptRun(currentFile, currentController.getArguments()); 94 | reset(); 95 | 96 | } catch (Throwable ex) { 97 | BowlerStudio.printStackTrace(ex); 98 | reset(); 99 | } 100 | 101 | } 102 | }; 103 | 104 | try { 105 | 106 | scriptRunner.start(); 107 | } catch (Exception e) { 108 | // Auto-generated catch block 109 | e.printStackTrace(); 110 | } 111 | 112 | } 113 | 114 | public static void reset() { 115 | setRunning(false); 116 | BowlerStudio.runLater(() -> { 117 | currentController.getRunStopButton().setText(currentController.getButtonRunText()); 118 | // game.setGraphic(AssetFactory.loadIcon("Run.png")); 119 | for(String classes : currentController.getRunStopButton().getStyleClass()) { 120 | //com.neuronrobotics.sdk.common.Log.error("Clearing "+classes); 121 | } 122 | BowlerStudio.setToRunButton(currentController.getRunStopButton()); 123 | currentController.getRunStopButton().setGraphic(currentController.getRunAsset()); 124 | }); 125 | 126 | } 127 | /** 128 | * @return the running 129 | */ 130 | public static boolean isRunning() { 131 | return running; 132 | } 133 | /** 134 | * @param running the running to set 135 | */ 136 | private static void setRunning(boolean running) { 137 | GameControlThreadManager.running = running; 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/creature/IAmControlled.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.creature; 2 | 3 | import java.io.File; 4 | import java.util.ArrayList; 5 | 6 | public interface IAmControlled { 7 | File getScriptFile(); 8 | ArrayList getArguments(); 9 | javafx.scene.image.ImageView getRunAsset(); 10 | javafx.scene.control.Button getRunStopButton(); 11 | String getButtonRunText(); 12 | String getName(); 13 | } 14 | -------------------------------------------------------------------------------- /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/IJogProvider.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.creature; 2 | 3 | import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; 4 | 5 | public interface IJogProvider { 6 | 7 | public TransformNR getJogIncrement(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /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/ITransformProvider.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.creature; 2 | 3 | import com.neuronrobotics.sdk.addons.kinematics.VitaminLocation; 4 | import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; 5 | 6 | public interface ITransformProvider { 7 | TransformNR get(VitaminLocation selectedVitamin); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/creature/ITrimControl.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.creature; 2 | 3 | public interface ITrimControl { 4 | public void trimPlus(); 5 | public void trimMinus(); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/creature/TransformWidgetTest.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.creature; 2 | 3 | import java.io.File; 4 | 5 | import com.neuronrobotics.bowlerstudio.assets.AssetFactory; 6 | import com.neuronrobotics.bowlerstudio.assets.FontSizeManager; 7 | import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; 8 | 9 | import javafx.application.Application; 10 | import javafx.stage.Stage; 11 | import javafx.scene.Scene; 12 | 13 | public class TransformWidgetTest extends Application { 14 | private TransformWidget w; 15 | 16 | public TransformWidgetTest() { 17 | this.w = new TransformWidget("Test Widget", new TransformNR(1,2,3), new IOnTransformChange() { 18 | 19 | @Override 20 | public void onTransformFinished(TransformNR newTrans) { 21 | com.neuronrobotics.sdk.common.Log.error("Finished "+newTrans.toSimpleString() ); 22 | } 23 | 24 | @Override 25 | public void onTransformChaging(TransformNR newTrans) { 26 | com.neuronrobotics.sdk.common.Log.error("Changing "+newTrans.toSimpleString() ); 27 | } 28 | }); 29 | 30 | } 31 | 32 | @Override 33 | public void start(Stage primaryStage) throws Exception { 34 | File layoutFile = AssetFactory.loadFile("layout/default.css"); 35 | String nwfile = layoutFile.toURI().toString().replace("file:/", "file:///"); 36 | Scene scene = new Scene(w); 37 | 38 | scene.getStylesheets().clear(); 39 | scene.getStylesheets().add(nwfile); 40 | com.neuronrobotics.sdk.common.Log.error("Loading CSS from " + nwfile); 41 | double scale = (double)(FontSizeManager.getDefaultSize())/12.0; 42 | 43 | primaryStage.setScene(scene); 44 | //primaryStage.setWidth(668*scale); 45 | //primaryStage.setHeight(664*scale); 46 | primaryStage.setTitle("Test Application"); 47 | primaryStage.show(); 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/creature/VitaminWidgetTest.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.creature; 2 | 3 | import java.io.File; 4 | 5 | import com.neuronrobotics.bowlerstudio.BowlerStudio; 6 | import com.neuronrobotics.bowlerstudio.BowlerStudioController; 7 | import com.neuronrobotics.bowlerstudio.assets.AssetFactory; 8 | import com.neuronrobotics.bowlerstudio.assets.FontSizeManager; 9 | import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine; 10 | import com.neuronrobotics.sdk.addons.kinematics.MobileBase; 11 | import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; 12 | 13 | import eu.mihosoft.vrl.v3d.JavaFXInitializer; 14 | import javafx.application.Application; 15 | import javafx.scene.Scene; 16 | import javafx.stage.Stage; 17 | import javafx.scene.Parent; 18 | import javafx.fxml.FXMLLoader; 19 | 20 | public class VitaminWidgetTest extends Application { 21 | private VitatminWidget tw; 22 | 23 | @Override 24 | public void start(Stage primaryStage) throws Exception { 25 | FXMLLoader loader = AssetFactory.loadLayout("layout/AddRemoveVitamins.fxml"); 26 | loader.setClassLoader(VitatminWidget.class.getClassLoader()); 27 | Parent w = loader.load(); 28 | 29 | tw = loader.getController(); 30 | 31 | File layoutFile = AssetFactory.loadFile("layout/default.css"); 32 | String nwfile = layoutFile.toURI().toString().replace("file:/", "file:///"); 33 | Scene scene = new Scene(w); 34 | 35 | scene.getStylesheets().clear(); 36 | scene.getStylesheets().add(nwfile); 37 | com.neuronrobotics.sdk.common.Log.error("Loading CSS from " + nwfile); 38 | FontSizeManager.addListener(fontNum->{ 39 | int tmp = fontNum-10; 40 | if(tmp<12) 41 | tmp=12; 42 | com.neuronrobotics.sdk.common.Log.error("Setting font size to "+fontNum); 43 | w.setStyle("-fx-font-size: "+tmp+"pt"); 44 | }); 45 | primaryStage.setOnCloseRequest(arg0 -> { 46 | System.exit(0); 47 | }); 48 | primaryStage.setScene(scene); 49 | primaryStage.setWidth(600); 50 | primaryStage.setHeight(777); 51 | primaryStage.setTitle("Test Application"); 52 | primaryStage.show(); 53 | } 54 | 55 | public static void main(String[] args) { 56 | JavaFXInitializer.go(); 57 | BowlerStudio.runLater(() -> { 58 | Stage s = new Stage(); 59 | // 60 | VitaminWidgetTest controller = new VitaminWidgetTest(); 61 | try { 62 | controller.start(s); 63 | } catch (Exception e) { 64 | e.printStackTrace(); 65 | } 66 | VitatminWidget tw = controller.getTw(); 67 | new Thread(() -> { 68 | try { 69 | MobileBase mb = (MobileBase) ScriptingEngine 70 | .gitScriptRun("https://github.com/NeuronRobotics/NASACurisoity.git", "NASA_Curiosity.xml"); 71 | tw.setVitaminProvider(mb.getAllDHChains().get(0).getLinkConfiguration(0),selected->{ 72 | return mb.forwardOffset(new TransformNR()); 73 | }); 74 | } catch (Exception e) { 75 | // Auto-generated catch block 76 | e.printStackTrace(); 77 | } 78 | }).start(); 79 | }); 80 | } 81 | 82 | /** 83 | * @return the tw 84 | */ 85 | public VitatminWidget getTw() { 86 | return tw; 87 | } 88 | 89 | /** 90 | * @param tw the tw to set 91 | */ 92 | public void setTw(VitatminWidget tw) { 93 | if (tw == null) 94 | throw new RuntimeException(); 95 | this.tw = tw; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/scripting/AskToDeleteWidget.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.scripting; 2 | 3 | import java.util.concurrent.CompletableFuture; 4 | 5 | import com.neuronrobotics.bowlerstudio.assets.FontSizeManager; 6 | 7 | import javafx.application.Platform; 8 | import javafx.scene.Node; 9 | import javafx.scene.control.Alert; 10 | import javafx.scene.control.ButtonType; 11 | import javafx.stage.Stage; 12 | 13 | public class AskToDeleteWidget { 14 | public static boolean askToDeleteFile(String name) { 15 | CompletableFuture future = new CompletableFuture<>(); 16 | 17 | Platform.runLater(() -> { 18 | Alert alert = new Alert(Alert.AlertType.CONFIRMATION); 19 | alert.setTitle("File Exists"); 20 | alert.setHeaderText(name); 21 | alert.setContentText("Delete existing and replace?"); 22 | 23 | ButtonType yes = new ButtonType("Yes"); 24 | ButtonType no = new ButtonType("No"); 25 | 26 | alert.getButtonTypes().setAll(yes, no); 27 | Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); 28 | stage.setOnCloseRequest(event -> alert.hide()); 29 | Node root = alert.getDialogPane(); 30 | FontSizeManager.addListener(fontNum -> { 31 | int tmp = fontNum - 10; 32 | if (tmp < 12) 33 | tmp = 12; 34 | root.setStyle("-fx-font-size: " + tmp + "pt"); 35 | alert.getDialogPane().applyCss(); 36 | alert.getDialogPane().layout(); 37 | stage.sizeToScene(); 38 | }); 39 | boolean result = alert.showAndWait().map(response -> { 40 | if (response == yes) 41 | return true; 42 | if (response == no) 43 | return false; 44 | return null; 45 | }).orElse(null); 46 | 47 | future.complete(result); 48 | }); 49 | 50 | try { 51 | return future.get(); 52 | } catch (Exception e) { 53 | e.printStackTrace(); 54 | return false; 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/scripting/GithubLoginFX.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.scripting; 2 | 3 | import java.io.IOException; 4 | import java.net.URL; 5 | import java.util.ResourceBundle; 6 | 7 | import javafx.fxml.FXML; 8 | import javafx.scene.Parent; 9 | import javafx.scene.Scene; 10 | import javafx.scene.control.TextField; 11 | import javafx.scene.control.PasswordField; 12 | import javafx.stage.Stage; 13 | 14 | 15 | 16 | public class GithubLoginFX implements javafx.fxml.Initializable { 17 | 18 | @FXML 19 | private TextField username; 20 | @FXML PasswordField password; 21 | 22 | private boolean done=false; 23 | 24 | private String [] creds = new String[]{"",""}; 25 | private Stage stage; 26 | private Parent root; 27 | private Scene scene; 28 | 29 | @Override 30 | public void initialize(URL location, ResourceBundle resources) { 31 | 32 | reset(); 33 | } 34 | 35 | public void reset(){ 36 | done=false; 37 | setCreds(new String[]{"",""}); 38 | password.clear(); 39 | getUsername().clear(); 40 | 41 | 42 | } 43 | 44 | @FXML public void anonMode() { 45 | setCreds(null); 46 | try { 47 | // this should make anon mode stick 48 | ScriptingEngine.setupAnyonmous(); 49 | } catch (IOException e) { 50 | // Auto-generated catch block 51 | e.printStackTrace(); 52 | } 53 | finish(); 54 | } 55 | private void finish(){ 56 | stage.close(); 57 | stage.hide(); 58 | done=true; 59 | } 60 | 61 | @FXML public void login() { 62 | getCreds()[0]= getUsername().getText(); 63 | getCreds()[1]= password.getText(); 64 | if(getCreds()[0]==null||getCreds()[1]==null){ 65 | setCreds(null); 66 | }else if(getCreds()[0].equals("")||getCreds()[1].equals("")){ 67 | setCreds(null); 68 | } 69 | 70 | finish(); 71 | } 72 | 73 | @FXML public void focusOnPw() { 74 | password.requestFocus(); 75 | } 76 | 77 | public boolean isDone() { 78 | return done; 79 | } 80 | 81 | public void setDone(boolean done) { 82 | this.done = done; 83 | } 84 | 85 | public String [] getCreds() { 86 | return creds; 87 | } 88 | 89 | public void setCreds(String [] creds) { 90 | this.creds = creds; 91 | } 92 | 93 | public void setStage(Stage stage, Parent root) { 94 | this.stage = stage; 95 | if(this.root==null){ 96 | this.root = root; 97 | scene= new Scene(root); 98 | } 99 | stage.setScene(scene); 100 | } 101 | 102 | public TextField getUsername() { 103 | return username; 104 | } 105 | 106 | public void setUsername(TextField username) { 107 | this.username = username; 108 | } 109 | 110 | 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/scripting/IExternalEditor.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.scripting; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.File; 5 | import java.io.IOException; 6 | import java.io.InputStreamReader; 7 | import java.io.PrintStream; 8 | import java.net.MalformedURLException; 9 | import java.net.URL; 10 | import java.util.Arrays; 11 | import java.util.List; 12 | 13 | import com.neuronrobotics.bowlerstudio.BowlerStudio; 14 | import com.neuronrobotics.video.OSUtil; 15 | 16 | import javafx.application.Platform; 17 | import javafx.scene.control.Alert; 18 | import javafx.scene.control.Alert.AlertType; 19 | import javafx.scene.control.Button; 20 | import javafx.scene.image.Image; 21 | 22 | public interface IExternalEditor { 23 | 24 | 25 | List getSupportedLangauge(); 26 | 27 | default boolean isSupportedByExtention(File file) { 28 | if(getSupportedLangauge()!=null) 29 | for(Class c:getSupportedLangauge()) 30 | if (c.isInstance(ScriptingEngine.getLangaugeByExtention(file.getAbsolutePath()))) { 31 | return true; 32 | } 33 | return false; 34 | } 35 | 36 | void launch(File file, Button advanced); 37 | 38 | String nameOfEditor(); 39 | 40 | URL getInstallURL() throws MalformedURLException; 41 | 42 | void onProcessExit(int ev); 43 | 44 | Image getImage(); 45 | 46 | 47 | 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/scripting/IScriptEventListener.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.scripting; 2 | 3 | import java.io.File; 4 | 5 | import groovy.lang.GroovyShell; 6 | import groovy.lang.Script; 7 | 8 | public interface IScriptEventListener { 9 | 10 | void onScriptFinished( Object result,Object pervious, File source); 11 | 12 | void onScriptChanged(String previous, String current, File source); 13 | 14 | void onScriptError( Throwable except, File source); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /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/scripting/external/ArduinoExternalEditor.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.scripting.external; 2 | 3 | import static com.neuronrobotics.bowlerstudio.scripting.DownloadManager.*; 4 | 5 | import java.io.File; 6 | import java.io.IOException; 7 | import java.net.MalformedURLException; 8 | import java.net.URL; 9 | import java.util.Arrays; 10 | import java.util.List; 11 | 12 | import org.eclipse.jgit.api.Git; 13 | import org.eclipse.jgit.lib.Repository; 14 | 15 | import com.neuronrobotics.bowlerstudio.assets.AssetFactory; 16 | import com.neuronrobotics.bowlerstudio.scripting.ArduinoLoader; 17 | import com.neuronrobotics.bowlerstudio.scripting.DownloadManager; 18 | import com.neuronrobotics.bowlerstudio.scripting.IExternalEditor; 19 | import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine; 20 | import com.neuronrobotics.bowlerstudio.scripting.StlLoader; 21 | import com.neuronrobotics.video.OSUtil; 22 | 23 | import eu.mihosoft.vrl.v3d.JavaFXInitializer; 24 | import javafx.scene.control.Button; 25 | import javafx.scene.image.Image; 26 | 27 | public class ArduinoExternalEditor implements IExternalEditor { 28 | 29 | private Button advanced; 30 | 31 | @Override 32 | public void launch(File file, Button advanced) { 33 | this.advanced = advanced; 34 | new Thread(() -> { 35 | try { 36 | File exe = DownloadManager.getRunExecutable("arduino2", null); 37 | List asList = Arrays.asList(exe.getAbsolutePath(), file.getAbsolutePath()); 38 | if(isMac()) { 39 | asList = Arrays.asList("open","-a",exe.getAbsolutePath(), file.getAbsolutePath()); 40 | 41 | } 42 | Thread rthread = run(this, file.getParentFile(), System.err, asList); 43 | try { 44 | rthread.join(); 45 | } catch (InterruptedException e) { 46 | // Auto-generated catch block 47 | e.printStackTrace(); 48 | } 49 | }catch(Throwable t) { 50 | t.printStackTrace(); 51 | } 52 | if(advanced!=null) 53 | onProcessExit(0); 54 | }).start(); 55 | } 56 | 57 | public Image getImage() { 58 | try { 59 | return AssetFactory.loadAsset("Script-Tab-Arduino.png"); 60 | } catch (Exception e) { 61 | // Auto-generated catch block 62 | e.printStackTrace(); 63 | } 64 | return null; 65 | } 66 | 67 | @Override 68 | public String nameOfEditor() { 69 | // Auto-generated method stub 70 | return "Arduino"; 71 | } 72 | 73 | @Override 74 | public URL getInstallURL() throws MalformedURLException { 75 | return new URL("https://github.com/WPIRoboticsEngineering/RobotInterfaceBoard/blob/master/InstallEclipse.md"); 76 | } 77 | 78 | @Override 79 | public void onProcessExit(int ev) { 80 | advanced.setDisable(false); 81 | } 82 | 83 | @Override 84 | public List getSupportedLangauge() { 85 | return Arrays.asList( ArduinoLoader.class); 86 | } 87 | public static void main(String[] args) throws Exception { 88 | /* 89 | * JavaFXInitializer.go(); ScriptingEngine.pull( 90 | * "https://github.com/OperationSmallKat/LunaMotherboardFirmware.git"); File f = 91 | * ScriptingEngine.fileFromGit( 92 | * "https://github.com/OperationSmallKat/LunaMotherboardFirmware.git", 93 | * "LunaMotherboardFirmware.ino"); 94 | * 95 | * new ArduinoExternalEditor().launch(f, new javafx.scene.control.Button()); 96 | */ 97 | // File exe = DownloadManager.getRunExecutable("arduino2", null); 98 | // File file = new File(); 99 | String absolutePath = "C:\\Users\\Kevin Bad Name\\bin\\" + DownloadManager.getSTUDIO_INSTALL() + "\\arduino2\\Arduino IDE.exe";// exe.getAbsolutePath(); 100 | run(null, new File("C:\\Users\\Kevin Bad Name\\bin\\" + DownloadManager.getSTUDIO_INSTALL() + "\\arduino2"), System.err, Arrays.asList( 101 | absolutePath, 102 | "C:\\Users\\Kevin Bad Name\\Documents\\bowler-workspace\\gitcache\\github.com\\OperationSmallKat\\LunaMotherboardFirmware\\LunaMotherboardFirmware.ino")); 103 | 104 | } 105 | 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/scripting/external/BlenderExternalEditor.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.scripting.external; 2 | 3 | import static com.neuronrobotics.bowlerstudio.scripting.DownloadManager.*; 4 | 5 | import java.io.File; 6 | import java.io.IOException; 7 | import java.net.MalformedURLException; 8 | import java.net.URL; 9 | import java.util.ArrayList; 10 | import java.util.Arrays; 11 | import java.util.List; 12 | 13 | import org.eclipse.jgit.api.Git; 14 | import org.eclipse.jgit.api.errors.GitAPIException; 15 | import org.eclipse.jgit.api.errors.InvalidRemoteException; 16 | import org.eclipse.jgit.api.errors.TransportException; 17 | import org.eclipse.jgit.errors.NoWorkTreeException; 18 | 19 | import com.neuronrobotics.bowlerstudio.BowlerStudio; 20 | import com.neuronrobotics.bowlerstudio.BowlerStudioController; 21 | import com.neuronrobotics.bowlerstudio.assets.AssetFactory; 22 | import com.neuronrobotics.bowlerstudio.scripting.AskToDeleteWidget; 23 | import com.neuronrobotics.bowlerstudio.scripting.BlenderLoader; 24 | import com.neuronrobotics.bowlerstudio.scripting.DownloadManager; 25 | import com.neuronrobotics.bowlerstudio.scripting.IExternalEditor; 26 | import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine; 27 | import com.neuronrobotics.bowlerstudio.scripting.ScriptingFileWidget; 28 | import com.neuronrobotics.bowlerstudio.scripting.StlLoader; 29 | import com.neuronrobotics.bowlerstudio.scripting.SvgLoader; 30 | import com.neuronrobotics.video.OSUtil; 31 | 32 | import eu.mihosoft.vrl.v3d.JavaFXInitializer; 33 | import javafx.scene.control.Button; 34 | import javafx.scene.image.Image; 35 | 36 | public class BlenderExternalEditor implements IExternalEditor { 37 | 38 | private Button advanced; 39 | 40 | @Override 41 | public void launch(File file, Button advanced) { 42 | new Thread(() -> { 43 | this.advanced = advanced; 44 | String filename = file.getAbsolutePath(); 45 | File dir = new File(filename).getParentFile(); 46 | File exe = DownloadManager.getRunExecutable("blender", null); 47 | 48 | if(filename.toLowerCase().endsWith(".stl")) { 49 | File blenderfile = new File(dir.getAbsolutePath()+delim()+file.getName()+".blend"); 50 | if(AskToDeleteWidget.askToDeleteFile(blenderfile.getName())) { 51 | blenderfile.delete(); 52 | } 53 | BlenderLoader.toBlenderFile(file, blenderfile); 54 | filename=blenderfile.getAbsolutePath(); 55 | try { 56 | BowlerStudio.createFileTab(blenderfile); 57 | }catch(Exception e) { 58 | e.printStackTrace(); 59 | } 60 | } 61 | if(filename.toLowerCase().endsWith(".stl") || !new File(filename).exists()) { 62 | com.neuronrobotics.sdk.common.Log.error("ERROR blender conversion failed!"); 63 | return; 64 | } 65 | try { 66 | List asList = Arrays.asList(exe.getAbsolutePath(), filename); 67 | if(isMac()) { 68 | asList = Arrays.asList("open","-a",exe.getAbsolutePath(), filename); 69 | 70 | } 71 | Thread t=run(this, dir, System.out, asList); 72 | t.join(); 73 | } catch (NoWorkTreeException e) { 74 | // Auto-generated catch block 75 | e.printStackTrace(); 76 | } catch (Exception e) { 77 | // Auto-generated catch block 78 | e.printStackTrace(); 79 | } 80 | onProcessExit(0) ; 81 | 82 | }).start(); 83 | } 84 | 85 | public void onProcessExit(int ev) { 86 | advanced.setDisable(false); 87 | } 88 | 89 | @Override 90 | public URL getInstallURL() throws MalformedURLException { 91 | return new URL("https://www.blender.org/download/release/Blender4.1/blender-4.1.1-linux-x64.tar.xz/"); 92 | } 93 | 94 | @Override 95 | public String nameOfEditor() { 96 | return "Blender"; 97 | } 98 | 99 | public Image getImage() { 100 | try { 101 | return AssetFactory.loadAsset("Blender.png"); 102 | } catch (Exception e) { 103 | // Auto-generated catch block 104 | e.printStackTrace(); 105 | } 106 | return null; 107 | } 108 | 109 | public static void main(String[] args) 110 | throws InvalidRemoteException, TransportException, GitAPIException, IOException { 111 | JavaFXInitializer.go(); 112 | File f = ScriptingEngine.fileFromGit("https://github.com/NeuronRobotics/NASACurisoity.git", 113 | "STL/upper-arm.STL"); 114 | 115 | new BlenderExternalEditor().launch(f, new Button()); 116 | } 117 | 118 | @Override 119 | public List getSupportedLangauge() { 120 | return Arrays.asList( StlLoader.class,BlenderLoader.class); 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/scripting/external/CaDoodleExternalEditor.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.scripting.external; 2 | 3 | import static com.neuronrobotics.bowlerstudio.scripting.DownloadManager.*; 4 | 5 | import java.io.File; 6 | import java.io.IOException; 7 | import java.net.MalformedURLException; 8 | import java.net.URL; 9 | import java.util.Arrays; 10 | import java.util.HashMap; 11 | import java.util.List; 12 | 13 | import org.eclipse.jgit.api.Git; 14 | import org.eclipse.jgit.api.errors.GitAPIException; 15 | import org.eclipse.jgit.api.errors.InvalidRemoteException; 16 | import org.eclipse.jgit.api.errors.TransportException; 17 | import org.eclipse.jgit.errors.NoWorkTreeException; 18 | 19 | import com.neuronrobotics.bowlerstudio.assets.AssetFactory; 20 | import com.neuronrobotics.bowlerstudio.scripting.BashLoader; 21 | import com.neuronrobotics.bowlerstudio.scripting.CaDoodleLoader; 22 | import com.neuronrobotics.bowlerstudio.scripting.DownloadManager; 23 | import com.neuronrobotics.bowlerstudio.scripting.FXMLBowlerLoader; 24 | import com.neuronrobotics.bowlerstudio.scripting.GroovyHelper; 25 | import com.neuronrobotics.bowlerstudio.scripting.IExternalEditor; 26 | import com.neuronrobotics.bowlerstudio.scripting.JsonRunner; 27 | import com.neuronrobotics.bowlerstudio.scripting.OpenSCADLoader; 28 | import com.neuronrobotics.bowlerstudio.scripting.RobotHelper; 29 | import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine; 30 | import com.neuronrobotics.bowlerstudio.scripting.SvgLoader; 31 | import com.neuronrobotics.video.OSUtil; 32 | 33 | import eu.mihosoft.vrl.v3d.JavaFXInitializer; 34 | import javafx.scene.control.Button; 35 | import javafx.scene.image.Image; 36 | 37 | public class CaDoodleExternalEditor implements IExternalEditor { 38 | 39 | private Button advanced; 40 | 41 | @Override 42 | public void launch(File file, Button advanced) { 43 | new Thread(() -> { 44 | this.advanced = advanced; 45 | String filename = "\""+file.getAbsolutePath()+"\""; 46 | 47 | try { 48 | File dir = file.getAbsoluteFile().getParentFile(); 49 | File exe; 50 | if(OSUtil.isOSX()) { 51 | exe = DownloadManager.getConfigExecutable("cadoodle", null); 52 | }else { 53 | exe = DownloadManager.getRunExecutable("cadoodle", null); 54 | } 55 | 56 | List asList = Arrays.asList( 57 | exe.getAbsolutePath(), 58 | filename); 59 | 60 | DownloadManager.legacySystemRun(new HashMap(),dir, System.err, asList); 61 | 62 | } catch (NoWorkTreeException e) { 63 | // Auto-generated catch block 64 | e.printStackTrace(); 65 | } catch (Exception e) { 66 | // Auto-generated catch block 67 | e.printStackTrace(); 68 | } 69 | onProcessExit(0) ; 70 | 71 | }).start(); 72 | } 73 | 74 | public void onProcessExit(int ev) { 75 | advanced.setDisable(false); 76 | } 77 | 78 | @Override 79 | public URL getInstallURL() throws MalformedURLException { 80 | return new URL("https://github.com/CommonWealthRobotics/CaDoodle/blob/main/README.md"); 81 | } 82 | 83 | @Override 84 | public String nameOfEditor() { 85 | return "CaDoodle"; 86 | } 87 | 88 | public Image getImage() { 89 | try { 90 | Image asset = AssetFactory.loadAsset("Script-Tab-CaDoodle.png"); 91 | return asset; 92 | } catch (Exception e) { 93 | // Auto-generated catch block 94 | e.printStackTrace(); 95 | } 96 | return null; 97 | } 98 | 99 | public static void main(String[] args) 100 | throws InvalidRemoteException, TransportException, GitAPIException, IOException { 101 | JavaFXInitializer.go(); 102 | String url="https://github.com/madhephaestus/TestRepo.git"; 103 | ScriptingEngine.pull("https://github.com/CommonWealthRobotics/ExternalEditorsBowlerStudio.git"); 104 | ScriptingEngine.pull(url); 105 | File f = ScriptingEngine.fileFromGit(url, 106 | "Doodle1/TestRepo.doodle"); 107 | 108 | new CaDoodleExternalEditor().launch(f, new Button()); 109 | } 110 | 111 | @Override 112 | public List getSupportedLangauge() { 113 | return Arrays.asList( CaDoodleLoader.class); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/scripting/external/ExternalEditorController.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.scripting.external; 2 | 3 | import java.io.File; 4 | import java.util.ArrayList; 5 | 6 | import com.neuronrobotics.bowlerstudio.assets.AssetFactory; 7 | import com.neuronrobotics.bowlerstudio.assets.FontSizeManager; 8 | import com.neuronrobotics.bowlerstudio.scripting.IExternalEditor; 9 | import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine; 10 | 11 | import javafx.scene.Node; 12 | import javafx.scene.control.Button; 13 | import javafx.scene.control.CheckBox; 14 | import javafx.scene.control.Tooltip; 15 | import javafx.scene.image.Image; 16 | import javafx.scene.image.ImageView; 17 | 18 | public class ExternalEditorController { 19 | private File currentFile; 20 | boolean hasEditor = false; 21 | private Button advanced = new Button(); 22 | private ImageView image=new ImageView(); 23 | private ArrayList editors=new ArrayList(); 24 | 25 | private void loadEditors() { 26 | editors.add(new SVGExternalEditor()); 27 | editors.add(new GroovyEclipseExternalEditor()); 28 | editors.add(new ArduinoExternalEditor()); 29 | editors.add(new BlenderExternalEditor()); 30 | editors.add(new FreeCADExternalEditor()); 31 | editors.add(new SceneBuilderExternalEditor()); 32 | editors.add(new OpenSCADExternalEditor()); 33 | editors.add(new CaDoodleExternalEditor()); 34 | } 35 | private IExternalEditor myEditor=null; 36 | public ExternalEditorController(File f, CheckBox autoRun){ 37 | loadEditors(); 38 | this.currentFile = f; 39 | for(IExternalEditor e:editors) { 40 | if(e.isSupportedByExtention(f)) { 41 | hasEditor=true; 42 | myEditor=e; 43 | image.setImage(e.getImage()); 44 | FontSizeManager.addListener(fontNum->{ 45 | image.setScaleX(FontSizeManager.getImageScale()); 46 | image.setScaleY(FontSizeManager.getImageScale()); 47 | }); 48 | com.neuronrobotics.sdk.common.Log.error("ExternalEditorController: FOUND "+f.getName()+" is supported by "+e.getClass()); 49 | break; 50 | }else { 51 | com.neuronrobotics.sdk.common.Log.error(":ExternalEditorController: "+f.getName()+" is not supported by "+e.getClass()); 52 | } 53 | 54 | } 55 | if(hasEditor) { 56 | 57 | advanced.setGraphic(image); 58 | advanced.setTooltip(new Tooltip("Click here to launch "+myEditor.nameOfEditor()+" the advanced editor for this file")); 59 | advanced.setText(myEditor.nameOfEditor()); 60 | advanced.setMinWidth(100); 61 | advanced.setTextOverrun(javafx.scene.control.OverrunStyle.CLIP); 62 | advanced.setOnAction(event -> { 63 | advanced.setDisable(true); 64 | myEditor.launch(currentFile,advanced); 65 | //autoRun.setSelected(true); 66 | }); 67 | // FontSizeManager.addListener(fontNum->{ 68 | // advanced.setScaleX(FontSizeManager.getImageScale()); 69 | // advanced.setScaleY(FontSizeManager.getImageScale()); 70 | // }); 71 | }else { 72 | try { 73 | Image loadAsset = AssetFactory.loadAsset("Script-Tab-"+ScriptingEngine.getShellType(currentFile.getName())+".png"); 74 | image.setImage(loadAsset); 75 | FontSizeManager.addListener(fontNum->{ 76 | image.setScaleX(FontSizeManager.getImageScale()); 77 | image.setScaleY(FontSizeManager.getImageScale()); 78 | }); 79 | } catch (Exception e) { 80 | // Auto-generated catch block 81 | e.printStackTrace(); 82 | } 83 | } 84 | image.setFitHeight(30); 85 | image.setFitWidth(30); 86 | 87 | } 88 | 89 | public Node getControl() { 90 | if(hasEditor) 91 | return advanced; 92 | else 93 | return image; 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/scripting/external/FreeCADExternalEditor.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.scripting.external; 2 | 3 | import java.io.File; 4 | import java.net.MalformedURLException; 5 | import java.net.URL; 6 | import java.util.Arrays; 7 | import java.util.List; 8 | 9 | import com.neuronrobotics.bowlerstudio.assets.AssetFactory; 10 | import com.neuronrobotics.bowlerstudio.scripting.FreecadLoader; 11 | import com.neuronrobotics.bowlerstudio.scripting.IExternalEditor; 12 | import com.neuronrobotics.bowlerstudio.scripting.SvgLoader; 13 | 14 | import javafx.application.Platform; 15 | import javafx.scene.control.Button; 16 | import javafx.scene.image.Image; 17 | 18 | public class FreeCADExternalEditor implements IExternalEditor { 19 | private Button advanced; 20 | 21 | @Override 22 | public List getSupportedLangauge() { 23 | return Arrays.asList( FreecadLoader.class); 24 | } 25 | 26 | @Override 27 | public void launch(File file, Button button) { 28 | advanced=button; 29 | new Thread(()->{ 30 | try { 31 | FreecadLoader.open(file); 32 | }catch(Throwable t) { 33 | t.printStackTrace(); 34 | } 35 | onProcessExit(0); 36 | }).start(); 37 | } 38 | 39 | @Override 40 | public String nameOfEditor() { 41 | return "FreeCAD"; 42 | } 43 | 44 | @Override 45 | public URL getInstallURL() throws MalformedURLException { 46 | return new URL("https://github.com/FreeCAD/FreeCAD-Bundle/releases"); 47 | } 48 | 49 | @Override 50 | public void onProcessExit(int ev) { 51 | if(advanced!=null) 52 | Platform.runLater(()->advanced.setDisable(false)); 53 | } 54 | 55 | @Override 56 | public Image getImage() { 57 | try { 58 | return AssetFactory.loadAsset("Script-Tab-FreeCAD.png"); 59 | } catch (Exception e) { 60 | // Auto-generated catch block 61 | e.printStackTrace(); 62 | } return null; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/scripting/external/OpenSCADExternalEditor.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.scripting.external; 2 | 3 | import static com.neuronrobotics.bowlerstudio.scripting.DownloadManager.*; 4 | 5 | import java.io.File; 6 | import java.io.IOException; 7 | import java.net.MalformedURLException; 8 | import java.net.URL; 9 | import java.util.Arrays; 10 | import java.util.List; 11 | 12 | import org.eclipse.jgit.api.Git; 13 | import org.eclipse.jgit.api.errors.GitAPIException; 14 | import org.eclipse.jgit.api.errors.InvalidRemoteException; 15 | import org.eclipse.jgit.api.errors.TransportException; 16 | import org.eclipse.jgit.errors.NoWorkTreeException; 17 | 18 | import com.neuronrobotics.bowlerstudio.assets.AssetFactory; 19 | import com.neuronrobotics.bowlerstudio.scripting.BashLoader; 20 | import com.neuronrobotics.bowlerstudio.scripting.DownloadManager; 21 | import com.neuronrobotics.bowlerstudio.scripting.FXMLBowlerLoader; 22 | import com.neuronrobotics.bowlerstudio.scripting.GroovyHelper; 23 | import com.neuronrobotics.bowlerstudio.scripting.IExternalEditor; 24 | import com.neuronrobotics.bowlerstudio.scripting.JsonRunner; 25 | import com.neuronrobotics.bowlerstudio.scripting.OpenSCADLoader; 26 | import com.neuronrobotics.bowlerstudio.scripting.RobotHelper; 27 | import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine; 28 | import com.neuronrobotics.bowlerstudio.scripting.SvgLoader; 29 | import com.neuronrobotics.video.OSUtil; 30 | 31 | import eu.mihosoft.vrl.v3d.JavaFXInitializer; 32 | import javafx.scene.control.Button; 33 | import javafx.scene.image.Image; 34 | 35 | public class OpenSCADExternalEditor implements IExternalEditor { 36 | 37 | private Button advanced; 38 | 39 | @Override 40 | public void launch(File file, Button advanced) { 41 | new Thread(() -> { 42 | this.advanced = advanced; 43 | String filename = file.getAbsolutePath(); 44 | 45 | try { 46 | File dir = file.getAbsoluteFile().getParentFile(); 47 | File openscad = DownloadManager.getRunExecutable("openscad", null); 48 | 49 | List asList = Arrays.asList( 50 | openscad.getAbsolutePath(), 51 | filename); 52 | 53 | Thread t=run(this, dir, System.err, asList); 54 | t.join(); 55 | } catch (NoWorkTreeException e) { 56 | // Auto-generated catch block 57 | e.printStackTrace(); 58 | } catch (Exception e) { 59 | // Auto-generated catch block 60 | e.printStackTrace(); 61 | } 62 | onProcessExit(0) ; 63 | 64 | }).start(); 65 | } 66 | 67 | public void onProcessExit(int ev) { 68 | advanced.setDisable(false); 69 | } 70 | 71 | @Override 72 | public URL getInstallURL() throws MalformedURLException { 73 | return new URL("https://openscad.org/downloads.html"); 74 | } 75 | 76 | @Override 77 | public String nameOfEditor() { 78 | return "OpenSCAD"; 79 | } 80 | 81 | public Image getImage() { 82 | try { 83 | return AssetFactory.loadAsset("Script-Tab-OpenSCAD.png"); 84 | } catch (Exception e) { 85 | // Auto-generated catch block 86 | e.printStackTrace(); 87 | } 88 | return null; 89 | } 90 | 91 | public static void main(String[] args) 92 | throws InvalidRemoteException, TransportException, GitAPIException, IOException { 93 | JavaFXInitializer.go(); 94 | String url="https://github.com/madhephaestus/TestRepo.git"; 95 | ScriptingEngine.pull(url); 96 | File f = ScriptingEngine.fileFromGit(url, 97 | "test.scad"); 98 | 99 | new OpenSCADExternalEditor().launch(f, new Button()); 100 | } 101 | 102 | @Override 103 | public List getSupportedLangauge() { 104 | return Arrays.asList( OpenSCADLoader.class); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/scripting/external/SVGExternalEditor.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.scripting.external; 2 | 3 | import static com.neuronrobotics.bowlerstudio.scripting.DownloadManager.*; 4 | 5 | import java.io.File; 6 | import java.io.IOException; 7 | import java.net.MalformedURLException; 8 | import java.net.URL; 9 | import java.util.Arrays; 10 | import java.util.List; 11 | 12 | import org.eclipse.jgit.api.Git; 13 | import org.eclipse.jgit.api.errors.GitAPIException; 14 | import org.eclipse.jgit.api.errors.InvalidRemoteException; 15 | import org.eclipse.jgit.api.errors.TransportException; 16 | import org.eclipse.jgit.errors.NoWorkTreeException; 17 | 18 | import com.neuronrobotics.bowlerstudio.assets.AssetFactory; 19 | import com.neuronrobotics.bowlerstudio.scripting.BashLoader; 20 | import com.neuronrobotics.bowlerstudio.scripting.DownloadManager; 21 | import com.neuronrobotics.bowlerstudio.scripting.GroovyHelper; 22 | import com.neuronrobotics.bowlerstudio.scripting.IExternalEditor; 23 | import com.neuronrobotics.bowlerstudio.scripting.JsonRunner; 24 | import com.neuronrobotics.bowlerstudio.scripting.RobotHelper; 25 | import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine; 26 | import com.neuronrobotics.bowlerstudio.scripting.SvgLoader; 27 | import com.neuronrobotics.video.OSUtil; 28 | 29 | import javafx.scene.control.Button; 30 | import javafx.scene.image.Image; 31 | 32 | public class SVGExternalEditor implements IExternalEditor { 33 | 34 | private Button advanced; 35 | 36 | @Override 37 | public void launch(File file, Button advanced) { 38 | new Thread(() -> { 39 | this.advanced = advanced; 40 | String filename = file.getAbsolutePath(); 41 | 42 | try { 43 | // Git locateGit = ScriptingEngine.locateGit(file); 44 | // File dir = locateGit.getRepository().getWorkTree(); 45 | // ScriptingEngine.closeGit(locateGit); 46 | 47 | File exe = DownloadManager.getRunExecutable("inkscape", null); 48 | 49 | List asList = Arrays.asList(exe.getAbsolutePath(), filename); 50 | if(isMac()) { 51 | asList = Arrays.asList("open","-a",exe.getAbsolutePath(), filename); 52 | 53 | } 54 | Thread t=run(this, file.getParentFile(), System.err, asList); 55 | t.join(); 56 | } catch (NoWorkTreeException e) { 57 | // Auto-generated catch block 58 | e.printStackTrace(); 59 | } catch (Exception e) { 60 | // Auto-generated catch block 61 | e.printStackTrace(); 62 | } 63 | onProcessExit(0) ; 64 | 65 | }).start(); 66 | } 67 | 68 | public void onProcessExit(int ev) { 69 | advanced.setDisable(false); 70 | } 71 | 72 | @Override 73 | public URL getInstallURL() throws MalformedURLException { 74 | return new URL("https://inkscape.org/release/"); 75 | } 76 | 77 | @Override 78 | public String nameOfEditor() { 79 | return "Inkscape"; 80 | } 81 | 82 | public Image getImage() { 83 | try { 84 | return AssetFactory.loadAsset("Script-Tab-SVG.png"); 85 | } catch (Exception e) { 86 | // Auto-generated catch block 87 | e.printStackTrace(); 88 | } 89 | return null; 90 | } 91 | 92 | public static void main(String[] args) 93 | throws InvalidRemoteException, TransportException, GitAPIException, IOException { 94 | File f = ScriptingEngine.fileFromGit("https://github.com/Technocopia/Graphics.git", 95 | "Graphics/SimplifiedLogo/simplified logo.svg"); 96 | 97 | new SVGExternalEditor().launch(f, new Button()); 98 | } 99 | 100 | @Override 101 | public List getSupportedLangauge() { 102 | return Arrays.asList( SvgLoader.class); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/scripting/external/SceneBuilderExternalEditor.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.scripting.external; 2 | 3 | import static com.neuronrobotics.bowlerstudio.scripting.DownloadManager.*; 4 | 5 | import java.io.File; 6 | import java.io.IOException; 7 | import java.net.MalformedURLException; 8 | import java.net.URL; 9 | import java.util.Arrays; 10 | import java.util.List; 11 | 12 | import org.eclipse.jgit.api.Git; 13 | import org.eclipse.jgit.api.errors.GitAPIException; 14 | import org.eclipse.jgit.api.errors.InvalidRemoteException; 15 | import org.eclipse.jgit.api.errors.TransportException; 16 | import org.eclipse.jgit.errors.NoWorkTreeException; 17 | 18 | import com.neuronrobotics.bowlerstudio.assets.AssetFactory; 19 | import com.neuronrobotics.bowlerstudio.scripting.BashLoader; 20 | import com.neuronrobotics.bowlerstudio.scripting.DownloadManager; 21 | import com.neuronrobotics.bowlerstudio.scripting.FXMLBowlerLoader; 22 | import com.neuronrobotics.bowlerstudio.scripting.GroovyHelper; 23 | import com.neuronrobotics.bowlerstudio.scripting.IExternalEditor; 24 | import com.neuronrobotics.bowlerstudio.scripting.JsonRunner; 25 | import com.neuronrobotics.bowlerstudio.scripting.RobotHelper; 26 | import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine; 27 | import com.neuronrobotics.bowlerstudio.scripting.SvgLoader; 28 | import com.neuronrobotics.video.OSUtil; 29 | 30 | import javafx.scene.control.Button; 31 | import javafx.scene.image.Image; 32 | 33 | public class SceneBuilderExternalEditor implements IExternalEditor { 34 | 35 | private Button advanced; 36 | 37 | @Override 38 | public void launch(File file, Button advanced) { 39 | new Thread(() -> { 40 | this.advanced = advanced; 41 | String filename = file.getAbsolutePath(); 42 | 43 | try { 44 | File dir = file.getAbsoluteFile().getParentFile(); 45 | File scenebuilder = DownloadManager.getRunExecutable("scenebuilder", null); 46 | File java = DownloadManager.getRunExecutable("java17", null); 47 | 48 | List asList = Arrays.asList( 49 | java.getAbsolutePath(), 50 | "-jar", 51 | scenebuilder.getAbsolutePath(), 52 | filename); 53 | 54 | Thread t=run(this, dir, System.err, asList); 55 | t.join(); 56 | } catch (NoWorkTreeException e) { 57 | // Auto-generated catch block 58 | e.printStackTrace(); 59 | } catch (Exception e) { 60 | // Auto-generated catch block 61 | e.printStackTrace(); 62 | } 63 | onProcessExit(0) ; 64 | 65 | }).start(); 66 | } 67 | 68 | public void onProcessExit(int ev) { 69 | advanced.setDisable(false); 70 | } 71 | 72 | @Override 73 | public URL getInstallURL() throws MalformedURLException { 74 | return new URL("https://gluonhq.com/products/scene-builder/"); 75 | } 76 | 77 | @Override 78 | public String nameOfEditor() { 79 | return "SceneBuilder"; 80 | } 81 | 82 | public Image getImage() { 83 | try { 84 | return AssetFactory.loadAsset("Script-Tab-fxml.png"); 85 | } catch (Exception e) { 86 | // Auto-generated catch block 87 | e.printStackTrace(); 88 | } 89 | return null; 90 | } 91 | 92 | public static void main(String[] args) 93 | throws InvalidRemoteException, TransportException, GitAPIException, IOException { 94 | File f = ScriptingEngine.fileFromGit("https://github.com/madhephaestus/HortonsLinkages.git", 95 | "main.fxml"); 96 | 97 | new SceneBuilderExternalEditor().launch(f, new Button()); 98 | } 99 | 100 | @Override 101 | public List getSupportedLangauge() { 102 | return Arrays.asList( FXMLBowlerLoader.class); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /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.bowlerstudio.BowlerStudioController; 6 | import com.neuronrobotics.bowlerstudio.BowlerStudioModularFrame; 7 | import com.neuronrobotics.bowlerstudio.creature.MobileBaseCadManager; 8 | import com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics; 9 | import com.neuronrobotics.sdk.addons.kinematics.MobileBase; 10 | import com.neuronrobotics.sdk.common.BowlerAbstractConnection; 11 | import com.neuronrobotics.sdk.common.BowlerAbstractDevice; 12 | import com.neuronrobotics.sdk.common.IConnectionEventListener; 13 | import com.neuronrobotics.sdk.common.IDeviceConnectionEventListener; 14 | //import com.sun.javafx.scene.control.behavior.TabPaneBehavior; 15 | //import com.sun.javafx.scene.control.skin.TabPaneSkin; 16 | 17 | import eu.mihosoft.vrl.v3d.CSG; 18 | import javafx.application.Platform; 19 | import javafx.event.Event; 20 | import javafx.event.EventHandler; 21 | import javafx.scene.control.Tab; 22 | 23 | public abstract class AbstractBowlerStudioTab extends Tab implements EventHandler { 24 | 25 | private boolean active = false; 26 | ArrayList myNames =null; 27 | private EventHandler localCopyOfEventHandler; 28 | 29 | public abstract void onTabClosing(); 30 | public abstract String[] getMyNameSpaces(); 31 | public abstract void initializeUI(BowlerAbstractDevice pm); 32 | public abstract void onTabReOpening(); 33 | 34 | 35 | public void setDevice(BowlerAbstractDevice pm){ 36 | myNames = new ArrayList<> (); 37 | if(getMyNameSpaces().length>0){ 38 | for(int i=0;i names) { 82 | if (names == null) 83 | return false; 84 | for(String s:names){ 85 | for(String m:myNames){ 86 | if(s.contains(m)){ 87 | setActive(true); 88 | } 89 | } 90 | } 91 | 92 | return isAcvive(); 93 | } 94 | @Override 95 | public void setOnCloseRequest(EventHandler value){ 96 | this.localCopyOfEventHandler = value; 97 | super.setOnCloseRequest(value); 98 | com.neuronrobotics.sdk.common.Log.error(" A close requested for "+getText()); 99 | } 100 | public void requestClose() { 101 | BowlerStudioModularFrame.getBowlerStudioModularFrame().closeTab(this); 102 | } 103 | // 104 | // private TabPaneBehavior getBehavior() { 105 | // return ((TabPaneSkin) getTabPane().getSkin()).getBehavior(); 106 | // } 107 | 108 | public void setActive(boolean a){ 109 | active=a; 110 | } 111 | 112 | public boolean isAcvive() { 113 | return active; 114 | } 115 | 116 | @Override 117 | public void handle(Event event){ 118 | com.neuronrobotics.sdk.common.Log.error("Closing "+getText()); 119 | onTabClosing(); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/tabs/CalibrateGameControl.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.tabs; 2 | 3 | import java.io.File; 4 | import java.net.URL; 5 | 6 | import javax.swing.JFrame; 7 | 8 | import org.firmata4j.IODevice; 9 | import org.firmata4j.firmata.FirmataDevice; 10 | import org.firmata4j.ui.JPinboard; 11 | 12 | import com.neuronrobotics.bowlerstudio.assets.AssetFactory; 13 | import com.neuronrobotics.bowlerstudio.assets.FontSizeManager; 14 | import com.neuronrobotics.sdk.addons.gamepad.BowlerJInputDevice; 15 | import com.neuronrobotics.sdk.addons.gamepad.JogTrainerWidget; 16 | import com.neuronrobotics.sdk.addons.kinematics.FirmataBowler; 17 | import com.neuronrobotics.sdk.common.BowlerAbstractDevice; 18 | 19 | import javafx.embed.swing.SwingNode; 20 | import javafx.fxml.FXMLLoader; 21 | import javafx.scene.Parent; 22 | import javafx.scene.control.ScrollPane; 23 | 24 | public class CalibrateGameControl extends AbstractBowlerStudioTab { 25 | 26 | private JogTrainerWidget w; 27 | 28 | @Override 29 | public void onTabClosing() { 30 | // Auto-generated method stub 31 | 32 | } 33 | 34 | @Override 35 | public String[] getMyNameSpaces() { 36 | // Auto-generated method stub 37 | return new String[0]; 38 | } 39 | 40 | @Override 41 | public void initializeUI(BowlerAbstractDevice pm) { 42 | BowlerJInputDevice dev = (BowlerJInputDevice)pm; 43 | 44 | File fxmlFIle; 45 | try { 46 | fxmlFIle = AssetFactory.loadFile("layout/jogTrainerWidget.fxml"); 47 | URL fileURL = fxmlFIle.toURI().toURL(); 48 | FXMLLoader loader = new FXMLLoader(fileURL); 49 | loader.setLocation(fileURL); 50 | Parent root; 51 | w = new JogTrainerWidget(dev); 52 | loader.setController(w); 53 | // This is needed when loading on MAC 54 | loader.setClassLoader(JogTrainerWidget.class.getClassLoader()); 55 | root = loader.load(); 56 | FontSizeManager.addListener(fontNum->{ 57 | int tmp = fontNum-10; 58 | if(tmp<12) 59 | tmp=12; 60 | root.setStyle("-fx-font-size: "+tmp+"pt"); 61 | }); 62 | setContent(root); 63 | } catch (Exception e) { 64 | // Auto-generated catch block 65 | e.printStackTrace(); 66 | } 67 | 68 | setText("Calibrate Game Control"); 69 | onTabReOpening(); 70 | } 71 | 72 | @Override 73 | public void onTabReOpening() { 74 | 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/tabs/FirmataTab.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.tabs; 2 | 3 | import javax.swing.JFrame; 4 | 5 | import org.firmata4j.IODevice; 6 | import org.firmata4j.firmata.FirmataDevice; 7 | import org.firmata4j.ui.JPinboard; 8 | 9 | import com.neuronrobotics.sdk.addons.kinematics.FirmataBowler; 10 | import com.neuronrobotics.sdk.common.BowlerAbstractDevice; 11 | 12 | import javafx.embed.swing.SwingNode; 13 | import javafx.scene.control.ScrollPane; 14 | 15 | public class FirmataTab extends AbstractBowlerStudioTab { 16 | 17 | @Override 18 | public void onTabClosing() { 19 | // Auto-generated method stub 20 | 21 | } 22 | 23 | @Override 24 | public String[] getMyNameSpaces() { 25 | // Auto-generated method stub 26 | return new String[0]; 27 | } 28 | 29 | @Override 30 | public void initializeUI(BowlerAbstractDevice pm) { 31 | FirmataDevice device =( (FirmataBowler) pm).getFirmataDevice(); 32 | // Auto-generated method stub 33 | JFrame frame = new JFrame("Pinboard Example"); 34 | frame.add(new JPinboard(device )); 35 | frame.pack(); 36 | frame.setVisible(true); 37 | 38 | JPinboard pinboard = new JPinboard(device ); 39 | pinboard.setVisible(true); 40 | SwingNode sn = new SwingNode(); 41 | sn.setContent(pinboard); 42 | ScrollPane s1 = new ScrollPane(); 43 | 44 | s1.setContent(sn); 45 | setContent(s1); 46 | setText("Firmata Pinpoard"); 47 | onTabReOpening(); 48 | } 49 | 50 | @Override 51 | public void onTabReOpening() { 52 | // Auto-generated method stub 53 | 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/tabs/WebTabFactory.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.tabs; 2 | import javafx.beans.value.ChangeListener; 3 | import javafx.beans.value.ObservableValue; 4 | import javafx.collections.ObservableList; 5 | import javafx.concurrent.Worker.State; 6 | import javafx.event.ActionEvent; 7 | import javafx.event.Event; 8 | import javafx.event.EventHandler; 9 | import javafx.scene.control.Button; 10 | import javafx.scene.control.Tab; 11 | import javafx.scene.control.TextField; 12 | import javafx.scene.layout.HBox; 13 | import javafx.scene.layout.Priority; 14 | import javafx.scene.layout.VBox; 15 | import javafx.scene.web.WebEngine; 16 | import javafx.scene.web.WebHistory; 17 | import javafx.scene.web.WebView; 18 | import javafx.scene.layout.AnchorPane; 19 | public class WebTabFactory { 20 | 21 | public static Tab WebTab(String title, String Url,boolean isTutorialTab) { 22 | return null; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/tabs/WebTabTest.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.tabs; 2 | 3 | import java.io.File; 4 | import java.time.Duration; 5 | 6 | import com.neuronrobotics.bowlerstudio.BowlerStudio; 7 | import com.neuronrobotics.bowlerstudio.assets.AssetFactory; 8 | import com.neuronrobotics.bowlerstudio.assets.FontSizeManager; 9 | import com.neuronrobotics.bowlerstudio.creature.VitaminWidgetTest; 10 | import com.neuronrobotics.bowlerstudio.creature.VitatminWidget; 11 | import com.neuronrobotics.bowlerstudio.scripting.ScriptingEngine; 12 | import com.neuronrobotics.sdk.addons.kinematics.MobileBase; 13 | import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; 14 | 15 | import eu.mihosoft.vrl.v3d.JavaFXInitializer; 16 | import javafx.application.Application; 17 | import javafx.fxml.FXMLLoader; 18 | import javafx.scene.Parent; 19 | import javafx.scene.Scene; 20 | import javafx.scene.control.Tab; 21 | import javafx.stage.Stage; 22 | 23 | public class WebTabTest extends Application { 24 | private WebTabController tw; 25 | 26 | @Override 27 | public void start(Stage primaryStage) throws Exception { 28 | FXMLLoader loader = AssetFactory.loadLayout("layout/WebTabLayout.fxml"); 29 | loader.setClassLoader(WebTabController.class.getClassLoader()); 30 | Parent w = loader.load(); 31 | 32 | tw = loader.getController(); 33 | 34 | File layoutFile = AssetFactory.loadFile("layout/default.css"); 35 | String nwfile = layoutFile.toURI().toString().replace("file:/", "file:///"); 36 | Scene scene = new Scene(w); 37 | 38 | scene.getStylesheets().clear(); 39 | scene.getStylesheets().add(nwfile); 40 | com.neuronrobotics.sdk.common.Log.error("Loading CSS from " + nwfile); 41 | 42 | FontSizeManager.addListener(fontNum->{ 43 | int tmp = fontNum-10; 44 | if(tmp<12) 45 | tmp=12; 46 | com.neuronrobotics.sdk.common.Log.error("Setting font size to "+fontNum); 47 | w.setStyle("-fx-font-size: "+tmp+"pt"); 48 | }); 49 | primaryStage.setOnCloseRequest(arg0 -> { 50 | System.exit(0); 51 | }); 52 | 53 | 54 | primaryStage.setScene(scene); 55 | primaryStage.setWidth(600); 56 | primaryStage.setHeight(777); 57 | primaryStage.setTitle("Web Tab Test Application"); 58 | primaryStage.show(); 59 | 60 | } 61 | 62 | public static void main(String[] args) { 63 | JavaFXInitializer.go(); 64 | 65 | BowlerStudio.runLater(() -> { 66 | Stage s = new Stage(); 67 | // 68 | WebTabTest controller = new WebTabTest(); 69 | try { 70 | controller.start(s); 71 | 72 | } catch (Exception e) { 73 | e.printStackTrace(); 74 | } 75 | WebTabController tw = controller.getTw(); 76 | new Thread(() -> { 77 | FontSizeManager.setFontSize(48); 78 | }).start(); 79 | }); 80 | } 81 | 82 | /** 83 | * @return the tw 84 | */ 85 | public WebTabController getTw() { 86 | return tw; 87 | } 88 | 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/threed/AssemblySlider.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.threed; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.Iterator; 6 | import java.util.Optional; 7 | import java.util.Set; 8 | 9 | import com.neuronrobotics.bowlerstudio.physics.TransformFactory; 10 | import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; 11 | import eu.mihosoft.vrl.v3d.CSG; 12 | import eu.mihosoft.vrl.v3d.PropertyStorage; 13 | import eu.mihosoft.vrl.v3d.Transform; 14 | import javafx.scene.control.Slider; 15 | import javafx.beans.value.ChangeListener; 16 | import javafx.beans.value.ObservableValue; 17 | import javafx.scene.transform.Affine; 18 | 19 | 20 | 21 | public class AssemblySlider { 22 | public static Slider getSlider(Set listOfObjects) { 23 | int s=0; 24 | 25 | CSG[] array = listOfObjects.toArray(new CSG[0]); 26 | for (int i = 0; i < array.length; i++) { 27 | CSG c = array[i]; 28 | PropertyStorage incomingGetStorage = c.getAssemblyStorage(); 29 | if(incomingGetStorage.getValue("MaxAssemblyStep")!=Optional.empty()) { 30 | Integer max = (Integer) incomingGetStorage.getValue("MaxAssemblyStep").get(); 31 | if(max>s) { 32 | s=max; 33 | } 34 | } 35 | } 36 | int numSteps=s; 37 | Slider slider = new Slider(0, numSteps, numSteps); 38 | slider.setShowTickMarks(true); 39 | slider.setShowTickLabels(true); 40 | slider.setMajorTickUnit(0.25f); 41 | slider.setBlockIncrement(0.1f); 42 | slider.setPrefWidth(300); 43 | slider.valueProperty().addListener(new ChangeListener() { 44 | public void changed(ObservableValue observable, Number oldValue, Number newValue){ 45 | int step = (int)(newValue.doubleValue()+1); 46 | double fraction =-1*(newValue.doubleValue()-step); 47 | 48 | for (Iterator iterator = listOfObjects.iterator(); iterator.hasNext();) { 49 | CSG c = iterator.next(); 50 | PropertyStorage incomingGetStorage = c.getAssemblyStorage(); 51 | String key = "AssemblySteps"; 52 | if(incomingGetStorage.getValue(key)!=Optional.empty()) { 53 | HashMap map=(HashMap) incomingGetStorage.getValue(key).get(); 54 | boolean set=false; 55 | TransformNR target=new TransformNR(); 56 | for(int i=step;i<=numSteps;i++) { 57 | if(map.get(i)!=null) { 58 | double myScale= (i==step)?fraction:1; 59 | TransformNR scaled =TransformFactory.csgToNR(map.get(i)).scale(myScale); 60 | target=target.times(scaled); 61 | //println c.getName()+" sliderval="+newValue+" step="+step+" fraction:"+myScale+" || "+i 62 | TransformFactory.nrToAffine(target,(Affine) incomingGetStorage.getValue("AssembleAffine").get()); 63 | set=true; 64 | } 65 | } 66 | if(!set) { 67 | TransformFactory.nrToAffine(new TransformNR(),(Affine) incomingGetStorage.getValue("AssembleAffine").get()); 68 | } 69 | 70 | } 71 | } 72 | } 73 | }); 74 | if(numSteps==0) 75 | slider.setDisable(true); 76 | return slider; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/threed/CreaturelLabController.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.threed; 2 | 3 | /** 4 | * Sample Skeleton for "CreatureLab.fxml" Controller Class 5 | * You can copy and paste this code into your favorite IDE 6 | **/ 7 | 8 | import java.net.URL; 9 | import java.util.ResourceBundle; 10 | import javafx.fxml.FXML; 11 | import javafx.scene.control.ScrollPane; 12 | import javafx.scene.layout.AnchorPane; 13 | 14 | 15 | public class CreaturelLabController { 16 | 17 | @FXML // ResourceBundle that was given to the FXMLLoader 18 | private ResourceBundle resources; 19 | 20 | @FXML // URL location of the FXML file that was given to the FXMLLoader 21 | private URL location; 22 | 23 | @FXML // fx:id="CadControlsAnchor" 24 | private AnchorPane CadControlsAnchor; // Value injected by FXMLLoader 25 | 26 | @FXML // fx:id="DriveControlsAnchor" 27 | private AnchorPane DriveControlsAnchor; // Value injected by FXMLLoader 28 | 29 | @FXML // fx:id="TempControlsAnchor" 30 | private AnchorPane TempControlsAnchor; // Value injected by FXMLLoader 31 | 32 | @FXML // fx:id="jfx3dControls" 33 | private AnchorPane jfx3dControls; // Value injected by FXMLLoader 34 | 35 | @FXML // fx:id="overlayScrollPanel" 36 | private ScrollPane overlayScrollPanel; // Value injected by FXMLLoader 37 | 38 | @FXML // fx:id="viewContainer" 39 | private AnchorPane viewContainer; // Value injected by FXMLLoader 40 | 41 | 42 | @FXML // This method is called by the FXMLLoader when initialization is complete 43 | void initialize() { 44 | assert CadControlsAnchor != null : "fx:id=\"CadControlsAnchor\" was not injected: check your FXML file 'CreatureLab.fxml'."; 45 | assert DriveControlsAnchor != null : "fx:id=\"DriveControlsAnchor\" was not injected: check your FXML file 'CreatureLab.fxml'."; 46 | assert TempControlsAnchor != null : "fx:id=\"TempControlsAnchor\" was not injected: check your FXML file 'CreatureLab.fxml'."; 47 | assert jfx3dControls != null : "fx:id=\"jfx3dControls\" was not injected: check your FXML file 'CreatureLab.fxml'."; 48 | assert overlayScrollPanel != null : "fx:id=\"overlayScrollPanel\" was not injected: check your FXML file 'CreatureLab.fxml'."; 49 | assert viewContainer != null : "fx:id=\"viewContainer\" was not injected: check your FXML file 'CreatureLab.fxml'."; 50 | 51 | // Initialize your logic here: all @FXML variables will have been injected 52 | 53 | 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/threed/ICameraChangeListener.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.threed; 2 | 3 | public interface ICameraChangeListener { 4 | void onChange( VirtualCameraMobileBase camera); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/threed/IControlsMap.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.threed; 2 | 3 | public interface IControlsMap { 4 | public boolean timeToCancel(javafx.scene.input.MouseEvent event); 5 | public boolean isSlowMove(javafx.scene.input.MouseEvent event); 6 | public boolean isMove(javafx.scene.input.MouseEvent ev); 7 | public boolean isRotate(javafx.scene.input.MouseEvent me); 8 | public boolean isZoom(javafx.scene.input.ScrollEvent t); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/threed/Jbullet.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.threed; 2 | 3 | import javax.vecmath.Matrix4f; 4 | import javax.vecmath.Quat4f; 5 | import javax.vecmath.Vector3f; 6 | 7 | import com.bulletphysics.collision.broadphase.BroadphaseInterface; 8 | import com.bulletphysics.collision.broadphase.DbvtBroadphase; 9 | import com.bulletphysics.collision.dispatch.CollisionDispatcher; 10 | import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; 11 | import com.bulletphysics.collision.shapes.CollisionShape; 12 | import com.bulletphysics.collision.shapes.SphereShape; 13 | import com.bulletphysics.collision.shapes.StaticPlaneShape; 14 | import com.bulletphysics.dynamics.DiscreteDynamicsWorld; 15 | import com.bulletphysics.dynamics.RigidBody; 16 | import com.bulletphysics.dynamics.RigidBodyConstructionInfo; 17 | import com.bulletphysics.dynamics.constraintsolver.SequentialImpulseConstraintSolver; 18 | import com.bulletphysics.linearmath.DefaultMotionState; 19 | import com.bulletphysics.linearmath.Transform; 20 | 21 | public class Jbullet { 22 | 23 | public static void main(String[] args) { 24 | 25 | BroadphaseInterface broadphase = new DbvtBroadphase(); 26 | DefaultCollisionConfiguration collisionConfiguration = new DefaultCollisionConfiguration(); 27 | CollisionDispatcher dispatcher = new CollisionDispatcher(collisionConfiguration); 28 | 29 | SequentialImpulseConstraintSolver solver = new SequentialImpulseConstraintSolver(); 30 | 31 | DiscreteDynamicsWorld dynamicsWorld = new DiscreteDynamicsWorld(dispatcher, broadphase, solver, 32 | collisionConfiguration); 33 | 34 | // set the gravity of our world 35 | dynamicsWorld.setGravity(new Vector3f(0, -10, 0)); 36 | 37 | // setup our collision shapes 38 | CollisionShape groundShape = new StaticPlaneShape(new Vector3f(0, 1, 0), 1); 39 | CollisionShape fallShape = new SphereShape(1); 40 | 41 | // setup the motion state 42 | DefaultMotionState groundMotionState = new DefaultMotionState( 43 | new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), new Vector3f(0, -1, 0), 1.0f))); 44 | 45 | RigidBodyConstructionInfo groundRigidBodyCI = new RigidBodyConstructionInfo(0, groundMotionState, groundShape, 46 | new Vector3f(0, 0, 0)); 47 | RigidBody groundRigidBody = new RigidBody(groundRigidBodyCI); 48 | 49 | dynamicsWorld.addRigidBody(groundRigidBody); // add our ground to the 50 | // dynamic world.. 51 | 52 | // setup the motion state for the ball 53 | DefaultMotionState fallMotionState = new DefaultMotionState( 54 | new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), new Vector3f(0, 100, 0), 1.0f))); 55 | 56 | // This we're going to give mass so it responds to gravity 57 | int mass = 1; 58 | 59 | Vector3f fallInertia = new Vector3f(0, 0, 0); 60 | fallShape.calculateLocalInertia(mass, fallInertia); 61 | 62 | RigidBodyConstructionInfo fallRigidBodyCI = new RigidBodyConstructionInfo(mass, fallMotionState, fallShape, 63 | fallInertia); 64 | RigidBody fallRigidBody = new RigidBody(fallRigidBodyCI); 65 | 66 | // now we add it to our physics simulation 67 | dynamicsWorld.addRigidBody(fallRigidBody); 68 | 69 | for (int i = 0; i < 300; i++) { 70 | dynamicsWorld.stepSimulation(1 / 60.f, 10); 71 | 72 | Transform trans = new Transform(); 73 | fallRigidBody.getMotionState().getWorldTransform(trans); 74 | 75 | com.neuronrobotics.sdk.common.Log.error("sphere height: " + trans.origin.y); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/threed/MakeRuler.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.threed; 2 | 3 | import java.util.HashMap; 4 | 5 | import com.neuronrobotics.bowlerstudio.BowlerKernel; 6 | 7 | import eu.mihosoft.vrl.v3d.CSG; 8 | import javafx.scene.Group; 9 | import javafx.scene.shape.CullFace; 10 | import javafx.scene.shape.Line; 11 | import javafx.scene.text.Text; 12 | import javafx.scene.text.Font; 13 | import javafx.scene.shape.TriangleMesh; 14 | import javafx.scene.shape.MeshView; 15 | import javafx.scene.shape.MeshView; 16 | import javafx.scene.shape.TriangleMesh; 17 | import javafx.scene.paint.PhongMaterial; 18 | import javafx.scene.paint.Color; 19 | import javafx.scene.transform.Affine; 20 | import javafx.scene.shape.SVGPath; 21 | 22 | public class MakeRuler { 23 | // SVG paths for numbers 0-9 24 | private static HashMap numbers = new HashMap<>(); 25 | 26 | public static Group createRuler(boolean flipNumber) { 27 | int numCentimeters = 30; 28 | double width = 0.15; 29 | double height = 10; 30 | Group ruler = new Group(); 31 | new Thread(() -> { 32 | // Create base mesh for the ruler line 33 | TriangleMesh baseMesh = createRectangleMesh(width, 1.0f); 34 | MeshView baseView = new MeshView(baseMesh); 35 | baseView.setMouseTransparent(true); 36 | PhongMaterial phongMaterial = new PhongMaterial(Color.BLACK); 37 | 38 | baseView.setMaterial(phongMaterial); 39 | 40 | // Position the base line in the middle 41 | Affine baseTransform = new Affine(); 42 | baseTransform.setTy(height / 2 - 1.0); 43 | baseView.getTransforms().add(baseTransform); 44 | BowlerKernel.runLater(() -> ruler.getChildren().add(baseView)); 45 | 46 | // Constants for spacing 47 | double mmSpacing = width / (numCentimeters * 10.0); 48 | double tickWidth = 0.25; 49 | // Draw tick marks and labels 50 | for (int i = 0; i <= numCentimeters * 10; i++) { 51 | double x = i * mmSpacing; 52 | TriangleMesh tickMesh; 53 | 54 | // Determine tick type based on position 55 | if (i % 10 == 0) { 56 | // Centimeter marks 57 | tickMesh = createRectangleMesh(tickWidth, height / 1.5); 58 | if (i % 20 == 0) { 59 | // Add centimeter number using SVGPath 60 | int number = i / 10; 61 | if (numbers.get(number) == null) { 62 | numbers.put(number, CSG.textToSize("" + i, 4, 6, 0.1).movey(height).moveToCenterX() 63 | .setColor(Color.BLACK)); 64 | } 65 | CSG movey = flipNumber?numbers.get(number): numbers.get(number).roty(180); 66 | int index=i; 67 | BowlerKernel.runLater(() -> { 68 | MeshView numberGroup = movey.newMesh(); 69 | numberGroup.setMouseTransparent(true); 70 | // Scale and position the number 71 | Affine numberTransform = new Affine(); 72 | numberTransform.appendTranslation(index, 0); 73 | numberGroup.getTransforms().add(numberTransform); 74 | ruler.getChildren().add(numberGroup); 75 | }); 76 | } 77 | } else if (i % 5 == 0) { 78 | // 5mm marks 79 | tickMesh = createRectangleMesh(tickWidth, height / 2.5); 80 | } else { 81 | // 1mm marks 82 | tickMesh = createRectangleMesh(tickWidth, height / 4); 83 | } 84 | 85 | // Create and position tick mark 86 | MeshView tickView = new MeshView(tickMesh); 87 | tickView.setMouseTransparent(true); 88 | tickView.setMaterial(phongMaterial); 89 | 90 | // Use Affine transform for tick positioning 91 | // com.neuronrobotics.sdk.common.Log.error("Tick for " + i); 92 | Affine tickTransform = new Affine(); 93 | tickTransform.setTx(i - tickWidth / 2); 94 | // tickTransform.setTy((height - tickView.getBoundsInLocal().getHeight()) / 2); 95 | tickView.getTransforms().add(tickTransform); 96 | tickView.setCullFace(CullFace.NONE); 97 | BowlerKernel.runLater(() -> ruler.getChildren().add(tickView)); 98 | } 99 | }).start(); 100 | return ruler; 101 | } 102 | 103 | private static TriangleMesh createRectangleMesh(double width, double height) { 104 | float[] points = { 0, 0, 0, // point 0 105 | (float) width, 0, 0, // point 1 106 | (float) width, (float) height, 0, // point 2 107 | 0, (float) height, 0 // point 3 108 | }; 109 | 110 | float[] texCoords = { 0, 0, 1, 0, 1, 1, 0, 1 }; 111 | 112 | int[] faces = { 0, 0, 1, 1, 2, 2, // First triangle 113 | 0, 0, 2, 2, 3, 3 // Second triangle 114 | }; 115 | 116 | TriangleMesh mesh = new TriangleMesh(); 117 | mesh.getPoints().addAll(points); 118 | mesh.getTexCoords().addAll(texCoords); 119 | mesh.getFaces().addAll(faces); 120 | 121 | return mesh; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/bowlerstudio/utils/SVGFactory.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.bowlerstudio.utils; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.util.List; 6 | 7 | import com.neuronrobotics.nrconsole.util.FileSelectionFactory; 8 | import eu.mihosoft.vrl.v3d.CSG; 9 | import eu.mihosoft.vrl.v3d.Polygon; 10 | import eu.mihosoft.vrl.v3d.Slice; 11 | import eu.mihosoft.vrl.v3d.Transform; 12 | import eu.mihosoft.vrl.v3d.svg.SVGExporter; 13 | 14 | @SuppressWarnings("restriction") 15 | public class SVGFactory{ 16 | 17 | 18 | public static File exportSVG(CSG currentCsg, File defaultDir) { 19 | com.neuronrobotics.sdk.common.Log.error("Starting SVG ..."); 20 | 21 | File baseDirForFiles = FileSelectionFactory.GetFile(defaultDir, true); 22 | 23 | if (!baseDirForFiles.getAbsolutePath().toLowerCase().endsWith(".svg")) 24 | baseDirForFiles = new File(baseDirForFiles.getAbsolutePath() + ".svg"); 25 | try { 26 | SVGExporter.export(currentCsg, baseDirForFiles); 27 | } catch (IOException e) { 28 | // Auto-generated catch block 29 | e.printStackTrace(); 30 | } 31 | com.neuronrobotics.sdk.common.Log.error("SVG at "+baseDirForFiles); 32 | return baseDirForFiles.getParentFile(); 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /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 | private CSVWriter() { 15 | } 16 | 17 | public static void WriteToCSV(ArrayList dataTable, String filename) { 18 | String out = ""; 19 | synchronized(dataTable){ 20 | for(int j =0;j< dataTable.size();j++) { 21 | out+=dataTable.get(j).getTimestamp(); 22 | 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 | // 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 | // Auto-generated catch block 67 | e.printStackTrace(); 68 | } catch (WriteException e) { 69 | // 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 | // 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 | // Auto-generated method stub 17 | 18 | } 19 | 20 | @Override 21 | public String[] getMyNameSpaces() { 22 | // 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 | // 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(Integer.toString(r.getValue())); 77 | gl.setText(Integer.toString(g.getValue())); 78 | bl.setText(Integer.toString(b.getValue())); 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/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 | // 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 | // 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 | // Auto-generated method stub 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /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 com.neuronrobotics.bowlerstudio.assets.AssetFactory; 4 | 5 | import javax.swing.*; 6 | import java.net.MalformedURLException; 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("dyio/ok.png")); 22 | break; 23 | case ERROR: 24 | setIcon(createImageIcon("dyio/error.png")); 25 | break; 26 | default: 27 | setIcon(createImageIcon("dyio/blank.png")); 28 | break; 29 | } 30 | 31 | invalidate(); 32 | //repaint(); 33 | } 34 | 35 | protected ImageIcon createImageIcon(String path) { 36 | java.net.URL imgURL; 37 | try { 38 | imgURL = AssetFactory.loadFile(path).toURI().toURL(); 39 | if (imgURL != null) 40 | return new ImageIcon(imgURL); 41 | } catch (MalformedURLException e) { 42 | // Auto-generated catch block 43 | e.printStackTrace(); 44 | } catch (Exception e) { 45 | // Auto-generated catch block 46 | e.printStackTrace(); 47 | } 48 | 49 | 50 | com.neuronrobotics.sdk.common.Log.error("Couldn't find file: " + path); 51 | return null; 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /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.DirectoryChooser; 7 | import javafx.stage.FileChooser; 8 | import javafx.stage.FileChooser.ExtensionFilter; 9 | import javafx.stage.Stage; 10 | 11 | import com.neuronrobotics.bowlerstudio.BowlerStudio; 12 | import com.neuronrobotics.bowlerstudio.BowlerStudioModularFrame; 13 | import com.neuronrobotics.sdk.util.ThreadUtil; 14 | 15 | public class FileSelectionFactory { 16 | private static Stage stage = null; 17 | 18 | private FileSelectionFactory() { 19 | } 20 | 21 | private static class fileHolder { 22 | private boolean done = false; 23 | private File file = null; 24 | 25 | public boolean isDone() { 26 | return done; 27 | } 28 | 29 | public void setDone(boolean done) { 30 | this.done = done; 31 | } 32 | 33 | public File getFile() { 34 | return file; 35 | } 36 | 37 | public void setFile(File file) { 38 | this.file = file; 39 | } 40 | } 41 | 42 | public static File GetFile(File start, boolean save, ExtensionFilter... filter) { 43 | if (start == null) 44 | throw new NullPointerException(); 45 | 46 | final fileHolder file = new fileHolder(); 47 | BowlerStudio.runLater(() -> { 48 | FileChooser fileChooser = new FileChooser(); 49 | 50 | fileChooser.setInitialDirectory(start.isDirectory() ? start : start.getParentFile()); 51 | if (filter != null) 52 | fileChooser.getExtensionFilters().addAll(filter); 53 | fileChooser.setTitle("Bowler File Chooser"); 54 | if (save) 55 | file.setFile(fileChooser.showSaveDialog(getStage())); 56 | else 57 | file.setFile(fileChooser.showOpenDialog(getStage())); 58 | file.setDone(true); 59 | 60 | }); 61 | while (!file.isDone()) { 62 | ThreadUtil.wait(16); 63 | } 64 | 65 | return file.getFile(); 66 | } 67 | 68 | private static Stage getStage() { 69 | if (stage == null) 70 | stage = BowlerStudioModularFrame.getPrimaryStage(); 71 | return stage; 72 | } 73 | 74 | public static File GetFile(File start, ExtensionFilter... filter) { 75 | return GetFile(start, false, filter); 76 | } 77 | 78 | public static File GetDirectory(File start) { 79 | if (start == null) 80 | throw new NullPointerException(); 81 | 82 | final fileHolder file = new fileHolder(); 83 | BowlerStudio.runLater(() -> { 84 | DirectoryChooser fileChooser = new DirectoryChooser(); 85 | 86 | fileChooser.setInitialDirectory(start.isDirectory() ? start : start.getParentFile()); 87 | fileChooser.setTitle("Bowler File Chooser"); 88 | file.setFile(fileChooser.showDialog(getStage())); 89 | file.setDone(true); 90 | 91 | }); 92 | while (!file.isDone()) { 93 | ThreadUtil.wait(16); 94 | } 95 | 96 | return file.getFile(); 97 | } 98 | 99 | public static void setStage(Stage stage) { 100 | FileSelectionFactory.stage = stage; 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /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 { 23 | TextInputDialog alert = new TextInputDialog(defaultID); 24 | alert.setTitle(purpose); 25 | alert.setHeaderText("Enter the URL (Clone vie HTTPS)"); 26 | alert.setContentText("Git Clone URL: "); 27 | alert.setResizable(true); 28 | alert.setWidth(800); 29 | Node rt = alert.getDialogPane(); 30 | Stage st = (Stage) alert.getDialogPane().getScene().getWindow(); 31 | st.setOnCloseRequest(ev -> alert.hide()); 32 | FontSizeManager.addListener(fontNum -> { 33 | int tmp = fontNum - 10; 34 | if (tmp < 12) 35 | tmp = 12; 36 | rt.setStyle("-fx-font-size: " + tmp + "pt"); 37 | alert.getDialogPane().applyCss(); 38 | alert.getDialogPane().layout(); 39 | st.sizeToScene(); 40 | }); 41 | // Traditional way to get the response value. 42 | Optional result = alert.showAndWait(); 43 | if (result.isPresent()){ 44 | 45 | String gistcode=null; 46 | if(result.get().endsWith(".git")) 47 | gistcode=result.get(); 48 | else 49 | gistcode= "https://gist.github.com/"+ScriptingEngine.urlToGist(result.get())+".git"; 50 | com.neuronrobotics.sdk.common.Log.error("Creature Git " + gistcode); 51 | ArrayList choices; 52 | String suggestedChoice=""; 53 | int numXml=0; 54 | try { 55 | choices = ScriptingEngine.filesInGit(gistcode); 56 | for(int i=0;i d = new ChoiceDialog<>(suggestedChoice, choices); 63 | d.setTitle("Choose a file in the git"); 64 | d.setHeaderText("Select from the files in the git to pick the Creature File"); 65 | d.setContentText("Choose A Creature:"); 66 | Node root = d.getDialogPane(); 67 | Stage stage = (Stage) d.getDialogPane().getScene().getWindow(); 68 | stage.setOnCloseRequest(ev -> d.hide()); 69 | FontSizeManager.addListener(fontNum -> { 70 | int tmp = fontNum - 10; 71 | if (tmp < 12) 72 | tmp = 12; 73 | root.setStyle("-fx-font-size: " + tmp + "pt"); 74 | d.getDialogPane().applyCss(); 75 | d.getDialogPane().layout(); 76 | stage.sizeToScene(); 77 | }); 78 | // Traditional way to get the response value. 79 | Optional r = d.showAndWait(); 80 | if (r.isPresent()){ 81 | com.neuronrobotics.sdk.common.Log.error("Your choice: " + r.get()); 82 | listener.done(gistcode,r.get()); 83 | } 84 | } catch (Exception e) { 85 | // Auto-generated catch block 86 | e.printStackTrace(); 87 | } 88 | if(numXml ==1){ 89 | //com.neuronrobotics.sdk.common.Log.error("Found just one file at " + suggestedChoice); 90 | //loadMobilebaseFromGist(gistcode,suggestedChoice); 91 | //return; 92 | 93 | } 94 | 95 | } 96 | 97 | }); 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /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 | if (f.getName().toLowerCase().contains("slic3r")) { 17 | return true; 18 | } 19 | 20 | return f.getName().toLowerCase().matches("slic3r"); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /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 | // 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 | // 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 | // Auto-generated catch block 60 | e.printStackTrace(); 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /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 | // 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 | // 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 | // Auto-generated catch block 79 | e.printStackTrace(); 80 | } catch (WriteException e) { 81 | // 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 | // 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(Double.toString(getKp())); 38 | iData.setText(Double.toString(getKi())); 39 | dData.setText(Double.toString(getKd())); 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, "CommonWealthRobotics 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 | LinearPhysicsEngine engine = new LinearPhysicsEngine(); 7 | PIDSim pid = engine.getPid(); 8 | pid.setMass(0.01); 9 | pid.setLength(0.1); 10 | pid.setDynamicFriction(0.3); 11 | pid.setStaticFriction(0.5); 12 | pid.setSetPoint(45); 13 | PIDConstantsDialog d = pid.getConstants(); 14 | d.setKp(1); 15 | d.setKd(0); 16 | d.setKi(0); 17 | 18 | double IntegralCircularBuffer[] = new double[100]; 19 | double iTotal=0; 20 | int index=0; 21 | double previousState = 0; 22 | for(int i =0;i getNamespacesImp() { 46 | // Auto-generated method stub 47 | return new ArrayList(); 48 | } 49 | 50 | public FirmataDevice getFirmataDevice() { 51 | return device; 52 | } 53 | 54 | public void setFirmataDevice(FirmataDevice device) { 55 | this.device = device; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/neuronrobotics/sdk/addons/kinematics/FirmataLink.java: -------------------------------------------------------------------------------- 1 | package com.neuronrobotics.sdk.addons.kinematics; 2 | 3 | import java.io.IOException; 4 | 5 | import org.firmata4j.IOEvent; 6 | import org.firmata4j.Pin; 7 | import org.firmata4j.PinEventListener; 8 | 9 | import com.neuronrobotics.sdk.common.DeviceManager; 10 | 11 | public class FirmataLink extends AbstractLink implements PinEventListener{ 12 | 13 | private Pin pin; 14 | 15 | public FirmataLink(LinkConfiguration arg0,FirmataBowler device) throws InterruptedException, IllegalArgumentException, IOException { 16 | super(arg0); 17 | 18 | pin = device.getFirmataDevice().getPin(arg0.getHardwareIndex()); 19 | pin.setMode(Pin.Mode.SERVO); 20 | // our listeners will get event about this change 21 | pin.addEventListener(this); 22 | } 23 | 24 | @Override 25 | public void cacheTargetValueDevice() { 26 | // Auto-generated method stub 27 | 28 | } 29 | 30 | @Override 31 | public void flushAllDevice(double arg0) { 32 | // Auto-generated method stub 33 | flushDevice(arg0); 34 | } 35 | 36 | @Override 37 | public void flushDevice(double arg0) { 38 | try { 39 | pin.setValue((long) getTargetValue()); 40 | } catch (IllegalStateException | IOException e) { 41 | e.printStackTrace(); 42 | } 43 | } 44 | 45 | @Override 46 | public double getCurrentPosition() { 47 | return pin.getValue(); 48 | } 49 | 50 | @Override 51 | public void onModeChange(IOEvent event) { 52 | } 53 | 54 | @Override 55 | public void onValueChange(IOEvent event) { 56 | fireLinkListener(getCurrentPosition()); 57 | 58 | } 59 | 60 | public static void addLinkFactory(){ 61 | INewLinkProvider lp = new INewLinkProvider() { 62 | @Override 63 | public AbstractLink generate(LinkConfiguration config) { 64 | FirmataBowler dev = (FirmataBowler)DeviceManager 65 | .getSpecificDevice( 66 | FirmataBowler.class, 67 | config.getDeviceScriptingName() 68 | ); 69 | if(dev!= null) 70 | try { 71 | return new FirmataLink(config, dev); 72 | } catch (IllegalArgumentException e) { 73 | // Auto-generated catch block 74 | e.printStackTrace(); 75 | } catch (InterruptedException e) { 76 | // Auto-generated catch block 77 | e.printStackTrace(); 78 | } catch (IOException e) { 79 | // Auto-generated catch block 80 | e.printStackTrace(); 81 | } 82 | return null; 83 | } 84 | }; 85 | LinkFactory.addLinkProvider("firmata-servo-rotory", lp); 86 | LinkFactory.addLinkProvider("firmata-servo-prismatic", lp); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/resources/NeuronRobotics.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CommonWealthRobotics/BowlerStudio/c6a15352f19793e7ec6a812db4f6ceaab28b9af1/src/main/resources/NeuronRobotics.ico -------------------------------------------------------------------------------- /src/main/resources/com/neuronrobotics/bowlerstudio/applicationImageBackground-965x482.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CommonWealthRobotics/BowlerStudio/c6a15352f19793e7ec6a812db4f6ceaab28b9af1/src/main/resources/com/neuronrobotics/bowlerstudio/applicationImageBackground-965x482.png -------------------------------------------------------------------------------- /src/main/resources/com/neuronrobotics/bowlerstudio/build.properties: -------------------------------------------------------------------------------- 1 | app.name=BowlerStudio 2 | app.version=source 3 | -------------------------------------------------------------------------------- /src/main/resources/com/neuronrobotics/bowlerstudio/ruler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CommonWealthRobotics/BowlerStudio/c6a15352f19793e7ec6a812db4f6ceaab28b9af1/src/main/resources/com/neuronrobotics/bowlerstudio/ruler.png -------------------------------------------------------------------------------- /src/main/resources/com/neuronrobotics/bowlerstudio/splash-with-boarder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CommonWealthRobotics/BowlerStudio/c6a15352f19793e7ec6a812db4f6ceaab28b9af1/src/main/resources/com/neuronrobotics/bowlerstudio/splash-with-boarder.png -------------------------------------------------------------------------------- /src/main/resources/com/neuronrobotics/bowlerstudio/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CommonWealthRobotics/BowlerStudio/c6a15352f19793e7ec6a812db4f6ceaab28b9af1/src/main/resources/com/neuronrobotics/bowlerstudio/splash.png -------------------------------------------------------------------------------- /src/main/resources/com/neuronrobotics/nrconsole/images/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CommonWealthRobotics/BowlerStudio/c6a15352f19793e7ec6a812db4f6ceaab28b9af1/src/main/resources/com/neuronrobotics/nrconsole/images/splash.png -------------------------------------------------------------------------------- /src/main/resources/com/neuronrobotics/nrconsole/plugin/bootloader/images/blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CommonWealthRobotics/BowlerStudio/c6a15352f19793e7ec6a812db4f6ceaab28b9af1/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/CommonWealthRobotics/BowlerStudio/c6a15352f19793e7ec6a812db4f6ceaab28b9af1/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/CommonWealthRobotics/BowlerStudio/c6a15352f19793e7ec6a812db4f6ceaab28b9af1/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 | -------------------------------------------------------------------------------- /wrappers/JavaVersionCheck.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CommonWealthRobotics/BowlerStudio/c6a15352f19793e7ec6a812db4f6ceaab28b9af1/wrappers/JavaVersionCheck.jar -------------------------------------------------------------------------------- /wrappers/linux/BowlerStudio.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=Bowler Studio 4 | Exec=/usr/bin/bowlerstudio 5 | Categories=Application;Development;Programming;3DGraphics;Education;Network;WebBrowser; 6 | Icon=/usr/share/themes/base/neuronrobotics/icons/NeuronRobotics.png 7 | -------------------------------------------------------------------------------- /wrappers/linux/NeuronRobotics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CommonWealthRobotics/BowlerStudio/c6a15352f19793e7ec6a812db4f6ceaab28b9af1/wrappers/linux/NeuronRobotics.png -------------------------------------------------------------------------------- /wrappers/linux/bowlerstudio: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | NRDIR=/usr/share/bowlerstudio/ 4 | JAR=BowlerStudio.jar 5 | 6 | if (test -d $NRDIR)then 7 | java -jar $NRDIR$JAR "$@" 8 | else 9 | zenity --error --text="#ERROR: $JAR is not where i expect it to be, $NRDIR" 10 | fi 11 | -------------------------------------------------------------------------------- /wrappers/linux/control: -------------------------------------------------------------------------------- 1 | Source: bowlerstudio 2 | Package: bowlerstudio 3 | Priority: extra 4 | Maintainer: Customer Support 5 | Architecture: all 6 | Version: BOWLERVERSION 7 | Depends: oracle-java8-set-default,libopencv2.4-java,libopencv2.4-jni,slic3r,jarwrapper,arduino 8 | Provides: bowlerstudio 9 | Conflicts: modemmanager,nr-rdk-java 10 | Replaces: modemmanager,nr-rdk-java 11 | Description: Robotics Development Engironment and runtime. 12 | A scripting platform for writing, designing, simulating 13 | and manufacturing robots. 14 | -------------------------------------------------------------------------------- /wrappers/osx/BowlerStudio: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 4 | 5 | export OPENCV_DIR=$DIR/opencv249build/ 6 | echo Setting OPENCV_DIR = ${OPENCV_DIR} 7 | if (java -jar "$DIR/JavaVersionCheck.jar" 8 45) ; then 8 | java -jar "$DIR/bin/BowlerStudio.jar" 9 | else 10 | echo "Update Java and try again" 11 | fi 12 | 13 | -------------------------------------------------------------------------------- /wrappers/osx/bowler-scripting-kernel.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 4 | 5 | export OPENCV_DIR=$DIR/opencv249build/ 6 | echo Setting OPENCV_DIR = ${OPENCV_DIR} 7 | if (java -jar "$DIR/JavaVersionCheck.jar" 8 45) ; then 8 | java -jar "$DIR/bin/BowlerStudio.jar" -r "$@" 9 | else 10 | echo "Update Java and try again" 11 | fi 12 | 13 | --------------------------------------------------------------------------------