Skip to content

Commit b917a6c

Browse files
committed
Update README.md
1 parent 4cd2158 commit b917a6c

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/prpy/tsr/README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,28 @@ Finally, we compose these into a chain
8383
ipython> tsrchain = prpy.tsr.TSRChain(sample_start=False, sample_goal=False, constrain=True,
8484
TSRs = [constraint1, constraint2])
8585
```
86-
Similar to the TSRs, we can sample and compute distance to chains using the ```sample``` and ```distance``` functions respectively.
86+
Similar to the TSRs, we can sample and compute distance to chains using the ```sample``` and ```distance``` functions respectively. The ```sample_start```, ```sample_goal``` and ```constrain``` flags will be explained in the next section.
8787

8888
## Prpy Planning support for TSRs
89+
Several of the planners in the prpy [planning pipeline](https://github.com/personalrobotics/prpy/tree/master/src/prpy/planning) have some support for using TSRs for defining constriants through the ```PlanToTSR``` method. The method accepts as a list of ```TSRChain``` objects. The ```sample_start```, ```sample_goal``` and ```constrain``` flags on the each ```TSRChain``` indicate to the planner how the chain should be used.
90+
91+
### Example: Planning to a single TSR
92+
Consider the example of grasping a bottle. Given our ```grasp_tsr``` we would now like to generate a plan that moves the robot to any configuration such that the end-effector meets the constraint defined by the tsr. The following code can be used to do this:
93+
```python
94+
ipython> tsrchain = prpy.tsr.TSRChain(sample_goal=True, sample_start=False, constrain=False,
95+
TSR = grasp_tsr)
96+
```
97+
Defining ```sample_goal=True``` tells the planner to apply the constraint only to the last point in the plan. Now we can call the planner:
98+
```python
99+
ipython> traj = robot.PlanToTSR([tsrchain])
100+
```
101+
102+
### Example: Planning to a set of TSRs
103+
Now imagine we had to TSRs, ```grasp1_tsr``` and ```grasp2_tsr``` the each defined a set of valid configurations for grasping. We can ask the planner to generate a plan to any configuration that meets either the ```grasp1_tsr``` or the ```grasp2_tsr``` constraint in the following way:
104+
```python
105+
ipython> tsrchain1 = prpy.tsr.TSRChain(sample_goal=True, sample_start=False, constrain=False,
106+
TSR = grasp1_tsr)
107+
ipython> tsrchain2 = prpy.tsr.TSRChain(sample_goal=True, sample_start=False, constrain=False,
108+
TSR = grasp2_tsr)
109+
ipython> traj = robot.PlanToTSR([tsrchain1, tsrchain2])
110+
```

0 commit comments

Comments
 (0)