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

Not understand MoveItGroupInterface #525

Closed
enriLoniterp opened this issue Oct 4, 2022 · 7 comments
Closed

Not understand MoveItGroupInterface #525

enriLoniterp opened this issue Oct 4, 2022 · 7 comments

Comments

@enriLoniterp
Copy link

enriLoniterp commented Oct 4, 2022

Description

I've downloaded Universalrobots driver and followed the procedure to use moveIt!2, it actually works what showed in the README and i use "ur_manipulator" in Rviz to move my arm. But my interest is to use moveit2_tutorials to send pose and design a pick and place application with MoveItGriuoInterface.

What i have designed is:

#include <memory>

#include <rclcpp/rclcpp.hpp>
#include <moveit/move_group_interface/move_group_interface.h>

int main(int argc, char * argv[])
{
  rclcpp::init(argc, argv);
  auto const node = std::make_shared<rclcpp::Node>(
    "hello_moveit",
    rclcpp::NodeOptions().automatically_declare_parameters_from_overrides(true)
  );

  auto const logger = rclcpp::get_logger("ur_manipulator");


  // Create the MoveIt MoveGroup Interface
using moveit::planning_interface::MoveGroupInterface;
auto move_group_interface = MoveGroupInterface(node, "ur_manipulator");
printf("picvkandplace");

// Set a target Pose
auto const target_pose = []{
  geometry_msgs::msg::Pose msg;
  msg.orientation.w = 1.0;
  msg.position.x = 0.28;
  msg.position.y = -0.2;
  msg.position.z = 0.5;
  return msg;
}();
move_group_interface.setPoseTarget(target_pose);

// Create a plan to that target pose
auto const [success, plan] = [&move_group_interface]{
  moveit::planning_interface::MoveGroupInterface::Plan msg;
  auto const ok = static_cast<bool>(move_group_interface.plan(msg));
  return std::make_pair(ok, msg);
}();

// Execute the plan
if(success) {
  move_group_interface.execute(plan);
} else {
  RCLCPP_ERROR(logger, "Planing failed!");
}
  // Shutdown ROS
  rclcpp::shutdown();
  return 0;
}

i launch ros2 run hello_moveit hello_moveit as in the tutorial but i get:

[ERROR] [1664871447.339399807] [hello_moveit]: Could not find parameter robot_description_semantic and did not receive robot_description_semantic via std_msgs::msg::String subscription within 10.000000 seconds.
Error:   Could not parse the SRDF XML File. Error=XML_ERROR_EMPTY_DOCUMENT ErrorID=13 (0xd) Line number=0
         at line 715 in ./src/model.cpp
[ERROR] [1664871447.342434566] [moveit_rdf_loader.rdf_loader]: Unable to parse SRDF
[FATAL] [1664871447.342740966] [move_group_interface]: Unable to construct robot model. Please make sure all needed information is on the parameter server.
terminate called after throwing an instance of 'std::runtime_error'
  what():  Unable to construct robot model. Please make sure all needed information is on the parameter server.
[ros2run]: Aborted

I can't understand what should i look for also because in that everything is set to use moveit, robot_description_semantic included.

Hope someone could help to this endless problem!

Enrico

@jwson97
Copy link

jwson97 commented Oct 5, 2022

I have same problem. Who can solve this problem?

@enriLoniterp
Copy link
Author

@jwson97 maybe i can't understand some procedures but in my mind it would be usefull install the driver and use the simulation as it is.
It could be some problems with packages? it tells it doesn't publish on specific topic.

Hope someone could help, it would be important for me!

@felipebapa
Copy link

@enriLoniterp Did you find an answer? I am developing a similar program.
Thanks for your help!

@okvik
Copy link

okvik commented Mar 23, 2023

The issue is that the program (actually the MoveGroupInterface constructor) cannot find the SRDF robot description in either of the two places it looks in: 1) in the robot_description_semantic parameter in program node's own parameters list, or 2) in a published /robot_description_semantic ROS topic.

It follows that this can be solved in two ways: either 1) feed the robot_description_semantic parameter to the program node when launching it, or 2) configure the move_group node to publish its own robot_description_semantic parameter to a matching topic from which other nodes in the system can read it.

I think the second method is preferable.

Find the launch file that is creating the move_group node (likely in a *_moveit_config package for your robot or written by you) and set its node parameter publish_robot_description_semantic = True . I suggest you set the publish_robot_description as well.

To verify the SRDF is published correctly run

ros2 topic echo /robot_description_semantic

Which should spit out the .srdf file.

@felipebapa
Copy link

Thanks for your fast answer!. I am going to check.

@macmacal
Copy link

Thanks @okvik , your solution works well!

@sjahr
Copy link
Contributor

sjahr commented Dec 1, 2023

Looks like the discussion is resolved. Feel free to re-open if you'd like to continue it

@sjahr sjahr closed this as completed Dec 1, 2023
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

No branches or pull requests

6 participants