Goal was rejected by server: error on MoveIt script for a TM5-900

asked 2023-03-09 14:56:18 -0500

fragaud gravatar image

updated 2023-03-11 08:01:28 -0500

Hi everyone, I am currently trying to move a TM5-900 robot using a Moveit script (foxy distro), but right now I am finding some difficulties. This is my script:

#include <moveit/move_group_interface/move_group_interface.h>
#include <moveit/planning_scene_interface/planning_scene_interface.h>
#include <moveit_msgs/msg/display_robot_state.hpp>
#include <moveit_msgs/msg/display_trajectory.hpp>
#include <moveit_msgs/msg/attached_collision_object.hpp>
#include <moveit_msgs/msg/collision_object.hpp>
#include "rclcpp/rclcpp.hpp"
#include "geometry_msgs/msg/pose_stamped.hpp"
using namespace std;
static const rclcpp::Logger LOGGER = rclcpp::get_logger("project");
int main(int argc, char** argv)
 {
 rclcpp::init(argc, argv); 
 rclcpp::NodeOptions node_options;
 node_options.automatically_declare_parameters_from_overrides(true);
 /* // ROS spinning must be running for the MoveGroupInterface to get information
 // about the robot's state. One way to do this is to start an AsyncSpinner
 // beforehand.
  ros::AsyncSpinner spinner(1);
  spinner.start(); */
   cout << "ROS node creation!" << endl;
   auto move_node = rclcpp::Node::make_shared("project", node_options);
   RCLCPP_INFO(move_node->get_logger(), "MoveNode created successfully");

   rclcpp::executors::SingleThreadedExecutor executor; 
   executor.add_node(move_node);
   std::thread([&executor]() { executor.spin(); }).detach();
   static const string PLANNING_GROUP_ARM = "tmr_arm";
   static const string PLANNING_GROUP_GRIPPER = "gripper";
   cout << "MOVE GROUP INTERFACE" << endl;

   moveit::planning_interface::MoveGroupInterface move_group_interface_arm(move_node, PLANNING_GROUP_ARM);
   cout << "Plan creation" << endl;
   moveit::planning_interface::MoveGroupInterface::Plan my_plan_arm;
   // 1. Move to first position
   move_group_interface_arm.setJointValueTarget(move_group_interface_arm.getNamedTargetValues("ready1"));
   bool success = (move_group_interface_arm.plan(my_plan_arm) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
   cout << "success done" << endl;
   RCLCPP_INFO(LOGGER, "Visualizing plan 1 (pose goal) %s", success ? "" : "FAILED");
   move_group_interface_arm.move();
   cout << "After move" << endl;
   rclcpp::spin(move_node);
   rclcpp::shutdown();
   return 0;
  }

Which nodes should I run on the launch file? Right now on the terminal I get the following errors:

  1. The sampling frequency for trajectory states should be positive
  2. Goal was rejected by server
  3. Failed to send trajectory part 1 of 1 to controller trm_arm_controller
  4. MoveGroupInterface::move() failed or timeout reached -
edit retag flag offensive close merge delete