Skip to content

Commit

Permalink
Fix: Skill description service cb could fail
Browse files Browse the repository at this point in the history
Duration.sleep does not exist
However there is no point in creating this service before the skills are
loaded anyway.
  • Loading branch information
matthias-mayr committed Mar 1, 2024
1 parent 50a83df commit ed5bc90
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions skiros2_skill/skiros2_skill/ros/skill_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,8 @@ def __init__(self):
self.sm.observe_tick(self._on_tick)

# Init skills
self._initialized = False
self._getskills = self.create_service(srvs.ResourceGetDescriptions, self._node_name + '/get_skills', self._get_descriptions_cb)
self._init_skills()
# Duration(nanoseconds=5 * (10**8)).sleep()
self._initialized = True
self._getskills = self.create_service(srvs.ResourceGetDescriptions, self._node_name + '/get_skills', self._get_descriptions_cb)

# Start communications
self._command = self.create_service(srvs.SkillCommand, self._node_name + '/command', self._command_cb)
Expand Down Expand Up @@ -494,8 +491,6 @@ def _get_descriptions_cb(self, msg, to_ret):
"""
@brief Returns available skills. Called when receiving a command on ~/get_descriptions
"""
while not self._initialized:
Duration(nanoseconds=(10**8)).sleep()
for s in self.sm.skills:
to_ret.list.append(skill2msg(s))
return to_ret
Expand Down

0 comments on commit ed5bc90

Please sign in to comment.