ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Cartesian path won't achieve full trajectory

asked 2022-05-20 07:33:01 -0600

brynagut gravatar image

updated 2022-05-20 15:47:13 -0600

Hi,

Using this code:

geometry_msgs::PoseStamped current_pose;
current_pose = move_group_interface_arm.getCurrentPose("ee_link");


geometry_msgs::Pose target_pose1;
target_pose1.orientation = current_pose.pose.orientation;
//target_pose1.orientation.w = 1.0;
target_pose1.position.x = 0.3;
target_pose1.position.y = 0.5;
target_pose1.position.z = 0.8;
move_group_interface_arm.setPoseTarget(target_pose1);

success = (move_group_interface_arm.plan(my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);

ROS_INFO_NAMED("Spraying", "Visualizing plan 2 (pose goal) %s", success ? "" : "FAILED");

move_group_interface_arm.move();

ros::Duration(0.5).sleep();


moveit::planning_interface::MoveGroupInterface::Plan my_plan_gripper;

// 3. close the gripper
move_group_interface_gripper.setJointValueTarget(move_group_interface_gripper.getNamedTargetValues("closed"));

success = (move_group_interface_gripper.plan(my_plan_gripper) == 
moveit::planning_interface::MoveItErrorCode::SUCCESS);

ROS_INFO_NAMED("Spraying", "Visualizing plan 3 (pose goal) %s", success ? "" : "FAILED");

move_group_interface_gripper.move();
ros::Duration(0.5).sleep();



std::vector<geometry_msgs::Pose> waypoints;
waypoints.push_back(target_pose1);

geometry_msgs::Pose target_pose2 = target_pose1; 

target_pose2.position.x -=  0.6;
waypoints.push_back(target_pose2);  // right

target_pose2.position.z -= 0.2;
waypoints.push_back(target_pose2);  // down

target_pose2.position.x +=  0.6;
waypoints.push_back(target_pose2);  // left


moveit_msgs::RobotTrajectory trajectory;
const double jump_threshold = 0.0;
const double eef_step = 0.01;
double fraction = move_group_interface_arm.computeCartesianPath(waypoints, eef_step, jump_threshold, trajectory);
ROS_INFO_NAMED("tutorial", "Visualizing plan 4 (Cartesian path) (%.2f%% achieved)", fraction * 100.0);
move_group_interface_arm.execute(trajectory);

ros::Duration(0.5).sleep();

I get the Console output:

[ INFO] [1653046139.892592363]: Received request to compute Cartesian path

[ INFO] [1653046139.893181186]: Attempting to follow 12 waypoints for link 'ee_link' using a step of 0.010000 m and jump threshold 0.000000 (in global reference frame)

[ INFO] [1653046139.937448016]: Computed Cartesian path with 146 points (followed 34.583333% of requested trajectory)

[ INFO] [1653046139.938547863]: Execution request received

[ INFO] [1653046139.978539353]: Fake execution of trajectory

[ INFO] [1653046150.178819596]: Completed trajectory execution with status SUCCEEDED ...

[ INFO] [1653046150.179159290]: Execution completed: SUCCEEDED

There are no errors displayed in terminal, and I've got no obstacles in my environment. How do I get to execute the full trajectory?

Repository here

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-05-21 04:13:04 -0600

brynagut gravatar image

I'm an idiot. Realized

ros::Duration(0.5).sleep();

only allowed the trajectory to be executed within the specified timeline. Sorry to any eyes that had to witness this.

edit flag offensive delete link more

Comments

1

You can pass an argument, wait=True, to have the execute() call block until it is done (or fails.) It's also a good idea to check the status returned by execute().

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-05-21 07:19:39 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2022-05-20 07:17:15 -0600

Seen: 141 times

Last updated: May 21 '22