【问题标题】:PositionConstraint goal for robot arm: Unable to construct goal representation机器人手臂的 PositionConstraint 目标:无法构建目标表示
【发布时间】:2018-05-30 16:37:09
【问题描述】:

我在 Ubuntu 14.04 下设置了 ROS indigo, Gazebo。在 ROS 下,moveit 节点正在运行。模拟机械臂 IRB120 并站在 Gazebo 中。我有一个节点,它使用moveit(move_group 节点)为 Bob 想要的 destination 规划路径(轨迹)。计划的轨迹将被发送到 Gazebo 以便稍后显示。

Bob 可以使用两种方法来描述目的地:

  1. 手臂每个关节的角度:使用六个数字的数组(对于手臂的六个关节),定义每个关节和胫骨的形式。这种方法效果很好。它使用JointConstraint 类:

    双目标姿势 [] = {0.52, 0.50, 0.73, -0.02, 0.31, 6.83}; for(int i = 0 ; i

  2. 仅定义末端执行器的位置和方向。我不能使用这种方法。我使用了PositionConstraint 类。

简而言之问题:我可以使用JointConstraint 类描述目的地,但我不知道如何在PositionConstraint 类中描述它。 如何通过指出末端执行器的位置来描述目标?

我如何以PositionConstraint 格式描述目标:(我指出末端执行器应该在哪里以及它的方向应该是什么。)

  moveit_msgs::PositionConstraint pc;
  pc.weight = 1.0;
  geometry_msgs::Pose p;
  p.position.x = 0.3; // not sure if feasible position
  p.position.y = 0.3; // not sure if feasible position
  p.position.z = 0.3; // not sure if feasible position
  pc.link_name="tool0";
  p.orientation.x = 0;
  p.orientation.y = 0;
  p.orientation.z = 0;
  p.orientation.w = 1;
  pc.constraint_region.mesh_poses.push_back(p);
  goal_constraint.position_constraints.push_back(pc);

但是当请求发送时,服务器响应:

[ERROR] [1527689581.951677797, 295.242000000]: Unable to construct goal representation

注意:

在这两种情况下,我都将goal_constraint 添加到trajectory_request

trajectory_request.goal.request.goal_constraints.push_back(goal_constraint);
// add other details to trajectory_request here...

trajectory_request 将被发送到move_group。 (通过在/move_group/goal 主题上发布trajectory_request

【问题讨论】:

    标签: ros moveit


    【解决方案1】:

    稍微不同的解决方案解决了用末端执行器的方向和位置描述目标

    我们可以使用moveit库函数computeCartesianPath,而不是在topic上发布目标以供另一个节点解析和读取。 (在本例中,发布轨迹的代码被注释并部分缺失)

    void planTo(std::vector<double> coordinate, std::vector<double> orientation){
    
      geometry_msgs::Pose p;
      p.orientation.w = 1.0;
      p.position.x = coordinate[0];
      p.position.y = coordinate[1];
      p.position.z = coordinate[2];
    
      tf::Quaternion q = tf::createQuaternionFromRPY(
          orientation[0],orientation[1],orientation[2]);
    
      p.orientation.x = q.getX();
      p.orientation.y = q.getY();
      p.orientation.z = q.getZ();
      p.orientation.w = q.getW();
    
      std::vector<geometry_msgs::Pose> goals;
      goals.push_back(p);
    
      moveit::planning_interface::MoveGroup mg("manipulator");
      mg.setStartStateToCurrentState();
    
      // load the path in the `trajectory` variable:
      moveit_msgs::RobotTrajectory trajectory;
      mg.computeCartesianPath(goals, 0.01, 0.0, trajectory);
      // publish to gazebo:
      // trajectory.joint_trajectory.header.stamp = ros::Time::now();
      // publisher.publish(trajectory.joint_trajectory);
    }
    

    几个月前我解决了这个问题,不幸的是我不记得确切的来源/教程。

    【讨论】:

      猜你喜欢
      • 2011-05-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-22
      • 2019-06-27
      • 2022-10-14
      相关资源
      最近更新 更多