13 srv.request.mvvelo = 20.0 / 57.0;
14 srv.request.mvacc = 1000;
15 srv.request.mvtime = 0;
18 ROS_INFO(
"%s\n", srv.response.message.c_str());
22 ROS_ERROR(
"Failed to call service go home");
30 std::vector<float> joint[2] = {{0, 0, 0, 0, 0, 0, 0},
31 {0, -0.3, 0, 0, 0, 0, 0}};
33 srv.request.mvvelo = 0;
34 srv.request.mvacc = 0;
35 srv.request.mvtime = 0;
36 for (
int i = 0; i < 2; i++)
38 srv.request.pose = joint[i];
41 ROS_INFO(
"%s\n", srv.response.message.c_str());
45 ROS_ERROR(
"Failed to call service move_servoj");
55 std::vector<float> pose[5] = { {300, 0, 100, -3.14, 0, 0},
56 {300, 100, 100, -3.14, 0, 0},
57 {400, 100, 100, -3.14, 0, 0},
58 {400, -100, 100, -3.14, 0, 0},
59 {300, -100, 100, -3.14, 0, 0}};
60 srv.request.mvvelo = 100;
61 srv.request.mvacc = 1000;
62 srv.request.mvtime = 0;
63 srv.request.mvradii = 20;
65 for(
int k=0; k<3; k++)
67 for(
int i = 0; i < 5; i++)
69 srv.request.pose = pose[i];
72 ROS_INFO(
"%s\n", srv.response.message.c_str());
76 ROS_ERROR(
"Failed to call service move_lineb");
84 int main(
int argc,
char **argv)
89 nh.
setParam(
"/xarm/wait_for_finish",
true);
98 xarm_msgs::SetAxis set_axis_srv_;
99 xarm_msgs::SetInt16 set_int16_srv_;
100 xarm_msgs::Move move_srv_;
102 set_axis_srv_.request.id = 8;
103 set_axis_srv_.request.data = 1;
105 if(motion_ctrl_client_.call(set_axis_srv_))
107 ROS_INFO(
"%s\n", set_axis_srv_.response.message.c_str());
111 ROS_ERROR(
"Failed to call service motion_ctrl");
115 set_int16_srv_.request.data = 0;
116 if(set_mode_client_.call(set_int16_srv_))
118 ROS_INFO(
"%s\n", set_int16_srv_.response.message.c_str());
122 ROS_ERROR(
"Failed to call service set_mode");
126 set_int16_srv_.request.data = 0;
127 if(set_state_client_.call(set_int16_srv_))
129 ROS_INFO(
"%s\n", set_int16_srv_.response.message.c_str());
133 ROS_ERROR(
"Failed to call service set_state");
141 nh.
setParam(
"/xarm/wait_for_finish",
false);
142 std_msgs::Float32 sleep_msg;
143 sleep_msg.data = 1.0;
147 nh.
setParam(
"/xarm/wait_for_finish",
true);
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
void publish(const boost::shared_ptr< M > &message) const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
int main(int argc, char **argv)
int go_home_test(xarm_msgs::Move srv, ros::ServiceClient client)
int move_lineb_test(xarm_msgs::Move srv, ros::ServiceClient client)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
int servoj_test(xarm_msgs::Move srv, ros::ServiceClient client)
void setParam(const std::string &key, const XmlRpc::XmlRpcValue &v) const