Skip to content

A repository for controlling the KUKA lbr or med with impedance control

Notifications You must be signed in to change notification settings

idra-lab/kuka_impedance

Repository files navigation

KUKA LBR Cartesian Impedance Control

A repository for controlling the KUKA lbr or med with cartesian impedance control.

ROS2 Distro Controller FRI library LBR Stack
Humble


Jazzy


Setup

Set the FRI impedance gains to zero

Follows the instructions reported in the lbr stack documentation that you can find here.
Set the stiffness of the JointImpedanceControlMode in the LBRServer.java to zero for each joint, i.e.:

control_mode_ = new JointImpedanceControlMode(0, 0, 0, 0, 0, 0, 0);

Then synchronize the application to update the changes.

Install

Clone this repo inside your ros2 workspace as the src folder

git clone --recursive [email protected]:idra-lab/kuka_impedance.git src

Install ros2 dependencies

rosdep install --from-paths src -i -r -y

Build the workspace

colcon build --symlink-install

Run the controllers on real hardware

Gravity compensation

source install/setup.bash
ros2 launch lbr_bringup hardware.launch.py ctrl:=gravity_compensation

Cartesian impedance control

source install/setup.bash
ros2 launch lbr_bringup hardware.launch.py ctrl:=cartesian_impedance_controller model:=iiwa14 # or iiwa7, med7, med14

Cartesian impedance control with nullspace task

This controller takes the initial configuration as the reference position for the nullspace control.
Can be activated by setting

...
nullspace_stiffness: 10.0
...

in lbr_fri_ros2_stack/lbr_description/ros2_control/lbr_controllers.yaml under the cartesian_impedance_controller configuration.
Then run the controller:

source install/setup.bash
ros2 launch lbr_bringup hardware.launch.py ctrl:=cartesian_impedance_controller model:=iiwa14 # or iiwa7, med7, med14

Test the controllers in Gazebo

You need first to set

...
kuka_hw: false
...
compensate_gravity: true
compensate_coriolis: true

in lbr_fri_ros2_stack/lbr_description/ros2_control/lbr_controllers.yaml under the cartesian_impedance_controller configuration.
Then run the gazebo simulation:

source install/setup.bash
ros2 launch lbr_bringup gazebo.launch.py ctrl:=cartesian_impedance_controller model:=iiwa14

Tracking a reference trajectory

This controller takes a trajectory as input a PoseStamped message and tracks it. You need to publish a PoseStamped message on the /lbr/target_frame topic.
Some examples trajectories are already implemented here where tracking performances are also visualized.

git clone [email protected]:Hydran00/controller_evaluation.git
cd controller_evaluation/

Make sure that the robot type is set to "kuka" in the initialize.py file. Adjust the trajectory parameters in the traj_sin.py or traj_lin.py file. Then run the trajectory publisher:

source /opt/ros/humble/setup.bash
python3 traj_sin.py # traj_lin.py

References

About

A repository for controlling the KUKA lbr or med with impedance control

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published