Hi,
Many thanks for your library as it has become very useful. However, recently I had found some issues that perhaps you could help me to clarify.
I am trying to make use of custom defined messages from another module but I receive the error:
TypeError: Cannot read property 'msg' of undefined
I am including the custom message module in the package.xml as build_depend and exec_depend and in the CMakelists.txt in the parts related to find_package and CATKIN_DEPENDS of the "catkin_package".
I also tried to load the messages explicitly with rosnodejs.loadAllPackages(); before calling the require of the custom-made module, but this only works when I execute the node inside the ROS module.
I installed the node_modules/ inside the ROS module itself. The file structure looks like this:
my_ws/
custom_messages_module/
msg/
myMessage.msg
error_module/
scripts/
node_modules/
package-lock.json
ros_node_script.js
user@host: ~/my_ws$ rosrun error_module ros_node_script.js
TypeError: Cannot read property 'msg' of undefined
The file ros_node_script.js would look like this:
#!/usr/bin/env node
const rosnodejs = require('rosnodejs');
rosnodejs.loadAllPackages();
const custom_messages_module = rosnodejs.require('custom_messages_module').msg;
Any idea would be very helpful.
Regards,
Renato.
Hi,
Many thanks for your library as it has become very useful. However, recently I had found some issues that perhaps you could help me to clarify.
I am trying to make use of custom defined messages from another module but I receive the error:
TypeError: Cannot read property 'msg' of undefinedI am including the custom message module in the package.xml as
build_dependandexec_dependand in the CMakelists.txt in the parts related tofind_packageandCATKIN_DEPENDSof the "catkin_package".I also tried to load the messages explicitly with
rosnodejs.loadAllPackages();before calling therequireof the custom-made module, but this only works when I execute the node inside the ROS module.I installed the node_modules/ inside the ROS module itself. The file structure looks like this:
user@host: ~/my_ws$ rosrun error_module ros_node_script.jsTypeError: Cannot read property 'msg' of undefinedThe file ros_node_script.js would look like this:
#!/usr/bin/env nodeconst rosnodejs = require('rosnodejs');rosnodejs.loadAllPackages();const custom_messages_module = rosnodejs.require('custom_messages_module').msg;Any idea would be very helpful.
Regards,
Renato.