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

AP_DDS: added support for UDP transport #23586

Merged
merged 3 commits into from May 3, 2023

Conversation

tridge
Copy link
Contributor

@tridge tridge commented Apr 24, 2023

enable UDP transport on SITL. It will be enabled on ChibiOS once ethernet support is merged to master
pair programmed with @arshPratap

@tridge tridge added the ROS label Apr 24, 2023
@tridge tridge requested a review from Ryanf55 April 24, 2023 05:17
@rmackay9
Copy link
Contributor

nice! great to see this!

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.

Thanks for this support! This one's been a long time coming.

Good news: serial still works
Bad news: Initialization didn't pass on UDP with the following settings.

Yes, I enabled DDS.

ros2 run micro_ros_agent micro_ros_agent udp4 -p 2019  -r dds_xrce_profile.xml

sim_vehicle.py -v ArduPlane --console --enable-dds 

stuck on:

AP: DDS Client: Initialization waiting...

After Dev call tomorrow I will have time to drop into a GDB session if you need.

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_UDP.cpp Outdated Show resolved Hide resolved
libraries/AP_DDS/AP_DDS_UDP.cpp Outdated Show resolved Hide resolved
libraries/AP_DDS/AP_DDS_UDP.cpp Outdated Show resolved Hide resolved
@arshPratap
Copy link
Member

just tested it on my system..works fine for the udp transport

running the following command

ros2 node list
gives out the following output
Ardupilot_DDS_XRCE_Client

@srmainwaring
Copy link
Contributor

Checked on macOS and with updated ROS 2 launch scripts: https://github.com/srmainwaring/ardupilot/tree/wips/wip-dds-udp-launch (tests have not yet been updated).

@Ryanf55
Copy link
Collaborator

Ryanf55 commented Apr 25, 2023

ros2 run micro_ros_agent micro_ros_agent udp4 -p 2019 -r dds_xrce_profile.xml

It was suspected that I didn't have the params set. After a reboot, still no luck.

param show DDS*
MANUAL> DDS_ENABLED      1
DDS_PORT         2019

@Ryanf55
Copy link
Collaborator

Ryanf55 commented Apr 27, 2023

Go ahead and merge. Everyone else has got this working. It's an issue on my side.

@Ryanf55 Ryanf55 changed the title DDS: added support for UDP transport AP_DDS: added support for UDP transport Apr 28, 2023
Comment on lines 390 to 391
reliable_in = uxr_create_input_reliable_stream(&session, input_reliable_stream, BUFFER_SIZE_SERIAL, STREAM_HISTORY);
reliable_out = uxr_create_output_reliable_stream(&session, output_reliable_stream, BUFFER_SIZE_SERIAL, STREAM_HISTORY);
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove? - creates a pair of streams which are not used (the pair ofuxrStreamId created in the if-else below has uxrStreamId.index incremented).

@tridge
Copy link
Contributor Author

tridge commented May 2, 2023

@Ryanf55 @arshPratap rewritten to use custom transport for both UDP and serial, so we only have to link one transport

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.

I wasn't able to get either serial or udp to initialize properly.

On UDP, no topics show up, but the node is there.

ryan@ryan-B650:~/Development/ardu_ws$ ros2 node list
/Ardupilot_DDS_XRCE_Client
ryan@ryan-B650:~/Development/ardu_ws$ ros2 topic list
/parameter_events
/rosout

On serial, it does not pass initialization.

@@ -91,6 +92,7 @@ Run the simulator with the following command. Take note how two parameters need
sim_vehicle.py -w -v ArduPlane
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add --enable-dds too? It's missing.

@@ -126,9 +126,9 @@ const AP_Param::GroupInfo AP_Vehicle::var_info[] = {
#endif

#if AP_DDS_ENABLED
// @Group: XRCE
// @Group: DDS
// @Path: ../AP_DDS/AP_DDS_Client.cpp
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like some indent alignment issues here.

libraries/AP_DDS/AP_DDS_Serial.cpp Show resolved Hide resolved
tridge and others added 3 commits May 3, 2023 12:45
this allows for an DDS_ENABLED parameter
and switch serial transport to use custom transport
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.

Approved. Serial and UDP work.

Tested TCP failed, we can look into this later.

ryan@ryan-B650:~/Development/ardu_ws/src/ardupilot/libraries/AP_DDS$ ros2 run micro_ros_agent micro_ros_agent tcp4 -p 2019  -r dds_xrce_profile.xml -v 5
[1683082402.146296] info     | TCPv4AgentLinux.cpp | init                     | running...             | port: 2019
[1683082402.146669] info     | Root.cpp           | set_verbose_level        | logger setup           | verbose_level: 5
[1683082441.202584] debug    | TCPv4AgentLinux.cpp | recv_message             | [==>> TCP <<==]        | client_key: 0x00000000, len: 8240
[1683082442.100784] debug    | TCPv4AgentLinux.cpp | recv_message             | [==>> TCP <<==]        | client_key: 0x00000000, len: 80
terminate called after throwing an instance of 'eprosima::fastcdr::exception::BadParamException'
  what():  Unexpected byte value in Cdr::deserialize(bool), expected 0 or 1
[ros2run]: Aborted
sim_vehicle.py -v ArduPlane -D --console --enable-dds -A "--uartC=tcpclient:127.0.0.1:2019"

....

@tridge tridge merged commit fbc7a6d into ArduPilot:master May 3, 2023
82 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants