Skip to content

Commit 712eb5b

Browse files
author
Tim Schneider
committed
Releasing GIL when fetching robot state
1 parent 21def9b commit 712eb5b

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

python/bind_robot.cpp

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ void bind_robot(py::module &m) {
7878
.def("homing_async", &Gripper::homingAsync, py::call_guard<py::gil_scoped_release>())
7979
.def("stop", &Gripper::stop, py::call_guard<py::gil_scoped_release>())
8080
.def("stop_async", &Gripper::stopAsync, py::call_guard<py::gil_scoped_release>())
81-
.def_property_readonly("state", &Gripper::state)
81+
.def_property_readonly("state", &Gripper::state, py::call_guard<py::gil_scoped_release>())
8282
.def_property_readonly("server_version", reinterpret_cast<uint16_t (Gripper::*)()>(&Gripper::serverVersion))
83-
.def_property_readonly("width", &Gripper::width)
84-
.def_property_readonly("is_grasped", &Gripper::is_grasped)
85-
.def_property_readonly("max_width", &Gripper::max_width);
83+
.def_property_readonly("width", &Gripper::width, py::call_guard<py::gil_scoped_release>())
84+
.def_property_readonly("is_grasped", &Gripper::is_grasped, py::call_guard<py::gil_scoped_release>())
85+
.def_property_readonly("max_width", &Gripper::max_width, py::call_guard<py::gil_scoped_release>());
8686

8787
py::class_<Robot>(m, "_RobotInternal")
8888
.def(
@@ -223,14 +223,18 @@ void bind_robot(py::module &m) {
223223
.def("set_load", &Robot::setLoad, "load_mass"_a, "F_x_Cload"_a, "load_inertia"_a)
224224
.def("stop", &Robot::stop)
225225
.def_property("relative_dynamics_factor", &Robot::relative_dynamics_factor, &Robot::setRelativeDynamicsFactor)
226-
.def_property_readonly("has_errors", &Robot::hasErrors)
227-
.def_property_readonly("current_pose", &Robot::currentPose)
228-
.def_property_readonly("current_cartesian_velocity", &Robot::currentCartesianVelocity)
229-
.def_property_readonly("current_cartesian_state", &Robot::currentCartesianState)
230-
.def_property_readonly("current_joint_state", &Robot::currentJointState)
231-
.def_property_readonly("current_joint_velocities", &Robot::currentJointVelocities)
232-
.def_property_readonly("current_joint_positions", &Robot::currentJointPositions)
233-
.def_property_readonly("state", &Robot::state)
226+
.def_property_readonly("has_errors", &Robot::hasErrors, py::call_guard<py::gil_scoped_release>())
227+
.def_property_readonly("current_pose", &Robot::currentPose, py::call_guard<py::gil_scoped_release>())
228+
.def_property_readonly(
229+
"current_cartesian_velocity", &Robot::currentCartesianVelocity, py::call_guard<py::gil_scoped_release>())
230+
.def_property_readonly(
231+
"current_cartesian_state", &Robot::currentCartesianState, py::call_guard<py::gil_scoped_release>())
232+
.def_property_readonly("current_joint_state", &Robot::currentJointState, py::call_guard<py::gil_scoped_release>())
233+
.def_property_readonly(
234+
"current_joint_velocities", &Robot::currentJointVelocities, py::call_guard<py::gil_scoped_release>())
235+
.def_property_readonly(
236+
"current_joint_positions", &Robot::currentJointPositions, py::call_guard<py::gil_scoped_release>())
237+
.def_property_readonly("state", &Robot::state, py::call_guard<py::gil_scoped_release>())
234238
.def_property_readonly("is_in_control", &Robot::is_in_control)
235239
.def_property_readonly("fci_hostname", &Robot::fci_hostname)
236240
.def_property_readonly("current_control_signal_type", &Robot::current_control_signal_type)

0 commit comments

Comments
 (0)