OpenDDS / node-opendds

NodeJS to OpenDDS bridge.
26 stars 18 forks source link

CycloneDDS c++ communicate with OpenDDS JSBinding #45

Closed luojinzhang closed 2 years ago

luojinzhang commented 2 years ago

Hi, I have tried to communicate CycloneDDS and OpenDDS c++ and it worked. But when I use the opendds nodejs module, I got some error from cycloneDDS publisher saying that the qos parameter is invalid. But I really don't know about qos and not really sure how to match the two. You can see the error message at https://github.com/eclipse-cyclonedds/cyclonedds/issues/1395.

1661987970.270809 [32] dq.builtin: invalid parameter list (vendor 1.3, version 2.4): pid 75 (TYPE_INFORMATION) invalid, input = 84,0,0,0,1,16,0,64,40,0,0,0,36,0,0,0,20,0,0,0,241,2,226,168,205,142,140,"j=XX",233,132,176,90,0,56,0,0,0,255,255,255,255,4,0,0,0,0,0,0,0,2,16,0,64,28,0,0,0,24,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0 1661987970.270891 [32] dq.builtin: Invalid SubscriptionBuiltinTopicData (vendor 1.3): invalid qos/parameters

I tried remove the qos in test_subscriber.js but does not work either. My question is how do I use default qos, or change qos in js binding of opendds, or if you know anything about the error message.

Thank you.

Edit: here is the js file:



var DOMAIN_ID = 32;
var secure = process.argv.includes('--secure');
var rtps = process.argv.includes('--rtps');

function init_opendds(opendds_addon) {
  if (secure || rtps) {
    return opendds_addon.initialize('-DCPSConfigFile', 'rtps_disc.ini');
  } else {
    return opendds_addon.initialize();
  }
}

var opendds_addon = require('../lib/node-opendds'),
  factory = init_opendds(opendds_addon),
  library = opendds_addon.load('idl/NodeJSTest'),
  participant = factory.create_participant(DOMAIN_ID),
  reader

try {
  if (!library) {
    throw 'Failed to load shared library';
  }
  reader = participant.subscribe('HelloWorldData_Msg', 'HelloWorldData::Msg', 
  {
    DataReaderQos: {
      reliability: {
        kind: 'RELIABLE_RELIABILITY_QOS',
        max_blocking_time: {sec: 10, nanosec: 0}
      },

      history: {
        kind: 'KEEP_ALL_HISTORY_QOS',
        depth: 1
      },

      resource_limits: {
        max_samples: 1000,
      },

    }
  },
   function (dr, sinfo, sample) {
    console.log("sample info", sinfo);
    console.log("sample", sample);
  });
} catch (e) {
  console.log(e);
}

process.on('exit', function () {
  factory.delete_participant(participant); // optional
  opendds_addon.finalize(factory);
});
mitza-oci commented 2 years ago

Which version of OpenDDS is this using? What command line options are used when invoking opendds_idl?

mitza-oci commented 2 years ago

Also... because you reported that "I have tried to communicate CycloneDDS and OpenDDS c++ and it worked" please attach a packet capture for both the working and non-working examples.

luojinzhang commented 2 years ago

Thank you for replying, I've found a solution.

mitza-oci commented 2 years ago

Thank you for replying, I've found a solution.

What was the solution? Others may have the same problem.

luojinzhang commented 2 years ago

Sorry for not mentioning it, because I actually dropped the OpenDDS and used another way to subscribe messages from CycloneDDS. This method is not from myself so I can't share it.