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: Goal topic publisher #28372

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tizianofiorenzani
Copy link
Contributor

@tizianofiorenzani tizianofiorenzani commented Oct 10, 2024

Issue

#28299

What Changed

  • New topic /ap/goal_lla to provide current goal as GeopointStamped.
  • The topic is published only when changed, reliability set to UXR_RELIABILITY_RELIABLE

Test

Automatic test

test_goal_lla_msg_received.py is a basic script that verify whether the topic has been published at least once.

Semi automatic test

Run the plane SITL

ros2 launch ardupilot_sitl sitl_dds_udp.launch.py model:=plane command:=arduplane defaults:=$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/models/plane.parm

and then run the test as:

ros2 run ardupilot_dds_tests plane_waypoint_follower

image

SITL

Tested in SITL: sending copter to a waypoint:

image

ros2 topic echo /ap/goal_lla
image

@tizianofiorenzani
Copy link
Contributor Author

@Ryanf55 I set the topic to be published only when changed.

libraries/AP_DDS/AP_DDS_Client.cpp Outdated Show resolved Hide resolved
libraries/AP_DDS/AP_DDS_Client.cpp Outdated Show resolved Hide resolved
msg.position.altitude = target_loc.alt * alt_scale_factor;

// Check whether the goal has changed or if the topic has never been published.
const double distance_lat_lon = 1e-8;
Copy link
Collaborator

Choose a reason for hiding this comment

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

How did you pick this value?

Copy link
Contributor Author

@tizianofiorenzani tizianofiorenzani Oct 10, 2024

Choose a reason for hiding this comment

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

all goals are usually sent at 1e-7 resolution, so this is one order of magnitude better that AP can resolve.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's resolution on the lat-lon value, but this is in meters, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, it's degrees. Lat Lon are sent in any mavlink message to 1e-7 resolution. I don't think it's necessary to convert to meters here.

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 rename the variable then? Distance is measured in meters, or add some more comment.

Perhaps goal_tol_lat_lon

Copy link
Contributor Author

Choose a reason for hiding this comment

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

renamed to tolerance_lat_lon, good call.

libraries/AP_DDS/AP_DDS_Client.h Outdated Show resolved Hide resolved
libraries/AP_DDS/AP_DDS_Client.h Outdated Show resolved Hide resolved
@tizianofiorenzani tizianofiorenzani force-pushed the wips/dds-goal-topic branch 2 times, most recently from 4a30ee6 to 41fdc63 Compare October 18, 2024 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants