-
Notifications
You must be signed in to change notification settings - Fork 136
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
Rosbridge connection established, but not able to publish. #30
Comments
looks good so far. Did you start the rosbridge as suggested? (roslaunch rosbridge_server rosbridge_tcp.launch bson_only_mode:=True) |
I've tried both I've also tried making a blueprint to subscribe to a topic, without success. Thanks for helping me out. |
The rosbridge would output an error if it gets any corrupted data messages that is true. But if the data is fine it would not output anything on the console. It would just republish the message to the ROS Environment. You need at least have a console open with "rostopic echo /chatter" before starting your BeginPlay to see if the message really is dropped somewhere in the middle. Subscribing to a topic that was not advertised yet is completely fine in the ROS world because it is not safe to say when one ROS Node is started or available before any other node. Everything can come and go. As soon as someone is publishing to this topic your subscription should work then without issues. |
I wasn't sure if I needed to manually create the topic (since the plugin doesn't support advertising, as far as I understand), so I made a little python script that continually publishes to /chatter. The BP with subscribe isn't picking up anything either. If I subscribe to a string topic, "Event On String Message" is supposed to fire every time something is published to the topic, right? Edit: |
Yes the BP should fire every time. Sounds as you set it up correctly. I have no idea at the moment what the issue could be. The next thing I would do is to debug the code of the rosbridge2cpp code of the ROSIntegration Plugin to see what is happening with the messages. |
Hmm. This will probably take me some time. I looked at the value of "ExampleTopic" during execution, which gave me this:
I see that Connected is true. Does that narrow anything down? |
Looks good. You may have to go deeper to see what is really going on. You could try to set a breakpoint at line 422 of rosbridge2cpp/ros_bridge.cpp and see if the SendMessage call returns success. If so, the message is lost somewhere on the way to the rosbridge node or the republishing of the message into the ROS realm done by the rosbridge node is somehow faulty. On the message receiving side you could check rosbridge2cpp/TCPConnection.cpp from line 168 on whether the data that is incoming is parsed correctly and a few lines down passed to the incoming_message_callback_bson_(). |
Thank you! |
Yes, it's weird though, that the initial connection works and sending the data also works but the rosbridge is not communicating with the ROS. You said Unreal Computer. May be you started the rosbridge on the computer that is also running unreal and also started a ROS Core on another computer? starting the RosBridge with roslaunch you get two ROS cores, one on each computer. Or is the ROSbridge run on the other machine where your python script also runs? |
My setup is a Windows 10 computer with Unreal installed, with a direct wired connection to a computer running Ubuntu 16.04 and ROS Indigo. ROSbridge and the python script run on this computer. This is all I get (I'm sure this isn't very helpful, though):
|
Interesting. The BP that subscribes to a topic should result in an output at the rosbridge as something like the following: Are you sure you subscribing at event beginplay to the topic via the BP? Other than that it looks fine if you only have the topic that publishes from Unreal via code in Beginplay. I have to admit I never tried to use it like that. Maybe it helps to put the following part:
Into the Tick function of your Actor instead of BeginPlay, just to be sure this has nothing to do with Setting up the connection in right order prior to sending something. |
At beginplay, an actor constructs a BP listentotopic, whose "Event on construct" triggers subscribe as well as print to screen. The blueprint prints to screen, so I think it's subscribing as well.
I also captured these packets when the publishing code runs:
using wireshark on the receiving computer, I saw these same packets arrive. I tried putting the publishing string into the tick function, although I had to include the
to get it to compile. Is it alright to make a UROSIntegrationGameInstance on every tick? Edit: |
Casting to UROSIntegrationGameInstance is not a problem, but you create new topic every tick. That will not work. Put the ExampleTopic into a member of your class and it will work to put the init into BeginPlay and the rest into the Tick method. The Blueprint part looks fine though. That alone should already work. |
@florian-leblanc We need additional information to debug this. Also: Where do you hold your instance of your Topic? Please note that it should live in some scope that persists: #32 |
We also use roslibjs and it works fine. you have to start a rosbridge_websocket on a different port additionally to the rosbridge_tcp though. |
It's ok now i find my problem it was tornado : #353 |
Hi,
I've set the plugin and world up as per the instructions, and on pressing play rosbridge registers a connection.
But when putting the example publishing code in an actor, rosbridge does not seem to receive anything. Is there something in particular I have to do to make the code communicate properly?
Thanks.
This is what I have in BeginPlay():
The text was updated successfully, but these errors were encountered: