Skip to content

MoveIt 2 Move Group C++ Interface #43

@kavikode

Description

@kavikode

Motion planning to control Tiago MoveIt 2 Move Group C++ Interface for ROS 2 Humble

Terminal 1: ros2 launch tiago_gazebo tiago_gazebo.launch.py moveit:=True world_name:=pick is_public_sim:=True

Terminal 2: ros2 launch tiago_moveit_config moveit_rviz.launch.py

Then I used the following C++ file pose_goal.cep from the repo https://github.com/ut-ims-robotics/pool-thesis-2023-moveit2-examples and I modified it for the planning group arm:

#include

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

int main(int argc, char * argv[])
{
// Initialize ROS and create the Node
rclcpp::init(argc, argv);
auto const node = std::make_sharedrclcpp::Node("pose_goal");

// Create a ROS logger
auto const logger = rclcpp::get_logger("pose_goal");

// Create the MoveIt Move Group Interface for panda arm
using moveit::planning_interface::MoveGroupInterface;
auto move_group_interface = MoveGroupInterface(node, "arm");

// Create a target Pose for the end-effector
geometry_msgs::msg::Pose target_pose;
target_pose.orientation.w = 1.0;
target_pose.position.x = 0.28;
target_pose.position.y = -0.2;
target_pose.position.z = 0.5;

// Set the target pose
move_group_interface.setPoseTarget(target_pose);

// Create a plan to that target pose and check if that plan is successful
moveit::planning_interface::MoveGroupInterface::Plan my_plan;
bool success = (move_group_interface.plan(my_plan) == moveit::core::MoveItErrorCode::SUCCESS);

// If the plan is successful, execute the plan
if(success) {
move_group_interface.execute(my_plan);
} else {
RCLCPP_ERROR(logger, "Planing failed!");
}

// Shutdown
rclcpp::shutdown();
return 0;
}

Terminal 3: ros2 run cpp_examples pose_goal

Results:

[INFO] [1725589103.149830117] [moveit_rdf_loader.rdf_loader]: Loaded robot model in 2.06175 seconds
[INFO] [1725589103.150369063] [moveit_robot_model.robot_model]: Loading robot model 'tiago'...
[INFO] [1725589103.150455974] [moveit_robot_model.robot_model]: No root/virtual joint specified in SRDF. Assuming fixed joint
[WARN] [1725589103.153558698] [moveit_robot_model.robot_model]: Link base_laser_link has visual geometry but no collision geometry. Collision geometry will be left empty. Fix your URDF file by explicitly specifying collision geometry.
[WARN] [1725589103.153734240] [moveit_robot_model.robot_model]: Link base_sonar_01_link has visual geometry but no collision geometry. Collision geometry will be left empty. Fix your URDF file by explicitly specifying collision geometry.
[WARN] [1725589103.153859441] [moveit_robot_model.robot_model]: Link base_sonar_02_link has visual geometry but no collision geometry. Collision geometry will be left empty. Fix your URDF file by explicitly specifying collision geometry.
[WARN] [1725589103.153933842] [moveit_robot_model.robot_model]: Link base_sonar_03_link has visual geometry but no collision geometry. Collision geometry will be left empty. Fix your URDF file by explicitly specifying collision geometry.
[WARN] [1725589103.154007663] [moveit_robot_model.robot_model]: Link caster_back_left_1_link has visual geometry but no collision geometry. Collision geometry will be left empty. Fix your URDF file by explicitly specifying collision geometry.
[WARN] [1725589103.154122424] [moveit_robot_model.robot_model]: Link caster_back_right_1_link has visual geometry but no collision geometry. Collision geometry will be left empty. Fix your URDF file by explicitly specifying collision geometry.
[WARN] [1725589103.154208935] [moveit_robot_model.robot_model]: Link caster_front_left_1_link has visual geometry but no collision geometry. Collision geometry will be left empty. Fix your URDF file by explicitly specifying collision geometry.
[WARN] [1725589103.154289036] [moveit_robot_model.robot_model]: Link caster_front_right_1_link has visual geometry but no collision geometry. Collision geometry will be left empty. Fix your URDF file by explicitly specifying collision geometry.
[WARN] [1725589103.172293933] [moveit_robot_model.robot_model]: Link base_cover_link has visual geometry but no collision geometry. Collision geometry will be left empty. Fix your URDF file by explicitly specifying collision geometry.
[WARN] [1725589103.213727746] [moveit_ros.robot_model_loader]: No kinematics plugins defined. Fill and load kinematics.yaml!
[INFO] [1725589103.273724043] [move_group_interface]: Ready to take commands for planning group arm.
[INFO] [1725589103.273980655] [move_group_interface]: MoveGroup action client/server ready
[INFO] [1725589103.276105519] [move_group_interface]: Planning request accepted
[INFO] [1725589108.368755300] [move_group_interface]: Planning request aborted
[ERROR] [1725589108.369412777] [move_group_interface]: MoveGroupInterface::plan() failed or timeout reached
[ERROR] [1725589108.369453317] [pose_goal]: Planing failed!

How can I fix this error because I did use the correct planning group named arm? Please advise.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions