9 .
advertiseService<franka_msgs::SetJointImpedance>(node_handle,
"set_joint_impedance",
10 [&robot](
auto&& req,
auto&& res) {
14 .advertiseService<franka_msgs::SetCartesianImpedance>(
15 node_handle,
"set_cartesian_impedance",
16 [&robot](
auto&& req,
auto&& res) {
19 .advertiseService<franka_msgs::SetEEFrame>(
20 node_handle,
"set_EE_frame",
22 .advertiseService<franka_msgs::SetKFrame>(
23 node_handle,
"set_K_frame",
25 .advertiseService<franka_msgs::SetForceTorqueCollisionBehavior>(
26 node_handle,
"set_force_torque_collision_behavior",
27 [&robot](
auto&& req,
auto&& res) {
30 .advertiseService<franka_msgs::SetFullCollisionBehavior>(
31 node_handle,
"set_full_collision_behavior",
32 [&robot](
auto&& req,
auto&& res) {
35 .advertiseService<franka_msgs::SetLoad>(
36 node_handle,
"set_load",
41 const franka_msgs::SetCartesianImpedance::Request& req,
42 franka_msgs::SetCartesianImpedance::Response& ) {
43 std::array<double, 6> cartesian_stiffness;
44 std::copy(req.cartesian_stiffness.cbegin(), req.cartesian_stiffness.cend(),
45 cartesian_stiffness.begin());
50 const franka_msgs::SetJointImpedance::Request& req,
51 franka_msgs::SetJointImpedance::Response& ) {
52 std::array<double, 7> joint_stiffness;
53 std::copy(req.joint_stiffness.cbegin(), req.joint_stiffness.cend(), joint_stiffness.begin());
58 const franka_msgs::SetEEFrame::Request& req,
59 franka_msgs::SetEEFrame::Response& ) {
60 std::array<double, 16> F_T_EE;
61 std::copy(req.F_T_EE.cbegin(), req.F_T_EE.cend(), F_T_EE.begin());
66 const franka_msgs::SetKFrame::Request& req,
67 franka_msgs::SetKFrame::Response& ) {
68 std::array<double, 16> EE_T_K;
69 std::copy(req.EE_T_K.cbegin(), req.EE_T_K.cend(), EE_T_K.begin());
75 const franka_msgs::SetForceTorqueCollisionBehavior::Request& req,
76 franka_msgs::SetForceTorqueCollisionBehavior::Response&
78 std::array<double, 7> lower_torque_thresholds_nominal;
79 std::copy(req.lower_torque_thresholds_nominal.cbegin(),
80 req.lower_torque_thresholds_nominal.cend(), lower_torque_thresholds_nominal.begin());
81 std::array<double, 7> upper_torque_thresholds_nominal;
82 std::copy(req.upper_torque_thresholds_nominal.cbegin(),
83 req.upper_torque_thresholds_nominal.cend(), upper_torque_thresholds_nominal.begin());
84 std::array<double, 6> lower_force_thresholds_nominal;
85 std::copy(req.lower_force_thresholds_nominal.cbegin(), req.lower_force_thresholds_nominal.cend(),
86 lower_force_thresholds_nominal.begin());
87 std::array<double, 6> upper_force_thresholds_nominal;
88 std::copy(req.upper_force_thresholds_nominal.cbegin(), req.upper_force_thresholds_nominal.cend(),
89 upper_force_thresholds_nominal.begin());
92 lower_force_thresholds_nominal, upper_force_thresholds_nominal);
96 const franka_msgs::SetFullCollisionBehavior::Request& req,
97 franka_msgs::SetFullCollisionBehavior::Response& ) {
98 std::array<double, 7> lower_torque_thresholds_acceleration;
99 std::copy(req.lower_torque_thresholds_acceleration.cbegin(),
100 req.lower_torque_thresholds_acceleration.cend(),
101 lower_torque_thresholds_acceleration.begin());
102 std::array<double, 7> upper_torque_thresholds_acceleration;
103 std::copy(req.upper_torque_thresholds_acceleration.cbegin(),
104 req.upper_torque_thresholds_acceleration.cend(),
105 upper_torque_thresholds_acceleration.begin());
106 std::array<double, 7> lower_torque_thresholds_nominal;
107 std::copy(req.lower_torque_thresholds_nominal.cbegin(),
108 req.lower_torque_thresholds_nominal.cend(), lower_torque_thresholds_nominal.begin());
109 std::array<double, 7> upper_torque_thresholds_nominal;
110 std::copy(req.upper_torque_thresholds_nominal.cbegin(),
111 req.upper_torque_thresholds_nominal.cend(), upper_torque_thresholds_nominal.begin());
112 std::array<double, 6> lower_force_thresholds_acceleration;
113 std::copy(req.lower_force_thresholds_acceleration.cbegin(),
114 req.lower_force_thresholds_acceleration.cend(),
115 lower_force_thresholds_acceleration.begin());
116 std::array<double, 6> upper_force_thresholds_acceleration;
117 std::copy(req.upper_force_thresholds_acceleration.cbegin(),
118 req.upper_force_thresholds_acceleration.cend(),
119 upper_force_thresholds_acceleration.begin());
120 std::array<double, 6> lower_force_thresholds_nominal;
121 std::copy(req.lower_force_thresholds_nominal.cbegin(), req.lower_force_thresholds_nominal.cend(),
122 lower_force_thresholds_nominal.begin());
123 std::array<double, 6> upper_force_thresholds_nominal;
124 std::copy(req.upper_force_thresholds_nominal.cbegin(), req.upper_force_thresholds_nominal.cend(),
125 upper_force_thresholds_nominal.begin());
127 upper_torque_thresholds_acceleration, lower_torque_thresholds_nominal,
128 upper_torque_thresholds_nominal, lower_force_thresholds_acceleration,
129 upper_force_thresholds_acceleration, lower_force_thresholds_nominal,
130 upper_force_thresholds_nominal);
134 const franka_msgs::SetLoad::Request& req,
135 franka_msgs::SetLoad::Response& ) {
136 double mass(req.mass);
137 std::array<double, 3> F_x_center_load;
138 std::copy(req.F_x_center_load.cbegin(), req.F_x_center_load.cend(), F_x_center_load.begin());
139 std::array<double, 9> load_inertia;
140 std::copy(req.load_inertia.cbegin(), req.load_inertia.cend(), load_inertia.begin());
142 robot.
setLoad(mass, F_x_center_load, load_inertia);
void setKFrame(franka::Robot &robot, const franka_msgs::SetKFrame::Request &req, franka_msgs::SetKFrame::Response &res)
Callback for the service interface to franka::robot::setKFrame.
void setEE(const std::array< double, 16 > &F_T_EE)
This class serves as container that gathers all possible service interfaces to a libfranka robot inst...
void setJointImpedance(franka::Robot &robot, const franka_msgs::SetJointImpedance::Request &req, franka_msgs::SetJointImpedance::Response &res)
Callback for the service interface to franka::robot::setJointImpedance.
void setJointImpedance(const std::array< double, 7 > &K_theta)
void setCartesianImpedance(const std::array< double, 6 > &K_x)
void setLoad(franka::Robot &robot, const franka_msgs::SetLoad::Request &req, franka_msgs::SetLoad::Response &res)
Callback for the service interface to franka::robot::setLoad.
void setK(const std::array< double, 16 > &EE_T_K)
void setForceTorqueCollisionBehavior(franka::Robot &robot, const franka_msgs::SetForceTorqueCollisionBehavior::Request &req, franka_msgs::SetForceTorqueCollisionBehavior::Response &res)
Callback for the service interface to franka::robot::setForceTorqueCollisionBehavior.
void setupServices(franka::Robot &robot, ros::NodeHandle &node_handle, ServiceContainer &services)
Sets up all services relevant for a libfranka robot inside a service container.
ServiceContainer & advertiseService(TArgs &&...args)
Advertises and adds a service to the container class.
void setLoad(double load_mass, const std::array< double, 3 > &F_x_Cload, const std::array< double, 9 > &load_inertia)
void setCollisionBehavior(const std::array< double, 7 > &lower_torque_thresholds_acceleration, const std::array< double, 7 > &upper_torque_thresholds_acceleration, const std::array< double, 7 > &lower_torque_thresholds_nominal, const std::array< double, 7 > &upper_torque_thresholds_nominal, const std::array< double, 6 > &lower_force_thresholds_acceleration, const std::array< double, 6 > &upper_force_thresholds_acceleration, const std::array< double, 6 > &lower_force_thresholds_nominal, const std::array< double, 6 > &upper_force_thresholds_nominal)
void setFullCollisionBehavior(franka::Robot &robot, const franka_msgs::SetFullCollisionBehavior::Request &req, franka_msgs::SetFullCollisionBehavior::Response &res)
Callback for the service interface to franka::robot::setFullCollisionBehavior.
void setCartesianImpedance(franka::Robot &robot, const franka_msgs::SetCartesianImpedance::Request &req, franka_msgs::SetCartesianImpedance::Response &res)
Callback for the service interface to franka::robot::setCartesianImpedance.
void setEEFrame(franka::Robot &robot, const franka_msgs::SetEEFrame::Request &req, franka_msgs::SetEEFrame::Response &res)
Callback for the service interface to franka::robot::setEEFrame.