tud-cor / FS19_modROS

(partial) ROS1 integration for FarmSim19
Apache License 2.0
49 stars 12 forks source link

Using `rosbridge` protocol to publish ROS topics #48

Open tckarenchiang opened 3 years ago

tckarenchiang commented 3 years ago

Instead of using convert_json_to_ros_message to convert JSON to ROS messages in our custom python script, we could use rosbridge protocol to write rosbridge JSON packets to the pipe in Lua side and create a Python script that reads bytes from the pipe and write to the TCP socket (connected to a rosbridge) without interpreting them at all.

tckarenchiang commented 3 years ago

rosbridge v2.0 Protocol Specification: https://github.com/RobotWebTools/rosbridge_suite/blob/ros2/ROSBRIDGE_PROTOCOL.md

tckarenchiang commented 3 years ago

I tried using a low-level internet networking interface: socket and a higher-level library: Twisted to connect to a rosbridge server. However, I can't handle sending data efficiently when the data size is large using either library. The higher-volume the data is coming from FS, the larger the lag is in receiving messages from ROS side. I'm not sure how to solve this issue so I'll for now put this issue on the back burner.

gavanderhoorn commented 3 years ago

Current state of this work: rosbridge_protocol_client.

Timple commented 2 years ago

If everything is communicated using rosbridge, is #14 automatically tackled? As there is already rosbridge2.

gavanderhoorn commented 2 years ago

Yes, correct.

However given the state of the rosbridge implementation I don't believe we'll be able to switch to it. There are too many problems with performance. It's likely/possible that's our fault (as we tried some naive ways to connect everything together), but as-is, the custom 'bridge' outperforms rosbridge by (at least) an order of magnitude, especially when it comes to larger messages (such as LaserScan).