com.github.jy2.commandline.picocli.topic.TopicDelayCommand Maven / Gradle / Ivy
package com.github.jy2.commandline.picocli.topic;
import java.lang.reflect.Field;
import java.util.function.Consumer;
import com.github.jy2.commandline.picocli.Main;
import com.github.jy2.commandline.picocli.topic.completion.TopicNameCompletionCandidates;
import go.jyroscope.ros.std_msgs.Header;
import picocli.CommandLine.Command;
import picocli.CommandLine.Parameters;
import picocli.CommandLine.ParentCommand;
@Command(name = "delay", description = "Print delay of the message time with respect to curent time")
public class TopicDelayCommand implements Runnable {
@ParentCommand
TopicCommand parent;
@Parameters(index = "0", description = "Name of the topic", completionCandidates = TopicNameCompletionCandidates.class)
String topicName;
public void run() {
System.out.println("Subscribed to topic: " + topicName);
System.out.println("Press Crtl-C to stop");
Class type = Main.introspector.getTopicType(topicName);
TopicEchoCommand.subscriber = Main.di.createSubscriber(topicName, type, 5, 50);
TopicEchoCommand.subscriber.addMessageListener(new Consumer
© 2015 - 2024 Weber Informatics LLC | Privacy Policy