forked from pheobeyeung/universal_robots_sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c92455a
commit 1027e3e
Showing
65 changed files
with
1,833 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
samples/swing/com.ur.urcap.examples.tooliocontrolswing/assembly.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> | ||
<id>sources</id> | ||
<formats> | ||
<format>tar.gz</format> | ||
</formats> | ||
<includeBaseDirectory>false</includeBaseDirectory> | ||
<fileSets> | ||
<fileSet> | ||
<directory>.</directory> | ||
<includes> | ||
<include>pom.xml</include> | ||
<include>assembly.xml</include> | ||
</includes> | ||
<useDefaultExcludes>true</useDefaultExcludes> | ||
</fileSet> | ||
<fileSet> | ||
<directory>src</directory> | ||
<useDefaultExcludes>true</useDefaultExcludes> | ||
</fileSet> | ||
</fileSets> | ||
</assembly> |
302 changes: 302 additions & 0 deletions
302
samples/swing/com.ur.urcap.examples.tooliocontrolswing/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,302 @@ | ||
<?xml version="1.0"?> | ||
<project | ||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.ur.urcap.examples</groupId> | ||
<artifactId>tooliocontrolswing</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>Tool I/O Control Swing</name> | ||
<packaging>bundle</packaging> | ||
|
||
<properties> | ||
|
||
<!--********************************************************************--> | ||
<!-- Note: Update this section with relevant meta data --> | ||
<!-- that comes along with your URCap --> | ||
<!--********************************************************************--> | ||
<!--******************* BEGINNING OF URCAP META DATA *******************--> | ||
<urcap.symbolicname>com.ur.urcap.examples.tooliocontrolswing</urcap.symbolicname> | ||
<urcap.vendor>Universal Robots</urcap.vendor> | ||
<urcap.contactAddress>Energivej 25, 5260 Odense S, Denmark</urcap.contactAddress> | ||
<urcap.copyright>Copyright (C) 2009-${copyright.year} Universal Robots. All Rights Reserved</urcap.copyright> | ||
<urcap.description>Tool I/O interface control sample URCap</urcap.description> | ||
<urcap.licenseType>Sample license</urcap.licenseType> | ||
<urcap.compatibility.CB3>true</urcap.compatibility.CB3> | ||
<urcap.compatibility.eSeries>true</urcap.compatibility.eSeries> | ||
<!--********************** END OF URCAP META DATA **********************--> | ||
<!--********************************************************************--> | ||
|
||
<!-- Host, username and password of the robot to be used when running "mvn install -Premote" --> | ||
<urcap.install.host>localhost</urcap.install.host> | ||
<urcap.install.username>root</urcap.install.username> | ||
<urcap.install.password>easybot</urcap.install.password> | ||
|
||
<!--Install path for the UR Sim--> | ||
<ursim.home></ursim.home> | ||
|
||
<!--Host and standard user/password for UR Sim running in a VM--> | ||
<ursimvm.install.host></ursimvm.install.host> | ||
<ursimvm.install.username>ur</ursimvm.install.username> | ||
<ursimvm.install.password>easybot</ursimvm.install.password> | ||
|
||
<!--Current year for the copyright--> | ||
<copyright.year>${maven.build.timestamp}</copyright.year> | ||
<maven.build.timestamp.format>yyyy</maven.build.timestamp.format> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.6.0</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-install-plugin</artifactId> | ||
<version>2.5.2</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.22.1</version> | ||
<configuration> | ||
<runOrder>alphabetical</runOrder> | ||
<useSystemClassLoader>false</useSystemClassLoader> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>3.0.2</version> | ||
<configuration> | ||
<archive> | ||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<version>3.0.2</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.felix</groupId> | ||
<artifactId>maven-bundle-plugin</artifactId> | ||
<version>2.4.0</version> | ||
<extensions>true</extensions> | ||
<executions> | ||
<execution> | ||
<id>bundle-manifest</id> | ||
<phase>process-classes</phase> | ||
<goals> | ||
<goal>manifest</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<instructions> | ||
<!--********** DO NOT MODIFY THE ENTRIES OF THIS SECTION **********--> | ||
<Bundle-Category>URCap</Bundle-Category> | ||
<Bundle-Activator>com.ur.urcap.examples.tooliocontrol.Activator</Bundle-Activator> | ||
<Bundle-Vendor>${urcap.vendor}</Bundle-Vendor> | ||
<Bundle-ContactAddress>${urcap.contactAddress}</Bundle-ContactAddress> | ||
<Bundle-Copyright>${urcap.copyright}</Bundle-Copyright> | ||
<Bundle-LicenseType>${urcap.licenseType}</Bundle-LicenseType> | ||
<Bundle-Description>${urcap.description}</Bundle-Description> | ||
<URCapCompatibility-CB3>${urcap.compatibility.CB3}</URCapCompatibility-CB3> | ||
<URCapCompatibility-eSeries>${urcap.compatibility.eSeries}</URCapCompatibility-eSeries> | ||
<!--***************************************************************--> | ||
<Import-Package> | ||
com.ur.urcap.api*, | ||
* | ||
</Import-Package> | ||
</instructions> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>1.1</version> | ||
<executions> | ||
<!-- generate URCap package after compiling --> | ||
<execution> | ||
<id>package-urcap</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
<configuration> | ||
<executable>cp</executable> | ||
<commandlineArgs>target/${project.build.finalName}.jar target/${project.build.finalName}.urcap</commandlineArgs> | ||
<workingDirectory>.</workingDirectory> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<configuration> | ||
<descriptors> | ||
<descriptor>assembly.xml</descriptor> | ||
</descriptors> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.osgi</groupId> | ||
<artifactId>org.osgi.core</artifactId> | ||
<version>4.3.0</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.ur.urcap</groupId> | ||
<artifactId>api</artifactId> | ||
<version>1.7.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- test dependencies --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<profiles> | ||
<profile> | ||
<id>remote</id> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>1.1</version> | ||
<executions> | ||
<execution> | ||
<id>remote-install-urcap</id> | ||
<phase>install</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
<configuration> | ||
<executable>sshpass</executable> | ||
<commandlineArgs>-p ${urcap.install.password} scp -o StrictHostKeyChecking=no target/${project.build.finalName}.jar ${urcap.install.username}@${urcap.install.host}:/root/.urcaps/${urcap.symbolicname}.jar</commandlineArgs> | ||
<workingDirectory>.</workingDirectory> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>remote-restart-ui</id> | ||
<phase>install</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
<configuration> | ||
<executable>sshpass</executable> | ||
<commandlineArgs>-p ${urcap.install.password} ssh ${urcap.install.username}@${urcap.install.host} pkill java</commandlineArgs> | ||
<workingDirectory>.</workingDirectory> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
<profile> | ||
<id>local</id> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>1.1</version> | ||
<executions> | ||
<execution> | ||
<id>local-install-urcap</id> | ||
<phase>install</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
<configuration> | ||
<executable>cp</executable> | ||
<commandlineArgs>target/${project.build.finalName}.jar ${user.home}/.urcaps/${urcap.symbolicname}.jar</commandlineArgs> | ||
<workingDirectory>.</workingDirectory> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
<profile> | ||
<id>ursim</id> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>1.1</version> | ||
<executions> | ||
<execution> | ||
<id>ursim-install-urcap</id> | ||
<phase>install</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
<configuration> | ||
<executable>cp</executable> | ||
<commandlineArgs>target/${project.build.finalName}.jar ${ursim.home}/.urcaps/${urcap.symbolicname}.jar</commandlineArgs> | ||
<workingDirectory>.</workingDirectory> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
<profile> | ||
<id>ursimvm</id> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>1.1</version> | ||
<executions> | ||
<execution> | ||
<id>ursimvm-install-urcap</id> | ||
<phase>install</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
<configuration> | ||
<executable>sshpass</executable> | ||
<commandlineArgs>-p ${ursimvm.install.password} scp -o StrictHostKeyChecking=no target/${project.build.finalName}.jar ${ursimvm.install.username}@${ursimvm.install.host}:/home/ur/ursim-current/.urcaps/${urcap.symbolicname}.jar</commandlineArgs> | ||
<workingDirectory>.</workingDirectory> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |
20 changes: 20 additions & 0 deletions
20
...mples.tooliocontrolswing/src/main/java/com/ur/urcap/examples/tooliocontrol/Activator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.ur.urcap.examples.tooliocontrol; | ||
|
||
import com.ur.urcap.api.contribution.installation.swing.SwingInstallationNodeService; | ||
import com.ur.urcap.api.contribution.program.swing.SwingProgramNodeService; | ||
import com.ur.urcap.examples.tooliocontrol.installation.ToolIOControlInstallationNodeService; | ||
import com.ur.urcap.examples.tooliocontrol.program.ToolIOControlProgramNodeService; | ||
import org.osgi.framework.BundleActivator; | ||
import org.osgi.framework.BundleContext; | ||
|
||
public class Activator implements BundleActivator { | ||
@Override | ||
public void start(BundleContext bundleContext) throws Exception { | ||
bundleContext.registerService(SwingInstallationNodeService.class, new ToolIOControlInstallationNodeService(), null); | ||
bundleContext.registerService(SwingProgramNodeService.class, new ToolIOControlProgramNodeService(), null); | ||
} | ||
|
||
@Override | ||
public void stop(BundleContext bundleContext) throws Exception { | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
.../urcap/examples/tooliocontrol/installation/ToolIOControlInstallationNodeContribution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.ur.urcap.examples.tooliocontrol.installation; | ||
|
||
import com.ur.urcap.api.contribution.InstallationNodeContribution; | ||
import com.ur.urcap.api.contribution.installation.InstallationAPIProvider; | ||
import com.ur.urcap.api.domain.resource.ControllableResourceModel; | ||
import com.ur.urcap.api.domain.script.ScriptWriter; | ||
|
||
public class ToolIOControlInstallationNodeContribution implements InstallationNodeContribution { | ||
private final ToolIOControlInstallationNodeView view; | ||
private final ToolIOController toolIOController; | ||
|
||
public ToolIOControlInstallationNodeContribution(InstallationAPIProvider apiProvider, ToolIOControlInstallationNodeView view) { | ||
this.view = view; | ||
|
||
ControllableResourceModel resourceModel = apiProvider.getInstallationAPI().getControllableResourceModel(); | ||
toolIOController = new ToolIOController(resourceModel, apiProvider.getSystemAPI().getCapabilityManager()); | ||
resourceModel.requestControl(toolIOController); | ||
} | ||
|
||
@Override | ||
public void openView() { | ||
view.showHelp(!toolIOController.hasControl()); | ||
} | ||
|
||
@Override | ||
public void closeView() { | ||
|
||
} | ||
|
||
@Override | ||
public void generateScript(ScriptWriter writer) { | ||
|
||
} | ||
|
||
public boolean isSetupCorrect() { | ||
return toolIOController.isSetupCorrect(); | ||
} | ||
} |
Oops, something went wrong.