0
$\begingroup$

Rosanswers logo

Dear altruist, I am trying to send some data on this settings

#define SERVER_IP       "192.168.1.121"
#define SERVER_PORT     5000
#define TCP_DATA_LEN    256

this is on a WiFi board(ESP32) which is directly controlling some actions. Is there any simple demo example of such application Regards


Edit: Hello gvdhoorn, thanks for your querry. I have setup the server with the card. So if I now send

> echo "3" | nc 192.168.0.102 3000

I get response to that.
So to implement in ROS, I need to send a value to IP address: 192.168.0.102 and Port: 3000

How can I achieve that easily, if my computer is connected to this server by LAN connection.

Regards Muntahi


Originally posted by KARIM on ROS Answers with karma: 1 on 2018-07-23

Post score: 0


Original comments

Comment by gvdhoorn on 2018-07-23:
Can you clarify how this is related to ROS? This board is rather focused on ROS-specific topics, and general programming of embedded boards (such as an ESP32) does not fall into that category.

Comment by gvdhoorn on 2018-07-23:
re: edit: so you are trying to write a ROS node that sends that 3 to the IP?

If so: I don't believe there is anything that ROS adds or changes here. I would advise you to look up some plain C++ examples of what you are trying to achieve, make sure you understand those and then add ROS.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

https://github.com/abhinavjain241/comm_tcp looks like it was aiming to be a generic TCP/IP ros node- it or one of its forks could be a good starting point for a lot of these questions (like #q219872). It sends strings received by the client node and the server node publishes out any string it receives.

For talking to netcat I couldn't get a netcat client to talk to a comm_tcp server, but the other way around worked:

netcat -l 4444
rosrun comm_tcp client_node 127.0.0.1 4444
rostopic pub /client_messages std_msgs/String "data: 'foo'"

It puts the incoming String in a buffer and sends it repeatedly, but that is easy to fix.

Dynamic reconfigure for ports and server ip address and for connecting and disconnecting would be useful. Adding UDP and most anything else netcat can do would be good also.


Originally posted by lucasw with karma: 8729 on 2018-07-23

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

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