Sanic / rosbridge2cpp

A C++11 library to interface ROS via rosbridge
52 stars 21 forks source link

Expected behavior of client/client.cpp? #8

Open shineyruan opened 3 years ago

shineyruan commented 3 years ago

Hi,

I was trying to run ./rosbridge2cpp-client as a test of functionality on Ubuntu 20.04 + Noetic. However my rosbridge_server does not output any data received and it also does not advertises the topic within ROS created by the client. I'm getting the following output from the client side:

[TCPConnection] Socket created
[TCPConnection] Connected
[TCPConnection] Setting up receiver thread...
[TCPConnection] Receiving
[TCPConnection] bson_only_mode is : 1
.
[TCPConnection] Data send (144 Bytes):
:90:00:00:00:02:6f:70:00:0a:00:00:00:61:64:76:65:72:74:69:73:65:00:02:69:64:00:20:00:00:00:61:64:76:65:72:74:69:73:65:3a:2f:74:65:73:74:5f:72:6f:73:62:72:69:64:67:65:32:63:70:70:3a:31:00:02:74:6f:70:69:63:00:14:00:00:00:2f:74:65:73:74:5f:72:6f:73:62:72:69:64:67:65:32:63:70:70:00:02:74:79:70:65:00:10:00:00:00:73:74:64:5f:6d:73:67:73:2f:53:74:72:69:6e:67:00:10:71:75:65:75:65:5f:73:69:7a:65:00:0a:00:00:00:08:6c:61:74:63:68:00:00:00[TCPConnection] Data end

[TCPConnection] Data send (8f Bytes):
:8f:00:00:00:02:6f:70:00:08:00:00:00:70:75:62:6c:69:73:68:00:02:69:64:00:1e:00:00:00:70:75:62:6c:69:73:68:3a:2f:74:65:73:74:5f:72:6f:73:62:72:69:64:67:65:32:63:70:70:3a:32:00:02:74:6f:70:69:63:00:14:00:00:00:2f:74:65:73:74:5f:72:6f:73:62:72:69:64:67:65:32:63:70:70:00:08:6c:61:74:63:68:00:00:03:6d:73:67:00:28:00:00:00:02:64:61:74:61:00:19:00:00:00:50:75:62:6c:69:73:68:20:66:72:6f:6d:20:54:65:73:74:20:43:6c:69:65:6e:74:00:00:00[TCPConnection] Data end

I have also verified that rosbridge_server has established a connection with the client

[INFO] [1615441368.612716]: Rosbridge TCP server started on port 9090
[INFO] [1615441373.894233]: [Client 0] connected. 1 client total.

However the topic /test_rosbridge2cpp was not published within ROS and I had no way to retrieve data from rosbridge_server side.

Does that look normal for the client test? If yes, is there anything else I need to do in order to retrieve data from rosbridge_server besides launching it with

roslaunch rosbridge_server rosbridge_tcp.launch bson_only_mode:=True

?

Thanks in advance!

Sanic commented 3 years ago

Hi! Which version of rosbridge do you use? Some users in ROSIntegration reported that newer eversions of it might break the rosbridge connection: https://github.com/code-iai/ROSIntegration/issues/139

shineyruan commented 3 years ago

Hi!

Which version of rosbridge do you use?

Some users in ROSIntegration reported that newer eversions of it might break the rosbridge connection:

https://github.com/code-iai/ROSIntegration/issues/139

Hi,

I tried both the latest version (0.11.13) and the "working" version (0.11.10) according to https://github.com/code-iai/ROSIntegration/issues/139, and both of them has the same outcome --- not publishing any desired topics within ROS Noetic.

Thanks

RamanZharkou commented 3 years ago

I am having a similar issue. I debugged the rosbridge_server code and found that I am getting an exception here (added try/catch): https://github.com/RobotWebTools/rosbridge_suite/blob/develop/rosbridge_server/src/rosbridge_server/tcp_handler.py#L62

[ERROR] [1621035498.547522]: Exception in recvall(). Reason: can only concatenate str (not "bytes") to str

It looks like Python 3 compatibility issue to me.

wuyingnan commented 2 years ago

This is a bug caused by rosbridge_server decoding byte array as utf-8 in Python3. There is actually an open PR in rosbridge that works for me. I think they will merge that PR recently into rosbridge.

Sanic commented 2 years ago

@wuyingnan Many thanks for the info!