Commit ed9c5d9e authored by Daniella Tola's avatar Daniella Tola
Browse files

added movel and screwdriving functions

parent 7d3db0cf
......@@ -68,7 +68,7 @@ class RobotConnection:
reply = self._receive_ascii_bytes(self.dashboard_socket)
assert reply.startswith("Program running: false"), reply
def movej(self, q=np.zeros(6), v=None, a=None, t=None, r=None):
def _move(self, q=np.zeros(6), v=None, a=None, t=None, r=None):
# ensure that the robot is in the remote control mode
self._ensure_ready()
q_string = np.array2string(q, precision=6, separator=',').replace(" ", "")
......@@ -85,11 +85,48 @@ class RobotConnection:
opts_string = ", ".join(opts)
if len(opts) > 0:
opts_string = ", " + opts_string
return q_string, opts_string
program = "movej("+q_string+opts_string+")\n"
def _send_ctrl_cmd(self, program):
self._send_ascii_bytes(program, self.controller_socket)
self._ensure_ready()
def movej(self, q=np.zeros(6), v=None, a=None, t=None, r=None):
q_string, opts_string = self._move(q,v,a,r)
program = "movej("+q_string+opts_string+")\n"
self._send_ctrl_cmd(program)
def movel(self, q=np.zeros(6), v=None, a=None, t=None, r=None):
q_string, opts_string = self._move(q,v,a,r)
program = "movel("+q_string+opts_string+")\n"
self._send_ctrl_cmd(program)
def screw_driving(self, f, v_limit):
"""
f: The amount of force the robot will exert along the TCP Z-axis (Newtons).
v_limit: Maximum TCP velocity along the Z axis (m/s).
"""
self._ensure_ready()
program = "screw_driving(" + str(f) + "," + str(v_limit) + ")\n"
self._send_ctrl_cmd(program)
def end_screw_driving(self):
self._ensure_ready()
program = "end_screw_driving()\n"
self._send_ctrl_cmd(program)
def zero_ftsensor(self):
self._ensure_ready()
program = "zero_ftsensor()\n"
self._send_ctrl_cmd(program)
def sleep(self, t):
self._ensure_ready()
program = "sleep(" + str(t) + ")\n"
self._send_ctrl_cmd(program)
def load_program(self, program_name):
self._send_ascii_bytes(f"load {program_name}\n", self.dashboard_socket)
return self.dashboard_socket.recv(1024).decode().startswith("Loading program: ")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment