Skip to content

Commit 688346e

Browse files
committed
service docs
Signed-off-by: Leonardo Rossetti <[email protected]>
1 parent e7f0d40 commit 688346e

File tree

1 file changed

+63
-3
lines changed

1 file changed

+63
-3
lines changed

README.md

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,78 @@ This section describes how to run nodes within the `rhover_control`.
4848

4949
#### rhover_control.engine_manager
5050

51-
This node subscribes to the `rhover_control_engine_manager` to abstarct engine operations.
51+
This node subscribes to the `rhover_control_engine_erver` to handle engine operations from client requests.
5252

5353
Running the node:
5454

5555
```sh
5656
ros2 run rhover_control engine_manager
5757
```
5858

59-
Send data using the `ros2` cli:
59+
You can now open another tab and run client requests using ros2.
60+
61+
Do not forget to run `source install/setup.bash` for each new tab you open to run `ros2` commands.
62+
63+
##### Services/Methods
64+
65+
###### GetEngineState
66+
67+
Return the engine's current state.
68+
69+
```sh
70+
$ ros2 service call /get_engine_state rhover_control_interfaces/srv/GetEngineState
71+
requester: making request: rhover_control_interfaces.srv.GetEngineState_Request()
72+
73+
response:
74+
rhover_control_interfaces.srv.GetEngineState_Response(state=rhover_control_interfaces.msg.EngineState(on=False, speed=0.0, battery=100))
75+
```
76+
77+
###### AdjustSpeed
78+
79+
Ajust the Rhover speed, up or down.
80+
81+
```sh
82+
ros2 service call /adjust_speed rhover_control_interfaces/srv/AdjustSpeed '{"speed": 10.0}'
83+
requester: making request: rhover_control_interfaces.srv.AdjustSpeed_Request(speed=10.0)
84+
85+
response:
86+
rhover_control_interfaces.srv.AdjustSpeed_Response(err=rhover_control_interfaces.msg.ErrorStatus(err=False, errcode=0, errmsg=''))
87+
```
88+
89+
It will return an error in case you try to reduce its speed and the rhover is already stopped or it does not have enough battery:
6090

6191
```sh
62-
ros2 topic pub /rhover_engine example_interfaces/msg/String "data: 'turn on'"
92+
$ ros2 service call /adjust_speed rhover_control_interfaces/srv/AdjustSpeed '{"speed": -50.0}'
93+
requester: making request: rhover_control_interfaces.srv.AdjustSpeed_Request(speed=-50.0)
94+
95+
response:
96+
rhover_control_interfaces.srv.AdjustSpeed_Response(err=rhover_control_interfaces.msg.ErrorStatus(err=True, errcode=1, errmsg='rhover is stopped'))
97+
```
98+
99+
###### Battery State
100+
101+
Checks the battery state as "ok" (high power), "warn" (somewhere above 50%) or "danger" (bellow 33%):
102+
103+
```sh
104+
$ ros2 service call /battery_state rhover_control_interfaces/srv/BatteryState
105+
requester: making request: rhover_control_interfaces.srv.BatteryState_Request()
106+
107+
response:
108+
rhover_control_interfaces.srv.BatteryState_Response(ok=True, warn=False, danger=False)
109+
```
110+
111+
Each "AdjustSpeed" call reduces its battery power by 10.
112+
113+
###### Stop
114+
115+
Stops the rhover, reducing its speed to 0.
116+
117+
```sh
118+
ros2 service call /stop rhover_control_interfaces/srv/Stop
119+
requester: making request: rhover_control_interfaces.srv.Stop_Request()
120+
121+
response:
122+
rhover_control_interfaces.srv.Stop_Response(err=rhover_control_interfaces.msg.ErrorStatus(err=False, errcode=0, errmsg=''))
63123
```
64124

65125
## License

0 commit comments

Comments
 (0)