def test_reduce_to_axes_make_none(self, values, axes, reduced, expected_values): a = Coordinate(values, axes) b = a.reduce_to_axes(reduced, make_none=True) assert list(b.axes) == list(axes) and list(b.values) == expected_values assert str(a) == str(Coordinate(values, axes))
def test_reduce_to_axes(self, test_input, remaining, expected): """ Test that only remaining axes are kept :param test_input: Input axes :param remaining: Function input :param expected: Expected remaining axes :return: """ a = Coordinate((1, -3, None), test_input) b = a.reduce_to_axes(remaining) assert "".join(list(b.axes)) == expected assert str(a) == str(Coordinate((1, -3, None), test_input))
def go_home(self, option="") -> None: """ Moves the robot to its current home point (current work coordinate origin or global safe position respectively) :return: """ if self.work_coordinate_active: # Acquire new zero coordinate zero = Coordinate(self.zero.values, self.zero.axes) if option != "": zero = zero.reduce_to_axes(option, make_none=True) # Acquire current position to determine robot orientation current_position = self.protocol.reader.get_current_xyzabc() zero.add_axis(current_position) zero.update_empty(current_position) # Move to zero self.linear_move_poll(zero) else: self.go_safe_pos()