libfranka Example Code: Unable to Set Realtime Scheduling – Operation Not Permitted
When running the following command:
./communication_test 172.16.0.2
You might encounter this error:
unable to set realtime scheduling: Operation not permitted Solution
To resolve this, simply add sudo before the command:
sudo ./communication_test 172.16.0.2
Error in ROS Launch Example
When running another example using ROS launch:
roslaunch franka_example_controllers move_to_start.launch robot_ip:=172.16.0.2
The same error appears:
unable to set realtime scheduling: Operation not permitted
Why Does This Happen?
The real-time kernel requires sudo privileges. However, when launching a ROS file using roslaunch, there is no direct way to add sudo to the internal commands.
Alternative Solution: Use Root Mode
Instead of adding sudo manually for each command, enter root mode and execute the launch file directly:
su
Enter your root password when prompted
roslaunch franka_example_controllers move_to_start.launch robot_ip:=172.16.0.2
Once in root mode, you no longer need sudo for the communication_test command. You can simply run:
./communication_test 172.16.0.2
This ensures the robotic arm functions correctly.
How to Enter Root Mode
To switch to root mode, use:
su
You’ll be prompted to enter the root password.
If You Haven’t Set a Root Password Before First, set a new root password with:
sudo passwd root
Then, enter root mode with:
su
Now, you should be able to run libfranka’s examples without issues.
Copyright: Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
Author: Jerry
Posted on: February 22, 2025