diff --git a/single_ursim_control/plugins/ur_rtde_plugin.py b/single_ursim_control/plugins/ur_rtde_plugin.py index 032e071..be5f424 100644 --- a/single_ursim_control/plugins/ur_rtde_plugin.py +++ b/single_ursim_control/plugins/ur_rtde_plugin.py @@ -50,42 +50,6 @@ class CombinedRobotInterface: class URRTDEMoveJCommand(AbstractCommand): - def __init__(self, - logger: logging.Logger, - robot: CombinedRobotInterface, - pose: List[float], - speed: float, - acceleration: float): - # TODO: validations - - self._logger = logger - self._robot = robot - self._pose = pose - self._speed = speed - self._acceleration = acceleration - - def execute(self): - self._logger.debug(f"Moving robot arm: MoveJ to {self._pose} s: {self._speed} a: {self._acceleration}") - self._robot.robot_c.moveJ(self._pose, self._speed, self._acceleration) - self._logger.debug("Done moving") - - def abort(self): - # TODO - pass - - def describe(self) -> dict: - return { - "command": "moveJ", - "params": { - "pose": self._pose, - "speed": self._speed, - "acceleration": self._acceleration - } - } - - -class URRTDEMoveLCommand(AbstractCommand): - def __init__(self, logger: logging.Logger, robot: CombinedRobotInterface, @@ -101,8 +65,44 @@ class URRTDEMoveLCommand(AbstractCommand): self._acceleration = acceleration def execute(self): - self._logger.debug(f"Moving robot arm: MoveL to {self._q} s: {self._speed} a: {self._acceleration}") - self._robot.robot_c.moveL(self._q, self._speed, self._acceleration) + self._logger.debug(f"Moving robot arm: MoveJ to {self._q} s: {self._speed} a: {self._acceleration}") + self._robot.robot_c.moveJ(self._q, self._speed, self._acceleration) + self._logger.debug("Done moving") + + def abort(self): + # TODO + pass + + def describe(self) -> dict: + return { + "command": "moveJ", + "params": { + "q": self._q, + "speed": self._speed, + "acceleration": self._acceleration + } + } + + +class URRTDEMoveLCommand(AbstractCommand): + + def __init__(self, + logger: logging.Logger, + robot: CombinedRobotInterface, + pose: List[float], + speed: float, + acceleration: float): + # TODO: validations + + self._logger = logger + self._robot = robot + self._pose = pose + self._speed = speed + self._acceleration = acceleration + + def execute(self): + self._logger.debug(f"Moving robot arm: MoveL to {self._pose} s: {self._speed} a: {self._acceleration}") + self._robot.robot_c.moveL(self._pose, self._speed, self._acceleration) self._logger.debug("Done moving") def abort(self): @@ -113,7 +113,7 @@ class URRTDEMoveLCommand(AbstractCommand): return { "command": "moveL", "params": { - "q": self._q, + "pose": self._pose, "speed": self._speed, "acceleration": self._acceleration } @@ -126,8 +126,8 @@ class URRTDEMoveJCompiler(AbstractCommandCompiler): self._logger = logger self._robot = robot - def compile(self, pose: List[float], speed: float = 1.05, acceleration: float = 1.4) -> AbstractCommand: - return URRTDEMoveJCommand(self._logger, self._robot, pose, speed, acceleration) + def compile(self, q: List[float], speed: float = 1.05, acceleration: float = 1.4) -> AbstractCommand: + return URRTDEMoveJCommand(self._logger, self._robot, q, speed, acceleration) class URRTDEMoveLCompiler(AbstractCommandCompiler): @@ -136,8 +136,8 @@ class URRTDEMoveLCompiler(AbstractCommandCompiler): self._logger = logger self._robot = robot - def compile(self, q: List[float], speed: float = 0.25, acceleration: float = 1.2) -> AbstractCommand: - return URRTDEMoveLCommand(self._logger, self._robot, q, speed, acceleration) + def compile(self, pose: List[float], speed: float = 0.25, acceleration: float = 1.2) -> AbstractCommand: + return URRTDEMoveLCommand(self._logger, self._robot, pose, speed, acceleration) class URRTDEPlugin(AbstractPlugin): @@ -147,7 +147,7 @@ class URRTDEPlugin(AbstractPlugin): self._logger = logging.getLogger("plugin").getChild("ur_rtde") self._robot = CombinedRobotInterface(Config.ROBOT_ADDRESS) - logging.info(f"Connected to robot at {Config.ROBOT_ADDRESS}") + self._logger.info(f"Connected to robot at {Config.ROBOT_ADDRESS}") def load_compilers(self) -> Dict[str, AbstractCommandCompiler]: return {