Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cbor compression makes an error : "Uncaught Cannot process BSON encoded message without BSON header." #315

Open
HeekonKim opened this issue Jan 22, 2019 · 4 comments

Comments

@HeekonKim
Copy link

HeekonKim commented Jan 22, 2019

I wrote a simple code like below and included it in an html file.

<script type="text/javascript" src="http://static.robotwebtools.org/EventEmitter2/current/eventemitter2.min.js"></script>

<script type="text/javascript" src="http://static.robotwebtools.org/roslibjs/current/roslib.min.js"></script>

<script src="bower_components/cbor/cbor.js" type="text/javascript"></script>

<script>

var ros = new ROSLIB.Ros({
url : 'ws://localhost:9090'
});

ros.on('connection', function() {
console.log('Connected to websocket server.');
});

ros.on('error', function(error) {
console.log('Error connecting to websocket server: ', error);
});

ros.on('close', function() {
console.log('Connection to websocket server closed.');
});

var listener = new ROSLIB.Topic({
ros : ros,
name : '/os1_node/points',
messageType : 'sensor_msgs/PointCloud2',
compression : 'cbor',
});

console.log(listener);
listener.subscribe(
function(message) {
}
);

</script>

I did 'roscore', 'roslaunch rosbridge_server rosbridge_websocket.launch', and played an appropriate rosbag file, which has a topic named '/os1_node/points'.

But the browser console makes an error "Uncaught Cannot process BSON encoded message without BSON header." at roslib.min.js:1.

The cbor-compressed message can't be decoded because the error comes out even before the function called in listener.subscribe() works.

Thank you.

@mvollrath
Copy link
Contributor

This is happening because the CDN version of roslibjs has not been updated with CBOR support. You can try building roslibjs from the develop branch and loading that instead, or wait for the next release which is currently in progress.

@jihoonl
Copy link
Member

jihoonl commented Jan 23, 2019

will update cdn within this week.

@HeekonKim
Copy link
Author

Thank you for answer. I built from the develop branch and did the same thing but same error occurs. Is there a code using cbor compression that I can refer to?

@mvollrath
Copy link
Contributor

roslib_bench has a docker example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants