您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

26 行
825 B

#!/usr/bin/env python
import rospy
from ros_tcp_endpoint import TcpServer, RosPublisher, RosSubscriber, RosService
from robotics_demo.msg import PosRot, UnityColor
from robotics_demo.srv import PositionService
def main():
ros_node_name = rospy.get_param("/TCP_NODE_NAME", 'TCPServer')
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)
rospy.init_node(ros_node_name, anonymous=True)
tcp_server.start({
'pos_srv': RosService('position_service', PositionService),
'pos_rot': RosPublisher('pos_rot', PosRot, queue_size=10),
'color': RosSubscriber('color', UnityColor, tcp_server)
})
rospy.spin()
if __name__ == "__main__":
main()