|
22 | 22 | #include <map> |
23 | 23 | #include <thread> |
24 | 24 |
|
25 | | -#include <moveit/utils/moveit_error_code.hpp> |
26 | 25 | #include <moveit_visual_tools/moveit_visual_tools.h> |
27 | 26 | #include <moveit/move_group_interface/move_group_interface.hpp> |
28 | 27 | #include <moveit/trajectory_processing/time_optimal_trajectory_generation.hpp> |
| 28 | +#include <moveit/utils/moveit_error_code.hpp> |
29 | 29 | #include <moveit_msgs/msg/allowed_collision_matrix.hpp> |
30 | 30 | #include <moveit_msgs/srv/apply_planning_scene.hpp> |
31 | 31 | #include <moveit_msgs/srv/get_planning_scene.hpp> |
@@ -760,38 +760,37 @@ class RunDemoNode : public rclcpp::Node |
760 | 760 | { |
761 | 761 | move_group->setJointValueTarget(move_group->getNamedTargetValues(waypoint.preset_name)); |
762 | 762 | } |
763 | | - if (waypoint.use_jconfig) |
| 763 | + else if (waypoint.use_jconfig) |
764 | 764 | { |
765 | 765 | move_group->setJointValueTarget(waypoint.config); |
766 | | - move_group->setNumPlanningAttempts(10); |
767 | 766 | } |
768 | 767 | else |
769 | 768 | { |
770 | | - geometry_msgs::msg::Pose start_pose = move_group->getCurrentPose().pose; |
771 | 769 | geometry_msgs::msg::Pose end_pose = waypoint.pose; |
772 | 770 | if (waypoint.is_relative) |
773 | 771 | { |
| 772 | + geometry_msgs::msg::Pose start_pose = move_group->getCurrentPose().pose; |
774 | 773 | end_pose = this->relative_to_global(start_pose, end_pose); |
775 | 774 | } |
776 | | - move_group->setJointValueTarget(end_pose); |
777 | | - move_group->setNumPlanningAttempts(10); |
| 775 | + move_group->setPoseTarget(end_pose); |
778 | 776 | } |
779 | 777 |
|
| 778 | + move_group->setNumPlanningAttempts(5); |
780 | 779 | move_group->setMaxVelocityScalingFactor(scaling); |
781 | 780 | move_group->setMaxAccelerationScalingFactor(scaling); |
782 | 781 |
|
783 | 782 | moveit::planning_interface::MoveGroupInterface::Plan plan; |
784 | 783 | moveit::core::MoveItErrorCode error_code = move_group->plan(plan); |
785 | 784 |
|
786 | | - if (error_code == moveit::core::MoveItErrorCode::SUCCESS) |
| 785 | + if (error_code) |
787 | 786 | { |
788 | 787 | RCLCPP_INFO(LOGGER, "Successfully computed trajectory"); |
789 | 788 | trajectory = plan.trajectory; |
790 | 789 | return true; |
791 | 790 | } |
792 | 791 | else |
793 | 792 | { |
794 | | - RCLCPP_ERROR(LOGGER, "Planning failed with error code %s", error_code.message.c_str()); |
| 793 | + RCLCPP_ERROR(LOGGER, "Planning failed: %s", error_code.message.c_str()); |
795 | 794 | return false; |
796 | 795 | } |
797 | 796 | } |
|
0 commit comments