spike.forcesensor
Force sensor mock APi
Classes
|
Force sensor mocking class |
- class spike.forcesensor.ForceSensor(port)
Force sensor mocking class
Class is accessed simultaneously by the user side thread and the ground truth update thread. It is therefore protected by a mutex
- __init__(port)
Contructor
- Parameters:
port (string ('A','B','C','D','E' or 'F')) – the hub port to which the sensor is connected
- wait_until_pressed()
Waits until the Force Sensor is pressed.
- wait_until_released()
Waits until the Force Sensor is released.
- is_pressed()
Tests whether the button on the sensor is pressed.
- Returns:
True if the sensor is pressed, False otherwise
- Return type:
boolean
- get_force_newton()
Retrieves the measured force, in newtons.
- Returns:
the measured force, specified in newtons
- Return type:
float
- get_force_percentage()
Retrieves the measured force as a percentage of the maximum force.
- Returns:
the measured force, given as a percentage.
- Return type:
integer [0,100]
- c_reset()
Reset function
Warning
This function is not part of the spike API. It is provided to update the component from scenario data and shall not be used by the end-user.
- c_read(force)
Update the force from scenario data
Warning
This function is not part of the spike API. It is provided to update the component from scenario data and shall not be used by the end-user.
- Parameters:
force (integer) – force in newton
- property port
Sets the component connection port
Warning
This function is not part of the spike API. It is provided to update the component from scenario data and shall not be used by the end-user.
- Parameters:
port (string) – the component port