franka_ros2 icon indicating copy to clipboard operation
franka_ros2 copied to clipboard

Cartesian Stiffness Values Ignored

Open jcarpinelli-bdai opened this issue 10 months ago • 1 comments

When I use the Cartesian pose interface through franka_semantic_components, the arm seems to ignore the Cartesian stiffness values I set through the /service_center. The Joint impedance values are respected, but no matter how low I set the Cartesian stiffness values, the arm is not compliant in Cartesian space.

To replicate this, you can add the following code to the on_configure method of the CartesianImpedanceExampleController class. Am I missing some way to configure the arm for compliant motion in Cartesian space?

  auto client =
      get_node()->create_client<franka_msgs::srv::SetCartesianStiffness>("service_server/set_cartesian_stiffness");
  
  auto request = std::make_shared<franka_msgs::srv::SetCartesianStiffness::Request>(franka_msgs::srv::SetCartesianStiffness::Request());
  request->cartesian_stiffness.at(0) = 10;
  request->cartesian_stiffness.at(1) = 10;
  request->cartesian_stiffness.at(2) = 10;
  request->cartesian_stiffness.at(3) = 10;
  request->cartesian_stiffness.at(4) = 10;
  request->cartesian_stiffness.at(5) = 10;

  auto future_result = client->async_send_request(request);
  future_result.wait_for(seconds(1));

  auto success = future_result.get();
  if (!success) {
    RCLCPP_FATAL(get_node()->get_logger(), "Failed to set Cartesian stiffness.");
    return controller_interface::CallbackReturn::ERROR;
  } else if (!success->success) {
    RCLCPP_FATAL(get_node()->get_logger(), "Failed to set Cartesian stiffness.");
    return controller_interface::CallbackReturn::ERROR;
  } else {
    RCLCPP_INFO(get_node()->get_logger(), "Cartesian stiffness set.");
  }

jcarpinelli-bdai avatar Mar 29 '24 19:03 jcarpinelli-bdai

This seems to be a small oversight of us - currently there is no way to do CartesianImpedance control (which then would re-act to the Cartesian stiffnesses you set).

But: You can work around it by changing in line 293 to 303 in https://github.com/frankaemika/franka_ros2/blob/humble/franka_hardware/src/robot.cpp to a research_interface::robot::Move::ControllerMode::kCartesianImpedance (or give the initialization function a parameter to be either/or)

AndreasKuhner avatar Apr 03 '24 09:04 AndreasKuhner