public void Publish(string topic, ROSBridgeMsg msg) { if (_ws != null) { if (m_AnnouncedTopics.Contains(topic)) { string s = ROSBridgeMsg.Publish(topic, msg.ToYAMLString()); //Debug.Log ("Sending on " + topic); _ws.Send(s); } else {// if not announced that we're publishing on this topic //-> go through list of publishers/ subscribers and see if one is not yet advertised, try again AnnouncePublishersAndSubscribers(); //Try second time otherwise not working if (m_AnnouncedTopics.Contains(topic)) { string s = ROSBridgeMsg.Publish(topic, msg.ToYAMLString()); //Debug.Log ("Sending on " + topic); _ws.Send(s); } else { Debug.LogWarning("[ROS Websocket Connection] Trying to publish on a topic that is not registered!\n Topic: " + topic); } } } }
public void Publish(String topic, ROSBridgeMsg msg) { if (_ws != null) { string s = ROSBridgeMsg.Publish(topic, msg.ToYAMLString()); //Debug.Log ("Sending " + s); _ws.Send(s); } }