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

Always specify topic and position in sender-stub.

parent a966bb62
......@@ -7,34 +7,21 @@ import java.util.concurrent.TimeUnit;
public class Main {
public static void main(String[] args) throws Exception {
final String topic;
final byte[] message;
if (args.length < 1) {
topic = "robot/joint1";
} else {
topic = args[0];
}
if (args.length < 2) {
Linkstate.PandaLinkState pls = Linkstate.PandaLinkState.newBuilder()
.setName("Joint1")
.setPos(Linkstate.PandaLinkState.Position.newBuilder()
.setPositionX(0.5f)
.setPositionY(0.5f)
.setPositionZ(0.5f)
.build())
.setOrient(Linkstate.PandaLinkState.Orientation.newBuilder()
.setOrientationX(0)
.setOrientationY(0)
.setOrientationZ(0)
.setOrientationW(0)
.build())
.build();
message = pls.toByteArray();
} else {
message = args[1].getBytes();
// assume 4 arguments
if (args.length < 4) {
System.err.println("Sends a new position, expected arguments: topic x y z");
return;
}
final String topic = args[0];
Linkstate.PandaLinkState pls = Linkstate.PandaLinkState.newBuilder()
.setName(args[0])
.setPos(Linkstate.PandaLinkState.Position.newBuilder()
.setPositionX(Float.parseFloat(args[1]))
.setPositionY(Float.parseFloat(args[2]))
.setPositionZ(Float.parseFloat(args[3]))
.build())
.build();
final byte[] message = pls.toByteArray();
MqttUpdater sender = new MqttUpdater("sender stub").dontSendWelcomeMessage();
sender.setHost("localhost", 1883);
......
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