Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDS: Added subscriber support #23629

Merged
merged 1 commit into from Jun 1, 2023

Conversation

arshPratap
Copy link
Member

@arshPratap arshPratap commented Apr 27, 2023

Aims to provide a subscriber support for the current DDS functionality in Ardupilot.
Note : based on the changes made in PR #23586
Current Scenario :
Screenshot from 2023-04-28 04-48-40
Special thanks to @Ryanf55 for initiating the said work on his branch

@arshPratap arshPratap changed the title Dds subscriber support DDS: Added subscriber support Apr 27, 2023
@srmainwaring
Copy link
Contributor

Hi @arshPratap, this is looking good!

It can be rebased on master now that #23586 is merged (I found it easier to cherry pick db8b632 onto master than try and rebase the old UDP transport commits).

I worked through your example and have a couple of suggested changes to get a working test:

  • Add the IDL for sensor_msgs/Joy
  • Update the topic table and topic name.
  • Add a registration entry.

This branch has the edits: https://github.com/srmainwaring/ardupilot/tree/arsh/ddsAddSubscriber-rebased

Run the example as usual and publish data with:

ros2 topic pub /ap/joy sensor_msgs/Joy "axes: [0.1, 0.2, 0.3, 0.4]"

and monitor in MAVProxy

dds_subscriber

@arshPratap
Copy link
Member Author

@srmainwaring thanks for the edits ..have rebased accordingly !

@arshPratap arshPratap marked this pull request as ready for review May 21, 2023 23:55
Copy link
Collaborator

@Ryanf55 Ryanf55 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the commit messages to all be compliant with standards, and feel free to squash them. The merge conflict commit yet doesn't have AP_DDS prefix, nor does it need to be part of the history since it's a rebase-style repo. Thanks for getting this updated!

libraries/AP_DDS/AP_DDS_Client.cpp Outdated Show resolved Hide resolved
libraries/AP_DDS/AP_DDS_Topic_Table.h Outdated Show resolved Hide resolved
@arshPratap arshPratap force-pushed the ddsSubscriberSupport branch 2 times, most recently from 50eeb56 to 880d301 Compare May 23, 2023 00:38
@Ryanf55
Copy link
Collaborator

Ryanf55 commented May 23, 2023

ros2 topic pub /ap/joy sensor_msgs/Joy "axes: [0.1, 0.2, 0.3, 0.4]"

I tested with the above process, it works. Then, with an empty array:
image

LGTM. Just finish up the last touches, and I'm happy to approve.

@arshPratap
Copy link
Member Author

arshPratap commented May 23, 2023

@Ryanf55 thanks for the suggestions ! Have made the required changes

@Ryanf55
Copy link
Collaborator

Ryanf55 commented May 24, 2023

Hey the build was failing due to style failing. I ran ./Tools/CodeStyle/ardupilot-astyle.sh libraries/AP_DDS/*.cpp libraries/AP_DDS/*.h to fix it. Overall, the PR appears to work. Great work. Approved

@arshPratap
Copy link
Member Author

rebased to master... @Ryanf55 @srmainwaring thanks for all your suggestions

@arshPratap arshPratap force-pushed the ddsSubscriberSupport branch 4 times, most recently from c5e080d to 3c27d8c Compare May 29, 2023 19:17
@Ryanf55 Ryanf55 added ROS DevCallTopic For-4.5 Planned for 4.5 release labels May 29, 2023
libraries/AP_DDS/AP_DDS_Client.cpp Outdated Show resolved Hide resolved
libraries/AP_DDS/AP_DDS_Client.cpp Outdated Show resolved Hide resolved
libraries/AP_DDS/AP_DDS_Client.cpp Outdated Show resolved Hide resolved
@Ryanf55
Copy link
Collaborator

Ryanf55 commented May 30, 2023

With the latest changes, it does not compile.

In file included from ../../libraries/AP_DDS/AP_DDS_Client.cpp:9:
../../libraries/AP_DDS/AP_DDS_Client.cpp: In static member function ‘static void AP_DDS_Client::on_topic(uxrSession*, uxrObjectId, uint16_t, uxrStreamId, ucdrBuffer*, uint16_t, void*)’:
../../libraries/AP_DDS/AP_DDS_Client.cpp:424:29: error: request for member ‘axes’ in ‘topic’, which is of pointer type ‘sensor_msgs_msg_Joy*’ (maybe you meant to use ‘->’ ?)
  424 |                       topic.axes[0], topic.axes[1], topic.axes[2], topic.axes[3]);
      |                             ^~~~
../../libraries/GCS_MAVLink/GCS.h:1312:86: note: in definition of macro ‘GCS_SEND_TEXT’
 1312 | #define GCS_SEND_TEXT(severity, format, args...) gcs().send_text(severity, format, ##args)

Can you reproduce this on your side?

@arshPratap
Copy link
Member Author

arshPratap commented May 30, 2023

@Ryanf55 should work now . Just rebased and pushed the latest changes and have run the astyle script for the necessary files.

* Register subscriber and deserialize sensor_msgs/Joy

Co-authored-by: Rhys Mainwaring <rhys.mainwaring@me.com>
Co-authored-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
@Ryanf55
Copy link
Collaborator

Ryanf55 commented May 31, 2023

Excellent work getting all the changes folded in. I've verified, LGTM. Marked merge on CI pass. Thanks for the contribution!

@peterbarker peterbarker merged commit 5168f39 into ArduPilot:master Jun 1, 2023
81 checks passed
@peterbarker
Copy link
Contributor

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For-4.5 Planned for 4.5 release ROS
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

7 participants