Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the internal Impedance controllers through ROS2 #44

Closed
kamiradi opened this issue Dec 8, 2023 · 3 comments
Closed

Using the internal Impedance controllers through ROS2 #44

kamiradi opened this issue Dec 8, 2023 · 3 comments

Comments

@kamiradi
Copy link

kamiradi commented Dec 8, 2023

Hi,

This might be a noob question.

The libfranka interface allows one to generate their own motions and then speak to the Robot control using the motion_generator interface and a default option of either the internal joint Impedance controller or the internal cartesian Impedance controller.

Is there a way of utilising the internal controllers through ROS2 api as well?

@BarisYazici
Copy link
Collaborator

Hi,

It's not a noob question you already now about the motion_generators, which is advanced :)

In ROS 2, we communicate also through the FCI(libfranka) interface with the Robot. You can think of ROS 2 as a wrapper of libfranka. In libfranka you can implement your control algorithm in two ways. First is the old callback style control, seconds is the relatively new one available only for new FR3 robot is the Active Control, which readOnce, writeOnce interface.

Motion_generators are using old callback function style control. Like in this callback function in the examples. We define the callback function, which takes robot_state and period as a argument and returns JointPositions based on some period function. And this callback function can return command interfaces types we support: JointPositions, JointVelocites, JointTorques, CartesianVelocity, CartesianPose. As you mentioned you can also pass the internal control type(JointImpendace, CartesianImpedance) to this control function in the old callback style code.

Now for the second approach with Active Control, the control style we support in ROS 2, is primarily developed to avoid two different threads in ROS 2 control package. This control style is simply usable as below.

auto active_control = startJointVelocityControl(franka::JointImpedance);
auto [robot_state, _] = active_control.readOnce();
active_control.writeOnce(joint_velocities);

In ROS 2, we currently defaulted the usage of internal control to franka::JointImpedance (

research_interface::robot::Move::ControllerMode::kJointImpedance);
). But you can easily change that to the franka::CartesianImpedance and compile again. Soon we can make it also configurable as in ROS 1.

@kamiradi
Copy link
Author

kamiradi commented Dec 8, 2023

Thank you for your answer.

Is there a way of using the internal controllers through the ros2_control api. I see that you recently exposed the cartesian_pose_interface and the cartesian_velocity_interface. So if I fire up these controllers, would these be speaking to the internal cartesian impedance controllers?

Another question I had is whether the user can schedule stiffness and damping gains on these internal controllers so as to achieve variable impedance effects?

Thank you for your support.

@BarisYazici
Copy link
Collaborator

You are using the internal controller, unless you are commanding torques to the robot, which external control.

You cannot change the stiffness or damping when a controller is running. You need to first stop the controller set the stiffness and activate the controller again

@kamiradi kamiradi closed this as completed Dec 8, 2023
peterdavidfagan pushed a commit to peterdavidfagan/franka_ros2 that referenced this issue Apr 1, 2024
…velocity-interface to humble

* commit '221229e1bb19ae881032456ce979c150c13cefd8':
  bump up version
  update velocity controller example collision thresholds
  test: write velocity command interface tests
  feat/joint-velocity-interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants