diff --git a/ros2rag.receiverstub/src/main/java/de/tudresden/inf/st/ros2rag/receiverstub/Main.java b/ros2rag.receiverstub/src/main/java/de/tudresden/inf/st/ros2rag/receiverstub/Main.java index 8c80b172671bc2b6eed937cca1cad99cf61d920e..f954120848dad5a83d498f91c6c33bdceb32969f 100644 --- a/ros2rag.receiverstub/src/main/java/de/tudresden/inf/st/ros2rag/receiverstub/Main.java +++ b/ros2rag.receiverstub/src/main/java/de/tudresden/inf/st/ros2rag/receiverstub/Main.java @@ -7,6 +7,7 @@ import config.Robotconfig.RobotConfig; import de.tudresden.inf.st.ros2rag.starter.ast.MqttUpdater; import de.tudresden.inf.st.ros2rag.starter.data.DataConfiguration; import de.tudresden.inf.st.ros2rag.starter.data.DataJoint; +import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import panda.Linkstate.PandaLinkState; @@ -19,6 +20,7 @@ import java.util.concurrent.TimeUnit; public class Main { private static final Logger logger = LogManager.getLogger(Main.class); + private String topicPattern; public static void main(String[] args) throws Exception { Main main = new Main(); @@ -32,6 +34,7 @@ public class Main { private void run(DataConfiguration config) throws IOException, InterruptedException { final CountDownLatch finish = new CountDownLatch(1); + int topicMaxLength = 0; MqttUpdater receiver = new MqttUpdater("receiver stub"); receiver.setHost(config.mqttHost); receiver.waitUntilReady(2, TimeUnit.SECONDS); @@ -39,7 +42,9 @@ public class Main { receiver.newConnection(config.dataConfigTopic, this::printDataConfig); for (DataJoint joint : config.joints) { receiver.newConnection(joint.topic, this::printPandaLinkState); + topicMaxLength = Math.max(topicMaxLength, joint.topic.length()); } + this.topicPattern = "%" + topicMaxLength + "s"; receiver.newConnection("components", bytes -> { String message = new String(bytes); @@ -70,8 +75,10 @@ public class Main { PandaLinkState.Orientation tmpOrientation = pls.getOrient(); PandaLinkState.TwistLinear tmpTwistLinear = pls.getTl(); PandaLinkState.TwistAngular tmpTwistAngular = pls.getTa(); - logger.info("{}: pos({},{},{}), orient({},{},{},{})," + - " twist-linear({},{},{}), twist-angular({},{},{})", + // panda::panda_link0: pos(-3.0621333E-8,-1.5197388E-8,3.3411725E-5), orient(0.0,0.0,0.0,0.0), twist-linear(0.0,0.0,0.0), twist-angular(0.0,0.0,0.0) + + logger.printf(Level.INFO,topicPattern + ": pos(% .5f,% .5f,% .5f), ori(%.1f,%.1f,%.1f,%.1f)," + + " twL(%.1f,%.1f,%.1f), twA(%.1f,%.1f,%.1f)", pls.getName(), tmpPosition.getPositionX(), tmpPosition.getPositionY(), diff --git a/ros2rag.receiverstub/src/main/resources/log4j2.xml b/ros2rag.receiverstub/src/main/resources/log4j2.xml index 679a7bb0c6171f5366d8283c0a451598fdca17db..ed3f9b7288951b7e2aaa1b25130158cd95d2ed97 100644 --- a/ros2rag.receiverstub/src/main/resources/log4j2.xml +++ b/ros2rag.receiverstub/src/main/resources/log4j2.xml @@ -6,7 +6,7 @@ </Console> </Appenders> <Loggers> - <Root level="debug"> + <Root level="info"> <AppenderRef ref="Console"/> </Root> </Loggers>