Skip to content

Custom messages not found? #93

@renatosamperio

Description

@renatosamperio

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions