Generate trajectories for soft robots from a file
Project description
sorotraj
Generate trajectories for soft robots from yaml files (accompanies the Ctrl-P project)
Installation
Install the release version
This package is on pypi, so anyone can install it with pip: pip install sorotraj
Install the most-recent development version
- Clone the package from the github repo
- Navigate into the main folder
pip install .
Usage
Minimal Example
import sorotraj
file_to_use = 'traj_setup/setpoint_traj_demo'
build = sorotraj.TrajBuilder()
build.load_traj_def(file_to_use)
traj = build.get_trajectory()
print(traj)
Check out the examples folder for more detailed usage examples
How to Set Up Trajectories:
Trajectories are made of three parts:
- main: used in a looping trajectory
- prefix: happens once before the main part
- suffix: happens once after the main part
Here's an example of what that might look like defined in a yaml file:
config:
setpoints:
# [time, finger1, finger2, n/c, n/c]
main:
- [0.0, 10, 12, 14, 16]
- [1.0, 20, 0, 0, 0]
- [2.0, 0, 20, 0, 0]
- [3.0, 0, 0, 20, 0]
- [4.0, 0, 0, 0, 20]
- [5.0, 10, 12, 14, 16]
prefix:
- [0.000, 0, 0, 0, 0]
- [1.0, 10, 12, 14, 16]
suffix:
- [2.000, 10, 12, 14, 16]
- [3.0, 0, 0, 0, 0]
There are currently three types of ways to generate the main part of a trajectory:
- direct: You enter waypoints directly
- Define waypoints as a list of lists of the form:
[time in sec], [a_1], [a_2], ..., [a_n]
- Define waypoints as a list of lists of the form:
- interp: Interpolate between waypoints
- Define waypoints as a list of lists of the form:
[time in sec], [a_1], [a_2], ..., [a_n]
- Set a few more parameters:
- interp_type: (
string
) The type of interpolation to use. right now types include:'linear'
,'cubic'
, and'none'
- subsample_num: (
int
) The total number of subsamples over the whole trajectory
- interp_type: (
- Define waypoints as a list of lists of the form:
- waveform: Generate waveforms (very basic, still just in-phase waveforms across all channels)
- Set up the waveform:
- waveform_type: (
string
) Types include: square-sampled, square, sin, cos-up, cos-down, triangle, sawtooth-f, and sawtooth-r - waveform_freq: (
float
) Frequency in Hertz - waveform_max: (
float
) A list of the maximum values for the waveform, in the form:[20, 0, 15, 5]
- waveform_min: (
float
) A list of the minimum values for the waveform, in the form:[0, 20, 0, 15]
- waveform_type: (
- Set a few more parameters:
- subsample_num: (
int
) The total number of subsamples over the whole trajectory - num_cycles: (
int
) The number of cycles of the waveform - channels: (
bool
) Flags to turn channels on and off. A list of the form:[1,1,0,0]
- subsample_num: (
- Set up the waveform:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sorotraj-0.5.tar.gz
(5.9 kB
view details)
Built Distribution
File details
Details for the file sorotraj-0.5.tar.gz
.
File metadata
- Download URL: sorotraj-0.5.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e034e78381ede7391fb3567e3a831b4ff22c5fdbdab50f664eb1e0102ccbf625 |
|
MD5 | 853c075d72d11133fe4e0061a3a5a018 |
|
BLAKE2b-256 | cd79e23e99a6fe43fc8f0fa8b9b811426d18e10281045e3b8ffc3d10018efc9d |
File details
Details for the file sorotraj-0.5-py3-none-any.whl
.
File metadata
- Download URL: sorotraj-0.5-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef7a26743f9a7c2ae5d08c174522dd630ee35872fa458fe44ad82ccdc4f3ea72 |
|
MD5 | 7d0c800e6c59384f9cd1627a77322246 |
|
BLAKE2b-256 | 14dc5bf5c7940acbbd08aea3e0037019475089f7413000713dcff91fa9d31a28 |