本文整理汇总了Python中Session.Session.previous_action方法的典型用法代码示例。如果您正苦于以下问题:Python Session.previous_action方法的具体用法?Python Session.previous_action怎么用?Python Session.previous_action使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session.Session
的用法示例。
在下文中一共展示了Session.previous_action方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Session import Session [as 别名]
# 或者: from Session.Session import previous_action [as 别名]
#.........这里部分代码省略.........
Interaction._is_programming = True
return [RobotSpeech.SWITCH_TO_EDIT_MODE, GazeGoal.NOD]
else:
return [RobotSpeech.ERROR_NO_SKILLS, GazeGoal.SHAKE]
def save_action(self, dummy=None):
'''Goes out of edit mode'''
self.session.save_current_action()
Interaction._is_programming = False
return [RobotSpeech.ACTION_SAVED + ' ' +
str(self.session.current_action_index), GazeGoal.NOD]
def create_action(self, dummy=None):
'''Creates a new empty action'''
self._move_to_arm_pose('take', 0)
self.world.clear_all_objects()
self.session.new_action()
Interaction._is_programming = True
return [RobotSpeech.SKILL_CREATED + ' ' +
str(self.session.current_action_index), GazeGoal.NOD]
def next_action(self, dummy=None):
'''Switches to next action'''
if (self.session.n_actions() > 0):
if self.session.next_action(self.world.get_frame_list()):
return [RobotSpeech.SWITCH_SKILL + ' ' +
str(self.session.current_action_index), GazeGoal.NOD]
else:
return [RobotSpeech.ERROR_NEXT_SKILL + ' ' +
str(self.session.current_action_index), GazeGoal.SHAKE]
else:
return [RobotSpeech.ERROR_NO_SKILLS, GazeGoal.SHAKE]
def previous_action(self, dummy=None):
'''Switches to previous action'''
if (self.session.n_actions() > 0):
if self.session.previous_action(self.world.get_frame_list()):
return [RobotSpeech.SWITCH_SKILL + ' ' +
str(self.session.current_action_index), GazeGoal.NOD]
else:
return [RobotSpeech.ERROR_PREV_SKILL + ' ' +
str(self.session.current_action_index), GazeGoal.SHAKE]
else:
return [RobotSpeech.ERROR_NO_SKILLS, GazeGoal.SHAKE]
def delete_all_steps(self, dummy=None):
'''Deletes all steps in the current action'''
if (self.session.n_actions() > 0):
if (Interaction._is_programming):
if self.session.n_frames() > 0:
self.session.clear_current_action()
self._undo_function = self._resume_all_steps
return [RobotSpeech.SKILL_CLEARED, GazeGoal.NOD]
else:
return [RobotSpeech.SKILL_EMPTY, None]
else:
return ['Action ' + str(self.session.current_action_index) +
RobotSpeech.ERROR_NOT_IN_EDIT, GazeGoal.SHAKE]
else:
return [RobotSpeech.ERROR_NO_SKILLS, GazeGoal.SHAKE]
def _resume_all_steps(self):
'''Resumes all steps after clearing'''
self.session.undo_clear()
return [RobotSpeech.ALL_POSES_RESUMED, GazeGoal.NOD]