From e920927e937cffbc7e85ca55d5e59ae5b88d3b75 Mon Sep 17 00:00:00 2001 From: PIERROOOTT Date: Thu, 1 Feb 2024 15:15:01 +0100 Subject: [PATCH] docs: minor adjustment of the docstrings --- examples/sample_protection.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/sample_protection.py b/examples/sample_protection.py index 9df1263..f6ba744 100644 --- a/examples/sample_protection.py +++ b/examples/sample_protection.py @@ -3,7 +3,12 @@ sample to the machine. In this example, the motor is driven in function of the level of stress in the -sample. This Machine Block drives the motor in speed here. +sample. If the force measured by the load cell is greater (resp. lesser) than a +threshold value (10 N), the motor will move at speed = 0.5 mm/s in the +appropriate direction so that the force stays lesser (resp. greater) than the +threshold value. + +This Machine Block drives the motor in speed here. The InOut Block measured the force applied, and also outputs it to a Grapher Block and to a Recorder Block. @@ -16,7 +21,8 @@ gain = 3.26496001e+05 save_folder = '/home/essais/Desktop/margotin/' - speed = 1 + speed = 0.5 # Speed in mm/s + thresh = 10 # Threshold force in N # This IOBlock gets the current force measured by a 1000N load cell with a # Phidget Wheatstone Bridge, and sends it to downstream Blocks. @@ -51,11 +57,11 @@ # The path drive the Machine in function of the force measured by the load # cell. gen = crappy.blocks.Generator([{'type': 'Conditional', - 'condition1': 'F(N)>10', - 'condition2': 'F(N)<-10', + 'condition1': f'F(N)>{thresh}', + 'condition2': f'F(N)<-{thresh}', 'value0': 0, - 'value1': -0.5, - 'value2': 0.5}]) + 'value1': -speed, + 'value2': speed}]) # This Grapher displays the force as measured by the LoadCell Block. graph_force = crappy.blocks.Grapher(('t(s)', 'F(N)'))