IEEE Robotics & Automation Magazine - June 2022 - 58

establish a connection with the robot and read the initial
state with the r e a d O n c e function of the
franka::Robot object:
// connect to robot
franka::Robot robot(robot_ip);
// load the kinematics and dynamics model
franka::Model model = robot.loadModel();
franka::RobotState initial_state =
robot.readOnce();
Eigen::Map>
force_ext_initial(initial_state.O_F_
ext_hat_K. data());
force_error_integral.setZero();
// equilibrium point is the initial position
Eigen::Affine3d initial_transform(Eigen::
Matrix4d ::Map(initial_state.O_T_EE.
data()));
Eigen::Vector3d position_d(initial_
transform.translation ());
Eigen::Quaterniond orientation_initial
(initial_transform.linear ());
double time = 0.0;
Note that to also correct the slightest bias that might be present
in the external force estimation, we store the initial force
(before establishing contact) as a bias correction, and we initialize
the integral term in (4) to 0. The force estimation during
motion (especially during high accelerations) is less
accurate in comparison to the quasi-static case known from
previous literature. This is an inherent property of the implemented
disturbance observer. The static bias can further be
caused by imprecise vertical mounting of the robot base,
imprecise compensation of the end effector's mass and inertia
tensor, or a missing update of finger dynamics.
A callback function for our controller is defined as a
C++11 function as
// define callback for the torque control
loop
std::function
plug_in_control_callback =
[&] (const franka::RobotState& robot_state,
franka::Duration period) ->
franka::Torques {
// ... code for callback
}
This function, which receives the robot state and duration of
the cycle, will be called every millisecond until a
58 * IEEE ROBOTICS & AUTOMATION MAGAZINE * JUNE 2022
// update time
time += period.toSec();
// get state variables
std::array coriolis_array =
model.Coriolis(robot_state);
std::array jacobian_array =
model.zeroJacobian(franka::Frame::kEnd
Effector, robot_state);
// convert to Eigen
Eigen::Map> coriolis(coriolis_array.data());
Eigen::Map> Jacobian (jacobian_array.data());
Eigen::Map> force_ext (robot_state.O_F_ext
_hat_K.data ());
Eigen::Map> dq (robot_state.dq.data());
Eigen::Affine3d transform(Eigen::Matrix4d
::Map(robot_state.O_T_EE.data()));
Eigen::Vector3d position(transform.
translation());
Eigen::Quaterniond orientation(transform.
linear());
To implement (5), the orientation of the equilibrium pose
is computed as
Eigen::AngleAxisd angle_axis_wiggle_x;
angle_axis_wiggle_x.axis() << 1, 0, 0;
angle_axis_wiggle_x.angle() = sin(2.0
franka::MotionFinished signal is sent by the callback.
We can then have a look at the callback code that implements
(5) and (2). We first cast all the involved variables to [28] to
easily perform matrix products and quaternion manipulation.
*
M_PI * time * plug_in_params.wiggle_
frequency_x) * plug_in_params.wiggle_
amplitude_x;
Eigen::AngleAxisd angle_axis_wiggle_y;
angle_axis_wiggle_y.axis() << 0, 1, 0;
angle_axis_wiggle_y.angle() = sin(2.0
*
M_PI * time * plug_in_params.wiggle_
frequency_y) * plug_in_params.wiggle_
amplitude_y;
Eigen::Quaterniond wiggle_x(angle_axis
_wiggle_x);
Eigen::Quaterniond wiggle_y(angle_axis
_wiggle_y);
Eigen::Quaterniond orientation_d
(wiggle_y * (
wiggle_x * orientation_initial));

IEEE Robotics & Automation Magazine - June 2022

Table of Contents for the Digital Edition of IEEE Robotics & Automation Magazine - June 2022

Contents
IEEE Robotics & Automation Magazine - June 2022 - Cover1
IEEE Robotics & Automation Magazine - June 2022 - Cover2
IEEE Robotics & Automation Magazine - June 2022 - Contents
IEEE Robotics & Automation Magazine - June 2022 - 2
IEEE Robotics & Automation Magazine - June 2022 - 3
IEEE Robotics & Automation Magazine - June 2022 - 4
IEEE Robotics & Automation Magazine - June 2022 - 5
IEEE Robotics & Automation Magazine - June 2022 - 6
IEEE Robotics & Automation Magazine - June 2022 - 7
IEEE Robotics & Automation Magazine - June 2022 - 8
IEEE Robotics & Automation Magazine - June 2022 - 9
IEEE Robotics & Automation Magazine - June 2022 - 10
IEEE Robotics & Automation Magazine - June 2022 - 11
IEEE Robotics & Automation Magazine - June 2022 - 12
IEEE Robotics & Automation Magazine - June 2022 - 13
IEEE Robotics & Automation Magazine - June 2022 - 14
IEEE Robotics & Automation Magazine - June 2022 - 15
IEEE Robotics & Automation Magazine - June 2022 - 16
IEEE Robotics & Automation Magazine - June 2022 - 17
IEEE Robotics & Automation Magazine - June 2022 - 18
IEEE Robotics & Automation Magazine - June 2022 - 19
IEEE Robotics & Automation Magazine - June 2022 - 20
IEEE Robotics & Automation Magazine - June 2022 - 21
IEEE Robotics & Automation Magazine - June 2022 - 22
IEEE Robotics & Automation Magazine - June 2022 - 23
IEEE Robotics & Automation Magazine - June 2022 - 24
IEEE Robotics & Automation Magazine - June 2022 - 25
IEEE Robotics & Automation Magazine - June 2022 - 26
IEEE Robotics & Automation Magazine - June 2022 - 27
IEEE Robotics & Automation Magazine - June 2022 - 28
IEEE Robotics & Automation Magazine - June 2022 - 29
IEEE Robotics & Automation Magazine - June 2022 - 30
IEEE Robotics & Automation Magazine - June 2022 - 31
IEEE Robotics & Automation Magazine - June 2022 - 32
IEEE Robotics & Automation Magazine - June 2022 - 33
IEEE Robotics & Automation Magazine - June 2022 - 34
IEEE Robotics & Automation Magazine - June 2022 - 35
IEEE Robotics & Automation Magazine - June 2022 - 36
IEEE Robotics & Automation Magazine - June 2022 - 37
IEEE Robotics & Automation Magazine - June 2022 - 38
IEEE Robotics & Automation Magazine - June 2022 - 39
IEEE Robotics & Automation Magazine - June 2022 - 40
IEEE Robotics & Automation Magazine - June 2022 - 41
IEEE Robotics & Automation Magazine - June 2022 - 42
IEEE Robotics & Automation Magazine - June 2022 - 43
IEEE Robotics & Automation Magazine - June 2022 - 44
IEEE Robotics & Automation Magazine - June 2022 - 45
IEEE Robotics & Automation Magazine - June 2022 - 46
IEEE Robotics & Automation Magazine - June 2022 - 47
IEEE Robotics & Automation Magazine - June 2022 - 48
IEEE Robotics & Automation Magazine - June 2022 - 49
IEEE Robotics & Automation Magazine - June 2022 - 50
IEEE Robotics & Automation Magazine - June 2022 - 51
IEEE Robotics & Automation Magazine - June 2022 - 52
IEEE Robotics & Automation Magazine - June 2022 - 53
IEEE Robotics & Automation Magazine - June 2022 - 54
IEEE Robotics & Automation Magazine - June 2022 - 55
IEEE Robotics & Automation Magazine - June 2022 - 56
IEEE Robotics & Automation Magazine - June 2022 - 57
IEEE Robotics & Automation Magazine - June 2022 - 58
IEEE Robotics & Automation Magazine - June 2022 - 59
IEEE Robotics & Automation Magazine - June 2022 - 60
IEEE Robotics & Automation Magazine - June 2022 - 61
IEEE Robotics & Automation Magazine - June 2022 - 62
IEEE Robotics & Automation Magazine - June 2022 - 63
IEEE Robotics & Automation Magazine - June 2022 - 64
IEEE Robotics & Automation Magazine - June 2022 - 65
IEEE Robotics & Automation Magazine - June 2022 - 66
IEEE Robotics & Automation Magazine - June 2022 - 67
IEEE Robotics & Automation Magazine - June 2022 - 68
IEEE Robotics & Automation Magazine - June 2022 - 69
IEEE Robotics & Automation Magazine - June 2022 - 70
IEEE Robotics & Automation Magazine - June 2022 - 71
IEEE Robotics & Automation Magazine - June 2022 - 72
IEEE Robotics & Automation Magazine - June 2022 - 73
IEEE Robotics & Automation Magazine - June 2022 - 74
IEEE Robotics & Automation Magazine - June 2022 - 75
IEEE Robotics & Automation Magazine - June 2022 - 76
IEEE Robotics & Automation Magazine - June 2022 - 77
IEEE Robotics & Automation Magazine - June 2022 - 78
IEEE Robotics & Automation Magazine - June 2022 - 79
IEEE Robotics & Automation Magazine - June 2022 - 80
IEEE Robotics & Automation Magazine - June 2022 - 81
IEEE Robotics & Automation Magazine - June 2022 - 82
IEEE Robotics & Automation Magazine - June 2022 - 83
IEEE Robotics & Automation Magazine - June 2022 - 84
IEEE Robotics & Automation Magazine - June 2022 - 85
IEEE Robotics & Automation Magazine - June 2022 - 86
IEEE Robotics & Automation Magazine - June 2022 - 87
IEEE Robotics & Automation Magazine - June 2022 - 88
IEEE Robotics & Automation Magazine - June 2022 - 89
IEEE Robotics & Automation Magazine - June 2022 - 90
IEEE Robotics & Automation Magazine - June 2022 - 91
IEEE Robotics & Automation Magazine - June 2022 - 92
IEEE Robotics & Automation Magazine - June 2022 - 93
IEEE Robotics & Automation Magazine - June 2022 - 94
IEEE Robotics & Automation Magazine - June 2022 - 95
IEEE Robotics & Automation Magazine - June 2022 - 96
IEEE Robotics & Automation Magazine - June 2022 - 97
IEEE Robotics & Automation Magazine - June 2022 - 98
IEEE Robotics & Automation Magazine - June 2022 - 99
IEEE Robotics & Automation Magazine - June 2022 - 100
IEEE Robotics & Automation Magazine - June 2022 - 101
IEEE Robotics & Automation Magazine - June 2022 - 102
IEEE Robotics & Automation Magazine - June 2022 - 103
IEEE Robotics & Automation Magazine - June 2022 - 104
IEEE Robotics & Automation Magazine - June 2022 - Cover3
IEEE Robotics & Automation Magazine - June 2022 - Cover4
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2023
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2023
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2023
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2023
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2022
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2022
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2022
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2022
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2021
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2021
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2021
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2021
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2020
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2020
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2020
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2020
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2019
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2019
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2019
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2019
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2018
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2018
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2018
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2018
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2017
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2017
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2017
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2017
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2016
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2016
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2016
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2016
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2015
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2015
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2015
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2015
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2014
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2014
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2014
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2014
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2013
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2013
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2013
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2013
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2012
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2012
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2012
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2012
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2011
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2011
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2011
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2011
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2010
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2010
https://www.nxtbookmedia.com