Commit c29bc52d authored by René Schöne's avatar René Schöne
Browse files

Introduce ros2rag.common for files used by multiple modules.

- remove some unnecessary gradle dependencies
parent 6956ebd2
......@@ -3,6 +3,8 @@ panda_mqtt_connector:
topics:
robotConfig: "robotconfig"
dataConfig: "dataconfig"
trajectory: "trajectory"
nextStep: "ros2rag/nextStep"
zone_size: 0.5
zones:
- "1 1"
......@@ -21,3 +23,8 @@ panda_mqtt_connector:
end_effectors:
panda:
EndEffector: "panda::panda_link7"
goal_poses:
- position: "0 0 0"
wait: "3"
- position: "1 1 1"
wait: "2"
package de.tudresden.inf.st.ros2rag.starter.data;
package de.tudresden.inf.st.ros2rag.common;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
......@@ -19,9 +18,16 @@ public class DataConfiguration {
public List<String> zones;
public Map<String, SortedMap<String, String>> parts;
public Map<String, SortedMap<String, String>> end_effectors;
public List<DataWorkPose> goal_poses;
}
public static class DataTopics {
public String robotConfig;
public String dataConfig;
public String trajectory;
public String nextStep;
}
public static class DataWorkPose {
public String position;
public String wait;
}
}
package de.tudresden.inf.st.ros2rag.starter;
package de.tudresden.inf.st.ros2rag.common;
import de.tudresden.inf.st.ros2rag.starter.ast.Link;
import de.tudresden.inf.st.ros2rag.starter.ast.MqttHandler;
import de.tudresden.inf.st.ros2rag.starter.data.DataConfiguration;
import de.tudresden.inf.st.ros2rag.starter.data.DataConfiguration.ActualConfiguration;
import de.tudresden.inf.st.ros2rag.common.DataConfiguration.ActualConfiguration;
import java.io.IOException;
import java.util.Map;
......@@ -15,12 +12,8 @@ import java.util.SortedMap;
* @author rschoene - Initial contribution
*/
public class Util {
public static void setMqttHost(RootElement model, ActualConfiguration config) throws IOException {
HostAndPort hostAndPort = split(config.server);
model.MqttSetHost(hostAndPort.host, hostAndPort.port);
}
public static void setMqttHost(MqttHandler handler, ActualConfiguration config) throws IOException {
public static void setMqttHost(SetHost handler, ActualConfiguration config) throws IOException {
HostAndPort hostAndPort = split(config.server);
handler.setHost(hostAndPort.host, hostAndPort.port);
}
......@@ -56,8 +49,8 @@ public class Util {
}
@FunctionalInterface
public interface RootElement {
void MqttSetHost(String host, int port) throws IOException;
public interface SetHost {
void setHost(String host, int port) throws IOException;
}
@FunctionalInterface
......
......@@ -21,14 +21,7 @@ jar.manifest.attributes('Main-Class': 'de.tudresden.inf.st.ros2rag.receiverstub.
dependencies {
implementation project(':ros2rag.starter')
// implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: "${jackson_version}"
// implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: "${jackson_version}"
// implementation group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
// implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.0.0'
// implementation group: 'org.fusesource.mqtt-client', name: 'mqtt-client', version: '1.15'
protobuf files("$projectDir/../ros2rag.example/src/main/proto")
implementation project(':ros2rag.common')
}
test {
......
......@@ -22,9 +22,6 @@ jar.manifest.attributes('Main-Class': 'de.tudresden.inf.st.ros2rag.senderstub.Se
dependencies {
implementation project(':ros2rag.starter')
// implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.0.0'
// implementation group: 'org.fusesource.mqtt-client', name: 'mqtt-client', version: '1.15'
protobuf files("$projectDir/../ros2rag.example/src/main/proto")
}
......
......@@ -27,6 +27,7 @@ jar.manifest.attributes('Main-Class': 'de.tudresden.inf.st.ros2rag.starter.Start
dependencies {
implementation project (':ros2rag.base')
implementation project (':ros2rag.common')
baseRuntimeClasspath project (':ros2rag.base')
// implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-xml', version: "${jackson_version}"
api group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: "${jackson_version}"
......
......@@ -3,16 +3,15 @@ package de.tudresden.inf.st.ros2rag.starter;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import config.Dataconfig;
import de.tudresden.inf.st.ros2rag.common.Util;
import de.tudresden.inf.st.ros2rag.starter.ast.*;
import de.tudresden.inf.st.ros2rag.starter.data.DataConfiguration;
import de.tudresden.inf.st.ros2rag.starter.data.DataConfiguration.ActualConfiguration;
import de.tudresden.inf.st.ros2rag.common.DataConfiguration;
import de.tudresden.inf.st.ros2rag.common.DataConfiguration.ActualConfiguration;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.io.IOException;
import java.util.Map.Entry;
import java.util.SortedMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
......@@ -83,7 +82,7 @@ public class StarterMain {
logger.info("To exit the system cleanly, send a message to the topic 'exit', or use Ctrl+C.");
mainHandler = new MqttHandler("mainHandler");
Util.setMqttHost(mainHandler, config);
Util.setMqttHost(mainHandler::setHost, config);
mainHandler.waitUntilReady(2, TimeUnit.SECONDS);
mainHandler.newConnection("exit", bytes -> exitCondition.countDown());
mainHandler.newConnection("model", bytes -> logStatus(new String(bytes), robotArm));
......
../../../common/proto/
\ No newline at end of file
../../../ros2rag.common/proto/
\ No newline at end of file
../../../common/proto/
\ No newline at end of file
../../../ros2rag.common/proto/
\ No newline at end of file
......@@ -6,3 +6,5 @@ include 'ros2rag.tests'
include 'ros2rag.starter'
include 'ros2rag.senderstub'
include 'ros2rag.receiverstub'
include 'ros2rag.goal'
include 'ros2rag.common'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment