Skip to content

Commit 4a366e4

Browse files
authored
Store joint_states subscriber as instance variable (#632)
1 parent c090d2e commit 4a366e4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

skrobot/interfaces/ros/base.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,16 @@ def __init__(self, robot,
110110
self.namespace = namespace
111111
self._joint_state_msg = None
112112
if self.namespace:
113-
rospy.Subscriber('{}/{}'.format(
113+
self.joint_states_sub = rospy.Subscriber('{}/{}'.format(
114114
self.namespace, joint_states_topic),
115115
JointState,
116116
callback=self.joint_state_callback,
117117
queue_size=joint_states_queue_size)
118118
else:
119-
rospy.Subscriber(joint_states_topic, JointState,
120-
callback=self.joint_state_callback,
121-
queue_size=joint_states_queue_size)
119+
self.joint_states_sub = rospy.Subscriber(
120+
joint_states_topic, JointState,
121+
callback=self.joint_state_callback,
122+
queue_size=joint_states_queue_size)
122123

123124
self.controller_table = {}
124125
self.controller_param_table = {}

0 commit comments

Comments
 (0)