optoforce
Project description
from optoforce import OptoForce
A package which simplifies connecting to and reading from optoforce sensors, using Python
This is mainly here to accompany my blog posts on communicating with embedded systems using python, where the optoforce sensor is an example. I hope this package is simple enough to serve as a template for others. I see that there are other packages on GitHub which help with this
I don't imagine it'll have many users, since the optoforce website redirects to another company which doesn't even mention them, and that company's optoforce page is pretty blank. BUT I use one, so perhaps there are others?
Installation
python -m pip install optoforce
Usage
From a python script:
from optoforce import OptoForce
with OptoForce(speed_hz=100, filter_hz=15, reset_on_thing=False) as force_sensor:
fx, fy, fx = force_sensor.read(only_latest_data=False)
do_stuff_with_force_readings(fx, fy, fz)
Or from the command line, to log to a file:
$ python -m optoforce.py --filename force-data.csv
Optoforce models supported
Only the single-channel 3 axis force sensor, though adding support for the others should be straightforward
Sources
OptoForce General DAQ - USB,CAN,UART - v1.7.pdf
was used to implement this module
The force scale parameters are from SensitivityReport-PFH0A052.pdf
A friend mentioned that I might not be allowed to share those docs, since the company is quite secretive, and I unfortunately haven't seen them online
Common bugs
If you get permission errors when trying to open the serial port and you run linux, try running the code below (source)
$ sudo chmod 666 /dev/ttyACM0 # replace with your serial port
Publishing a new version
Install flit, which makes publishing packages ridiculously easy. Next, increase the __version__
number in optoforce/__init__.py
. Then, create a (local) tag for the commit and publish:
# make a local tag with message "release v0.0.1"
$ git tag -a v0.0.1 -m "release v0.0.1"
# push local tag to remote repo
$ git push origin v0.0.1
# generate files into dist/ and upload them to pypi
$ flit publish
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file optoforce-0.0.1.tar.gz
.
File metadata
- Download URL: optoforce-0.0.1.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.23.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b819b0ac1a6721eb72cdef7801b41f5da88ec59d3a727d11b3937c0c5cffb7f |
|
MD5 | 0a4b4170482aa298b72a33a9eaadee02 |
|
BLAKE2b-256 | abf5e38444a95b68aaa55b40f558d6daa48d223b9dcd2e9e912d10b8eb272563 |
File details
Details for the file optoforce-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: optoforce-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.23.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bd08d805ced7f6ed74868cfbfbd8f2a7fe607350bd094461708f606c1e0bd3a |
|
MD5 | a429c8e0d2ac44cd38bc95627172028c |
|
BLAKE2b-256 | 416eb438d39b2c7628ea9ea8e95496208a5dd1f56ff9e2177b33315c9272fb4b |