12 srv.request.mvvelo = 20.0 / 57.0;
13 srv.request.mvacc = 1000;
14 srv.request.mvtime = 0;
17 ROS_INFO(
"%s\n", srv.response.message.c_str());
21 ROS_ERROR(
"Failed to call service go home");
29 std::vector<float> inc = {0.3, 0, 0, 0, 0, 0};
31 srv.request.mvvelo = 0;
32 srv.request.mvacc = 0;
33 srv.request.mvtime = 1;
35 srv.request.pose = inc;
37 for (
int i = 0; i < 500; i++)
41 ROS_INFO(
"%s\n", srv.response.message.c_str());
45 ROS_ERROR(
"Failed to call service move_servoj");
55 int main(
int argc,
char **argv)
59 nh.
setParam(
"/xarm/wait_for_finish",
true);
66 xarm_msgs::SetAxis set_axis_srv_;
67 xarm_msgs::SetInt16 set_int16_srv_;
68 xarm_msgs::Move move_srv_;
72 set_axis_srv_.request.id = 8;
73 set_axis_srv_.request.data = 1;
75 if(motion_ctrl_client_.
call(set_axis_srv_))
77 ROS_INFO(
"%s\n", set_axis_srv_.response.message.c_str());
81 ROS_ERROR(
"Failed to call service motion_ctrl");
86 set_int16_srv_.request.data = 0;
87 if(set_mode_client_.call(set_int16_srv_))
89 ROS_INFO(
"%s\n", set_int16_srv_.response.message.c_str());
93 ROS_ERROR(
"Failed to call service set_mode");
98 set_int16_srv_.request.data = 0;
99 if(set_state_client_.call(set_int16_srv_))
101 ROS_INFO(
"%s\n", set_int16_srv_.response.message.c_str());
105 ROS_ERROR(
"Failed to call service set_state");
115 set_int16_srv_.request.data = 1;
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");
127 set_int16_srv_.request.data = 0;
128 if(set_state_client_.call(set_int16_srv_))
130 ROS_INFO(
"%s\n", set_int16_srv_.response.message.c_str());
134 ROS_ERROR(
"Failed to call service set_state");
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
int go_home_test(xarm_msgs::Move &srv, ros::ServiceClient &client)
int main(int argc, char **argv)
int servo_cart_test(xarm_msgs::Move &srv, ros::ServiceClient &client)
void setParam(const std::string &key, const XmlRpc::XmlRpcValue &v) const