Skip to content

A ROS2 package for controlling the Kuka iiwa14 using a the serial link action server & client repositories.

License

Notifications You must be signed in to change notification settings

Woolfrey/control_kuka_velocity

Repository files navigation

🕹️ Kuka Velocity Control

This package contains launch files for several nodes, action servers, and action clients to enable joint & Cartesian velocity control of the Kuka iiwa14 robot. It uses the serial_link_action_client package to send goals to the serial_link_action_server. The latter implements Robot Library which is a C++ library for modeling & control. It can also interact with the mujoco_ros2 package to for simulation.

In essence, it serves as an example of how to implement the serial_link_action_client package to send goals to the serial_link_action_server to control a robot arm, with all the necessary config files. You can copy and/or modify it to get it working for other robot arms 🦾.

✨ Features:

  • Joint & Cartesian trajectory tracking,
  • Real-time velocity control of the endpoint with a joystick,
  • Real-time control of endpoint pose with an interactive marker in RViz.

🧭 Navigation

📋 Requirements

Note

This package was built and tested using Ubuntu 22.04, ROS2 Humble, and MuJoCo 3.2.0.

🔝 Back to Top.

💾 Installation

Your directory structure should end up looking something like this:

workspace/
├── software_robot_library/
├── mujoco_menagerie/
└── ros2_ws/
    ├── build/
    ├── install/
    ├── log/
    └── src/
        ├── client_serial_link/
        ├── control_kuka_velocity/
        ├── interface_serial_link/
        ├── mujoco_ros2/
        └── server_serial_link/

Download and install all the necessary packages.

🔝 Back to Top.

⚙️ Configuration Files

Inside the config/ directory are all the configuration files to change parameters & performance of the controller:

  • control_parameters.yaml contains things like feedback gains used by the underlying RobotLibrary::Control classes.
  • iiwa_endpoint_poses.yaml specifies waypoints for Cartesian trajectories, which is loaded by the trajectory_tracking_client node.
  • iiwa_joint_configurations.yaml specifies waypoints for joint trajectories, loaded by the TrackJointTrajectory action client.
  • tolerances.yaml contains maximum permissable errors for things like trajectory tracking, etc. The action server aborts if they are violated.
  • wii_nunchuck.yaml specifies how to convert joystick inputs to Cartesian velocities used in the joy_twist_mapper node.

Play around with them and see how it works.

🔝 Back to Top.

🚀 Launch Files

Note

I use bash scripts to simultaneously run the action client, and launch the action server. This is because the former allows you to type command prompts in to the terminal. This is not possible when you launch the client, instead of running.

mujoco.py

If you don't have a real robot, you can use this MuJoCo simulation. Inside the launch/mujoco.py you need to specify the xmlScenePath where the model is located:

xmlScenePath = "/home/<username>/workspace/mujoco_menagerie/kuka_iiwa_14/scene.xml"

Open a terminal, and run ros2 launch kuka_velocity_control mujoco.py and it should start. You should also see the joint states being published, and the joint command topic ready to control the robot:

launch_follow_transform.sh

Inside the control_kuka_velocity/ directory, type:

./launch_follow_transform.sh

and the relevant action clients & servers will start up.

In the client terminal:

  1. Type ready to move the robot in to the ready configuration,
  2. Move the interactive marker in the RViz window somewhere close to the robot end-effector transform, and
  3. Type follow in the client terminal.

You should be able to drag around the interactive marker and the robot will automatically follow.

launch_follow_twist.sh

Inside the control_kuka_velocity/ directory, type:

./launch_follow_twist.sh

and the relevant action clients & servers will start up.

In the client terminal:

  1. Type ready to move the robot in to the ready configuration,
  2. Type follow in the client terminal.

A joy node is automatically run, and a joy_twist_mapper node (from the interface package). If you plug in a game controller or joystick, you can manually control the endpoint of the robot 🕹️.

You can change the joystick mapping in the config/wii_nunchuck.yaml file.

launch_trajectory_tracking.sh

From the control_kuka_velocity/ directory type this in to a terminal:

./launch_track_trajectory.sh

This will start up the clients & servers for both joint & Cartesian velocity control:

  1. Type ready to move the robot to the start configuration.
  2. Try commands like up, down, left, right, etc. to move the endpoint of the robot in different directions.

Type options to see what is available.

🔝 Back to Top.

🤝 Contributing

Contributions to this repositore are welcome! Feel free to:

  1. Fork the repository,
  2. Implement your changes / improvements, then
  3. Issue a pull request.

If you're looking for ideas, you can always check the Issues tab for those with 🙋 [OPEN]. These are things I'd like to implement, but don't have time for. It'd be much appreciated, and you'll be tagged as a contributor 😎

🔝 Back to Top.

📑 Citing this Repository

If you find this code useful, spread the word by acknowledging it. Click on Cite this repository under the About section in the top-right corner of this page ↗️.

Here's a BibTeX reference:

@software{woolfrey_kuka_velocity_control_2025,
     author  = {Woolfrey, Jon},
     month   = apr,
     title   = {{K}uka {V}elocity {C}ontrol},
     url     = {https://github.com/Woolfrey/control_kuka_velocity},
     version = {1.0.0},
     year    = {2025}
}

Here's the automatically generated APA format:

Woolfrey, J. (2025). Kuka Velocity Control (Version 1.0.0). Retrieved from https://github.com/Woolfrey/control_kuka_velocity

🔝 Back to Top.

📜 License

This software package is licensed under the GNU General Public License v3.0 (GPL-3.0). You are free to use, modify, and distribute this package, provided that any modified versions also comply with the GPL-3.0 license. All modified versions must make the source code available and be licensed under GPL-3.0. The license also ensures that the software remains free and prohibits the use of proprietary restrictions such as Digital Rights Management (DRM) and patent claims. For more details, please refer to the full license text.

🔝 Back to Top.

About

A ROS2 package for controlling the Kuka iiwa14 using a the serial link action server & client repositories.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published