Last active
August 29, 2015 14:03
-
-
Save posilva/0d9d566174d65a73104f to your computer and use it in GitHub Desktop.
RosJava Node from Full Jar Dependencies Lib
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
import java.net.URI; | |
import java.net.URISyntaxException; | |
import org.ros.address.InetAddressFactory; | |
import org.ros.namespace.GraphName; | |
import org.ros.node.AbstractNodeMain; | |
import org.ros.node.ConnectedNode; | |
import org.ros.node.DefaultNodeMainExecutor; | |
import org.ros.node.NodeConfiguration; | |
import org.ros.node.NodeMainExecutor; | |
public class App { | |
private static URI getMasterUri() { | |
try { | |
return new URI("http", null, "localhost", 11311, "/", null, null); | |
} catch (URISyntaxException e) { | |
return null; | |
} | |
} | |
private static NodeConfiguration setupConfiguration() { | |
NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic( | |
InetAddressFactory.newNonLoopback().getHostName(), | |
getMasterUri()); | |
return nodeConfiguration; | |
} | |
public static void main(String[] args) { | |
NodeMainExecutor executor = DefaultNodeMainExecutor.newDefault(); | |
AbstractNodeMain node = new AbstractNodeMain() { | |
public GraphName getDefaultNodeName() { | |
// TODO Auto-generated method stub | |
return GraphName.of("mynode"); | |
} | |
@Override | |
public void onStart(ConnectedNode connectedNode) { | |
connectedNode.getLog().info("TEsted"); | |
super.onStart(connectedNode); | |
} | |
}; | |
executor.execute(node, setupConfiguration()); | |
} | |
} |
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
<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/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>pt.edu.academiafa</groupId> | |
<artifactId>rosjava-tester</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<packaging>jar</packaging> | |
<name>rosjava-tester</name> | |
<url>http://maven.apache.org</url> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
</properties> | |
<repositories> | |
<repository> | |
<releases> | |
<enabled>true</enabled> | |
<updatePolicy>always</updatePolicy> | |
<checksumPolicy>fail</checksumPolicy> | |
</releases> | |
<id>academiafa.edu.pt</id> | |
<name>seagull-rosjava</name> | |
<url>https://bitbucket.org/pmosilva/maven2-release/raw/master/seagull-rosjava-libs</url> | |
<layout>default</layout> | |
</repository> | |
</repositories> | |
<dependencies> | |
<dependency> | |
<groupId>pt.edu.academiafa</groupId> | |
<artifactId>seagull-rosjava-lib </artifactId> | |
<version>0.0.2</version> | |
<type>jar</type> | |
</dependency> | |
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>3.8.1</version> | |
<scope>test</scope> | |
</dependency> | |
</dependencies> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment