Wisc-HCI / tf2_web_republisher_py

TF2 Web Republisher for ROS2
BSD 2-Clause "Simplified" License
6 stars 5 forks source link

How to use this repo to solve the bug in ros2-web-bridge #2

Open EricSun787 opened 3 years ago

EricSun787 commented 3 years ago

Hi Andrew! I am also developing ros2 and ros2-web-bridge related applications, and I also facing some problems related to tf2-web-republisher. Here is log:

ros2-web-bridge:Bridge JSON command received: {"op":"advertise","id":"advertise:/tf2_web_republisher/goal:1","type":"tf2_web_republisher/TFSubscriptionActionGoal","topic":"/tf2_web_republisher/goal","latch":false,"queue_size":100} +45ms
  ros2-web-bridge:Bridge advertise a topic: /tf2_web_republisher/goal +0ms
  ros2-web-bridge:Bridge Response: {"op":"status","level":"error","msg":"advertise: Error: The message required does not exist: tf2_web_republisher, msg, TFSubscriptionActionGoal","id":"advertise:/tf2_web_republisher/goal:1"} +0ms
  ros2-web-bridge:Bridge JSON command received: {"op":"advertise","id":"advertise:/tf2_web_republisher/cancel:2","type":"actionlib_msgs/GoalID","topic":"/tf2_web_republisher/cancel","latch":false,"queue_size":100} +1ms
  ros2-web-bridge:Bridge advertise a topic: /tf2_web_republisher/cancel +0ms
  ros2-web-bridge:ResourceProvider Publisher has been created, and the topic name is /tf2_web_republisher/cancel. +0ms
  ros2-web-bridge:Bridge Suppressed: {"op":"status","level":"none","msg":"OK","id":"advertise:/tf2_web_republisher/cancel:2"} +2ms
  ros2-web-bridge:Bridge JSON command received: {"op":"subscribe","id":"subscribe:/tf2_web_republisher/status:3","type":"actionlib_msgs/GoalStatusArray","topic":"/tf2_web_republisher/status","compression":"none","throttle_rate":0} +0ms
  ros2-web-bridge:Bridge subscribe a topic named /tf2_web_republisher/status +0ms

I think the problem with tf2-web-republisher messages has caused me to be unable to use ros2djs or ros3djs to display all tfClient-related widgets, such as pose, laserscan, etc. When I searched for the solution to this problem, I found that you are also tracking similar problems and found this repo. I copied this repo to my ros2 workspace and compiled it. Then recompiled ros2-web-bridge. But the problem has not been solved. Because of the lack of documentation, I don’t know if what I did is correct. Do you have any progress now? Or the correct use of this branch to solve the problem of tf2-web-bridge? Looking forward to your reply! Thanks again!

SomaGallai commented 3 years ago

Is there any progress with this issue?

brockpatchin commented 1 year ago

Hi all, has there been any progress on this issue? @Sunshengjin @SomaGallai @AndrewJSchoen

AndrewJSchoen commented 1 year ago

Hi all, sorry for the lack of response (I haven't been using ROS2 lately). Let me try it out and see what happens on my end.

brockpatchin commented 1 year ago

Sounds good, thanks for the quick reply @AndrewJSchoen :) On my end, I am running into similar issues mentioned above with getting pointclouds to populate using ros3djs and tf2_web_republisher.

AndrewJSchoen commented 1 year ago

@brockpatchin If you have a minimal example workspace that might help me determine the issue.

brockpatchin commented 1 year ago

Sure. I am following this tutorial (https://github.com/RobotWebTools/ros3djs/blob/develop/examples/pointcloud2.html) except I am using a realsense d435i. An error keeps popping up on my rosbridge_server terminal that says something along the lines of

"[rosbridge_websocket-1] [ERROR] [1678311323.546637795] [rosbridge_websocket]: [Client 4281e172-6c6c-4cb4-8bec-2dd41321b535] [id: advertise:/tf2_web_republisher/goal:2] advertise: Unable to import msg class TFSubscriptionActionGoal from package tf2_web_republisher. Caused by module 'tf2_web_republisher.msg' has no attribute 'TFSubscriptionActionGoal'"

This is nothing to populate on the viewer object, but the pointcloud is showing on rViz.

Thank you for your help in advance :)

AndrewJSchoen commented 1 year ago

Still working on an issue getting a setup working on my machine. However, as I work through that, I thought I would mention a possible alternative, based on my own experiences with some aspects of the RobotWebTools materials. I generally had a lot of issues with getting the default tools working, hence why I made this repo (as part of that exploration). However, the thing I was trying to do was actually to create an interface for users, and found that while their ros3d environment did a good job of having parity with rviz, it actually worked pretty poorly in terms of making interfaces with good responsively on the local side, since there weren't great affordances on the front-end, and input had to be piped through the server to enable user interaction. I ended up following a different approach, using the same underlying technology (three.js), but architected in a way separated from the inherent ROS communication. That way I could use whichever communication approach I wanted (I could create my own socket or use the publishers/subscribers from the roslib library. That ended up turning into robot-scene, storybook here. Basically, it is structured to be fed data in a certain format, and it will handle the visualization. You can also configure callbacks for various interactions, and I just added point clouds. A couple caveats: it is in heavy development, and could change, and I haven't gotten to doing documentation, although there should be some good examples in the storybook. Finally, it uses react, so if you are hoping for a less engineered solution, that might not be it.

In terms of usage, you could write a subscriber to broadcast the data from the backend as a json string, and then parse on the front-end, and populate the data in the scene yourself. An example of setting up subscribers in that way can be found here and an example of updating the scene can be found here (last example doesn't use ROS, and instead uses a separate backend, but it gives the idea).

Long story short, still working out the issues with this (but I may be a bit sparse in responding because I am going to be away), but this other thing may work for you, depending on what exactly you are trying to accomplish, and how you are doing it. Let me know if you have any questions on any of that!

brockpatchin commented 1 year ago

Thank you very much @AndrewJSchoen for the in-depth response :)

I will try out the robot-scene library that you mentioned above!

I am trying to also build a user interface for a robot currently with a group of students for our senior project (undergraduate) so we are still relatively new to all of this stuff! It is truly appreciated that you took the time to respond to help us out!