Problem publish std_msgs/String with roslibjs.
hi
i send a problem with I publish a std_msgs/String from jsvascript (roslibjs and websockets). I need send a protocol with first bytesis 0xAA.
in js I send:
var header= "\xAA";
//var header= Uint8Array.of(\xAA,\xAA);
console.log("header vale:"+header);
console.log(typeof(header));
console.log("header length"+header.length);
console.log(header.buffer);
//header=String.fromCharCode.apply(null, header);
//header=String.fromCharCode.apply(null, header);
console.log(typeof(header));
console.log("Header length "+header.length);
console.log("Data length "+Data.length);
var msg=new ROSLIB.Message({
data: header
});
pub.publish (msg);
The header length is 1 and the content is 0xAA
When I read a topic in c++ node receiver a 2 bytes: {0xc2,0xAA}
if i send 0xAAAA in c++ node i receiver {0xc2,0xAA}
Which may be due?
UPDATE
if I send \x10 -> Reception OK 1 byte => 0x10
I send \xC0 -> Reception NO OK 2 bytes => {0xc3 0x80}
Regard