Skip to content

Commit b4e492f

Browse files
authored
Merge pull request #28 from EmDash00/develop
2 parents 83984ab + 30dea31 commit b4e492f

15 files changed

Lines changed: 12388 additions & 247 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,4 @@ dmypy.json
136136

137137
# Cython debug symbols
138138
cython_debug/
139+
*tags*

LICENSE

Lines changed: 674 additions & 203 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,112 @@
11
# forcedimension-python
2+
3+
![license](https://img.shields.io/github/v/release/EmDash00/forcedimension-python?display_name=tag)
4+
5+
Written and Mantained By: The Rothlab at IU: Bloomington. Looking for the documentation? You can find it here:
6+
7+
https://forcedimension-python-documentation.readthedocs.io/en/latest/
8+
9+
## About
10+
11+
### What is ForceDimensionSDK?
12+
13+
ForceDimensionSDK is a set of C/C++ functions and drivers created by [Force Dimension](https://www.forcedimension.com/company/about) for working with haptic devices, used by many companies and researchers around the world.
14+
15+
### Why Python?
16+
17+
Up until this point, the drivers have been exclusively in C/C++ with Java bindings; however, a lot of research is conducted using Python and its various scientific computing libraries (numpy, scipy, sympy, pandas, matplotlib, etc).
18+
19+
This was also the case for Prof. Roth's lab at IU: Bloomington. Our lab group is primarily focused on researching human-robot, many times through the use of haptic devices.
20+
21+
The ForceDimensionSDK is a very well written interface that solves the problem of making applications that use haptic devices.
22+
23+
## Installation
24+
25+
#### Note: Available for Windows and Linux only.
26+
27+
### PyPI Package (recommended)
28+
29+
```
30+
pip install forcedimension
31+
```
32+
33+
`numpy` is an optional dependency. If you want to install that as well:
34+
35+
```
36+
pip install forcedimension\[numpy\]
37+
```
38+
39+
40+
41+
#### Install the [ForceDimensionSDK](https://www.forcedimension.com/software/sdk) for your computer.
42+
By default, the bindings will search in the following system-wide install locations.
43+
44+
* System-wide install locations (Linux):
45+
- `/usr/local/lib`
46+
- `/usr/lib`
47+
* System-wide install location (Windows):
48+
- `C:\Program Files\ForceDimension\sdk-X.X.X\lib`
49+
50+
##### Non-system-wide Installs
51+
52+
If you do not wish to make a system-wide installation set the FORCEDIM_SDK environment variable to the root folder of the ForceDimensionSDK installation (the `lib` folder should be one level under the root installation folder)
53+
54+
##### System-wide install for Linux
55+
56+
This requires extra steps since the Makefile for the ForceDimensionSDK does not offer a `make install` target for a system-wide install.
57+
58+
1. Copy all files from `lib/release/lin-*-gcc` to `/usr/local/lib`
59+
60+
2. Copy all files from `include` to `/usr/local/include`
61+
62+
3. MAKE SURE the libraries have `755` level access using `chmod`. If they don't applications cannot link or load them.
63+
64+
4. Make a symbolic link to libdhd and libdrd that drop the version so they end in `.so`, so that the file names are `libdhd.so` and `libdrd.so`
65+
66+
These steps can be automated by adding these targets to the Makefile.
67+
68+
```makefile
69+
install:
70+
cp include/* /usr/local/include
71+
cp lib/release/lin-*-gcc/* /usr/local/lib
72+
chmod 755 /usr/local/lib/libdhd.so.X.X.X
73+
chmod 755 /usr/local/lib/libdrd.so.X.X.X
74+
chmod 755 /usr/local/lib/libdhd.a
75+
chmod 755 /usr/local/lib/libdrd.a
76+
ln -s /usr/local/lib/libdhd.so /usr/local/lib/libdhd.so.X.X.X
77+
ln -s /usr/local/lib/libdrd.so /usr/local/lib/libdrd.so.X.X.X
78+
```
79+
80+
```makefile
81+
uninstall:
82+
rm /usr/local/include/dhdc.h
83+
rm /usr/local/include/drdc.h
84+
rm /usr/local/lib/libdhd.a
85+
rm /usr/local/lib/libdhd.so.3.9.1
86+
rm /usr/local/lib/libdhd.so
87+
rm /usr/local/lib/libdrd.a
88+
rm /usr/local/lib/libdrd.so.3.9.1
89+
rm /usr/local/lib/libdrd.so
90+
```
91+
#### Additional Setup
92+
93+
##### Windows
94+
95+
Device Manager is a Windows tool that can be used to see connected devices, their statuses, driver information, and driver installation.
96+
97+
The easiest way to bring it up is to use the windows search bar on Windows 10 and search “Device Manager”. Regardless of the method used, you will need administrator level privileges to launch the Device Manager.
98+
99+
Find your haptics device and right-click on it and open `Properities`. Do `Update driver>Browse my computer for driver software` and specify the drivers listed under the `drivers\usb` in the root install directory. Try restarting if drivers are not detected or changes do not take place.
100+
101+
Your device should now be listed under `USB Haptic Devices`
102+
103+
##### Linux
104+
105+
Add a udev rule under `/etc/udev/rules.d` for your device. Here's an explaination from the [Arch Linux Wiki](https://wiki.archlinux.org/index.php/Udev#Waking_from_suspend_with_USB_device) about what they are and here's a good udev file for the [Novint Falcon](https://github.com/libnifalcon/libnifalcon/blob/master/linux/40-novint-falcon-udev.rules).
106+
107+
A good way to find the USB bus of the device is by unplugging the device, doing `ls -l /dev/bus/usb/00*`, replugging, the device and then performing it again.
108+
109+
MAKE SURE you unplug the USB and not just the power because the unpowering the device does not unpower the USB communications (which get power through the computer).
110+
111+
Then perform `lsusb` and note the ID of your device, which is in the format `idVendor:idPorduct`
112+

0 commit comments

Comments
 (0)