I need to subscribe to a new type of message, LogMsg.
I wrote the msg as follows. It's located under Assets/ROSBridgeLib/tevel_msgs
/////////////////////////////////////////////////////////////////////
using System.Collections;
using System.Text;
using SimpleJSON;
using ROSBridgeLib.tevel_msgs;
namespace ROSBridgeLib {
namespace tevel_msgs {
public class LogMsg : ROSBridgeMsg {
private string _module_name;
private string _text;
public LogMsg(JSONNode msg) {
_module_name = msg ["module_name"].Value;
_text = msg ["text"].Value;
}
public LogMsg(string moduleName, string text) {
_module_name = moduleName;
_text = text;
}
public static string GetMessageType() {
return "tevel_msgs/Log";
}
public string GetText() {
return _text;
}
public string GetModule() {
return _module_name;
}
public override string ToString() {
return "text =" + _text;
}
public override string ToYAMLString() {
return "{\"text\" : " + _text + "}";
}
}
}
}
//////////////////////////////////////////////////////
The subscriber is this:
////////////////////////////////////////////////////////////
using ROSBridgeLib;
using ROSBridgeLib.tevel_msgs;
using System.Collections;
using SimpleJSON;
using UnityEngine;
public class TevelInfo : ROSBridgeSubscriber {
public delegate void NewLogMessageDelegate (string module, string text);//, int type);
public static event NewLogMessageDelegate newLogMessageEvent;
public static int lastCounter = -1;
public new static string GetMessageTopic() {
return "/tevel/info";
}
public new static string GetMessageType() {
return "tevel_msgs/Log";
}
public new static ROSBridgeMsg ParseMessage(JSONNode msg) {
LogMsg newMsg = new LogMsg(msg);
if (newLogMessageEvent != null)
newLogMessageEvent (newMsg.GetModule (), newMsg.GetText ());
return new LogMsg(msg);
}
public new static void CallBack(ROSBridgeMsg msg) {
}
}
///////////////////////////////////////////////////////////////////
I use this line of code:
ros.AddSubscriber (typeof(TevelInfo));
And on RosBridge on Ubuntu, I get this error message:
subscribe: Unable to load the manifest for package tevel_msgs. Caused by: tevel_msgs
Why can't I subscribe to any topic / message type I want?
It sounds as though ROS does not know the level_msg msg. Are the messages properly built into ROS? That is, if you run runsmg do you get all the data about it?
Hi,
I need to subscribe to a new type of message, LogMsg. I wrote the msg as follows. It's located under Assets/ROSBridgeLib/tevel_msgs
The subscriber is this:
I use this line of code:
ros.AddSubscriber (typeof(TevelInfo));
And on RosBridge on Ubuntu, I get this error message:subscribe: Unable to load the manifest for package tevel_msgs. Caused by: tevel_msgs
Why can't I subscribe to any topic / message type I want?
Thanks :-)