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_msgs/SetInt16.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 exec_plan");
43 int main(
int argc,
char** argv)
45 std::vector<double> tar_joint1 = {-1.0, -0.75, 0.0, 0.2, 0.0, 0.3, 0.0};
46 std::vector<double> tar_joint2 = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
47 std::vector<double> tar_joint3 = {1.0, -0.75, 0.0, 0.2, 0.0, -0.3, 0.0};
49 ros::init(argc, argv,
"xarm_simple_planner_client");
57 xarm_planner::joint_plan srv;
58 xarm_planner::exec_plan srv_exec;
59 xarm_msgs::SetInt16 srv_stop;
66 srv.request.target = tar_joint1;
69 ROS_INFO(
"Plan SUCCESS! Executing... ");
70 srv_exec.request.exec =
true;
73 srv_stop.request.data = 4;
74 client_stop.call(srv_stop);
82 srv.request.target = tar_joint2;
85 ROS_INFO(
"Plan SUCCESS! Executing... ");
86 srv_exec.request.exec =
true;
89 srv_stop.request.data = 4;
90 client_stop.call(srv_stop);
98 srv.request.target = tar_joint3;
101 ROS_INFO(
"Plan SUCCESS! Executing... ");
102 srv_exec.request.exec =
true;
105 srv_stop.request.data = 4;
106 client_stop.call(srv_stop);
114 srv.request.target = tar_joint2;
117 ROS_INFO(
"Plan SUCCESS! Executing... ");
118 srv_exec.request.exec =
true;
121 srv_stop.request.data = 4;
122 client_stop.call(srv_stop);
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_plan(ros::ServiceClient &client, xarm_planner::joint_plan &srv)
bool request_exec(ros::ServiceClient &client, xarm_planner::exec_plan &srv)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ROSCPP_DECL void shutdown()
ROSCPP_DECL bool waitForService(const std::string &service_name, int32_t timeout)