Some parts of move_group_interface unclear. (using with Universal Robots)

asked 2022-01-04 03:44:40 -0500

jorosuser gravatar image

updated 2022-01-04 04:41:49 -0500

Hi,

I'm using ROS2 foxy with MoveIt2 source build (commit 7bbee08409f00efbd778d2a05696ef5277a2dd59) on Ubuntu 20.04.3 (64-bit)


I successfully changed the MoveIt2 Tutorial to work with Universal Robots UR10e (and others).

Basically I start the node with a launch-file that passes some robot description parameters. I created the launch-file by modifying the launch-files from the Official UR ROS2 driver to parse the .urdf .srdf etc. files. Then after doing all that stuff (see code below) in the main, I can use the move_group_interface with commands like setTargetPose(), move() with the reference to the move group (&move_group).

BUT, on some parts, I don't really know whats going on (I copied these parts from the tutorial, and it was generally quite hard to find information on how to adapt it for your own robot)

Can someone please briefly explain what is the point of the sections I commented with ???.

int main(int argc, char** argv)
{
    rclcpp::init(argc, argv);

    // ???
    rclcpp::NodeOptions node_options;
    node_options.automatically_declare_parameters_from_overrides(true);
    auto move_group_node = rclcpp::Node::make_shared("move_group_interface_tutorial", node_options);

    // ???
    rclcpp::executors::SingleThreadedExecutor executor;
    executor.add_node(move_group_node);
    std::thread([&executor]() { executor.spin(); }).detach();

    // ???
    // (see name in rviz: MotionPlannin > Planning Request > Planning Group)
    static const std::string PLANNING_GROUP = "ur_manipulator";

    // ???
    moveit::planning_interface::MoveGroupInterface move_group(move_group_node, PLANNING_GROUP);
    // ???
    moveit::planning_interface::PlanningSceneInterface planning_scene_interface;

    // Make the CMoveServer Shared (?)
    auto CMoveServer_shared_ptr = std::make_shared<CMoveServer>(&move_group, &planning_scene_interface);

    // Spin the Class CMoveServer
    rclcpp::executors::SingleThreadedExecutor executor2;
    executor2.add_node(CMoveServer_shared_ptr);
    executor2.spin();   

    rclcpp::shutdown();
    return 0;
}

I think this could also help other new ROS2 users.

edit retag flag offensive close merge delete

Comments

Did you make this work? We are setting up the UR10e for the first time now (foxy + moveit2), and are just getting familiar with the code. Would you share the updated script(s)?

Thanks Georg

discoimp gravatar image discoimp  ( 2022-07-14 08:37:36 -0500 )edit