Skip to content

Commit 2ea7ee6

Browse files
authored
Put all callbacks in the same Reentrant Callback Group (#90)
* Put all callbacks into one ReentrantCallbackGroup * Linting
1 parent 913770e commit 2ea7ee6

File tree

8 files changed

+10
-7
lines changed

8 files changed

+10
-7
lines changed

ada_feeding/ada_feeding/behaviors/move_to.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import py_trees
1616
from pymoveit2 import MoveIt2, MoveIt2State
1717
from pymoveit2.robots import kinova
18-
from rclpy.callback_groups import ReentrantCallbackGroup
1918
from rclpy.node import Node
2019
from rclpy.qos import QoSPresetProfiles
2120
from sensor_msgs.msg import JointState
@@ -121,14 +120,12 @@ def __init__(
121120
# Create MoveIt 2 interface for moving the Jaco arm. This must be done
122121
# in __init__ and not setup since the MoveIt2 interface must be
123122
# initialized before the ROS2 node starts spinning.
124-
callback_group = ReentrantCallbackGroup()
125123
self.moveit2 = MoveIt2(
126124
node=self.node,
127125
joint_names=kinova.joint_names(),
128126
base_link_name=kinova.base_link_name(),
129127
end_effector_name="forkTip",
130128
group_name=kinova.MOVE_GROUP_ARM,
131-
callback_group=callback_group,
132129
)
133130

134131
# Subscribe to the joint state and track the distance to goal while the

ada_feeding/ada_feeding/behaviors/toggle_collision_object.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import py_trees
1313
from pymoveit2 import MoveIt2
1414
from pymoveit2.robots import kinova
15-
from rclpy.callback_groups import ReentrantCallbackGroup
1615
from rclpy.node import Node
1716

1817
# Local imports
@@ -56,14 +55,12 @@ def __init__(
5655
# Create MoveIt 2 interface for moving the Jaco arm. This must be done
5756
# in __init__ and not setup since the MoveIt2 interface must be
5857
# initialized before the ROS2 node starts spinning.
59-
callback_group = ReentrantCallbackGroup()
6058
self.moveit2 = MoveIt2(
6159
node=self.node,
6260
joint_names=kinova.joint_names(),
6361
base_link_name=kinova.base_link_name(),
6462
end_effector_name="forkTip",
6563
group_name=kinova.MOVE_GROUP_ARM,
66-
callback_group=callback_group,
6764
)
6865

6966
def update(self) -> py_trees.common.Status:

ada_feeding/scripts/ada_watchdog.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def __init__(self) -> None:
4545
"""
4646
super().__init__("ada_watchdog")
4747

48+
self._default_callback_group = rclpy.callback_groups.ReentrantCallbackGroup()
49+
4850
# Load parameters
4951
self.__load_parameters()
5052

ada_feeding/scripts/create_action_servers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ def __init__(self) -> None:
8989
"""
9090
super().__init__("create_action_servers")
9191

92+
self._default_callback_group = rclpy.callback_groups.ReentrantCallbackGroup()
93+
9294
# Read the parameters that specify what action servers to create.
9395
action_server_params = self.read_params()
9496

ada_feeding/scripts/dummy_ft_sensor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ def __init__(self, rate_hz: float = 100.0) -> None:
5555
"""
5656
super().__init__("dummy_ft_sensor")
5757

58+
self._default_callback_group = rclpy.callback_groups.ReentrantCallbackGroup()
59+
5860
# Get the mean and standard deviaion of the distribution
5961
self.mean = self.declare_parameter(
6062
"mean",

ada_feeding_perception/ada_feeding_perception/face_detection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ def __init__(
5252
"""
5353
super().__init__("face_detection")
5454

55+
self._default_callback_group = rclpy.callback_groups.ReentrantCallbackGroup()
56+
5557
# Read the parameters
5658
# NOTE: These parameters are only read once. Any changes after the node
5759
# is initialized will not be reflected.

ada_feeding_perception/ada_feeding_perception/segment_from_point.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ def __init__(self) -> None:
5858

5959
super().__init__("segment_from_point")
6060

61+
self._default_callback_group = rclpy.callback_groups.ReentrantCallbackGroup()
62+
6163
# Check if cuda is available
6264
self.device = "cuda" if torch.cuda.is_available() else "cpu"
6365

ada_feeding_perception/launch/ada_feeding_perception.launch.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from launch import LaunchDescription
1212
from launch.actions import DeclareLaunchArgument
1313
from launch.conditions import IfCondition
14-
from launch.launch_context import LaunchContext
1514
from launch.substitutions import LaunchConfiguration, PythonExpression
1615

1716

0 commit comments

Comments
 (0)