2 #include "sensor_msgs/JointState.h" 3 #include "hebiros/AddGroupFromNamesSrv.h" 4 #include "hebiros/SendCommandWithAcknowledgementSrv.h" 9 int main(
int argc,
char **argv) {
12 ros::init(argc, argv,
"example_set_gains_node");
16 std::string group_name =
"my_group";
20 "/hebiros/add_group_from_names");
25 "/hebiros/"+group_name+
"/send_command_with_acknowledgement");
27 AddGroupFromNamesSrv add_group_srv;
30 add_group_srv.request.group_name = group_name;
31 add_group_srv.request.names = {
"base",
"shoulder",
"elbow"};
32 add_group_srv.request.families = {
"HEBI"};
35 while(!add_group_client.
call(add_group_srv)) {}
39 CommandMsg command_msg;
40 std::vector<std::string> names = {
"HEBI/base",
"HEBI/shoulder",
"HEBI/elbow"};
42 command_msg.name = names;
43 command_msg.settings.name = names;
45 command_msg.settings.save_current_settings = {
false,
false,
false};
46 command_msg.settings.position_gains.name = names;
47 command_msg.settings.velocity_gains.name = names;
48 command_msg.settings.effort_gains.name = names;
50 command_msg.settings.position_gains.kp = {1, 2, 1};
51 command_msg.settings.position_gains.ki = {0.1, 0.2, 0.2};
52 command_msg.settings.position_gains.kd = {0.005, 0.001, 0.001};
53 command_msg.settings.velocity_gains.kp = {0.1, 0.2, 0.1};
54 command_msg.settings.velocity_gains.ki = {0.01, 0.02, 0.02};
55 command_msg.settings.velocity_gains.kd = {0.005, 0.001, 0.001};
56 command_msg.settings.effort_gains.kp = {0.001, 0.002, 0.001};
57 command_msg.settings.effort_gains.ki = {0.001, 0.002, 0.001};
58 command_msg.settings.effort_gains.kd = {0.005, 0.001, 0.001};
60 SendCommandWithAcknowledgementSrv send_command_srv;
61 send_command_srv.request.command = command_msg;
65 if (send_command_client.call(send_command_srv)) {
66 std::cout <<
"The gains were changed successfully" << std::endl;
69 std::cout <<
"The gains were not changed" << std::endl;
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)