frankaemika/libfranka

Reading RobotState while a controller is running

Closed this issue · 2 comments

I have an implementation of a controller which uses the control method of franka_hw to move the robot.

I have written another node that connects to the robot by franka::Robot robot(robot_ip); and uses robot.readOnce() to see the current state of the robot. However, I noticed that I can't run both of these codes at the same time and a franka::NetworkException´ and ´libfranka: UDP receive: Timeout is raised if I do so.

Is there any way however to read the robot's state while a controller is already running?

ask the same question

As you said the readOnce cannot be called while controlling the robot. When a controller is running you get the RobotState in the control callback. You can pass it to another thread by protecting it with a mutex. See the joint_impedance_example