-
Notifications
You must be signed in to change notification settings - Fork 580
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
Get robot description from topic in GetUrdfService #2681
Conversation
Codecov ReportAttention:
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. |
There was a problem hiding this 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.
moveit_ros/move_group/src/default_capabilities/get_group_urdf_capability.cpp
Outdated
Show resolved
Hide resolved
…capability.cpp Co-authored-by: Tyler Weaver <maybe@tylerjw.dev>
moveit_ros/move_group/src/default_capabilities/get_group_urdf_capability.cpp
Outdated
Show resolved
Hide resolved
moveit_ros/move_group/src/default_capabilities/get_group_urdf_capability.cpp
Outdated
Show resolved
Hide resolved
@@ -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>( |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
It's sort of related; do you mind reviewing this? #2682 |
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