Open Hiroaki-K4 opened 3 years ago
I'm afraid you cannot send a topic to a specific subscriber (robot) by the current ros2-web-bridge. Will Hidden Topic or Service Names
introduced in topic_and_service_names help you?
@minggangw Thank you for reply. What are the uses of row-web-bridge? Does it play a role in connecting the localhost server and ros2 on the same device?
row-web-bridge
can run on an independent device and the web server connects to it through WebSocket, the ros2 can run on another device, neither the row-web-bridge
nor the web server. Normally, to simply the implementation, you can install row-web-bridge
and ros2 on the same machine.
Would you use ros2cli to verify if the message has been sent practically?
I noticed that when publishing a topic by the ros2-web-bridge
, there is always an error
17:49:45 Received Message: {"op":"status","level":"error","msg":"publish: TypeError: Cannot read property 'get' of undefined"} from undefined ::ffff:127.0.0.1
I think that is why it failed. Please check if you have a field named get
in the JSON object.
Do you get these logs by running DEBUG=ros2-web-bridge* node bin/rosbridge.js
?
If you are using ros2-web-bridge
and want to check if the bridge works correctly, I suggest you run DEBUG=ros2-web-bridge* node bin/rosbridge.js
Let me try to understand your problem, and I want to clarify the difference between rosbridge_suite and ros2-web-bridge first:
gzweb uses roslibjs to communicate with the bridge implemented by a nodejs addon if I understand correctly, the bridge is not rosbridge_suite or ros2-web-bridge. Does gzweb
support ROS2 already?
I'm not clear about your entire scenario, but it seems that you use some ROS1 component?
ros2-web-bridge is compatible with roslibjs by complying with rosbridge v2 protocol
I'm not familiar with Gazebo simulator, but I deem publishing a PoseStamped
topic is enough to control your virtual robot. Would you have a brief graph for your entire framework? It seems that you use the gzweb bridge and ros2-web-bridge simultaneously?
I'm not clear why do you need a ros2-web-bridge
here. For my understanding, GzWeb's NodeJS server will work as a bridge between the Javascript and gazebo C++ side. So, what is the role of ros2-web-bridge
, I think the whole system is running on ROS2.
isn't ros2-web-bridge's node_module rclnodejs required to publish PoseStamped?
Yes, rclnodejs
acts as back-end of ros2-web-bridge
to access the ROS2, e.g. pub/sub a topic, but it cannot connect to the gzserver. A general usage is below:
hi @minggangw still racking my brains on this. is this the missing interface for Gazebo to receive the web-cli published message? https://github.com/RobotWebTools/tf2_web_republisher what would it take to adapt it to ROS2?
thank you!
change the topic type of pub and sub to
PoseStamped
, then you can check if the topic can be received.
The topic is published in the bash terminal, and can be echoed in the bash terminal with this modified Index script: $ node examples/index_rclnode.js
but the message is not displayed in the web browser:
Publisher https://gist.github.com/newcanopies/85ccc01a27a60a82fccd0fd7a1d7398e
Subscriber https://gist.github.com/newcanopies/f679c3ad8464534d29ed5690d56a0532
Ending index_rclnode.js
gives this error:
ros2-web-bridge/node_modules/rclnodejs/lib/publisher.js:59
rclnodejs.publish(this._handle, rawMessage);
^
Error: publisher pointer is invalid, at /tmp/binarydeb/ros-foxy-rcl-1.1.11/src/rcl/publisher.c:434
at Publisher.publish (/home/user/ros2-web-bridge/node_modules/rclnodejs/lib/publisher.js:59:17)
at Timeout._onTimeout (/home/user/ros2-web-bridge/examples/index_rclnode.js:24:17)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
ros2-web-bridge/examples/index_rclnode.js
:24:17
hi @minggangw do you think there is an error in below scripts or bridge?
$ node examples/index_rclnode.js
Hi, I have a question. Is it possible to publish msg from a website to a specific robot using this ros2-web-bridge? Thanks!