Commit 4c20aee9 authored by Claudio Gomes's avatar Claudio Gomes
Browse files

Remove samples from start recording function.

parent ed9c5d9e
......@@ -39,7 +39,9 @@ pip install -e .
If using virtual box, then follow the instructions in https://www.universal-robots.com/download/
If using Hyper-V, then install ubuntu VM and then install the UR Robot simulator.
If using Hyper-V, then install ubuntu VM and then install the UR Robot simulator. Make use to use the quick create menu, so that you get clipboard and all that stuff for free (see https://superuser.com/questions/734880/hyper-v-clipboard-and-integration-services-in-ubuntu)
This package has been tested with **UR Sim for Linux 5.9.1**.
## Publishing this package on pypi
......
......@@ -13,6 +13,7 @@ from urinterface.recording import _recording_thread, STOP_REQUEST
_log = logging.getLogger("RobotConnection")
class RobotConnection:
# ip_adr: <string>
# controller_socket, dashboard_socket: <socket>
......@@ -144,13 +145,12 @@ class RobotConnection:
def record_samples(self, config_file='resources/record_configuration.xml', filename='robotdata.csv', overwrite=False,
frequency=500, samples=10, rtde_port=30004, RtdeConstructor=rtde.RTDE):
assert samples>0, "Expected positive number of samples. Use start_recording for samples=0."
self.start_recording(config_file, filename, overwrite, frequency, samples, rtde_port, RtdeConstructor)
assert samples > 0, "Expected positive number of samples. Use start_recording for samples=0."
self._start_recording(config_file, filename, overwrite, frequency, samples, rtde_port, RtdeConstructor)
self.stop_recording()
def start_recording(self, config_file='resources/record_configuration.xml', filename='robotdata.csv', overwrite=False,
frequency=500, samples=0, rtde_port=30004, RtdeConstructor=rtde.RTDE):
# TODO Check that the filename does not exist and give error in case it does.
def _start_recording(self, config_file, filename, overwrite,
frequency, samples, rtde_port, RtdeConstructor):
assert self.recording_thread is None, "Already logging."
# check for overwrite
......@@ -174,6 +174,11 @@ class RobotConnection:
)
self.recording_thread.start()
def start_recording(self, config_file='resources/record_configuration.xml', filename='robotdata.csv', overwrite=False,
frequency=500, rtde_port=30004, RtdeConstructor=rtde.RTDE):
samples=0
self._start_recording(config_file, filename, overwrite, frequency, samples, rtde_port, RtdeConstructor)
def stop_recording(self):
assert self.recording_thread is not None, "Should be recording data."
......
......@@ -19,7 +19,7 @@ class RobotConnectionTests(unittest.TestCase):
ur5e = RobotConnection("192.168.56.101",
controller_socket=DummySocket(),
dashboard_socket=DummyDashboardSocket())
ur5e.start_recording(config_file="resources/record_configuration.xml", overwrite=True, frequency=100, samples=0,
ur5e.start_recording(config_file="resources/record_configuration.xml", overwrite=True, frequency=100,
RtdeConstructor=DummyRTDE)
time.sleep(3.0)
......
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