def cb_produce(self, request):
with self.lock_iteration:
# Check if we need a new learner
self.produce_init_learner()
focus = copy(self.focus)
rospy.loginfo("Learning node is requesting the current state")
state = self.get_state(GetSensorialStateRequest()).state
demonstrate = request.skill_to_demonstrate
if demonstrate == "":
rospy.loginfo("Learning node is producing...")
w = self.learning.produce(self.translator.get_context(state), focus)
else:
rospy.logwarn("Assessing {}...".format(demonstrate))
context = self.translator.get_context(state)
w = self.learning.produce(context, goal=demonstrate)
trajectory_matrix = self.translator.w_to_trajectory(w)
trajectory_msg = self.translator.matrix_to_trajectory_msg(trajectory_matrix)
self.ready_for_interaction = True
response = ProduceResponse(torso_trajectory=trajectory_msg)
return response
评论列表
文章目录