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

Get robot description from topic in GetUrdfService #2681

Merged
merged 7 commits into from
Feb 13, 2024

Conversation

Abishalini
Copy link
Contributor

Description

If robot description is not passed as a parameter to the move_group node, this service will fail.
The robot description will now be acquired from the robot_description topic

Copy link

codecov bot commented Feb 12, 2024

Codecov Report

Attention: 29 lines in your changes are missing coverage. Please review.

Comparison is base (d962501) 50.74% compared to head (7db923b) 41.07%.
Report is 5 commits behind head on main.

Files Patch % Lines
...default_capabilities/get_group_urdf_capability.cpp 0.00% 23 Missing ⚠️
...nning_scene_monitor/src/planning_scene_monitor.cpp 40.00% 3 Missing ⚠️
.../rdf_loader/include/moveit/rdf_loader/rdf_loader.h 0.00% 2 Missing ⚠️
...py/src/moveit/moveit_ros/moveit_cpp/moveit_cpp.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2681      +/-   ##
==========================================
- Coverage   50.74%   41.07%   -9.67%     
==========================================
  Files         392      690     +298     
  Lines       32553    56237   +23684     
  Branches        0     7287    +7287     
==========================================
+ Hits        16517    23092    +6575     
- Misses      16036    32982   +16946     
- Partials        0      163     +163     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@tylerjw tylerjw left a comment

Choose a reason for hiding this comment

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

This all looks good except for the QoS on the subscriber. Set it to transient local to make sure you get a copy of the message if the subscriber starts after the publisher.

…capability.cpp

Co-authored-by: Tyler Weaver <maybe@tylerjw.dev>
@@ -62,6 +62,10 @@ GetUrdfService::GetUrdfService() : MoveGroupCapability("get_group_urdf")

void GetUrdfService::initialize()
{
robot_description_subscriber_ = context_->moveit_cpp_->getNode()->create_subscription<std_msgs::msg::String>(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we make sure the topic robot_description is available and wait for a given amount of time if not?

Copy link
Contributor Author

@Abishalini Abishalini Feb 12, 2024

Choose a reason for hiding this comment

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

I tried using this rclcpp function to wait for a certain time until we get a message in the robot_description topic. But this causes a timeout error when using get_urdf service. Not sure I'm using it wrong.

I could add a while loop with a timer to check if the full_urdf_string_ variable is set.

Do you have a better solution to this?

Copy link
Member

@tylerjw tylerjw Feb 12, 2024

Choose a reason for hiding this comment

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

I thought about this a bit more and because you have a moveit_cpp you should be able to get the URDF string like this and not need to manually handle the subscription.

If you add a function to RDFLoader to get the urdf_string_ value it contains. Maybe name it getUrdfString() -> std::string. Then you can do this:

std::string urdf_string = context_
  ->moveit_cpp_
  ->getPlanningSceneMonitor()
  ->getRobotModelLoader()
  ->getRDFLoader()
  ->getUrdfString();

I know it is ugly, but if you have a moveit_cpp and it is initialized, you should be able to get the string this way, too.

Then you could just add this call to top of the callback for your service and you shouldn't have to subscribe to the topic or read the parameter.

@tylerjw
Copy link
Member

tylerjw commented Feb 13, 2024

It's sort of related; do you mind reviewing this? #2682

@tylerjw tylerjw merged commit ab48a49 into moveit:main Feb 13, 2024
11 of 12 checks passed
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.

None yet

3 participants