Skip to content

Commit ddf066d

Browse files
bjsowasea-bass
andauthored
Add pydocstyle lint checks and fix rosdoc2 warnings (#1057)
* Add ruff config and pre-commit hook * Fix rosapi pydocstyle errors * rosapi: Add missing dependencies * rosapi: sort dependencies * rosapi: Add find_package for ament_cmake_python * rosbridge_library: Fix pydocstyle errors * rosbridge_library: Remove trailing whitespace * rosapi: Fix pydocstyle errors in rosapi_node * Reformat ruff config * rosbridge_server: Fix pydocstyle errors * rosbridge_library: Add mock imports for Sphinx autodoc * rosbridge_library: Add missing dosctring indent * Update descriptions in package.xml files * Fix end of file * rosapi: Update package description * rosapi: types -> interfaces * rosapi: update README * Fix lint errors * Apply suggestions from code review Co-authored-by: Sebastian Castro <[email protected]>
1 parent e49cbf1 commit ddf066d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+843
-556
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@ repos:
4040
rev: v2.3.0
4141
hooks:
4242
- id: codespell
43+
44+
- repo: https://github.com/astral-sh/ruff-pre-commit
45+
rev: v0.12.7
46+
hooks:
47+
- id: ruff-check

rosapi/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.5)
22
project(rosapi)
33

44
find_package(ament_cmake REQUIRED)
5+
find_package(ament_cmake_python REQUIRED)
56

67
if(NOT CMAKE_CXX_STANDARD)
78
set(CMAKE_CXX_STANDARD 14)

rosapi/README.md

Lines changed: 133 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,143 @@
11
rosapi
22
===============
33

4+
## Nodes
5+
6+
### rosapi (Executable: `rosapi_node`)
7+
Provides services for getting various ROS meta-information, including ROS topic, services, interfaces or
8+
action servers and managing ROS parameters.
9+
10+
#### Services
11+
12+
* `~/topics` (type: `rosapi_msgs/srv/Topics`)
13+
14+
Return a list of all the topics being published.
15+
16+
* `~/interfaces` (type: `rosapi_msgs/srv/Interfaces`)
17+
18+
Return a list of all the interfaces in the system.
19+
20+
* `~/topics_for_type` (type: `rosapi_msgs/srv/TopicsForType`)
21+
22+
Return a list of all the topics that are publishing a given type.
23+
24+
* `~/topics_and_raw_types` (type: `rosapi_msgs/srv/TopicsAndRawTypes`)
25+
26+
Return a list of all the topics being published, and their raw types.
27+
28+
* `~/services` (type: `rosapi_msgs/srv/Services`)
29+
30+
Return a list of all the services being advertised.
31+
32+
* `~/services_for_type` (type: `rosapi_msgs/srv/ServicesForType`)
33+
34+
Return a list of all the services that are publishing a given type.
35+
36+
* `~/nodes` (type: `rosapi_msgs/srv/Nodes`)
37+
38+
Return a list of all the nodes that are registered.
39+
40+
* `~/node_details` (type: `rosapi_msgs/srv/NodeDetails`)
41+
42+
Return a node description including subscribing, publishing, and services.
43+
44+
* `~/action_servers` (type: `rosapi_msgs/srv/GetActionServers`)
45+
46+
Return a list of action servers based on actions standard topics.
47+
48+
* `~/topic_type` (type: `rosapi_msgs/srv/TopicType`)
49+
50+
Given the name of a topic, return the name of the type of that topic.
51+
52+
* `~/service_type` (type: `rosapi_msgs/srv/ServiceType`)
53+
54+
Given the name of a service, return the type of that service.
55+
56+
* `~/publishers` (type: `rosapi_msgs/srv/Publishers`)
57+
58+
Given the name of a topic, return a list of node names that are publishing on that topic.
59+
60+
* `~/subscribers` (type: `rosapi_msgs/srv/Subscribers`)
61+
62+
Given the name of a topic, return a list of node names that are subscribing to that topic.
63+
64+
* `~/service_providers` (type: `rosapi_msgs/srv/ServiceProviders`)
65+
66+
Given the name of a service, returns a list of node names that are advertising that service type.
67+
68+
* `~/service_node` (type: `rosapi_msgs/srv/ServiceNode`)
69+
70+
Given the name of a service, returns the name of the node that is providing that service.
71+
72+
* `~/message_details` (type: `rosapi_msgs/srv/MessageDetails`)
73+
74+
Given the name of a message type, return the TypeDef for that type.
75+
76+
* `~/service_request_details` (type: `rosapi_msgs/srv/ServiceRequestDetails`)
77+
78+
Given the name of a service type, return the TypeDef for the request message of that service type.
79+
80+
* `~/service_response_details` (type: `rosapi_msgs/srv/ServiceResponseDetails`)
81+
82+
Given the name of a service type, return the TypeDef for the response message of that service type.
83+
84+
* `~/set_param` (type: `rosapi_msgs/srv/SetParam`)
85+
86+
Set a parameter value on a specific node.
87+
88+
* `~/get_param` (type: `rosapi_msgs/srv/GetParam`)
89+
90+
Get a parameter value from a specific node.
91+
92+
* `~/has_param` (type: `rosapi_msgs/srv/HasParam`)
93+
94+
Check if a parameter exists on a specific node.
95+
96+
* `~/delete_param` (type: `rosapi_msgs/srv/DeleteParam`)
97+
98+
Delete a parameter from a specific node.
99+
100+
* `~/get_param_names` (type: `rosapi_msgs/srv/GetParamNames`)
101+
102+
Get a list of all parameter names.
103+
104+
* `~/get_time` (type: `rosapi_msgs/srv/GetTime`)
105+
106+
Get the current ROS time.
107+
108+
* `~/get_ros_version` (type: `rosapi_msgs/srv/GetROSVersion`)
109+
110+
Get the ROS version and distribution name.
111+
4112
#### Parameters
5113

6-
* `~topics_glob` (string, default '')
7-
* `~services_glob` (string, default '')
8-
* `~params_glob` (string, default '')
114+
* `params_timeout` (float, default: `5.0`)
115+
116+
Timeout in seconds for param-related services.
9117

10-
```Note: By default the rosapi calls for details about topics, services, and parameters will return nothing. You must specify a list of allowed resources.```
11-
Each of the glob parameters may contain an array of one or more match patterns. Resources that match any of the specified patterns will be returned by calls to the rosapi services.
118+
* `topics_glob` (string, default: `[*]`)
119+
* `services_glob` (string, default: `[*]`)
120+
* `params_glob` (string, default: `[*]`)
12121

13-
An example launch file which enables all information to be returned.
122+
Each of the glob parameters may contain an array of one or more match patterns. Resources that match any of the specified patterns will be returned by calls to the rosapi services.
14123

15-
```
16-
<node name="rosapi" pkg="rosapi" type="rosapi_node">
17-
<param name="topics_glob" value="[*]" />
18-
<param name="services_glob" value="[*]" />
19-
<param name="params_glob" value="[*]" />
20-
</node>
21-
```
124+
An example launch file which enables all information to be returned:
22125

126+
```
127+
<launch>
128+
<node name="rosapi" pkg="rosapi" exec="rosapi_node">
129+
<param name="topics_glob" value="'[*]'" />
130+
<param name="services_glob" value="'[*]'" />
131+
<param name="params_glob" value="'[*]'" />
132+
</node>
133+
</launch>
134+
```
23135
24-
This example launch file enables only rosout and certain camera topics
25-
```
26-
<node name="rosapi" pkg="rosapi" type="rosapi_node">
27-
<param name="topics_glob" value="[/rosout, /camera/rgb/*]" />
28-
</node>
29-
```
136+
This example launch file enables only rosout and certain camera topics:
137+
```
138+
<launch>
139+
<node name="rosapi" pkg="rosapi" exec="rosapi_node">
140+
<param name="topics_glob" value="'[/rosout, /camera/rgb/*]'" />
141+
</node>
142+
</launch>
143+
```

rosapi/package.xml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<name>rosapi</name>
44
<version>2.0.1</version>
55
<description>
6-
Provides service calls for getting ros meta-information, like list of
7-
topics, services, params, etc.
6+
Provides services for getting various ROS meta-information, including ROS topic, services, interfaces or
7+
action servers and managing ROS parameters.
88
</description>
99

1010
<license>BSD</license>
@@ -18,27 +18,26 @@
1818
<maintainer email="[email protected]">Foxglove</maintainer>
1919

2020
<buildtool_depend>ament_cmake</buildtool_depend>
21+
<buildtool_depend>ament_cmake_python</buildtool_depend>
2122

22-
<exec_depend>rosapi_msgs</exec_depend>
2323
<exec_depend>builtin_interfaces</exec_depend>
24-
<exec_depend>rclpy</exec_depend>
2524
<exec_depend>rcl_interfaces</exec_depend>
26-
<exec_depend>rosbridge_library</exec_depend>
25+
<exec_depend>rclpy</exec_depend>
26+
<exec_depend>ros2interface</exec_depend>
2727
<exec_depend>ros2node</exec_depend>
2828
<exec_depend>ros2param</exec_depend>
29-
<exec_depend>ros2pkg</exec_depend>
3029
<exec_depend>ros2service</exec_depend>
3130
<exec_depend>ros2topic</exec_depend>
32-
<!--
33-
<exec_depend>rosnode</exec_depend>
34-
<exec_depend>rosgraph</exec_depend>
35-
-->
31+
<exec_depend>rosapi_msgs</exec_depend>
32+
<exec_depend>rosbridge_library</exec_depend>
33+
<exec_depend>rosidl_adapter</exec_depend>
34+
<exec_depend>rosidl_runtime_py</exec_depend>
3635

3736
<test_depend>ament_cmake_pytest</test_depend>
38-
<test_depend>sensor_msgs</test_depend>
39-
<test_depend>shape_msgs</test_depend>
4037
<test_depend>geometry_msgs</test_depend>
4138
<test_depend>rmw_dds_common</test_depend>
39+
<test_depend>sensor_msgs</test_depend>
40+
<test_depend>shape_msgs</test_depend>
4241

4342
<export>
4443
<build_type>ament_cmake</build_type>

0 commit comments

Comments
 (0)