Skip to content

Commit

Permalink
AP_DDS: Rally get has been extended with a size field
Browse files Browse the repository at this point in the history
  • Loading branch information
tizianofiorenzani committed Dec 5, 2024
1 parent dd3576f commit 9610e56
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Tools/ros2/ardupilot_msgs/srv/RallyGet.srv
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ uint8 index
---
# True is the retrieved point is valid.
bool success
# Size of Rally Points list.
uint8 size
# Rally point.
ardupilot_msgs/Rally rally
1 change: 1 addition & 0 deletions libraries/AP_DDS/AP_DDS_Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,7 @@ void AP_DDS_Client::on_request(uxrSession* uxr_session, uxrObjectId object_id, u
const AP_Rally *rally = AP::rally();
if (rally->get_rally_point_with_index(rally_get_request.index, rally_location)) {
rally_get_response.success = true;
rally_get_response.size = rally->get_rally_total();
rally_get_response.rally.point.latitude = rally_location.lat * 1e-7;
rally_get_response.rally.point.longitude = rally_location.lng * 1e-7;
rally_get_response.rally.point.altitude = rally_location.alt;
Expand Down
7 changes: 6 additions & 1 deletion libraries/AP_DDS/Idl/ardupilot_msgs/srv/RallyGet.idl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

module ardupilot_msgs {
module srv {
@verbatim (language="comment", text=
"This service requests a Rally point from its ID.")
struct RallyGet_Request {
@verbatim (language="comment", text=
"This service requests a Rally point from its ID." "\n"
"Rally Point ID.")
uint8 index;
};
Expand All @@ -17,6 +18,10 @@ module ardupilot_msgs {
struct RallyGet_Response {
boolean success;

@verbatim (language="comment", text=
"Size of Rally Points list.")
uint8 size;

@verbatim (language="comment", text=
"Rally point.")
ardupilot_msgs::msg::Rally rally;
Expand Down
4 changes: 2 additions & 2 deletions libraries/AP_DDS/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,14 +306,14 @@ response:
ardupilot_msgs.srv.RallySet_Response(success=True, size=1)
```

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

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

response:
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))
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))
```

## Commanding using ROS 2 Topics
Expand Down

0 comments on commit 9610e56

Please sign in to comment.