ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
If you haven't already, I suggest you read through the available ros java documentation. Especially the rosjava_core documentation should be helpful. The java ROS client and interaction works a little different from the other client libraries (such as roscpp
and rospy
).
Both your questions should be answered after this.
2 | No.2 Revision |
If you haven't already, I suggest you read through the available ros java documentation. Especially the rosjava_core documentation should be helpful. The java ROS client and interaction works a little different from the other client libraries (such as roscpp
and rospy
).
Both your questions should be answered after this.
Edit: for completeness:
what is this doing exactly?
rosTextView.setMessageToStringCallable ((message) -> {return message.getData();});
This is most likely a 'collapsed' view of:
rosTextView.setMessageToStringCallable(new MessageCallable<String, std_msgs.String>() {
@Override
public String call(std_msgs.String message) {
return message.getData();
}
});
In short: the class RosTextView
extends a specialised View
, which can update (append) its contents whenever a message comes in over a certain topic (in this case chatter, set by invoking rosTextView.setTopicName("chatter")
). The method setMessageToStringCallable(..)
just registers a callback (anonymous MessageCallable
here) which will be invoked upon reception of a message. In this case it just returns the data within the message (which is a String
), which RosTextView
will use to update its view.
Your other questions can also be answered by reading the sources of the relevant classes.
3 | No.3 Revision |
If you haven't already, I suggest you read through the available ros java documentation. Especially the rosjava_core documentation should be helpful. The java ROS client and interaction works a little different from the other client libraries (such as roscpp
and rospy
).
Both your questions should be answered after this.
Edit: for completeness:
what is this doing exactly?
rosTextView.setMessageToStringCallable ((message) -> {return message.getData();});
This is most likely a 'collapsed' view of:of (so your editor is collapsing this, look for a 'plus' in the gutter or margin):
rosTextView.setMessageToStringCallable(new MessageCallable<String, std_msgs.String>() {
@Override
public String call(std_msgs.String message) {
return message.getData();
}
});
In short: the class RosTextView
extends a specialised View
, which can update (append) its contents whenever a message comes in over a certain topic (in this case chatter, set by invoking rosTextView.setTopicName("chatter")
). The method setMessageToStringCallable(..)
just registers a callback (anonymous MessageCallable
here) which will be invoked upon reception of a message. In this case it just returns the data within the message (which is a String
), which RosTextView
will use to update its view.
Your other questions can also be answered by reading the sources of the relevant classes.