Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SkillManagerNode startup needs to turn on and off spinning #98

Open
matthias-mayr opened this issue Mar 1, 2024 · 0 comments
Open

SkillManagerNode startup needs to turn on and off spinning #98

matthias-mayr opened this issue Mar 1, 2024 · 0 comments
Assignees
Labels
enhancement ROS 2 Issue affects ROS 2

Comments

@matthias-mayr
Copy link
Member

Currently the SkillManagerNode that brings up the skill manager needs spinning during the __init__ function to register the skills with the world model:

# Note: The WMI must spin to set up the skill manager. During operation, the SM-node does the spinning
self._wmi = wmi.WorldModelInterface(node, agent_name, make_cache=True, allow_spinning=True)

However after we're done starting up the SkillManagerNode, we enter a rclpy.spin. This means that the WorldModelInterface that is used inside the SkillManager must not spin anymore.

def run(self):
# Note: The WMI must spin initially to set up the skill manager. During operation, the SM-node does the spinning
self.sm._wmi._allow_spinning = False
rclpy.spin(self)

Currently this is resolved by setting an allow_spinning variable in the WorldModelInterface that is used here:

def _call(self, service, msg):
future = service.call_async(msg)
if self._allow_spinning:
log.info("Service call to {} with spining".format(service.srv_name))
rclpy.spin_until_future_complete(self._node, future, timeout_sec=1.)
while not future.done():
log.warn("[{}]".format(self.__class__.__name__), "Waiting for reply from service {} ...".format(service.srv_name))
rclpy.spin_until_future_complete(self._node, future, timeout_sec=1.)
else:
while rclpy.ok() and not future.done():
pass
return future.result()

That works, but it's not a very sound solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ROS 2 Issue affects ROS 2
Projects
None yet
Development

No branches or pull requests

2 participants