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

Failed to recieve self-defined messages via bridge #153

Open
mayuribh opened this issue Aug 26, 2020 · 1 comment
Open

Failed to recieve self-defined messages via bridge #153

mayuribh opened this issue Aug 26, 2020 · 1 comment

Comments

@mayuribh
Copy link

Let's say I have created a message Allmsg in the package named my_msgs. I am not able to receive the message when subscribed to the concerned topic. I get an error stating the message required does not exist

ros2-web-bridge:Bridge JSON command received: {"op":"subscribe","id":"subscribe:/nmea:1","type":"my_msgs/Allmsg","topic":"/nmea","compression":"none","throttle_rate":0,"queue_length":0} +112ms
ros2-web-bridge:Bridge subscribe a topic named /nmea +1ms
ros2-web-bridge:Bridge Response: {"op":"status","level":"error","msg":"subscribe: Error: The message required does not exist: my_msgs, msg, Allmsg","id":"subscribe:/nmea:1"} +2ms

I am able to successfully subscribe and publish this above topic within ROS but the same with connecting over the bridge gives me and issue.

Here is my code for creating a new object for a topic with the related message type.

var txt_listener = new ROSLIB.Topic({
ros : ros,
name : '/nmea',
messageType : 'my_msgs/Allmsg'
@minggangw
Copy link
Member

I think the root cause is that you created and compiled the message (my_msgs/Allmsg) defined by yourself after you ran the web bridge the first time. Normally, the generated JS messages are generated when the first time you run the web bridge, and if you want to add other message types later, you have to regenerate them forcibly, which is not exposed to the web bridge.

One possible solution is: delete $YOUR_APP_PATH/node_modules/rclnodejs/generated/ manually, then re-run the web bridge which will trigger the regeneration of all JS messages.

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

2 participants