|
|
|
|
|
|
|
|
|
|
import rospy |
|
|
|
|
|
|
|
from tcp_endpoint.RosTCPServer import TCPServer |
|
|
|
from tcp_endpoint.RosPublisher import RosPublisher |
|
|
|
from tcp_endpoint.RosSubscriber import RosSubscriber |
|
|
|
from tcp_endpoint.RosService import RosService |
|
|
|
from ros_tcp_endpoint import TcpServer, RosPublisher, RosSubscriber, RosService |
|
|
|
|
|
|
|
from robotics_demo.msg import PosRot, UnityColor |
|
|
|
from robotics_demo.srv import PositionService |
|
|
|
|
|
|
buffer_size = rospy.get_param("/TCP_BUFFER_SIZE", 1024) |
|
|
|
connections = rospy.get_param("/TCP_CONNECTIONS", 10) |
|
|
|
tcp_server = TCPServer(ros_node_name, buffer_size, connections) |
|
|
|
tcp_server = TcpServer(ros_node_name, buffer_size, connections) |
|
|
|
|
|
|
|
tcp_server.source_destination_dict = { |
|
|
|
'pos_srv': RosService('position_service', PositionService), |
|
|
|
|
|
|
|
|
|
|
## Import Statements for Services and Messages |
|
|
|
```python |
|
|
|
# TCP Endpoint package imports to enable ROS communication |
|
|
|
from tcp_endpoint.RosTCPServer import TCPServer |
|
|
|
from tcp_endpoint.RosPublisher import RosPublisher |
|
|
|
from tcp_endpoint.RosSubscriber import RosSubscriber |
|
|
|
from tcp_endpoint.RosService import RosService |
|
|
|
from ros_tcp_endpoint import TcpServer, RosPublisher, RosSubscriber, RosService |
|
|
|
# Import specific ROS Messages and Services |
|
|
|
from robotics_demo.msg import PosRot, UnityColor |
|
|
|
from robotics_demo.srv import PositionService |
|
|
|
``` |
|
|
|
|
|
|
- The ROS node name |
|
|
|
|
|
|
|
```python |
|
|
|
tcp_server = TCPServer(ros_node_name) |
|
|
|
tcp_server = TcpServer(ros_node_name) |
|
|
|
``` |
|
|
|
|
|
|
|
## Source Destination Dictionary |
|
|
|