def clamp_command (self): if self.clamp_var.get (): self.mimot.clamp ('a0', 0x60, 0x100) self.mimot.clamp ('a1', 0x60, 0x100) else: self.mimot.goto_pos ('a0', 0) self.mimot.goto_pos ('a1', 0) def elevator_command (self): if self.elevator_var.get (): pos = 7089 else: pos = 0 self.asserv.goto_pos ('a0', pos) def gate_command (self): if self.gate_var.get (): pos = -0x1d6b else: pos = 0 self.asserv.goto_pos ('a1', pos) def loader_up_command (self): self.io.loader ('u') def loader_down_command (self): self.io.loader ('d') if __name__ == '__main__': run ('marcel', TestSimuControl)
self.backward_button.pack () self.goto_var = IntVar () self.goto_button = Checkbutton (self.control_frame, text = 'Goto FSM', variable = self.goto_var) self.goto_button.pack () self.table_view.bind ('<1>', self.move) self.table_view.bind ('<3>', self.orient) def fsm_debug (self): self.io.fsm_debug () def asserv_block (self): self.asserv.block () def move (self, ev): pos = self.table_view.screen_coord ((ev.x, ev.y)) if self.goto_var.get (): self.io.goto (pos[0], pos[1], self.backward_var.get ()) else: self.asserv.goto (pos[0], pos[1], self.backward_var.get ()) def orient (self, ev): x, y = self.table_view.screen_coord ((ev.x, ev.y)) robot_pos = self.robot_model.position.pos if robot_pos is not None: a = math.atan2 (y - robot_pos[1], x - robot_pos[0]) self.asserv.goto_angle (a) if __name__ == '__main__': run ('apbirthday', TestSimuControl)
def rotation_cw_command (self): self.mimot.speed_pos ('a1', self.ROTATION_STROKE / 2) def rotation_ccw_command (self): self.mimot.speed_pos ('a1', -self.ROTATION_STROKE / 2) def clamp_move_command (self): self.io.clamp_move (self.clamp_pos_scale.get ()) def clamp_move_element_command (self): self.io.clamp_move_element (self.clamp_pos_scale.get (), self.clamp_to_scale.get ()) def doors_command (self): for i in (0, 2, 3, 5): self.io.door (i, not self.doors_var.get ()) def drop_command (self): if self.drop_var.get (): if self.backward_var.get (): order = 'drop_backward' else: order = 'drop_forward' else: order = 'drop_clear' self.io.drop (order) if __name__ == '__main__': run ('robospierre', TestSimuControl)
else: self.asserv.goto (pos[0], pos[1], self.backward_var.get ()) def orient (self, ev): x, y = self.table_view.screen_coord ((ev.x, ev.y)) robot_pos = self.robot_model.position.pos if robot_pos is not None: a = math.atan2 (y - robot_pos[1], x - robot_pos[0]) self.asserv.goto_angle (a) def lower_clamp_rotate_command (self): self.mimot.speed_pos ('a0', self.LOWER_CLAMP_ROTATION_STROKE / 2) def tree_detected(self): self.io.tree_detected() def stop_tree_approach(self): self.io.stop_tree_approach() def empty_tree(self): self.io.empty_tree() def robot_is_back(self): self.io.robot_is_back() def unblock_bottom_clamp(self): self.io.unblock_bottom_clamp() if __name__ == '__main__': run ('guybrush', TestSimuControl)