Пример #1
0
 protected void publish() {
   if (publisher_string.isEmpty()) return;
   std_msgs.String string = publisher.newMessage();
   string.setData(publisher_string);
   publisher.publish(string);
   hasPublishedMsg = true;
   publisher_string = "";
 }
 public void send_coordinate(float[] p_array) {
   string = publisher.newMessage();
   StringBuilder stringBuilder = new StringBuilder();
   stringBuilder.append("c_");
   stringBuilder.append(java.lang.String.valueOf(p_array[0]));
   stringBuilder.append('_');
   stringBuilder.append(java.lang.String.valueOf(p_array[1]));
   string.setData(stringBuilder.toString());
   publisher.publish(string);
 }
Пример #3
0
 /**
  * This method is called whenever a message is received through ROS.
  *
  * @param message The String message received through the topic.
  */
 @Override
 public void onNewMessage(std_msgs.String message) {
   String status = message.getData();
   System.out.println("Changing status of: " + robot.getName() + " to: " + message.getData());
   RobotController.getInstance().setRobotStatus(robot.getName(), status);
 }
 public void sendMessage(java.lang.String p_string) {
   string = publisher.newMessage();
   string.setData(p_string);
   publisher.publish(string);
 }
 public void sendCloseMenu() {
   string = publisher.newMessage();
   string.setData("menu_close");
   publisher.publish(string);
 }