Skip to content

Commit

Permalink
Handling DEECo inter-project dependencies using maven.
Browse files Browse the repository at this point in the history
ROS configuration taken from environment at runtime.
  • Loading branch information
iridin committed Jul 15, 2015
1 parent 4a4730c commit 6f84516
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
17 changes: 4 additions & 13 deletions jdeeco-ros/src/cz/cuni/mff/d3s/jdeeco/ros/RosServices.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@
*/
public class RosServices extends AbstractNodeMain implements DEECoPlugin {

/**
* The address of the host where the DEECo is running.
*/
private static final String ROS_HOST = "192.168.0.102";
/**
* The address of where the ROS master is running.
*/
private static final String ROS_MASTER = "http://192.168.0.200:11311";

/**
* The timeout in milliseconds to wait for the ROS topic subscription.
*/
Expand Down Expand Up @@ -71,13 +62,13 @@ public class RosServices extends AbstractNodeMain implements DEECoPlugin {
* there is a problem with their creation an {@link RuntimeException}
* arises.
*/
public RosServices() {
public RosServices(String ros_master, String ros_host) {
try {
rosNodeConfig = NodeConfiguration.newPublic(ROS_HOST, new URI(
ROS_MASTER));
rosNodeConfig = NodeConfiguration.newPublic(ros_host, new URI(
ros_master));
rosNode = DefaultNodeMainExecutor.newDefault();
} catch (URISyntaxException e) {
throw new RuntimeException("Malformed URI: " + ROS_MASTER, e);
throw new RuntimeException("Malformed URI: " + ros_master, e);
}
}

Expand Down
22 changes: 21 additions & 1 deletion jdeeco-turtlebot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>cz.cuni.mff.d3s.jdeeco.turtlebot.simpleexchange.Run</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
Expand All @@ -58,13 +73,18 @@
<dependency>
<groupId>cz.cuni.mff.d3s.jdeeco</groupId>
<artifactId>cz.cuni.mff.d3s.jdeeco.network</artifactId>
<version>3.0.1</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.ros.rosjava_core</groupId>
<artifactId>rosjava</artifactId>
<version>0.2.1</version>
</dependency>
<dependency>
<groupId>cz.cuni.mff.d3s.jdeeco</groupId>
<artifactId>cz.cuni.mff.d3s.jdeeco.ros</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.ros.rosjava_messages</groupId>
<artifactId>kobuki_msgs</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package cz.cuni.mff.d3s.jdeeco.turtlebot.simpleexchange;

import java.net.InetAddress;
import java.util.Random;

import cz.cuni.mff.d3s.deeco.logging.Log;
import cz.cuni.mff.d3s.deeco.runtime.DEECoNode;
import cz.cuni.mff.d3s.deeco.timer.WallTimeTimer;
Expand Down Expand Up @@ -35,13 +38,16 @@ public static void main(String[] args) {
System.exit(1);
}

Random rand = new Random();
WallTimeTimer t = new WallTimeTimer();
try {
DEECoNode node;
RosServices services = new RosServices();
RosServices services = new RosServices(
System.getenv("ROS_MASTER_URI"),
InetAddress.getLocalHost().getHostName());
switch (args[0]) {
case SENSE_SWITCH:
node = new DEECoNode(0, t, services, new Network(),
node = new DEECoNode(rand.nextInt(), t, services, new Network(),
new BeeClickComm(), new DefaultKnowledgePublisher());

SensingComponent snsComponent = new SensingComponent(
Expand All @@ -61,7 +67,7 @@ public static void main(String[] args) {

break;
case RECEIVE_SWITCH:
node = new DEECoNode(0, t, services, new Network(), new BeeClickComm(),
node = new DEECoNode(rand.nextInt(), t, services, new Network(), new BeeClickComm(),
new DefaultKnowledgePublisher());

ReceivingComponent recvComponent = new ReceivingComponent(
Expand Down

0 comments on commit 6f84516

Please sign in to comment.