浏览代码

make server_endpoint.py executable (#103)

/devin-main-fix
GitHub 4 年前
当前提交
f2bb730d
共有 1 个文件被更改,包括 26 次插入0 次删除
  1. 26
      tutorials/pick_and_place/ROS/src/niryo_moveit/scripts/server_endpoint.py

26
tutorials/pick_and_place/ROS/src/niryo_moveit/scripts/server_endpoint.py


#!/usr/bin/env python
import rospy
from ros_tcp_endpoint import TcpServer, RosPublisher, RosSubscriber, RosService
from niryo_moveit.msg import NiryoMoveitJoints, NiryoTrajectory
from niryo_moveit.srv import MoverService
def main():
ros_node_name = rospy.get_param("/TCP_NODE_NAME", 'TCPServer')
tcp_server = TcpServer(ros_node_name)
rospy.init_node(ros_node_name, anonymous=True)
# Start the Server Endpoint with a ROS communication objects dictionary for routing messages
tcp_server.start({
'SourceDestination_input': RosPublisher('SourceDestination', NiryoMoveitJoints, queue_size=10),
'NiryoTrajectory': RosSubscriber('NiryoTrajectory', NiryoTrajectory, tcp_server),
'niryo_moveit': RosService('niryo_moveit', MoverService)
})
rospy.spin()
if __name__ == "__main__":
main()
正在加载...
取消
保存