Skip to content

Commit 39ba24d

Browse files
committed
Added jackhammer mode docs.
1 parent dac37b8 commit 39ba24d

File tree

3 files changed

+52
-11
lines changed

3 files changed

+52
-11
lines changed

docs/assets/libum.dll

41 KB
Binary file not shown.
Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,32 @@
1-
# Jackhammer Mode
1+
# Jackhammer Mode
2+
3+
This is an internal feature for rapidly oscillating the manipulator along an axis.
4+
5+
Jackhammer mode is not exposed in Ephys Link yet so this guide is to demonstrate how to test it in Python.
6+
7+
## 1. Get Ephys Link
8+
9+
Follow the instructions for [Installing for Development](index.md#installing-for-development). Or, just use a basic Python virtual environment (Python 3.13+ is required):
10+
11+
```powershell
12+
python -m venv venv
13+
.\venv\Scripts\Activate.ps1
14+
pip install .
15+
```
16+
17+
## 2. Change the Sensapex SDK to support Jackhammer Mode
18+
19+
You need to replace the `libum.dll` file in the Sensapex library folder. This is located at `<virtual env>\Lib\site-packages\sensapex`. If you made a virtual environment named `venv` in the previous step, it would be `.\venv\Lib\site-packages\sensapex`.
20+
21+
1. Download the custom SDK [here](../assets/libum.dll).
22+
2. (Optional) Make a backup of the old `libum.dll` in the Sensapex library folder by renaming it to `libum.dll.bck` or something like that.
23+
3. Copy the downloaded `libum.dll` to the Sensapex library folder.
24+
4. Modify `sensapex.py` in the Sensapex library folder to enable using this custom DLL. Set the `max_version` variable at line `398` to `(1, 510)`.
25+
26+
You can (optionally) test if everything is still working by [running Ephys Link](../usage/starting_ephys_link.md) and checking to see if it can still see and control Sensapex manipulators.
27+
28+
## 3. Use the test script
29+
30+
There's a test script in `scripts/jackhammer.py` that makes a call to Jackhammer mode.
31+
32+
In short jackhammer mode enables open-loop control of the manipulators by letting you turn on and off the motors in a sequence. You can define a "first" and "second" stage to cycle between. When the "thrust length" argument is positive, the manipulator will move in the forward direction and when it is negative it will move backwards. Thrust length is not a real unit but is some percentage representing the amount of movement a step should take.

scripts/jackhammer.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,26 @@
22

33
from sensapex import UMP
44

5-
um = UMP.get_ump()
5+
# Edit these parameters:
6+
DEVICE_ID = 3 # Manipulator ID.
7+
AXIS = 3 # Axis (0=X, 1=Y, 2=Z, 3=D).
8+
9+
NUMBER_OF_CYCLES = 20 # Number of time the first and second stage are repeated.
10+
11+
NUMBER_OF_STEP_IN_FIRST_STAGE = 10
12+
FIRST_STAGE_THRUST_LENGTH = 15 # +/- 0 - 100
613

7-
dev_id = 3
8-
axis = 3
14+
NUMBER_OF_STEP_IN_SECOND_STAGE = 5
15+
SECOND_STAGE_THRUST_LENGTH = -15 # +/- 0 - 100
16+
17+
# Do not edit below this line.
18+
um = UMP.get_ump()
919

1020
um.call("um_take_jackhammer_step",
11-
c_int(dev_id), # Device number
12-
c_char(axis), # Axis (0=X, 1=Y, 2=Z, 3=D)
13-
c_int(20), # Number of cycles
14-
c_int(10), # Number of steps in first-stage
15-
c_int(15), # Thrust length
16-
c_int(5), # Number of steps in second-stage
17-
c_int(-15)) # Thrust length
21+
c_int(DEVICE_ID),
22+
c_char(AXIS),
23+
c_int(NUMBER_OF_CYCLES),
24+
c_int(NUMBER_OF_STEP_IN_FIRST_STAGE),
25+
c_int(FIRST_STAGE_THRUST_LENGTH),
26+
c_int(NUMBER_OF_STEP_IN_SECOND_STAGE),
27+
c_int(SECOND_STAGE_THRUST_LENGTH))

0 commit comments

Comments
 (0)