rosbridge_suite入门教程-rosapi代码解读
rosbridge_suite入门教程-rosapi代码解读
说明:
- 介绍rosapi包功能,提供各种ROS服务
代码目录结构:
├── CHANGELOG.rst
├── CMakeLists.txt
├── msg
│ └── TypeDef.msg #消息类型定义
├── package.xml
├── scripts #脚本
│ └── rosapi_node #初始化服务和参数
├── setup.py
├── src
│ └── rosapi #API具体实现
│ ├── __init__.py
│ ├── objectutils.py
│ ├── params.py
│ └── proxy.py
└── srv #定义各种服务
├── DeleteParam.srv
├── GetActionServers.srv
├── GetParamNames.srv
├── GetParam.srv
├── GetTime.srv
├── HasParam.srv
├── MessageDetails.srv
├── NodeDetails.srv
├── Nodes.srv
├── Publishers.srv
├── SearchParam.srv
├── ServiceHost.srv
├── ServiceNode.srv
├── ServiceProviders.srv
├── ServiceRequestDetails.srv
├── ServiceResponseDetails.srv
├── ServicesForType.srv
├── Services.srv
├── ServiceType.srv
├── SetParam.srv
├── Subscribers.srv
├── TopicsForType.srv
├── Topics.srv
└── TopicType.srv
重要文件说明:
scripts/rosapi_node
- 初始化服务
- 服务包含:
rospy.Service('/rosapi/topics', Topics, get_topics)
rospy.Service('/rosapi/topics_for_type', TopicsForType, get_topics_for_type)
rospy.Service('/rosapi/services', Services, get_services)
rospy.Service('/rosapi/services_for_type', ServicesForType, get_services_for_type)
rospy.Service('/rosapi/nodes', Nodes, get_nodes)
rospy.Service('/rosapi/node_details', NodeDetails, get_node_details)
rospy.Service('/rosapi/action_servers', GetActionServers, get_action_servers)
rospy.Service('/rosapi/topic_type', TopicType, get_topic_type)
rospy.Service('/rosapi/service_type', ServiceType, get_service_type)
rospy.Service('/rosapi/publishers', Publishers, get_publishers)
rospy.Service('/rosapi/subscribers', Subscribers, get_subscribers)
rospy.Service('/rosapi/service_providers', ServiceProviders, get_service_providers)
rospy.Service('/rosapi/service_node', ServiceNode, get_service_node)
rospy.Service('/rosapi/service_host', ServiceHost, get_service_host)
rospy.Service('/rosapi/message_details', MessageDetails, get_message_details)
rospy.Service('/rosapi/service_request_details', ServiceRequestDetails, get_service_request_details)
rospy.Service('/rosapi/service_response_details', ServiceResponseDetails, get_service_response_details)
rospy.Service('/rosapi/set_param', SetParam, set_param)
rospy.Service('/rosapi/get_param', GetParam, get_param)
rospy.Service('/rosapi/has_param', HasParam, has_param)
rospy.Service('/rosapi/search_param', SearchParam, search_param)
rospy.Service('/rosapi/delete_param', DeleteParam, delete_param)
rospy.Service('/rosapi/get_param_names', GetParamNames, get_param_names)
rospy.Service('/rosapi/get_time', GetTime, get_time)
节点说明:
- /rosapi/Topics,返回所有发布的话题列表
- /rosapi/topics_for_type,返回指定类型的所有发布的话题列表
- /rosapi/services, 返回所有发布的服务列表
- /rosapi/services_for_type,返回指定类型的所有发布的服务列表
- /rosapi/nodes,返回所有已经注册的节点列表
- /rosapi/node_details,返回某节点详情
- /rosapi/action_servers,返回action服务列表
- /rosapi/topic_type,通过话题名获取相应的消息类型
- /rosapi/service_type,通过服务名获取相应的消息类型
- /rosapi/publishers,提供话题名获取发布此话题的节点名列表
- /rosapi/subscribers,提供话题名获取接受此话题的节点名列表
- /rosapi/service_providers,提供话题名返回广播此服务类型的节点名列表
- /rosapi/service_node,提供服务名,返回提供此服务的节点名
- /rosapi/service_host,提供服务名,返回提供此服务的主机名
- /rosapi/message_details,提供消息类型名,返回类型的TypeDef
- /rosapi/service_request_details,提供服务类型名,返回消息请求的服务类型的TypeDef
- /rosapi/service_response_details,提供服务类型名,返回消息反馈的服务类型的TypeDef
- /rosapi/set_param,设置参数
- /rosapi/get_param,获取参数
- /rosapi/has_param,判断参数是否存在
- /rosapi/search_param,检索参数
- /rosapi/delete_param,删除参数
- /rosapi/get_param_names,获取参数名
- /rosapi/get_time,获取服务器时间
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号