RobotWebTools / ros2-web-bridge

Bridging your browser to the ROS 2.0
Apache License 2.0
203 stars 68 forks source link

Subscription Failure #158

Closed eden-desta closed 3 years ago

eden-desta commented 3 years ago

Hi everyone! I was running the simple example and experimenting with different types of ROS messages when I had a failure trying to subscribe to a Joy data.

I am attaching my publisher.html and subscription.html for your to recreate.

For your reference -- the error ONLY occurs on subscription. without trying to subscribe to the Joystick data the publisher is able to happily publish the data with no problem (and i can echo it out in my terminal).

But this is my error below:

 Fatal error in , line 0
 Check failed: length == backing_store->byte_length().

#FailureMessage Object: 0x7fff5bb2cc10
 1: 0xacbb41  [node]
 2: 0x1aa66d4 V8_Fatal(char const*, ...) [node]
 3: 0xf23bba v8::internal::GlobalBackingStoreRegistry::Lookup(void*, unsigned long) [node]
 4: 0xc6256f  [node]
 5: 0xc62774 v8::ArrayBuffer::New(v8::Isolate*, void*, unsigned long, v8::ArrayBufferCreationMode) [node]
 6: 0x7f2ae45014af rclnodejs::CreateArrayBufferFromAddress(Nan::FunctionCallbackInfo<v8::Value> const&) [/home/eden/Desktop/nvs/webapp_ws/ros2-web-bridge/node_modules/rclnodejs/build/Release/rclnodejs.node]
 7: 0x7f2ae44f29ac  [/home/eden/Desktop/nvs/webapp_ws/ros2-web-bridge/node_modules/rclnodejs/build/Release/rclnodejs.node]
 8: 0xca1cfb  [node]
 9: 0xca32ac  [node]
10: 0xca3926 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
11: 0x14c19b9  [node]
Illegal instruction (core dumped)

PUBLISHER

  const joy_data = {
    header: {
      stamp: {sec: 1603917727, nanosec: 208370251},
      frame_id: "joy",
    },
    axes: [0.2, 1.5, 8.9, 3.1],
    buttons: [1, 32],
  }

  const joy_publisher = new ROSLIB.Topic({
    ros: ros,
    name: '/joy_data',
    messageType : 'sensor_msgs/Joy',
  });

  setInterval(() => {
    joy_publisher.publish(joy_data);
  }, 1000);

SUBSCRIPTION

const joy_publisher = new ROSLIB.Topic({
    ros: ros,
    name: '/joy_data',
    messageType : 'sensor_msgs/Joy',
  });

  joy_publisher.subscribe(function(message) {
    document.getElementById("header").innerText = message.header.frame_id
  });
minggangw commented 3 years ago

Hi @edesta-be thanks for reporting the issue, would you please offer your detailed env, e.g. ROS2/nodejs/rclnodejs version? I try to reproduce it on my local Linux host, but it seems workable.

My env is:

eden-desta commented 3 years ago

Env: Node.js: v15.0.1 ROS2 Foxy Fitzroy -- Patch Release 3 Ubuntu 20.04 rclnodejs v0.16.0

Thank you @minggangw

minggangw commented 3 years ago

Because rclnodejs, ROS2 Node.js client, hasn't been verified on Node.js higher than 12, I suggest you could downgrade your Node.js. Actually, there is some known issue (https://github.com/RobotWebTools/rclnodejs/issues/713) on the higher version of Node.js

eden-desta commented 3 years ago

Hi! Thank you for your help! I downgraded to 12.19.0 Node.js and it worked!

It might be worth investigating still but for the time being I am all set! Thank you for your time!

minggangw commented 3 years ago

My pleasure, I will update here once it works on Node.js v14.x and v15.x