0
$\begingroup$

Rosanswers logo

Hi everyone, I'm having a project to build a user interface with ROS in C++. I found that rosbridge is a useful tool but the rosbridge client only support java script, java and python. Is there any way we can embbed the api of one of those (roslibjs, jrosbridge, roslibpy) into C++? Thank you for reading my questions.


Originally posted by zuy on ROS Answers with karma: 66 on 2021-08-25

Post score: 2


Original comments

Comment by Mike Scheutzow on 2021-08-26:
At a high level, please explain what you want to accomplish. Why do you not create a "real" ros node, in c++ if that's your preferred language?

Comment by zuy on 2021-08-26:
Because I want to build a user interface which can monitor and control the robot remotely. But I want to have a native application instead of web-based. Is it possible to do this?

Comment by Mike Scheutzow on 2021-08-27:
Yes, it's very possible. However, you have not explained enough of your idea for me to comment on whether using rosbridge makes sense. Will you configure a ros network between the laptop (for UI) and the robot, or will the robot run a custom server that your UI app makes a network connection to? On which machine did you want to run rosbridge?

Comment by zuy on 2021-08-27:
Simply I just want to create an application which can communicate to ROS (on my robot) and this application should be run on a non-ROS machine. I found that rosbridge is almost the only way to do this without a great effort. So I'm looking for a solution to use rosbridge in a native application. C++ is a prefered language, however we can be flexible. Could you give me some advice? Thank you for paying attention in my topic.

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

From Google (rosbridge c++): Sanic/rosbridge2cpp and ppianpak/rosbridgecpp.

I've not used either of those, so you'll have to test them out and see whether they satisfy your requirements.


Originally posted by gvdhoorn with karma: 86574 on 2021-08-26

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by zuy on 2021-08-26:
Thank you for helping. But seems like there's nothing about other libraries like nav2djs or ros2djs, I wonder if I can build a complete application with this.

$\endgroup$
0
$\begingroup$

Rosanswers logo

Have you looked at the technical details of talking to rosbridge_server? From what I see, your app connects to a websocket on the robot, then you send a json message, and get one or more json responses. There are already libraries for c++ to help code both for websockets and for json. This approach should work if rosbridge does the things you need, but you will have to be careful not to subscribe to any high-bandwidth topics.

If it were me, I'd likely create a ros node in python that uses the tornado library to implement a very simple one-page http server. This approach keeps all ros message traffic on the robot, allowing the node to publish and subscribe to whatever it needs to, and not worry about consuming wireless bandwidth. How nice the displayed web page looks would depend entirely on how much effort you want to put into coding it.


Originally posted by Mike Scheutzow with karma: 4903 on 2021-08-27

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by zuy on 2021-08-28:
That is a great idea, I'll think about how to turn that into a real thing. Thank you!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.