Skip to content

Commit 134644c

Browse files
committed
Update README.md
1 parent 8626743 commit 134644c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/prpy/tsr/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,27 @@ Defining ```sample_goal=True``` tells the planner to apply the constraint only t
9898
```python
9999
ipython> traj = robot.PlanToTSR([tsrchain])
100100
```
101+
### Example: Planning from a single TSR
102+
Now imagine we wish to generate a plan that starts from any point in the grasp TSR and plans to a defined configuration, ```config```. The following code can be used to do this:
103+
```python
104+
ipython> tsrchain = prpy.tsr.TSRChain(sample_goal=False, sample_start=True, constrain=False,
105+
TSR = grasp_tsr)
106+
```
107+
Defining ```sample_start=True``` tells the planner to apply the constraint only to the first point in the plan. Now we can call the planner:
108+
```python
109+
ipython> traj = robot.PlanToTSR([tsrchain], jointgoals=[config])
110+
```
111+
### Example: Apply a TSR constraint across a full trajectory
112+
In the refrigerator opening example, the TSR Chain defined a constraint on the motion of the end-effector that should be applied over the whole trajectory. We defined:
113+
```python
114+
ipython> tsrchain = prpy.tsr.TSRChain(sample_start=False, sample_goal=False, constrain=True,
115+
TSRs = [constraint1, constraint2])
116+
```
117+
Here ```constrain=True``` tells the planner to apply the constraint to every point in the plan. Again, we can call the planner:
118+
```python
119+
ipython> traj = robot.PlanToTSR([tsrchain], jointgoals=[config])
120+
```
121+
Here, the caller must be careful to ensure that ```config``` meets the constraint defined by the TSR.
101122

102123
### Example: Planning to a set of TSRs
103124
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:
@@ -115,3 +136,4 @@ ipython> glass = env.GetKinBody('plastic_glass')
115136
ipython> tsrlist = robot.tsrlibrary(glass, 'grasp')
116137
ipython> traj = robot.PlanToTSR(tsrlist)
117138
```
139+

0 commit comments

Comments
 (0)