ZeroSimROSUnity icon indicating copy to clipboard operation
ZeroSimROSUnity copied to clipboard

Ros_bridge not publishing ROS messages

Open EdvardGrodem opened this issue 3 years ago • 14 comments

I've followed the tutorial on Setting up a new Unity Project, but want to set up the a new catkin_ws independent of the provided docker space. I'm quite new to ROS so this might be obvious. I've tried to run roslaunch rosbridge_server rosbridge_tcp.launch bson_only_mode:=true And then press play in Unity. The console in Unity then reports that connection to ros bridge is established, and rostopic list confirms that the topics have been published. However, when opening up rviz to view the sensors, none of them receive any messages.

Is it possible to get access files in the docker container so that it is easier to set up a workspace outside of docker? Does anyone know how to solve this issue?

EdvardGrodem avatar Jun 24 '21 14:06 EdvardGrodem

In a pivate mail with @micahpearlman Micah suggested the following:

Reproducing catkin_ws can be some of the trickiest things about ROS and is why we have released a Docker. We have not gotten around to open sourcing the docker build files, but will do so soon. In the meantime see attached docker files. Probably the part that will fix your roslaunch rosbridge_server issue is that there is an issue with the latest ROS Bridge Suite. The creation of the ROS bridge module for ROS is done via:

# install ROS bridge from source
# NOTE:  there seems to be issues with ROS bridge > 0.11.10 so we use the specific branch
RUN git clone -b 0.11.10 --single-branch https://github.com/RobotWebTools/rosbridge_suite.git
RUN cp -R ./rosbridge_suite/rosbridge_suite $CATKIN_WS/src
RUN cp -R ./rosbridge_suite/rosbridge_library $CATKIN_WS/src
RUN cp -R ./rosbridge_suite/rosbridge_server $CATKIN_WS/src
RUN cp -R ./rosbridge_suite/rosbridge_msgs $CATKIN_WS/src
RUN cp -R ./rosbridge_suite/rosapi $CATKIN_WS/src
RUN rm -rf ./rosbridge_suite

Also, the launch files can be browsed in the ZeroSim docker via opneing a bash script and browsing through the /catkin_ws/src directory: docker exec -it my_zerosim_vnc_docker \ bash -c "source devel/setup.bash ; rosrun turtlebot3_teleop turtlebot3_teleop_key". Attached is the basic Unity editor launch file.

This almost works. Laser scans and poses etc works well. However, images from cameras do not encode correctly and appears blue in Rviz. Does anyone know how to fix this?

EdvardGrodem avatar Jun 28 '21 08:06 EdvardGrodem

@EdvardGrodem Regarding images/cameras not showing up I've opened up a new issue: #4

micahpearlman avatar Jun 28 '21 16:06 micahpearlman

Hi @EdvardGrodem, I am having a similar issue as you described above. The difference is that I could not see any topics published from Unity after running "rostopic list".

I have rosbridge_server 0.11.13 installed with ROS Noetic in my Ubuntu 20.04 machine. After reading the issue here, I downloaded 0.11.10 and catkin_make it in a local workspace. After running "roslaunch rosbridge_server rosbridge_tcp.launch bson_only_mode:=true" and "rostopic list" on two consoles, I still could not see any topics from Unity.

Could you let me know what you did to make this work, please? Thanks a lot.

ghost avatar Jun 30 '21 22:06 ghost

Hi, @nsrj. The Recomended System specifies ROS Melodic, however I'm not familiar enough with ROS to be able to tell if Noetic could work.
I am running Ubuntu 18.04 with ROS Melodic and ROS bridge 0.11.10. Other then that I think we have the same setup.

EdvardGrodem avatar Jul 01 '21 06:07 EdvardGrodem

@nsrj you may want to checkout this pull request for ROS Bridge that hasn't been incorporated: https://github.com/RobotWebTools/rosbridge_suite/pull/545

micahpearlman avatar Jul 01 '21 16:07 micahpearlman

@micahpearlman, thank you for your follow-up. I downloaded and compiled this version and it is now working on my machine. The issue is the rosbridge. Thanks a lot for pointing it out!

ghost avatar Jul 01 '21 17:07 ghost

@EdvardGrodem, thank you for your reply. After switching to a different version of rosbridge as mentioned above, all the topics are visible now. Thanks!

ghost avatar Jul 01 '21 17:07 ghost

Hi @EdvardGrodem, I am having a similar issue as you described above. The difference is that I could not see any topics published from Unity after running "rostopic list".

I have rosbridge_server 0.11.13 installed with ROS Noetic in my Ubuntu 20.04 machine. After reading the issue here, I downloaded 0.11.10 and catkin_make it in a local workspace. After running "roslaunch rosbridge_server rosbridge_tcp.launch bson_only_mode:=true" and "rostopic list" on two consoles, I still could not see any topics from Unity.

Could you let me know what you did to make this work, please? Thanks a lot.

Hello, im having the same problem, i tried downloading and compiling this ROSBridge version, but when i run:

roslaunch rosbridge_server rosbridge_tcp.launch bson_only_mode:=true

i cant see any topics from Unity, i really dont know that else to try, i can perfectly see the topics from Unity being published when i use the docker catkin workspace, but when i try to see them from my local catkin workscape using rostopic list, i cant see them and when i check the Unity console, it reports that connection to ros bridge is established. Im running ROS Noetic on a Ubuntu 20.04 machine.

cramirez98 avatar Sep 19 '21 02:09 cramirez98

@cramirez98 this is the ZeroSim Docker setup for ROS Bridge:

# install ROS bridge from source
# NOTE:  there seems to be issues with ROS bridge > 1.11.10 so we use the specific branch
RUN git clone -b 0.11.10 --single-branch https://github.com/RobotWebTools/rosbridge_suite.git
RUN cp -R ./rosbridge_suite/rosbridge_suite $CATKIN_WS/src
RUN cp -R ./rosbridge_suite/rosbridge_library $CATKIN_WS/src
RUN cp -R ./rosbridge_suite/rosbridge_server $CATKIN_WS/src
RUN cp -R ./rosbridge_suite/rosbridge_msgs $CATKIN_WS/src
RUN cp -R ./rosbridge_suite/rosapi $CATKIN_WS/src
RUN rm -rf ./rosbridge_suite

See: https://github.com/fsstudio-team/zerosim_docker/blob/master/docker/base/Dockerfile

We have not tried Noetic yet though I hear some users have been successful. Very much recommend using a Docker for ROS if at all possible as setting up ROS is a bit of a nightmare at times.

micahpearlman avatar Sep 19 '21 03:09 micahpearlman

@cramirez98 any luck? If so, do you mind sharing how you were able to setup a non-Docker system for ROS Noetic?

micahpearlman avatar Sep 21 '21 00:09 micahpearlman

No, i couldn't get it to work

cramirez98 avatar Sep 21 '21 11:09 cramirez98

@cramirez98 perhaps you can try running ROS Bridge in the ZeroSim Docker and run other ROS nodes on your host OS by juggling the ROS master environment settings: https://answers.ros.org/question/272065/specification-of-ros_master_uri-and-ros_hostname/

micahpearlman avatar Sep 23 '21 16:09 micahpearlman

I have managed to set up the ROS Bridge mentioned here on my system (ROS Noetic, Ubuntu 20.04 LTS), and the topics from Unity were visible.

When I tried to set up the default rosbridge_suite package from apt, the server used to form a connection, but there were no topics from Unity being transferred. So the fix mentioned by @micahpearlman indeed does work on Noetic as well.

@cramirez98 I know this seems trivial, but were you able to confirm that the ROS path for the rosbridge_suite package was from your workspace and not from /opt/ros/noetic? An excellent way to check the path is using the roscd rosbridge_suite command.

leander-dsouza avatar Sep 27 '21 07:09 leander-dsouza

I found the easy way to solve this issue, but it only works on a linux host.

Add the --network host argument to the docker run command. You can also remove the --publish arguments to prevent the getting WARNING: Published ports are discarded when using host network mode.

Proof of fix

Run the docker image

docker run -it --rm \
--network host \
--name my_zerosim_vnc_docker \
zerodog/zerosim_ros_vnc:latest \
roslaunch zero_sim_ros basic_unity_editor.launch

rosbridge 0.11.13 (ROS Noetic, Ubuntu 20.04 LTS)

➜  catkin_ws roswtf
Loaded plugin tf.tfwtf
No package or stack in the current directory
================================================================================
Static checks summary:

No errors or warnings
================================================================================
Beginning tests of your ROS graph. These may take a while...
analyzing graph...
... done analyzing graph
running graph rules...
... done running graph rules
running tf checks, this will take a second...
... tf checks complete

Online checks summary:

Found 1 warning(s).
Warnings are things that may be just fine, but are sometimes at fault

WARNING No tf messages

➜  catkin_ws rosversion rosbridge_server
0.11.13
➜  catkin_ws rostopic echo /client_count 
data: 0
---

alex-ssom avatar Apr 15 '22 18:04 alex-ssom