8 #include <std_msgs/Bool.h> 9 #include <xarm_planner/pose_plan.h> 10 #include <xarm_planner/joint_plan.h> 11 #include <xarm_planner/exec_plan.h> 12 #include <xarm_planner/single_straight_plan.h> 20 return srv.response.success;
24 ROS_ERROR(
"Failed to call service joint_plan");
33 return srv.response.success;
37 ROS_ERROR(
"Failed to call service pose_plan");
46 return srv.response.success;
50 ROS_ERROR(
"Failed to call service single_straight_plan");
59 return srv.response.success;
63 ROS_ERROR(
"Failed to call service exec_plan");
69 int main(
int argc,
char** argv)
71 std::vector<double> tar_joint1 = {-1.0, -0.75, 0.0, -0.5, 0.0, 0.3, 0.0};
72 std::vector<double> tar_joint2 = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
73 std::vector<double> tar_joint3 = {1.0, -0.75, 0.0, -0.5, 0.0, -0.3, 0.0};
75 ros::init(argc, argv,
"xarm_simple_planner_client");
83 xarm_planner::joint_plan srv;
84 xarm_planner::pose_plan srv2;
85 xarm_planner::exec_plan srv_exec;
91 std::vector<double> tar_joint22 = {-19.9/57.3, 16.9/57.3, 0.8/57.3, 21.5/57.3, -2.9/57.3, 4.6/57.3, -16.3/57.3};
92 xarm_planner::single_straight_plan srv22;
95 geometry_msgs::Pose target1;
96 target1.position.x = 0.3;
97 target1.position.y = -0.1;
98 target1.position.z = 0.2;
100 target1.orientation.x = 1;
101 target1.orientation.y = 0;
102 target1.orientation.z = 0;
103 target1.orientation.w = 0;
105 geometry_msgs::Pose target2;
106 target2.position.x = 0.3;
107 target2.position.y = 0.1;
108 target2.position.z = 0.2;
110 target2.orientation.x = 1;
111 target2.orientation.y = 0;
112 target2.orientation.z = 0;
113 target2.orientation.w = 0;
115 geometry_msgs::Pose target3;
116 target3.position.x = 0.3;
117 target3.position.y = 0.1;
118 target3.position.z = 0.4;
120 target3.orientation.x = 1;
121 target3.orientation.y = 0;
122 target3.orientation.z = 0;
123 target3.orientation.w = 0;
125 geometry_msgs::Pose target4;
126 target4.position.x = 0.3;
127 target4.position.y = -0.1;
128 target4.position.z = 0.4;
130 target4.orientation.x = 1;
131 target4.orientation.y = 0;
132 target4.orientation.z = 0;
133 target4.orientation.w = 0;
136 srv.request.target = tar_joint22;
139 ROS_INFO(
"Plan SUCCESS! Executing... ");
143 srv_exec.request.exec =
true;
151 srv22.request.target = target1;
154 ROS_INFO(
"Plan SUCCESS! Executing... ");
158 srv_exec.request.exec =
true;
164 srv22.request.target = target2;
167 ROS_INFO(
"Plan SUCCESS! Executing... ");
171 srv_exec.request.exec =
true;
176 srv22.request.target = target3;
179 ROS_INFO(
"Plan SUCCESS! Executing... ");
183 srv_exec.request.exec =
true;
188 srv22.request.target = target4;
191 ROS_INFO(
"Plan SUCCESS! Executing... ");
195 srv_exec.request.exec =
true;
204 ROS_ERROR(
"Execution Failed at loop: %d!", i+1);
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
int main(int argc, char **argv)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
bool request_exec(ros::ServiceClient &client, xarm_planner::exec_plan &srv)
bool request_plan(ros::ServiceClient &client, xarm_planner::joint_plan &srv)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)