Skip to content

Commit 9610e56

Browse files
AP_DDS: Rally get has been extended with a size field
1 parent dd3576f commit 9610e56

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

Tools/ros2/ardupilot_msgs/srv/RallyGet.srv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ uint8 index
55
---
66
# True is the retrieved point is valid.
77
bool success
8+
# Size of Rally Points list.
9+
uint8 size
810
# Rally point.
911
ardupilot_msgs/Rally rally

libraries/AP_DDS/AP_DDS_Client.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,7 @@ void AP_DDS_Client::on_request(uxrSession* uxr_session, uxrObjectId object_id, u
999999
const AP_Rally *rally = AP::rally();
10001000
if (rally->get_rally_point_with_index(rally_get_request.index, rally_location)) {
10011001
rally_get_response.success = true;
1002+
rally_get_response.size = rally->get_rally_total();
10021003
rally_get_response.rally.point.latitude = rally_location.lat * 1e-7;
10031004
rally_get_response.rally.point.longitude = rally_location.lng * 1e-7;
10041005
rally_get_response.rally.point.altitude = rally_location.alt;

libraries/AP_DDS/Idl/ardupilot_msgs/srv/RallyGet.idl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66

77
module ardupilot_msgs {
88
module srv {
9+
@verbatim (language="comment", text=
10+
"This service requests a Rally point from its ID.")
911
struct RallyGet_Request {
1012
@verbatim (language="comment", text=
11-
"This service requests a Rally point from its ID." "\n"
1213
"Rally Point ID.")
1314
uint8 index;
1415
};
@@ -17,6 +18,10 @@ module ardupilot_msgs {
1718
struct RallyGet_Response {
1819
boolean success;
1920

21+
@verbatim (language="comment", text=
22+
"Size of Rally Points list.")
23+
uint8 size;
24+
2025
@verbatim (language="comment", text=
2126
"Rally point.")
2227
ardupilot_msgs::msg::Rally rally;

libraries/AP_DDS/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,14 @@ response:
306306
ardupilot_msgs.srv.RallySet_Response(success=True, size=1)
307307
```
308308

309-
Get a specific Rally Point:
309+
Get a specific Rally Point (the same service can be used to request the size of the Rally list):
310310

311311
```bash
312312
ros2 service call /ap/rally_get ardupilot_msgs/srv/RallyGet "index: 0"
313313
requester: making request: ardupilot_msgs.srv.RallyGet_Request(index=0)
314314

315315
response:
316-
ardupilot_msgs.srv.RallyGet_Response(success=True, rally=ardupilot_msgs.msg.Rally(point=geographic_msgs.msg.GeoPoint(latitude=-35.0, longitude=151.0, altitude=400.0), altitude_frame=0))
316+
ardupilot_msgs.srv.RallyGet_Response(success=True, size=1, rally=ardupilot_msgs.msg.Rally(point=geographic_msgs.msg.GeoPoint(latitude=-35.0, longitude=151.0, altitude=400.0), altitude_frame=0))
317317
```
318318

319319
## Commanding using ROS 2 Topics

0 commit comments

Comments
 (0)