Franka Robotics
I’m working with a Franka Panda in Robohub, need to understand how to interface with it.
Writing some notes for libfranka.
Essentially, they pass a callback that is passed and that is the realtime control loop.
robot.control
is the main command, and then you pass the command in it
robot.control(control_callback);
This is what a callback would look like:
control_ballback = ([&time, &initial_pose](const franka::RobotState& robot_state, franka::Duration period) -> franka::CartesianPose {
time += period.toSec();
if (time == 0.0) {
initial_pose = robot_state.O_T_EE_c;
}
constexpr double kRadius = 0.3;
double angle = M_PI / 4 * (1 - std::cos(M_PI / 5.0 * time));
double delta_x = kRadius * std::sin(angle);
double delta_z = kRadius * (std::cos(angle) - 1);
std::array<double, 16> new_pose = initial_pose;
new_pose[12] += delta_x;
new_pose[14] += delta_z;
if (time >= 10.0) {
std::cout << std::endl << "Finished motion, shutting down example" << std::endl;
return franka::MotionFinished(new_pose);
}
return new_pose;
});
But this callback would always run. Okay easy